analyzer: enable taint state machine by default [PR103533]
[official-gcc.git] / gcc / doc / invoke.texi
blob1748afdbfe0a48facadb308b8de2dc8fdb982999
1 @c Copyright (C) 1988-2023 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2023 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below).  A copy of the license is
19 included in the gfdl(7) man page.
21 (a) The FSF's Front-Cover Text is:
23      A GNU Manual
25 (b) The FSF's Back-Cover Text is:
27      You have freedom to copy and modify this GNU Manual, like GNU
28      software.  Copies published by the Free Software Foundation raise
29      funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37     [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43 Only the most useful options are listed here; see below for the
44 remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{https://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking.  The ``overall options'' allow you to stop this
72 process at an intermediate stage.  For example, the @option{-c} option
73 says not to run the linker.  Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
77 Other options are passed on to one or more stages of processing.  Some options
78 control the preprocessor and others the compiler itself.  Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly.  If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++} 
98 instead.  @xref{Invoking G++,,Compiling C++ Programs}, 
99 for information about the differences in behavior between @command{gcc} 
100 and @command{g++} when compiling C++ programs.
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands.  Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments.  For the most part, the order
112 you use doesn't matter.  Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified.  Also,
115 the placement of the @option{-l} option is significant.
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}.  This manual documents
122 only one of these two forms, whichever one is not the default.
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string.  Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers.  Hexadecimal arguments must begin with
129 the @samp{0x} prefix.  Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on.  Such arguments are
135 designated by @var{byte-size} in the following text.  Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
143 @menu
144 * Option Summary::      Brief list of all options, without explanations.
145 * Overall Options::     Controlling the kind of output:
146                         an executable, object files, assembler files,
147                         or preprocessed source.
148 * Invoking G++::        Compiling C++ programs.
149 * C Dialect Options::   Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                         and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                         be formatted.
155 * Warning Options::     How picky should the compiler be?
156 * Static Analyzer Options:: More expensive warnings.
157 * Debugging Options::   Producing debuggable code.
158 * Optimize Options::    How much optimization?
159 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
160 * Preprocessor Options:: Controlling header files and macro definitions.
161                          Also, getting dependency information for Make.
162 * Assembler Options::   Passing options to the assembler.
163 * Link Options::        Specifying libraries and so on.
164 * Directory Options::   Where to find header files and libraries.
165                         Where to find the compiler executable files.
166 * Code Gen Options::    Specifying conventions for function calls, data layout
167                         and register usage.
168 * Developer Options::   Printing GCC configuration info, statistics, and
169                         debugging dumps.
170 * Submodel Options::    Target-specific options, such as compiling for a
171                         specific processor variant.
172 * Spec Files::          How to pass switches to sub-processes.
173 * Environment Variables:: Env vars that affect GCC.
174 * Precompiled Headers:: Compiling a header once, and using it many times.
175 * C++ Modules::         Experimental C++20 module system.
176 @end menu
178 @c man begin OPTIONS
180 @node Option Summary
181 @section Option Summary
183 Here is a summary of all the options, grouped by type.  Explanations are
184 in the following sections.
186 @table @emph
187 @item Overall Options
188 @xref{Overall Options,,Options Controlling the Kind of Output}.
189 @gccoptlist{-c  -S  -E  -o @var{file}
190 -dumpbase @var{dumpbase}  -dumpbase-ext @var{auxdropsuf}
191 -dumpdir @var{dumppfx}  -x @var{language}
192 -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version
193 -pass-exit-codes  -pipe  -specs=@var{file}  -wrapper
194 @@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  -fcanon-prefix-map
195 -fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}
196 -fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
198 @item C Language Options
199 @xref{C Dialect Options,,Options Controlling C Dialect}.
200 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename}
201 -fno-asm
202 -fno-builtin  -fno-builtin-@var{function}  -fcond-mismatch
203 -ffreestanding  -fgimple  -fgnu-tm  -fgnu89-inline  -fhosted
204 -flax-vector-conversions  -fms-extensions
205 -foffload=@var{arg}  -foffload-options=@var{arg}
206 -fopenacc  -fopenacc-dim=@var{geom}
207 -fopenmp  -fopenmp-simd  -fopenmp-target-simd-clone@r{[}=@var{device-type}@r{]}
208 -fpermitted-flt-eval-methods=@var{standard}
209 -fplan9-extensions  -fsigned-bitfields  -funsigned-bitfields
210 -fsigned-char  -funsigned-char -fstrict-flex-arrays[=@var{n}]
211 -fsso-struct=@var{endianness}}
213 @item C++ Language Options
214 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
215 @gccoptlist{-fabi-version=@var{n}  -fno-access-control
216 -faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new
217 -fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n}
218 -fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n}
219 -fno-elide-constructors
220 -fno-enforce-eh-specs
221 -fno-gnu-keywords
222 -fno-implicit-templates
223 -fno-implicit-inline-templates
224 -fno-implement-inlines
225 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts
226 -fmodule-implicit-inline
227 -fno-module-lazy
228 -fmodule-mapper=@var{specification}
229 -fmodule-version-ignore
230 -fms-extensions
231 -fnew-inheriting-ctors
232 -fnew-ttp-matching
233 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names
234 -fno-optional-diags
235 -fno-pretty-templates
236 -fno-rtti  -fsized-deallocation
237 -ftemplate-backtrace-limit=@var{n}
238 -ftemplate-depth=@var{n}
239 -fno-threadsafe-statics  -fuse-cxa-atexit
240 -fno-weak  -nostdinc++
241 -fvisibility-inlines-hidden
242 -fvisibility-ms-compat
243 -fext-numeric-literals
244 -flang-info-include-translate@r{[}=@var{header}@r{]}
245 -flang-info-include-translate-not
246 -flang-info-module-cmi@r{[}=@var{module}@r{]}
247 -stdlib=@var{libstdc++,libc++}
248 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n}
249 -Wno-class-conversion  -Wclass-memaccess
250 -Wcomma-subscript  -Wconditionally-supported
251 -Wno-conversion-null  -Wctad-maybe-unsupported
252 -Wctor-dtor-privacy  -Wdangling-reference
253 -Wno-delete-incomplete
254 -Wdelete-non-virtual-dtor  -Wno-deprecated-array-compare
255 -Wdeprecated-copy -Wdeprecated-copy-dtor
256 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion
257 -Weffc++ -Wno-elaborated-enum-base
258 -Wno-exceptions -Wextra-semi  -Wno-inaccessible-base
259 -Wno-inherited-variadic-ctor  -Wno-init-list-lifetime
260 -Winvalid-constexpr -Winvalid-imported-macros
261 -Wno-invalid-offsetof  -Wno-literal-suffix
262 -Wmismatched-new-delete -Wmismatched-tags
263 -Wmultiple-inheritance  -Wnamespaces  -Wnarrowing
264 -Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor
265 -Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n}
266 -Wrange-loop-construct -Wredundant-move -Wredundant-tags
267 -Wreorder  -Wregister
268 -Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates
269 -Wno-non-template-friend  -Wold-style-cast
270 -Woverloaded-virtual  -Wno-pmf-conversions -Wself-move -Wsign-promo
271 -Wsized-deallocation  -Wsuggest-final-methods
272 -Wsuggest-final-types  -Wsuggest-override
273 -Wno-terminate  -Wuseless-cast  -Wno-vexing-parse
274 -Wvirtual-inheritance
275 -Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
277 @item Objective-C and Objective-C++ Language Options
278 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
279 Objective-C and Objective-C++ Dialects}.
280 @gccoptlist{-fconstant-string-class=@var{class-name}
281 -fgnu-runtime  -fnext-runtime
282 -fno-nil-receivers
283 -fobjc-abi-version=@var{n}
284 -fobjc-call-cxx-cdtors
285 -fobjc-direct-dispatch
286 -fobjc-exceptions
287 -fobjc-gc
288 -fobjc-nilcheck
289 -fobjc-std=objc1
290 -fno-local-ivars
291 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
292 -freplace-objc-classes
293 -fzero-link
294 -gen-decls
295 -Wassign-intercept  -Wno-property-assign-default
296 -Wno-protocol -Wobjc-root-class -Wselector
297 -Wstrict-selector-match
298 -Wundeclared-selector}
300 @item Diagnostic Message Formatting Options
301 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
302 @gccoptlist{-fmessage-length=@var{n}
303 -fdiagnostics-plain-output
304 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}
305 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}
306 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}
307 -fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]}
308 -fno-diagnostics-show-option  -fno-diagnostics-show-caret
309 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers
310 -fno-diagnostics-show-cwe
311 -fno-diagnostics-show-rule
312 -fdiagnostics-minimum-margin-width=@var{width}
313 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch
314 -fdiagnostics-show-template-tree  -fno-elide-type
315 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]}
316 -fdiagnostics-show-path-depths
317 -fno-show-column
318 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]}
319 -fdiagnostics-column-origin=@var{origin}
320 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}
321 -fdiagnostics-text-art-charset=@r{[}none@r{|}ascii@r{|}unicode@r{|}emoji@r{]}}
323 @item Warning Options
324 @xref{Warning Options,,Options to Request or Suppress Warnings}.
325 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic
326 -pedantic-errors -fpermissive
327 -w  -Wextra  -Wall  -Wabi=@var{n}
328 -Waddress  -Wno-address-of-packed-member  -Waggregate-return
329 -Walloc-size-larger-than=@var{byte-size}  -Walloc-zero
330 -Walloca  -Walloca-larger-than=@var{byte-size}
331 -Wno-aggressive-loop-optimizations
332 -Warith-conversion
333 -Warray-bounds  -Warray-bounds=@var{n}  -Warray-compare
334 -Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias
335 -Wno-attribute-warning
336 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
337 -Wbool-compare  -Wbool-operation
338 -Wno-builtin-declaration-mismatch
339 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat
340 -Wc11-c23-compat
341 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat
342 -Wc++20-compat
343 -Wno-c++11-extensions  -Wno-c++14-extensions -Wno-c++17-extensions
344 -Wno-c++20-extensions  -Wno-c++23-extensions
345 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual
346 -Wchar-subscripts
347 -Wclobbered  -Wcomment
348 -Wcompare-distinct-pointer-types
349 -Wno-complain-wrong-lang
350 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp
351 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}
352 -Wdate-time
353 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init
354 -Wdisabled-optimization
355 -Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers
356 -Wno-div-by-zero  -Wdouble-promotion
357 -Wduplicated-branches  -Wduplicated-cond
358 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion
359 -Wenum-int-mismatch
360 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors
361 -Wflex-array-member-not-at-end
362 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2
363 -Wno-format-contains-nul  -Wno-format-extra-args
364 -Wformat-nonliteral  -Wformat-overflow=@var{n}
365 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n}
366 -Wformat-y2k  -Wframe-address
367 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object
368 -Wno-if-not-aligned  -Wno-ignored-attributes
369 -Wignored-qualifiers  -Wno-incompatible-pointer-types
370 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n}
371 -Wno-implicit-function-declaration  -Wno-implicit-int
372 -Winfinite-recursion
373 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context
374 -Wno-int-to-pointer-cast  -Wno-invalid-memory-model
375 -Winvalid-pch  -Winvalid-utf8  -Wno-unicode  -Wjump-misses-init
376 -Wlarger-than=@var{byte-size}  -Wlogical-not-parentheses  -Wlogical-op
377 -Wlong-long  -Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized
378 -Wmemset-elt-size  -Wmemset-transposed-args
379 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces
380 -Wmissing-field-initializers  -Wmissing-format-attribute
381 -Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile
382 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare
383 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
384 -Wnull-dereference  -Wno-odr
385 -Wopenacc-parallelism
386 -Wopenmp-simd
387 -Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects
388 -Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded
389 -Wparentheses  -Wno-pedantic-ms-format
390 -Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast
391 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls
392 -Wrestrict  -Wno-return-local-addr  -Wreturn-type
393 -Wno-scalar-storage-order  -Wsequence-point
394 -Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local
395 -Wno-shadow-ivar
396 -Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value
397 -Wno-shift-overflow  -Wshift-overflow=@var{n}
398 -Wsign-compare  -Wsign-conversion
399 -Wno-sizeof-array-argument
400 -Wsizeof-array-div
401 -Wsizeof-pointer-div  -Wsizeof-pointer-memaccess
402 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing
403 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n}
404 -Wstring-compare
405 -Wno-stringop-overflow -Wno-stringop-overread
406 -Wno-stringop-truncation -Wstrict-flex-arrays
407 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]}
408 -Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum
409 -Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand
410 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs
411 -Wtrivial-auto-var-init -Wtsan -Wtype-limits  -Wundef
412 -Wuninitialized  -Wunknown-pragmas
413 -Wunsuffixed-float-constants  -Wunused
414 -Wunused-but-set-parameter  -Wunused-but-set-variable
415 -Wunused-const-variable  -Wunused-const-variable=@var{n}
416 -Wunused-function  -Wunused-label  -Wunused-local-typedefs
417 -Wunused-macros
418 -Wunused-parameter  -Wno-unused-result
419 -Wunused-value  -Wunused-variable
420 -Wno-varargs  -Wvariadic-macros
421 -Wvector-operation-performance
422 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than
423 -Wvolatile-register-var  -Wwrite-strings
424 -Wxor-used-as-pow
425 -Wzero-length-bounds}
427 @item Static Analyzer Options
428 @gccoptlist{
429 -fanalyzer
430 -fanalyzer-call-summaries
431 -fanalyzer-checker=@var{name}
432 -fno-analyzer-feasibility
433 -fanalyzer-fine-grained
434 -fanalyzer-show-events-in-system-headers
435 -fno-analyzer-state-merge
436 -fno-analyzer-state-purge
437 -fno-analyzer-suppress-followups
438 -fanalyzer-transitivity
439 -fno-analyzer-undo-inlining
440 -fanalyzer-verbose-edges
441 -fanalyzer-verbose-state-changes
442 -fanalyzer-verbosity=@var{level}
443 -fdump-analyzer
444 -fdump-analyzer-callgraph
445 -fdump-analyzer-exploded-graph
446 -fdump-analyzer-exploded-nodes
447 -fdump-analyzer-exploded-nodes-2
448 -fdump-analyzer-exploded-nodes-3
449 -fdump-analyzer-exploded-paths
450 -fdump-analyzer-feasibility
451 -fdump-analyzer-json
452 -fdump-analyzer-state-purge
453 -fdump-analyzer-stderr
454 -fdump-analyzer-supergraph
455 -fdump-analyzer-untracked
456 -Wno-analyzer-double-fclose
457 -Wno-analyzer-double-free
458 -Wno-analyzer-exposure-through-output-file
459 -Wno-analyzer-exposure-through-uninit-copy
460 -Wno-analyzer-fd-access-mode-mismatch
461 -Wno-analyzer-fd-double-close
462 -Wno-analyzer-fd-leak
463 -Wno-analyzer-fd-phase-mismatch
464 -Wno-analyzer-fd-type-mismatch
465 -Wno-analyzer-fd-use-after-close
466 -Wno-analyzer-fd-use-without-check
467 -Wno-analyzer-file-leak
468 -Wno-analyzer-free-of-non-heap
469 -Wno-analyzer-imprecise-fp-arithmetic
470 -Wno-analyzer-infinite-recursion
471 -Wno-analyzer-jump-through-null
472 -Wno-analyzer-malloc-leak
473 -Wno-analyzer-mismatching-deallocation
474 -Wno-analyzer-null-argument
475 -Wno-analyzer-null-dereference
476 -Wno-analyzer-out-of-bounds
477 -Wno-analyzer-overlapping-buffers
478 -Wno-analyzer-possible-null-argument
479 -Wno-analyzer-possible-null-dereference
480 -Wno-analyzer-putenv-of-auto-var
481 -Wno-analyzer-shift-count-negative
482 -Wno-analyzer-shift-count-overflow
483 -Wno-analyzer-stale-setjmp-buffer
484 -Wno-analyzer-tainted-allocation-size
485 -Wno-analyzer-tainted-assertion
486 -Wno-analyzer-tainted-array-index
487 -Wno-analyzer-tainted-divisor
488 -Wno-analyzer-tainted-offset
489 -Wno-analyzer-tainted-size
490 -Wanalyzer-too-complex
491 -Wno-analyzer-unsafe-call-within-signal-handler
492 -Wno-analyzer-use-after-free
493 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
494 -Wno-analyzer-use-of-uninitialized-value
495 -Wno-analyzer-va-arg-type-mismatch
496 -Wno-analyzer-va-list-exhausted
497 -Wno-analyzer-va-list-leak
498 -Wno-analyzer-va-list-use-after-va-end
499 -Wno-analyzer-write-to-const
500 -Wno-analyzer-write-to-string-literal
503 @item C and Objective-C-only Warning Options
504 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations
505 -Wmissing-parameter-type -Wmissing-prototypes -Wmissing-variable-declarations
506 -Wnested-externs -Wold-style-declaration  -Wold-style-definition
507 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion
508 -Wdeclaration-after-statement  -Wpointer-sign}
510 @item Debugging Options
511 @xref{Debugging Options,,Options for Debugging Your Program}.
512 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version}
513 -gbtf -gctf  -gctf@var{level}
514 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches
515 -gstrict-dwarf  -gno-strict-dwarf
516 -gas-loc-support  -gno-as-loc-support
517 -gas-locview-support  -gno-as-locview-support
518 -gcodeview
519 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64
520 -gstatement-frontiers  -gno-statement-frontiers
521 -gvariable-location-views  -gno-variable-location-views
522 -ginternal-reset-location-views  -gno-internal-reset-location-views
523 -ginline-points  -gno-inline-points
524 -gvms -gz@r{[}=@var{type}@r{]}
525 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies
526 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section
527 -fno-eliminate-unused-debug-types
528 -femit-struct-debug-baseonly  -femit-struct-debug-reduced
529 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
530 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always
531 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm
532 -fvar-tracking  -fvar-tracking-assignments}
534 @item Optimization Options
535 @xref{Optimize Options,,Options that Control Optimization}.
536 @gccoptlist{-faggressive-loop-optimizations
537 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
538 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
539 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
540 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
541 -fno-allocation-dce -fallow-store-data-races
542 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}]
543 -fauto-inc-dec  -fbranch-probabilities
544 -fcaller-saves
545 -fcombine-stack-adjustments  -fconserve-stack
546 -ffold-mem-offsets
547 -fcompare-elim  -fcprop-registers  -fcrossjumping
548 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules
549 -fcx-limited-range
550 -fdata-sections  -fdce  -fdelayed-branch
551 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively
552 -fdevirtualize-at-ltrans  -fdse
553 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects
554 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style}
555 -ffinite-loops
556 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections
557 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity
558 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion
559 -fif-conversion2  -findirect-inlining
560 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n}
561 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone
562 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const
563 -fipa-reference  -fipa-reference-addressable
564 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm}
565 -flive-patching=@var{level}
566 -fira-region=@var{region}  -fira-hoist-pressure
567 -fira-loop-pressure  -fno-ira-share-save-slots
568 -fno-ira-share-spill-slots
569 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute
570 -fivopts  -fkeep-inline-functions  -fkeep-static-functions
571 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage
572 -floop-block  -floop-interchange  -floop-strip-mine
573 -floop-unroll-and-jam  -floop-nest-optimize
574 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level
575 -flto-partition=@var{alg}  -fmerge-all-constants
576 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves
577 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg
578 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse
579 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole
580 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock
581 -fno-sched-spec  -fno-signed-zeros
582 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss
583 -fomit-frame-pointer  -foptimize-sibling-calls
584 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning
585 -fprefetch-loop-arrays
586 -fprofile-correction
587 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training
588 -fprofile-values -fprofile-reorder-functions
589 -freciprocal-math  -free  -frename-registers  -freorder-blocks
590 -freorder-blocks-algorithm=@var{algorithm}
591 -freorder-blocks-and-partition  -freorder-functions
592 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops
593 -frounding-math  -fsave-optimization-record
594 -fsched2-use-superblocks  -fsched-pressure
595 -fsched-spec-load  -fsched-spec-load-dangerous
596 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}]
597 -fsched-group-heuristic  -fsched-critical-path-heuristic
598 -fsched-spec-insn-heuristic  -fsched-rank-heuristic
599 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic
600 -fschedule-fusion
601 -fschedule-insns  -fschedule-insns2  -fsection-anchors
602 -fselective-scheduling  -fselective-scheduling2
603 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops
604 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate
605 -fsignaling-nans
606 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops
607 -fsplit-paths
608 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
609 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
610 -fthread-jumps  -ftracer  -ftree-bit-ccp
611 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
612 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
613 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
614 -ftree-loop-if-convert  -ftree-loop-im
615 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
616 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize
617 -ftree-loop-vectorize
618 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta
619 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra
620 -ftree-switch-conversion  -ftree-tail-merge
621 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init
622 -funconstrained-commons -funit-at-a-time  -funroll-all-loops
623 -funroll-loops -funsafe-math-optimizations  -funswitch-loops
624 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt
625 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs
626 --param @var{name}=@var{value}
627 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
629 @item Program Instrumentation Options
630 @xref{Instrumentation Options,,Program Instrumentation Options}.
631 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage
632 -fprofile-abs-path
633 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path}
634 -fprofile-info-section  -fprofile-info-section=@var{name}
635 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
636 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
637 -fprofile-exclude-files=@var{regex}
638 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
639 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style}
640 -fsanitize-trap   -fsanitize-trap=@var{style}
641 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},...
642 -fsanitize-undefined-trap-on-error  -fbounds-check
643 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
644 -fharden-compares -fharden-conditional-branches
645 -fharden-control-flow-redundancy  -fhardcfr-skip-leaf
646 -fhardcfr-check-exceptions  -fhardcfr-check-returning-calls
647 -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
648 -fstack-protector  -fstack-protector-all  -fstack-protector-strong
649 -fstack-protector-explicit  -fstack-check
650 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym}
651 -fno-stack-limit  -fsplit-stack
652 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
653 -fvtv-counts  -fvtv-debug
654 -finstrument-functions  -finstrument-functions-once
655 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
656 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
657 -fprofile-prefix-map=@var{old}=@var{new}
658 -fpatchable-function-entry=@var{N}@r{[},@var{M}@r{]}}
660 @item Preprocessor Options
661 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
662 @gccoptlist{-A@var{question}=@var{answer}
663 -A-@var{question}@r{[}=@var{answer}@r{]}
664 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]}
665 -dD  -dI  -dM  -dN  -dU
666 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers
667 -fexec-charset=@var{charset}  -fextended-identifiers
668 -finput-charset=@var{charset}  -flarge-source-files
669 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
670 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess
671 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion
672 -fwide-exec-charset=@var{charset}  -fworking-directory
673 -H  -imacros @var{file}  -include @var{file}
674 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules
675 -no-integrated-cpp  -P  -pthread  -remap
676 -traditional  -traditional-cpp  -trigraphs
677 -U@var{macro}  -undef
678 -Wp,@var{option}  -Xpreprocessor @var{option}}
680 @item Assembler Options
681 @xref{Assembler Options,,Passing Options to the Assembler}.
682 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
684 @item Linker Options
685 @xref{Link Options,,Options for Linking}.
686 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library}
687 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++
688 -e @var{entry}  --entry=@var{entry}
689 -pie  -pthread  -r  -rdynamic
690 -s  -static  -static-pie  -static-libgcc  -static-libstdc++
691 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan
692 -shared  -shared-libgcc  -symbolic
693 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option}
694 -u @var{symbol}  -z @var{keyword}}
696 @item Directory Options
697 @xref{Directory Options,,Options for Directory Search}.
698 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-
699 -idirafter @var{dir}
700 -imacros @var{file}  -imultilib @var{dir}
701 -iplugindir=@var{dir}  -iprefix @var{file}
702 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir}
703 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}
704 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix
705 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
707 @item Code Generation Options
708 @xref{Code Gen Options,,Options for Code Generation Conventions}.
709 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg}
710 -ffixed-@var{reg}  -fexceptions
711 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables
712 -fasynchronous-unwind-tables
713 -fno-gnu-unique
714 -finhibit-size-directive  -fcommon  -fno-ident
715 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt
716 -fno-jump-tables -fno-bit-tests
717 -frecord-gcc-switches
718 -freg-struct-return  -fshort-enums  -fshort-wchar
719 -fverbose-asm  -fpack-struct[=@var{n}]
720 -fleading-underscore  -ftls-model=@var{model}
721 -fstack-reuse=@var{reuse_level}
722 -ftrampolines -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
723 -ftrapv  -fwrapv
724 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
725 -fstrict-volatile-bitfields  -fsync-libcalls}
727 @item Developer Options
728 @xref{Developer Options,,GCC Developer Options}.
729 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion
730 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
731 -fchecking  -fchecking=@var{n}
732 -fdbg-cnt-list  -fdbg-cnt=@var{counter-value-list}
733 -fdisable-ipa-@var{pass_name}
734 -fdisable-rtl-@var{pass_name}
735 -fdisable-rtl-@var{pass-name}=@var{range-list}
736 -fdisable-tree-@var{pass_name}
737 -fdisable-tree-@var{pass-name}=@var{range-list}
738 -fdump-debug  -fdump-earlydebug
739 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links
740 -fdump-final-insns@r{[}=@var{file}@r{]}
741 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline
742 -fdump-lang-all
743 -fdump-lang-@var{switch}
744 -fdump-lang-@var{switch}-@var{options}
745 -fdump-lang-@var{switch}-@var{options}=@var{filename}
746 -fdump-passes
747 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename}
748 -fdump-statistics
749 -fdump-tree-all
750 -fdump-tree-@var{switch}
751 -fdump-tree-@var{switch}-@var{options}
752 -fdump-tree-@var{switch}-@var{options}=@var{filename}
753 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second
754 -fenable-@var{kind}-@var{pass}
755 -fenable-@var{kind}-@var{pass}=@var{range-list}
756 -fira-verbose=@var{n}
757 -flto-report  -flto-report-wpa  -fmem-report-wpa
758 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report
759 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]}
760 -fmultiflags  -fprofile-report
761 -frandom-seed=@var{string}  -fsched-verbose=@var{n}
762 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose
763 -fstats  -fstack-usage  -ftime-report  -ftime-report-details
764 -fvar-tracking-assignments-toggle  -gtoggle
765 -print-file-name=@var{library}  -print-libgcc-file-name
766 -print-multi-directory  -print-multi-lib  -print-multi-os-directory
767 -print-prog-name=@var{program}  -print-search-dirs  -Q
768 -print-sysroot  -print-sysroot-headers-suffix
769 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
771 @item Machine-Dependent Options
772 @xref{Submodel Options,,Machine-Dependent Options}.
773 @c This list is ordered alphanumerically by subsection name.
774 @c Try and put the significant identifier (CPU or system) first,
775 @c so users have a clue at guessing where the ones they want will be.
777 @emph{AArch64 Options}
778 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian
779 -mgeneral-regs-only
780 -mcmodel=tiny  -mcmodel=small  -mcmodel=large
781 -mstrict-align  -mno-strict-align
782 -momit-leaf-frame-pointer
783 -mtls-dialect=desc  -mtls-dialect=traditional
784 -mtls-size=@var{size}
785 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419
786 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div
787 -mpc-relative-literal-loads
788 -msign-return-address=@var{scope}
789 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
790 +@var{b-key}]|@var{bti}
791 -mharden-sls=@var{opts}
792 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}
793 -moverride=@var{string}  -mverbose-cost-dump
794 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
795 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
796 -moutline-atomics }
798 @emph{Adapteva Epiphany Options}
799 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs
800 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf
801 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num}
802 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16
803 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num}
804 -msplit-vecmove-early  -m1reg-@var{reg}}
806 @emph{AMD GCN Options}
807 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
809 @emph{ARC Options}
810 @gccoptlist{-mbarrel-shifter  -mjli-always
811 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700
812 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr
813 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic
814 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap
815 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape
816 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof
817 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved
818 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num}
819 -mvolatile-cache  -mtp-regno=@var{regno}
820 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc
821 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi
822 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none
823 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode
824 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level}
825 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame
826 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo}
827 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
829 @emph{ARM Options}
830 @gccoptlist{-mapcs-frame  -mno-apcs-frame
831 -mabi=@var{name}
832 -mapcs-stack-check  -mno-apcs-stack-check
833 -mapcs-reentrant  -mno-apcs-reentrant
834 -mgeneral-regs-only
835 -msched-prolog  -mno-sched-prolog
836 -mlittle-endian  -mbig-endian
837 -mbe8  -mbe32
838 -mfloat-abi=@var{name}
839 -mfp16-format=@var{name}
840 -mthumb-interwork  -mno-thumb-interwork
841 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}
842 -mtune=@var{name}  -mprint-tune-info
843 -mstructure-size-boundary=@var{n}
844 -mabort-on-noreturn
845 -mlong-calls  -mno-long-calls
846 -msingle-pic-base  -mno-single-pic-base
847 -mpic-register=@var{reg}
848 -mnop-fun-dllimport
849 -mpoke-function-name
850 -mthumb  -marm  -mflip-thumb
851 -mtpcs-frame  -mtpcs-leaf-frame
852 -mcaller-super-interworking  -mcallee-super-interworking
853 -mtp=@var{name}  -mtls-dialect=@var{dialect}
854 -mword-relocations
855 -mfix-cortex-m3-ldrd
856 -mfix-cortex-a57-aes-1742098
857 -mfix-cortex-a72-aes-1655431
858 -munaligned-access
859 -mneon-for-64bits
860 -mslow-flash-data
861 -masm-syntax-unified
862 -mrestrict-it
863 -mverbose-cost-dump
864 -mpure-code
865 -mcmse
866 -mfix-cmse-cve-2021-35465
867 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
868 -mfdpic
869 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
870 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
872 @emph{AVR Options}
873 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args
874 -mbranch-cost=@var{cost}
875 -mcall-prologues  -mgas-isr-prologues  -mint8
876 -mdouble=@var{bits} -mlong-double=@var{bits}
877 -mn_flash=@var{size}  -mno-interrupts
878 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack
879 -mfract-convert-truncate
880 -mshort-calls  -nodevicelib  -nodevicespecs
881 -Waddr-space-convert  -Wmisspelled-isr}
883 @emph{Blackfin Options}
884 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
885 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer
886 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly
887 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library
888 -mno-id-shared-library  -mshared-library-id=@var{n}
889 -mleaf-id-shared-library  -mno-leaf-id-shared-library
890 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls
891 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram
892 -micplb}
894 @emph{C6X Options}
895 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu}
896 -msim  -msdata=@var{sdata-type}}
898 @emph{CRIS Options}
899 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
900 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
901 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects
902 -mstack-align  -mdata-align  -mconst-align
903 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue
904 -melf  -maout  -sim  -sim2
905 -mmul-bug-workaround  -mno-mul-bug-workaround}
907 @emph{C-SKY Options}
908 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}
909 -mbig-endian  -EB  -mlittle-endian  -EL
910 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu
911 -mfloat-abi=@var{name}
912 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust
913 -mdsp  -medsp  -mvdsp
914 -mdiv  -msmart  -mhigh-registers  -manchor
915 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt
916 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
918 @emph{Darwin Options}
919 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal
920 -arch_only  -bind_at_load  -bundle  -bundle_loader
921 -client_name  -compatibility_version  -current_version
922 -dead_strip
923 -dependency-file  -dylib_file  -dylinker_install_name
924 -dynamic  -dynamiclib  -exported_symbols_list
925 -filelist  -flat_namespace  -force_cpusubtype_ALL
926 -force_flat_namespace  -headerpad_max_install_names
927 -iframework
928 -image_base  -init  -install_name  -keep_private_externs
929 -multi_module  -multiply_defined  -multiply_defined_unused
930 -noall_load   -no_dead_strip_inits_and_terms -nodefaultrpaths
931 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit
932 -pagezero_size  -prebind  -prebind_all_twolevel_modules
933 -private_bundle  -read_only_relocs  -sectalign
934 -sectobjectsymbols  -whyload  -seg1addr
935 -sectcreate  -sectobjectsymbols  -sectorder
936 -segaddr  -segs_read_only_addr  -segs_read_write_addr
937 -seg_addr_table  -seg_addr_table_filename  -seglinkedit
938 -segprot  -segs_read_only_addr  -segs_read_write_addr
939 -single_module  -static  -sub_library  -sub_umbrella
940 -twolevel_namespace  -umbrella  -undefined
941 -unexported_symbols_list  -weak_reference_mismatches
942 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version}
943 -mkernel  -mone-byte-bool}
945 @emph{DEC Alpha Options}
946 @gccoptlist{-mno-fp-regs  -msoft-float
947 -mieee  -mieee-with-inexact  -mieee-conformant
948 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
949 -mtrap-precision=@var{mode}  -mbuild-constants
950 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}
951 -mbwx  -mmax  -mfix  -mcix
952 -mfloat-vax  -mfloat-ieee
953 -mexplicit-relocs  -msmall-data  -mlarge-data
954 -msmall-text  -mlarge-text
955 -mmemory-latency=@var{time}}
957 @emph{eBPF Options}
958 @gccoptlist{-mbig-endian -mlittle-endian
959 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
960 -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
961 -masm=@var{dialect}}
963 @emph{FR30 Options}
964 @gccoptlist{-msmall-model  -mno-lsim}
966 @emph{FT32 Options}
967 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
969 @emph{FRV Options}
970 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64
971 -mhard-float  -msoft-float
972 -malloc-cc  -mfixed-cc  -mdword  -mno-dword
973 -mdouble  -mno-double
974 -mmedia  -mno-media  -mmuladd  -mno-muladd
975 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic
976 -mlinked-fp  -mlong-calls  -malign-labels
977 -mlibrary-pic  -macc-4  -macc-8
978 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move
979 -moptimize-membar  -mno-optimize-membar
980 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec
981 -mvliw-branch  -mno-vliw-branch
982 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec
983 -mno-nested-cond-exec  -mtomcat-stats
984 -mTLS  -mtls
985 -mcpu=@var{cpu}}
987 @emph{GNU/Linux Options}
988 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid
989 -tno-android-cc  -tno-android-ld}
991 @emph{H8/300 Options}
992 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
994 @emph{HPPA Options}
995 @gccoptlist{-march=@var{architecture-type}
996 -matomic-libcalls  -mbig-switch
997 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing
998 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld
999 -mfixed-range=@var{register-range}
1000 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls
1001 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs
1002 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
1003 -mno-jump-in-delay  -mno-long-load-store
1004 -mno-portable-runtime  -mno-soft-float
1005 -mno-space-regs  -msoft-float  -mpa-risc-1-0
1006 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime
1007 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio
1008 -munix=@var{unix-std}  -nolibdld  -static  -threads}
1010 @emph{IA-64 Options}
1011 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic
1012 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata
1013 -mconstant-gp  -mauto-pic  -mfused-madd
1014 -minline-float-divide-min-latency
1015 -minline-float-divide-max-throughput
1016 -mno-inline-float-divide
1017 -minline-int-divide-min-latency
1018 -minline-int-divide-max-throughput
1019 -mno-inline-int-divide
1020 -minline-sqrt-min-latency  -minline-sqrt-max-throughput
1021 -mno-inline-sqrt
1022 -mdwarf2-asm  -mearly-stop-bits
1023 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size}
1024 -mtune=@var{cpu-type}  -milp32  -mlp64
1025 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec
1026 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec
1027 -msched-spec-ldc  -msched-spec-control-ldc
1028 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns
1029 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path
1030 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost
1031 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1033 @emph{LM32 Options}
1034 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled
1035 -msign-extend-enabled  -muser-enabled}
1037 @emph{LoongArch Options}
1038 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type}
1039 -mfpu=@var{fpu-type} -msimd=@var{simd-type}
1040 -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx
1041 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1042 -mcond-move-int  -mno-cond-move-int
1043 -mcond-move-float  -mno-cond-move-float
1044 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1045 -mmax-inline-memcpy-size=@var{n}
1046 -mexplicit-relocs=@var{style} -mexplicit-relocs -mno-explicit-relocs
1047 -mdirect-extern-access -mno-direct-extern-access
1048 -mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as}
1050 @emph{M32R/D Options}
1051 @gccoptlist{-m32r2  -m32rx  -m32r
1052 -mdebug
1053 -malign-loops  -mno-align-loops
1054 -missue-rate=@var{number}
1055 -mbranch-cost=@var{number}
1056 -mmodel=@var{code-size-model-type}
1057 -msdata=@var{sdata-type}
1058 -mno-flush-func  -mflush-func=@var{name}
1059 -mno-flush-trap  -mflush-trap=@var{number}
1060 -G @var{num}}
1062 @emph{M32C Options}
1063 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1065 @emph{M680x0 Options}
1066 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1067 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1068 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1069 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1070 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1071 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1072 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1073 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1074 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1076 @emph{MCore Options}
1077 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1078 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1079 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1080 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1081 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1083 @emph{MicroBlaze Options}
1084 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1085 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1086 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1087 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1088 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1089 -mpic-data-is-text-relative}
1091 @emph{MIPS Options}
1092 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1093 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1094 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1095 -mips16  -mno-mips16  -mflip-mips16
1096 -minterlink-compressed  -mno-interlink-compressed
1097 -minterlink-mips16  -mno-interlink-mips16
1098 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1099 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1100 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1101 -mno-float  -msingle-float  -mdouble-float
1102 -modd-spreg  -mno-odd-spreg
1103 -mabs=@var{mode}  -mnan=@var{encoding}
1104 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1105 -mmcu  -mmno-mcu
1106 -meva  -mno-eva
1107 -mvirt  -mno-virt
1108 -mxpa  -mno-xpa
1109 -mcrc  -mno-crc
1110 -mginv  -mno-ginv
1111 -mmicromips  -mno-micromips
1112 -mmsa  -mno-msa
1113 -mloongson-mmi  -mno-loongson-mmi
1114 -mloongson-ext  -mno-loongson-ext
1115 -mloongson-ext2  -mno-loongson-ext2
1116 -mfpu=@var{fpu-type}
1117 -msmartmips  -mno-smartmips
1118 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1119 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1120 -mlong64  -mlong32  -msym32  -mno-sym32
1121 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1122 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1123 -membedded-data  -mno-embedded-data
1124 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1125 -mcode-readable=@var{setting}
1126 -msplit-addresses  -mno-split-addresses
1127 -mexplicit-relocs  -mno-explicit-relocs
1128 -mcheck-zero-division  -mno-check-zero-division
1129 -mdivide-traps  -mdivide-breaks
1130 -mload-store-pairs  -mno-load-store-pairs
1131 -munaligned-access  -mno-unaligned-access
1132 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1133 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1134 -mfix-24k  -mno-fix-24k
1135 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1136 -mfix-r5900  -mno-fix-r5900
1137 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1138 -mfix-vr4120  -mno-fix-vr4120
1139 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1140 -mflush-func=@var{func}  -mno-flush-func
1141 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1142 -mcompact-branches=@var{policy}
1143 -mfp-exceptions  -mno-fp-exceptions
1144 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1145 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1146 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1147 -mframe-header-opt  -mno-frame-header-opt}
1149 @emph{MMIX Options}
1150 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1151 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1152 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1153 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1155 @emph{MN10300 Options}
1156 @gccoptlist{-mmult-bug  -mno-mult-bug
1157 -mno-am33  -mam33  -mam33-2  -mam34
1158 -mtune=@var{cpu-type}
1159 -mreturn-pointer-on-d0
1160 -mno-crt0  -mrelax  -mliw  -msetlb}
1162 @emph{Moxie Options}
1163 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1165 @emph{MSP430 Options}
1166 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1167 -mwarn-mcu
1168 -mcode-region=  -mdata-region=
1169 -msilicon-errata=  -msilicon-errata-warn=
1170 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1172 @emph{NDS32 Options}
1173 @gccoptlist{-mbig-endian  -mlittle-endian
1174 -mreduced-regs  -mfull-regs
1175 -mcmov  -mno-cmov
1176 -mext-perf  -mno-ext-perf
1177 -mext-perf2  -mno-ext-perf2
1178 -mext-string  -mno-ext-string
1179 -mv3push  -mno-v3push
1180 -m16bit  -mno-16bit
1181 -misr-vector-size=@var{num}
1182 -mcache-block-size=@var{num}
1183 -march=@var{arch}
1184 -mcmodel=@var{code-model}
1185 -mctor-dtor  -mrelax}
1187 @emph{Nios II Options}
1188 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1189 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1190 -mel  -meb
1191 -mno-bypass-cache  -mbypass-cache
1192 -mno-cache-volatile  -mcache-volatile
1193 -mno-fast-sw-div  -mfast-sw-div
1194 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1195 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1196 -mcustom-fpu-cfg=@var{name}
1197 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1198 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1200 @emph{Nvidia PTX Options}
1201 @gccoptlist{-m64  -mmainkernel  -moptimize}
1203 @emph{OpenRISC Options}
1204 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1205 -msoft-mul  -msoft-div
1206 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1207 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1208 -mcmodel=@var{code-model}}
1210 @emph{PDP-11 Options}
1211 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1212 -mint32  -mno-int16  -mint16  -mno-int32
1213 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1215 @emph{PowerPC Options}
1216 See RS/6000 and PowerPC Options.
1218 @emph{PRU Options}
1219 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1220 -mabi=@var{variant}}
1222 @emph{RISC-V Options}
1223 @gccoptlist{-mbranch-cost=@var{N-instruction}
1224 -mplt  -mno-plt
1225 -mabi=@var{ABI-string}
1226 -mfdiv  -mno-fdiv
1227 -mdiv  -mno-div
1228 -misa-spec=@var{ISA-spec-string}
1229 -march=@var{ISA-string}
1230 -mtune=@var{processor-string}
1231 -mpreferred-stack-boundary=@var{num}
1232 -msmall-data-limit=@var{N-bytes}
1233 -msave-restore  -mno-save-restore
1234 -mshorten-memrefs  -mno-shorten-memrefs
1235 -mstrict-align  -mno-strict-align
1236 -mcmodel=medlow  -mcmodel=medany
1237 -mexplicit-relocs  -mno-explicit-relocs
1238 -mrelax  -mno-relax
1239 -mriscv-attribute  -mno-riscv-attribute
1240 -malign-data=@var{type}
1241 -mbig-endian  -mlittle-endian
1242 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1243 -mstack-protector-guard-offset=@var{offset}
1244 -mcsr-check -mno-csr-check
1245 -minline-atomics  -mno-inline-atomics
1246 -minline-strlen  -mno-inline-strlen
1247 -minline-strcmp  -mno-inline-strcmp
1248 -minline-strncmp  -mno-inline-strncmp}
1250 @emph{RL78 Options}
1251 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1252 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1253 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1255 @emph{RS/6000 and PowerPC Options}
1256 @gccoptlist{-mcpu=@var{cpu-type}
1257 -mtune=@var{cpu-type}
1258 -mcmodel=@var{code-model}
1259 -mpowerpc64
1260 -maltivec  -mno-altivec
1261 -mpowerpc-gpopt  -mno-powerpc-gpopt
1262 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1263 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1264 -mfprnd  -mno-fprnd
1265 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1266 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1267 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1268 -malign-power  -malign-natural
1269 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1270 -mupdate  -mno-update
1271 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1272 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1273 -mstrict-align  -mno-strict-align  -mrelocatable
1274 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1275 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1276 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1277 -mprioritize-restricted-insns=@var{priority}
1278 -msched-costly-dep=@var{dependence_type}
1279 -minsert-sched-nops=@var{scheme}
1280 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1281 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1282 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1283 -mtraceback=@var{traceback_type}
1284 -maix-struct-return  -msvr4-struct-return
1285 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1286 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1287 -mblock-move-inline-limit=@var{num}
1288 -mblock-compare-inline-limit=@var{num}
1289 -mblock-compare-inline-loop-limit=@var{num}
1290 -mno-block-ops-unaligned-vsx
1291 -mstring-compare-inline-limit=@var{num}
1292 -misel  -mno-isel
1293 -mvrsave  -mno-vrsave
1294 -mmulhw  -mno-mulhw
1295 -mdlmzb  -mno-dlmzb
1296 -mprototype  -mno-prototype
1297 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1298 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1299 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1300 -mno-recip-precision
1301 -mveclibabi=@var{type}  -mfriz  -mno-friz
1302 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1303 -msave-toc-indirect  -mno-save-toc-indirect
1304 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector
1305 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1306 -mquad-memory  -mno-quad-memory
1307 -mquad-memory-atomic  -mno-quad-memory-atomic
1308 -mcompat-align-parm  -mno-compat-align-parm
1309 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1310 -mgnu-attribute  -mno-gnu-attribute
1311 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1312 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1313 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1314 -mprivileged -mno-privileged}
1316 @emph{RX Options}
1317 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1318 -mcpu=
1319 -mbig-endian-data  -mlittle-endian-data
1320 -msmall-data
1321 -msim  -mno-sim
1322 -mas100-syntax  -mno-as100-syntax
1323 -mrelax
1324 -mmax-constant-size=
1325 -mint-register=
1326 -mpid
1327 -mallow-string-insns  -mno-allow-string-insns
1328 -mjsr
1329 -mno-warn-multiple-fast-interrupts
1330 -msave-acc-in-interrupts}
1332 @emph{S/390 and zSeries Options}
1333 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1334 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1335 -mlong-double-64  -mlong-double-128
1336 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1337 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1338 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1339 -mhtm  -mvx  -mzvector
1340 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1341 -mfused-madd  -mno-fused-madd
1342 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1343 -mhotpatch=@var{halfwords},@var{halfwords}}
1345 @emph{SH Options}
1346 @gccoptlist{-m1  -m2  -m2e
1347 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1348 -m3  -m3e
1349 -m4-nofpu  -m4-single-only  -m4-single  -m4
1350 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1351 -mb  -ml  -mdalign  -mrelax
1352 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1353 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1354 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1355 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1356 -maccumulate-outgoing-args
1357 -matomic-model=@var{atomic-model}
1358 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1359 -mcbranch-force-delay-slot
1360 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1361 -mpretend-cmove  -mtas}
1363 @emph{Solaris 2 Options}
1364 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1365 -pthreads}
1367 @emph{SPARC Options}
1368 @gccoptlist{-mcpu=@var{cpu-type}
1369 -mtune=@var{cpu-type}
1370 -mcmodel=@var{code-model}
1371 -mmemory-model=@var{mem-model}
1372 -m32  -m64  -mapp-regs  -mno-app-regs
1373 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1374 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1375 -mhard-quad-float  -msoft-quad-float
1376 -mstack-bias  -mno-stack-bias
1377 -mstd-struct-return  -mno-std-struct-return
1378 -munaligned-doubles  -mno-unaligned-doubles
1379 -muser-mode  -mno-user-mode
1380 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1381 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1382 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1383 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1384 -mpopc  -mno-popc  -msubxc  -mno-subxc
1385 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1386 -mlra  -mno-lra}
1388 @emph{System V Options}
1389 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1391 @emph{V850 Options}
1392 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1393 -mprolog-function  -mno-prolog-function  -mspace
1394 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1395 -mapp-regs  -mno-app-regs
1396 -mdisable-callt  -mno-disable-callt
1397 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1398 -mv850e  -mv850  -mv850e3v5
1399 -mloop
1400 -mrelax
1401 -mlong-jumps
1402 -msoft-float
1403 -mhard-float
1404 -mgcc-abi
1405 -mrh850-abi
1406 -mbig-switch}
1408 @emph{VAX Options}
1409 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1411 @emph{Visium Options}
1412 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1413 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1415 @emph{VMS Options}
1416 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1417 -mpointer-size=@var{size}}
1419 @emph{VxWorks Options}
1420 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1421 -Xbind-lazy  -Xbind-now}
1423 @emph{x86 Options}
1424 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1425 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1426 -mfpmath=@var{unit}
1427 -masm=@var{dialect}  -mno-fancy-math-387
1428 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1429 -mno-wide-multiply  -mrtd  -malign-double
1430 -mpreferred-stack-boundary=@var{num}
1431 -mincoming-stack-boundary=@var{num}
1432 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1433 -mrecip  -mrecip=@var{opt}
1434 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1435 -mpartial-vector-fp-math
1436 -mmove-max=@var{bits} -mstore-max=@var{bits}
1437 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1438 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1439 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1440 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1441 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1442 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1443 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1444 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1445 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1446 -mavx512vbmi2 -mavx512bf16 -menqcmd
1447 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1448 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1449 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1450 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1451 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1452 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mapxf
1453 -musermsr
1454 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1455 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1456 -mkl -mwidekl
1457 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1458 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1459 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1460 -mregparm=@var{num}  -msseregparm
1461 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1462 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1463 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1464 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1465 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1466 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1467 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1468 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1469 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1470 -mstack-protector-guard-reg=@var{reg}
1471 -mstack-protector-guard-offset=@var{offset}
1472 -mstack-protector-guard-symbol=@var{symbol}
1473 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1474 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1475 -mindirect-branch-register -mharden-sls=@var{choice}
1476 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1477 -munroll-only-small-loops -mlam=@var{choice}}
1479 @emph{x86 Windows Options}
1480 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mcygwin  -mno-cygwin  -mdll
1481 -mnop-fun-dllimport  -mthread
1482 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1484 @emph{Xstormy16 Options}
1485 @gccoptlist{-msim}
1487 @emph{Xtensa Options}
1488 @gccoptlist{-mconst16  -mno-const16
1489 -mfused-madd  -mno-fused-madd
1490 -mforce-no-pic
1491 -mserialize-volatile  -mno-serialize-volatile
1492 -mtext-section-literals  -mno-text-section-literals
1493 -mauto-litpools  -mno-auto-litpools
1494 -mtarget-align  -mno-target-align
1495 -mlongcalls  -mno-longcalls
1496 -mabi=@var{abi-type}
1497 -mextra-l32r-costs=@var{cycles}
1498 -mstrict-align  -mno-strict-align}
1500 @emph{zSeries Options}
1501 See S/390 and zSeries Options.
1502 @end table
1505 @node Overall Options
1506 @section Options Controlling the Kind of Output
1508 Compilation can involve up to four stages: preprocessing, compilation
1509 proper, assembly and linking, always in that order.  GCC is capable of
1510 preprocessing and compiling several files either into several
1511 assembler input files, or into one assembler input file; then each
1512 assembler input file produces an object file, and linking combines all
1513 the object files (those newly compiled, and those specified as input)
1514 into an executable file.
1516 @cindex file name suffix
1517 For any given input file, the file name suffix determines what kind of
1518 compilation is done:
1520 @table @gcctabopt
1521 @item @var{file}.c
1522 C source code that must be preprocessed.
1524 @item @var{file}.i
1525 C source code that should not be preprocessed.
1527 @item @var{file}.ii
1528 C++ source code that should not be preprocessed.
1530 @item @var{file}.m
1531 Objective-C source code.  Note that you must link with the @file{libobjc}
1532 library to make an Objective-C program work.
1534 @item @var{file}.mi
1535 Objective-C source code that should not be preprocessed.
1537 @item @var{file}.mm
1538 @itemx @var{file}.M
1539 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1540 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1541 to a literal capital M@.
1543 @item @var{file}.mii
1544 Objective-C++ source code that should not be preprocessed.
1546 @item @var{file}.h
1547 C, C++, Objective-C or Objective-C++ header file to be turned into a
1548 precompiled header (default), or C, C++ header file to be turned into an
1549 Ada spec (via the @option{-fdump-ada-spec} switch).
1551 @item @var{file}.cc
1552 @itemx @var{file}.cp
1553 @itemx @var{file}.cxx
1554 @itemx @var{file}.cpp
1555 @itemx @var{file}.CPP
1556 @itemx @var{file}.c++
1557 @itemx @var{file}.C
1558 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1559 the last two letters must both be literally @samp{x}.  Likewise,
1560 @samp{.C} refers to a literal capital C@.
1562 @item @var{file}.mm
1563 @itemx @var{file}.M
1564 Objective-C++ source code that must be preprocessed.
1566 @item @var{file}.mii
1567 Objective-C++ source code that should not be preprocessed.
1569 @item @var{file}.hh
1570 @itemx @var{file}.H
1571 @itemx @var{file}.hp
1572 @itemx @var{file}.hxx
1573 @itemx @var{file}.hpp
1574 @itemx @var{file}.HPP
1575 @itemx @var{file}.h++
1576 @itemx @var{file}.tcc
1577 C++ header file to be turned into a precompiled header or Ada spec.
1579 @item @var{file}.f
1580 @itemx @var{file}.for
1581 @itemx @var{file}.ftn
1582 Fixed form Fortran source code that should not be preprocessed.
1584 @item @var{file}.F
1585 @itemx @var{file}.FOR
1586 @itemx @var{file}.fpp
1587 @itemx @var{file}.FPP
1588 @itemx @var{file}.FTN
1589 Fixed form Fortran source code that must be preprocessed (with the traditional
1590 preprocessor).
1592 @item @var{file}.f90
1593 @itemx @var{file}.f95
1594 @itemx @var{file}.f03
1595 @itemx @var{file}.f08
1596 Free form Fortran source code that should not be preprocessed.
1598 @item @var{file}.F90
1599 @itemx @var{file}.F95
1600 @itemx @var{file}.F03
1601 @itemx @var{file}.F08
1602 Free form Fortran source code that must be preprocessed (with the
1603 traditional preprocessor).
1605 @item @var{file}.go
1606 Go source code.
1608 @item @var{file}.d
1609 D source code.
1611 @item @var{file}.di
1612 D interface file.
1614 @item @var{file}.dd
1615 D documentation code (Ddoc).
1617 @item @var{file}.ads
1618 Ada source code file that contains a library unit declaration (a
1619 declaration of a package, subprogram, or generic, or a generic
1620 instantiation), or a library unit renaming declaration (a package,
1621 generic, or subprogram renaming declaration).  Such files are also
1622 called @dfn{specs}.
1624 @item @var{file}.adb
1625 Ada source code file containing a library unit body (a subprogram or
1626 package body).  Such files are also called @dfn{bodies}.
1628 @c GCC also knows about some suffixes for languages not yet included:
1629 @c Ratfor:
1630 @c @var{file}.r
1632 @item @var{file}.s
1633 Assembler code.
1635 @item @var{file}.S
1636 @itemx @var{file}.sx
1637 Assembler code that must be preprocessed.
1639 @item @var{other}
1640 An object file to be fed straight into linking.
1641 Any file name with no recognized suffix is treated this way.
1642 @end table
1644 @opindex x
1645 You can specify the input language explicitly with the @option{-x} option:
1647 @table @gcctabopt
1648 @item -x @var{language}
1649 Specify explicitly the @var{language} for the following input files
1650 (rather than letting the compiler choose a default based on the file
1651 name suffix).  This option applies to all following input files until
1652 the next @option{-x} option.  Possible values for @var{language} are:
1653 @smallexample
1654 c  c-header  cpp-output
1655 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1656 objective-c  objective-c-header  objective-c-cpp-output
1657 objective-c++ objective-c++-header objective-c++-cpp-output
1658 assembler  assembler-with-cpp
1661 f77  f77-cpp-input f95  f95-cpp-input
1663 @end smallexample
1665 @item -x none
1666 Turn off any specification of a language, so that subsequent files are
1667 handled according to their file name suffixes (as they are if @option{-x}
1668 has not been used at all).
1669 @end table
1671 If you only want some of the stages of compilation, you can use
1672 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1673 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1674 @command{gcc} is to stop.  Note that some combinations (for example,
1675 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1677 @table @gcctabopt
1678 @opindex c
1679 @item -c
1680 Compile or assemble the source files, but do not link.  The linking
1681 stage simply is not done.  The ultimate output is in the form of an
1682 object file for each source file.
1684 By default, the object file name for a source file is made by replacing
1685 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1687 Unrecognized input files, not requiring compilation or assembly, are
1688 ignored.
1690 @opindex S
1691 @item -S
1692 Stop after the stage of compilation proper; do not assemble.  The output
1693 is in the form of an assembler code file for each non-assembler input
1694 file specified.
1696 By default, the assembler file name for a source file is made by
1697 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1699 Input files that don't require compilation are ignored.
1701 @opindex E
1702 @item -E
1703 Stop after the preprocessing stage; do not run the compiler proper.  The
1704 output is in the form of preprocessed source code, which is sent to the
1705 standard output.
1707 Input files that don't require preprocessing are ignored.
1709 @cindex output file option
1710 @opindex o
1711 @item -o @var{file}
1712 Place the primary output in file @var{file}.  This applies to whatever
1713 sort of output is being produced, whether it be an executable file, an
1714 object file, an assembler file or preprocessed C code.
1716 If @option{-o} is not specified, the default is to put an executable
1717 file in @file{a.out}, the object file for
1718 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1719 assembler file in @file{@var{source}.s}, a precompiled header file in
1720 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1721 standard output.
1723 Though @option{-o} names only the primary output, it also affects the
1724 naming of auxiliary and dump outputs.  See the examples below.  Unless
1725 overridden, both auxiliary outputs and dump outputs are placed in the
1726 same directory as the primary output.  In auxiliary outputs, the suffix
1727 of the input file is replaced with that of the auxiliary output file
1728 type; in dump outputs, the suffix of the dump file is appended to the
1729 input file suffix.  In compilation commands, the base name of both
1730 auxiliary and dump outputs is that of the primary output; in compile and
1731 link commands, the primary output name, minus the executable suffix, is
1732 combined with the input file name.  If both share the same base name,
1733 disregarding the suffix, the result of the combination is that base
1734 name, otherwise, they are concatenated, separated by a dash.
1736 @smallexample
1737 gcc -c foo.c ...
1738 @end smallexample
1740 will use @file{foo.o} as the primary output, and place aux outputs and
1741 dumps next to it, e.g., aux file @file{foo.dwo} for
1742 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1743 @option{-fdump-rtl-final}.
1745 If a non-linker output file is explicitly specified, aux and dump files
1746 by default take the same base name:
1748 @smallexample
1749 gcc -c foo.c -o dir/foobar.o ...
1750 @end smallexample
1752 will name aux outputs @file{dir/foobar.*} and dump outputs
1753 @file{dir/foobar.c.*}.
1755 A linker output will instead prefix aux and dump outputs:
1757 @smallexample
1758 gcc foo.c bar.c -o dir/foobar ...
1759 @end smallexample
1761 will generally name aux outputs @file{dir/foobar-foo.*} and
1762 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1763 @file{dir/foobar-bar.c.*}.
1765 The one exception to the above is when the executable shares the base
1766 name with the single input:
1768 @smallexample
1769 gcc foo.c -o dir/foo ...
1770 @end smallexample
1772 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1773 named @file{dir/foo.c.*}.
1775 The location and the names of auxiliary and dump outputs can be adjusted
1776 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1777 @option{-dumpdir}, @option{-save-temps=cwd}, and
1778 @option{-save-temps=obj}.
1781 @opindex dumpbase
1782 @item -dumpbase @var{dumpbase}
1783 This option sets the base name for auxiliary and dump output files.  It
1784 does not affect the name of the primary output file.  Intermediate
1785 outputs, when preserved, are not regarded as primary outputs, but as
1786 auxiliary outputs:
1788 @smallexample
1789 gcc -save-temps -S foo.c
1790 @end smallexample
1792 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1793 then compiles to the (implied) output file @file{foo.s}, whereas:
1795 @smallexample
1796 gcc -save-temps -dumpbase save-foo -c foo.c
1797 @end smallexample
1799 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1800 an intermediate, thus auxiliary output), and then assembles to the
1801 (implied) output file @file{foo.o}.
1803 Absent this option, dump and aux files take their names from the input
1804 file, or from the (non-linker) output file, if one is explicitly
1805 specified: dump output files (e.g. those requested by @option{-fdump-*}
1806 options) with the input name suffix, and aux output files (those
1807 requested by other non-dump options, e.g. @code{-save-temps},
1808 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1810 Similar suffix differentiation of dump and aux outputs can be attained
1811 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1812 @option{-dumpbase-ext .suf}.
1814 If @var{dumpbase} is explicitly specified with any directory component,
1815 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1816 @option{-save-temps=*}) is ignored, and instead of appending to it,
1817 @var{dumpbase} fully overrides it:
1819 @smallexample
1820 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1821   -dumpdir pfx- -save-temps=cwd ...
1822 @end smallexample
1824 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1825 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1826 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1828 When @option{-dumpbase} is specified in a command that compiles multiple
1829 inputs, or that compiles and then links, it may be combined with
1830 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1831 file is compiled using the combined @var{dumppfx}, and default values
1832 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1833 file:
1835 @smallexample
1836 gcc foo.c bar.c -c -dumpbase main ...
1837 @end smallexample
1839 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1840 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1841 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1842 and @file{main-bar.*}.
1844 An empty string specified as @var{dumpbase} avoids the influence of the
1845 output basename in the naming of auxiliary and dump outputs during
1846 compilation, computing default values :
1848 @smallexample
1849 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1850 @end smallexample
1852 will name aux outputs @file{dir/foo.*} and dump outputs
1853 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1854 name, but the directory still defaults to that of the output.
1856 The empty-string dumpbase does not prevent the use of the output
1857 basename for outputs during linking:
1859 @smallexample
1860 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1861 @end smallexample
1863 The compilation of the source files will name auxiliary outputs
1864 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1865 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1866 linking will use @file{dir/foobar.} as the prefix for dumps and
1867 auxiliary files.
1870 @opindex dumpbase-ext
1871 @item -dumpbase-ext @var{auxdropsuf}
1872 When forming the name of an auxiliary (but not a dump) output file, drop
1873 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1874 suffixes.  If not specified, this option defaults to the suffix of a
1875 default @var{dumpbase}, i.e., the suffix of the input file when
1876 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1877 is combined with @var{dumppfx}.
1879 @smallexample
1880 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1881 @end smallexample
1883 creates @file{dir/foo.o} as the main output, and generates auxiliary
1884 outputs in @file{dir/x-foo.*}, taking the location of the primary
1885 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1886 outputs retain the suffix: @file{dir/x-foo.c.*}.
1888 This option is disregarded if it does not match the suffix of a
1889 specified @var{dumpbase}, except as an alternative to the executable
1890 suffix when appending the linker output base name to @var{dumppfx}, as
1891 specified below:
1893 @smallexample
1894 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1895 @end smallexample
1897 creates @file{main.out} as the primary output, and avoids overwriting
1898 the auxiliary and dump outputs by using the executable name minus
1899 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1900 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1901 @file{main-foo.c.*} and @file{main-bar.c.*}.
1904 @opindex dumpdir
1905 @item -dumpdir @var{dumppfx}
1906 When forming the name of an auxiliary or dump output file, use
1907 @var{dumppfx} as a prefix:
1909 @smallexample
1910 gcc -dumpdir pfx- -c foo.c ...
1911 @end smallexample
1913 creates @file{foo.o} as the primary output, and auxiliary outputs named
1914 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1915 @var{dumpbase} derived from the default primary output, derived in turn
1916 from the input name.  Dump outputs also take the input name suffix:
1917 @file{pfx-foo.c.*}.
1919 If @var{dumppfx} is to be used as a directory name, it must end with a
1920 directory separator:
1922 @smallexample
1923 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1924 @end smallexample
1926 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1927 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1928 default @var{dumpbase} derived from the primary output name.  Dump
1929 outputs also take the input name suffix: @file{dir/bar.c.*}.
1931 It defaults to the location of the output file, unless the output
1932 file is a special file like @code{/dev/null}. Options
1933 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1934 default, just like an explicit @option{-dumpdir} option.  In case
1935 multiple such options are given, the last one prevails:
1937 @smallexample
1938 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1939 @end smallexample
1941 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1942 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1943 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1944 default for @option{-save-temps}, nor that the output directory is
1945 implicitly the current directory.  Dump outputs are named
1946 @file{foo.c.*}.
1948 When compiling from multiple input files, if @option{-dumpbase} is
1949 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1950 are appended to (or override, if containing any directory components) an
1951 explicit or defaulted @var{dumppfx}, so that each of the multiple
1952 compilations gets differently-named aux and dump outputs.
1954 @smallexample
1955 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1956 @end smallexample
1958 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1959 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1960 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1961 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1962 single-input compilation:
1964 @smallexample
1965 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1966 @end smallexample
1968 that, applying @option{-dumpbase} to a single source, does not compute
1969 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1970 dump outputs go in @file{dir/pfx-main.*}.
1972 When compiling and then linking from multiple input files, a defaulted
1973 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1974 transformation above (e.g. the compilation of @file{foo.c} and
1975 @file{bar.c} above, but without @option{-c}).  If neither
1976 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1977 base name, minus @var{auxdropsuf}, if specified, or the executable
1978 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1979 instead.  Note, however, that unlike earlier cases of linking:
1981 @smallexample
1982 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1983 @end smallexample
1985 does not append the output name @file{main} to @var{dumppfx}, because
1986 @option{-dumpdir} is explicitly specified.  The goal is that the
1987 explicitly-specified @var{dumppfx} may contain the specified output name
1988 as part of the prefix, if desired; only an explicitly-specified
1989 @option{-dumpbase} would be combined with it, in order to avoid simply
1990 discarding a meaningful option.
1992 When compiling and then linking from a single input file, the linker
1993 output base name will only be appended to the default @var{dumppfx} as
1994 above if it does not share the base name with the single input file
1995 name.  This has been covered in single-input linking cases above, but
1996 not with an explicit @option{-dumpdir} that inhibits the combination,
1997 even if overridden by @option{-save-temps=*}:
1999 @smallexample
2000 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
2001 @end smallexample
2003 Auxiliary outputs are named @file{foo.*}, and dump outputs
2004 @file{foo.c.*}, in the current working directory as ultimately requested
2005 by @option{-save-temps=cwd}.
2007 Summing it all up for an intuitive though slightly imprecise data flow:
2008 the primary output name is broken into a directory part and a basename
2009 part; @var{dumppfx} is set to the former, unless overridden by
2010 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2011 to the latter, unless overriden by @option{-dumpbase}.  If there are
2012 multiple inputs or linking, this @var{dumpbase} may be combined with
2013 @var{dumppfx} and taken from each input file.  Auxiliary output names
2014 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2015 minus suffix, and the auxiliary output suffix; dump output names are
2016 only different in that the suffix from @var{dumpbase} is retained.
2018 When it comes to auxiliary and dump outputs created during LTO
2019 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2020 given or as derived from the linker output name but not from inputs,
2021 even in cases in which this combination would not otherwise be used as
2022 such, is passed down with a trailing period replacing the compiler-added
2023 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2024 being involved in linking, this program does not normally get any
2025 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2027 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2028 names to the received @var{dumppfx}, ensures it contains a directory
2029 component so that it overrides any @option{-dumpdir}, and passes that as
2030 @option{-dumpbase} to sub-compilers.
2032 @opindex v
2033 @item -v
2034 Print (on standard error output) the commands executed to run the stages
2035 of compilation.  Also print the version number of the compiler driver
2036 program and of the preprocessor and the compiler proper.
2038 @opindex ###
2039 @item -###
2040 Like @option{-v} except the commands are not executed and arguments
2041 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2042 This is useful for shell scripts to capture the driver-generated command lines.
2044 @opindex help
2045 @item --help
2046 Print (on the standard output) a description of the command-line options
2047 understood by @command{gcc}.  If the @option{-v} option is also specified
2048 then @option{--help} is also passed on to the various processes
2049 invoked by @command{gcc}, so that they can display the command-line options
2050 they accept.  If the @option{-Wextra} option has also been specified
2051 (prior to the @option{--help} option), then command-line options that
2052 have no documentation associated with them are also displayed.
2054 @opindex target-help
2055 @item --target-help
2056 Print (on the standard output) a description of target-specific command-line
2057 options for each tool.  For some targets extra target-specific
2058 information may also be printed.
2060 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2061 Print (on the standard output) a description of the command-line
2062 options understood by the compiler that fit into all specified classes
2063 and qualifiers.  These are the supported classes:
2065 @table @asis
2066 @item @samp{optimizers}
2067 Display all of the optimization options supported by the
2068 compiler.
2070 @item @samp{warnings}
2071 Display all of the options controlling warning messages
2072 produced by the compiler.
2074 @item @samp{target}
2075 Display target-specific options.  Unlike the
2076 @option{--target-help} option however, target-specific options of the
2077 linker and assembler are not displayed.  This is because those
2078 tools do not currently support the extended @option{--help=} syntax.
2080 @item @samp{params}
2081 Display the values recognized by the @option{--param}
2082 option.
2084 @item @var{language}
2085 Display the options supported for @var{language}, where
2086 @var{language} is the name of one of the languages supported in this
2087 version of GCC@.  If an option is supported by all languages, one needs
2088 to select @samp{common} class.
2090 @item @samp{common}
2091 Display the options that are common to all languages.
2092 @end table
2094 These are the supported qualifiers:
2096 @table @asis
2097 @item @samp{undocumented}
2098 Display only those options that are undocumented.
2100 @item @samp{joined}
2101 Display options taking an argument that appears after an equal
2102 sign in the same continuous piece of text, such as:
2103 @samp{--help=target}.
2105 @item @samp{separate}
2106 Display options taking an argument that appears as a separate word
2107 following the original option, such as: @samp{-o output-file}.
2108 @end table
2110 Thus for example to display all the undocumented target-specific
2111 switches supported by the compiler, use:
2113 @smallexample
2114 --help=target,undocumented
2115 @end smallexample
2117 The sense of a qualifier can be inverted by prefixing it with the
2118 @samp{^} character, so for example to display all binary warning
2119 options (i.e., ones that are either on or off and that do not take an
2120 argument) that have a description, use:
2122 @smallexample
2123 --help=warnings,^joined,^undocumented
2124 @end smallexample
2126 The argument to @option{--help=} should not consist solely of inverted
2127 qualifiers.
2129 Combining several classes is possible, although this usually
2130 restricts the output so much that there is nothing to display.  One
2131 case where it does work, however, is when one of the classes is
2132 @var{target}.  For example, to display all the target-specific
2133 optimization options, use:
2135 @smallexample
2136 --help=target,optimizers
2137 @end smallexample
2139 The @option{--help=} option can be repeated on the command line.  Each
2140 successive use displays its requested class of options, skipping
2141 those that have already been displayed.  If @option{--help} is also
2142 specified anywhere on the command line then this takes precedence
2143 over any @option{--help=} option.
2145 If the @option{-Q} option appears on the command line before the
2146 @option{--help=} option, then the descriptive text displayed by
2147 @option{--help=} is changed.  Instead of describing the displayed
2148 options, an indication is given as to whether the option is enabled,
2149 disabled or set to a specific value (assuming that the compiler
2150 knows this at the point where the @option{--help=} option is used).
2152 Here is a truncated example from the ARM port of @command{gcc}:
2154 @smallexample
2155   % gcc -Q -mabi=2 --help=target -c
2156   The following options are target specific:
2157   -mabi=                                2
2158   -mabort-on-noreturn                   [disabled]
2159   -mapcs                                [disabled]
2160 @end smallexample
2162 The output is sensitive to the effects of previous command-line
2163 options, so for example it is possible to find out which optimizations
2164 are enabled at @option{-O2} by using:
2166 @smallexample
2167 -Q -O2 --help=optimizers
2168 @end smallexample
2170 Alternatively you can discover which binary optimizations are enabled
2171 by @option{-O3} by using:
2173 @smallexample
2174 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2175 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2176 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2177 @end smallexample
2179 @opindex version
2180 @item --version
2181 Display the version number and copyrights of the invoked GCC@.
2183 @opindex pass-exit-codes
2184 @item -pass-exit-codes
2185 Normally the @command{gcc} program exits with the code of 1 if any
2186 phase of the compiler returns a non-success return code.  If you specify
2187 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2188 the numerically highest error produced by any phase returning an error
2189 indication.  The C, C++, and Fortran front ends return 4 if an internal
2190 compiler error is encountered.
2192 @opindex pipe
2193 @item -pipe
2194 Use pipes rather than temporary files for communication between the
2195 various stages of compilation.  This fails to work on some systems where
2196 the assembler is unable to read from a pipe; but the GNU assembler has
2197 no trouble.
2199 @opindex specs
2200 @item -specs=@var{file}
2201 Process @var{file} after the compiler reads in the standard @file{specs}
2202 file, in order to override the defaults which the @command{gcc} driver
2203 program uses when determining what switches to pass to @command{cc1},
2204 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2205 @option{-specs=@var{file}} can be specified on the command line, and they
2206 are processed in order, from left to right.  @xref{Spec Files}, for
2207 information about the format of the @var{file}.
2209 @opindex wrapper
2210 @item -wrapper
2211 Invoke all subcommands under a wrapper program.  The name of the
2212 wrapper program and its parameters are passed as a comma separated
2213 list.
2215 @smallexample
2216 gcc -c t.c -wrapper gdb,--args
2217 @end smallexample
2219 @noindent
2220 This invokes all subprograms of @command{gcc} under
2221 @samp{gdb --args}, thus the invocation of @command{cc1} is
2222 @samp{gdb --args cc1 @dots{}}.
2224 @opindex ffile-prefix-map
2225 @item -ffile-prefix-map=@var{old}=@var{new}
2226 When compiling files residing in directory @file{@var{old}}, record
2227 any references to them in the result of the compilation as if the
2228 files resided in directory @file{@var{new}} instead.  Specifying this
2229 option is equivalent to specifying all the individual
2230 @option{-f*-prefix-map} options.  This can be used to make reproducible
2231 builds that are location independent.  Directories referenced by
2232 directives are not affected by these options.  See also
2233 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2234 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2236 @opindex fcanon-prefix-map
2237 @item -fcanon-prefix-map
2238 For the @option{-f*-prefix-map} options normally comparison
2239 of @file{@var{old}} prefix against the filename that would be normally
2240 referenced in the result of the compilation is done using textual
2241 comparison of the prefixes, or ignoring character case for case insensitive
2242 filesystems and considering slashes and backslashes as equal on DOS based
2243 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2244 to be done on canonicalized paths of @file{@var{old}}
2245 and the referenced filename.
2247 @opindex fplugin
2248 @item -fplugin=@var{name}.so
2249 Load the plugin code in file @var{name}.so, assumed to be a
2250 shared object to be dlopen'd by the compiler.  The base name of
2251 the shared object file is used to identify the plugin for the
2252 purposes of argument parsing (See
2253 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2254 Each plugin should define the callback functions specified in the
2255 Plugins API.
2257 @opindex fplugin-arg
2258 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2259 Define an argument called @var{key} with a value of @var{value}
2260 for the plugin called @var{name}.
2262 @opindex fdump-ada-spec
2263 @item -fdump-ada-spec@r{[}-slim@r{]}
2264 For C and C++ source and include files, generate corresponding Ada specs.
2265 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2266 GNAT User's Guide}, which provides detailed documentation on this feature.
2268 @opindex fada-spec-parent
2269 @item -fada-spec-parent=@var{unit}
2270 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2271 Ada specs as child units of parent @var{unit}.
2273 @opindex fdump-go-spec
2274 @item -fdump-go-spec=@var{file}
2275 For input files in any language, generate corresponding Go
2276 declarations in @var{file}.  This generates Go @code{const},
2277 @code{type}, @code{var}, and @code{func} declarations which may be a
2278 useful way to start writing a Go interface to code written in some
2279 other language.
2281 @include @value{srcdir}/../libiberty/at-file.texi
2282 @end table
2284 @node Invoking G++
2285 @section Compiling C++ Programs
2287 @cindex suffixes for C++ source
2288 @cindex C++ source file suffixes
2289 C++ source files conventionally use one of the suffixes @samp{.C},
2290 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2291 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2292 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2293 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2294 files with these names and compiles them as C++ programs even if you
2295 call the compiler the same way as for compiling C programs (usually
2296 with the name @command{gcc}).
2298 @findex g++
2299 @findex c++
2300 However, the use of @command{gcc} does not add the C++ library.
2301 @command{g++} is a program that calls GCC and automatically specifies linking
2302 against the C++ library.  It treats @samp{.c},
2303 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2304 files unless @option{-x} is used.  This program is also useful when
2305 precompiling a C header file with a @samp{.h} extension for use in C++
2306 compilations.  On many systems, @command{g++} is also installed with
2307 the name @command{c++}.
2309 @cindex invoking @command{g++}
2310 When you compile C++ programs, you may specify many of the same
2311 command-line options that you use for compiling programs in any
2312 language; or command-line options meaningful for C and related
2313 languages; or options that are meaningful only for C++ programs.
2314 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2315 explanations of options for languages related to C@.
2316 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2317 explanations of options that are meaningful only for C++ programs.
2319 @node C Dialect Options
2320 @section Options Controlling C Dialect
2321 @cindex dialect options
2322 @cindex language dialect options
2323 @cindex options, dialect
2325 The following options control the dialect of C (or languages derived
2326 from C, such as C++, Objective-C and Objective-C++) that the compiler
2327 accepts:
2329 @table @gcctabopt
2330 @cindex ANSI support
2331 @cindex ISO support
2332 @opindex ansi
2333 @item -ansi
2334 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2335 equivalent to @option{-std=c++98}.
2337 This turns off certain features of GCC that are incompatible with ISO
2338 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2339 such as the @code{asm} and @code{typeof} keywords, and
2340 predefined macros such as @code{unix} and @code{vax} that identify the
2341 type of system you are using.  It also enables the undesirable and
2342 rarely used ISO trigraph feature.  For the C compiler,
2343 it disables recognition of C++ style @samp{//} comments as well as
2344 the @code{inline} keyword.
2346 The alternate keywords @code{__asm__}, @code{__extension__},
2347 @code{__inline__} and @code{__typeof__} continue to work despite
2348 @option{-ansi}.  You would not want to use them in an ISO C program, of
2349 course, but it is useful to put them in header files that might be included
2350 in compilations done with @option{-ansi}.  Alternate predefined macros
2351 such as @code{__unix__} and @code{__vax__} are also available, with or
2352 without @option{-ansi}.
2354 The @option{-ansi} option does not cause non-ISO programs to be
2355 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2356 addition to @option{-ansi}.  @xref{Warning Options}.
2358 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2359 option is used.  Some header files may notice this macro and refrain
2360 from declaring certain functions or defining certain macros that the
2361 ISO standard doesn't call for; this is to avoid interfering with any
2362 programs that might use these names for other things.
2364 Functions that are normally built in but do not have semantics
2365 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2366 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2367 built-in functions provided by GCC}, for details of the functions
2368 affected.
2370 @opindex std
2371 @item -std=
2372 Determine the language standard. @xref{Standards,,Language Standards
2373 Supported by GCC}, for details of these standard versions.  This option
2374 is currently only supported when compiling C or C++.
2376 The compiler can accept several base standards, such as @samp{c90} or
2377 @samp{c++98}, and GNU dialects of those standards, such as
2378 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2379 compiler accepts all programs following that standard plus those
2380 using GNU extensions that do not contradict it.  For example,
2381 @option{-std=c90} turns off certain features of GCC that are
2382 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2383 keywords, but not other GNU extensions that do not have a meaning in
2384 ISO C90, such as omitting the middle term of a @code{?:}
2385 expression. On the other hand, when a GNU dialect of a standard is
2386 specified, all features supported by the compiler are enabled, even when
2387 those features change the meaning of the base standard.  As a result, some
2388 strict-conforming programs may be rejected.  The particular standard
2389 is used by @option{-Wpedantic} to identify which features are GNU
2390 extensions given that version of the standard. For example
2391 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2392 comments, while @option{-std=gnu99 -Wpedantic} does not.
2394 A value for this option must be provided; possible values are
2396 @table @samp
2397 @item c90
2398 @itemx c89
2399 @itemx iso9899:1990
2400 Support all ISO C90 programs (certain GNU extensions that conflict
2401 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2403 @item iso9899:199409
2404 ISO C90 as modified in amendment 1.
2406 @item c99
2407 @itemx c9x
2408 @itemx iso9899:1999
2409 @itemx iso9899:199x
2410 ISO C99.  This standard is substantially completely supported, modulo
2411 bugs and floating-point issues
2412 (mainly but not entirely relating to optional C99 features from
2413 Annexes F and G).  See
2414 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2415 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2417 @item c11
2418 @itemx c1x
2419 @itemx iso9899:2011
2420 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2421 substantially completely supported, modulo bugs, floating-point issues
2422 (mainly but not entirely relating to optional C11 features from
2423 Annexes F and G) and the optional Annexes K (Bounds-checking
2424 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2426 @item c17
2427 @itemx c18
2428 @itemx iso9899:2017
2429 @itemx iso9899:2018
2430 ISO C17, the 2017 revision of the ISO C standard
2431 (published in 2018).  This standard is
2432 same as C11 except for corrections of defects (all of which are also
2433 applied with @option{-std=c11}) and a new value of
2434 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2436 @item c23
2437 @itemx c2x
2438 @itemx iso9899:2024
2439 ISO C23, the 2023 revision of the ISO C standard (expected to be
2440 published in 2024).  The support for this version is experimental and
2441 incomplete.  The name @samp{c2x} is deprecated.
2443 @item gnu90
2444 @itemx gnu89
2445 GNU dialect of ISO C90 (including some C99 features).
2447 @item gnu99
2448 @itemx gnu9x
2449 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2451 @item gnu11
2452 @itemx gnu1x
2453 GNU dialect of ISO C11.
2454 The name @samp{gnu1x} is deprecated.
2456 @item gnu17
2457 @itemx gnu18
2458 GNU dialect of ISO C17.  This is the default for C code.
2460 @item gnu23
2461 @itemx gnu2x
2462 The next version of the ISO C standard, still under development, plus
2463 GNU extensions.  The support for this version is experimental and
2464 incomplete.  The name @samp{gnu2x} is deprecated.
2466 @item c++98
2467 @itemx c++03
2468 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2469 additional defect reports. Same as @option{-ansi} for C++ code.
2471 @item gnu++98
2472 @itemx gnu++03
2473 GNU dialect of @option{-std=c++98}.
2475 @item c++11
2476 @itemx c++0x
2477 The 2011 ISO C++ standard plus amendments.
2478 The name @samp{c++0x} is deprecated.
2480 @item gnu++11
2481 @itemx gnu++0x
2482 GNU dialect of @option{-std=c++11}.
2483 The name @samp{gnu++0x} is deprecated.
2485 @item c++14
2486 @itemx c++1y
2487 The 2014 ISO C++ standard plus amendments.
2488 The name @samp{c++1y} is deprecated.
2490 @item gnu++14
2491 @itemx gnu++1y
2492 GNU dialect of @option{-std=c++14}.
2493 The name @samp{gnu++1y} is deprecated.
2495 @item c++17
2496 @itemx c++1z
2497 The 2017 ISO C++ standard plus amendments.
2498 The name @samp{c++1z} is deprecated.
2500 @item gnu++17
2501 @itemx gnu++1z
2502 GNU dialect of @option{-std=c++17}.
2503 This is the default for C++ code.
2504 The name @samp{gnu++1z} is deprecated.
2506 @item c++20
2507 @itemx c++2a
2508 The 2020 ISO C++ standard plus amendments.
2509 Support is experimental, and could change in incompatible ways in
2510 future releases.
2511 The name @samp{c++2a} is deprecated.
2513 @item gnu++20
2514 @itemx gnu++2a
2515 GNU dialect of @option{-std=c++20}.
2516 Support is experimental, and could change in incompatible ways in
2517 future releases.
2518 The name @samp{gnu++2a} is deprecated.
2520 @item c++2b
2521 @itemx c++23
2522 The next revision of the ISO C++ standard, planned for
2523 2023.  Support is highly experimental, and will almost certainly
2524 change in incompatible ways in future releases.
2526 @item gnu++2b
2527 @itemx gnu++23
2528 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2529 and will almost certainly change in incompatible ways in future
2530 releases.
2532 @item c++2c
2533 @itemx c++26
2534 The next revision of the ISO C++ standard, planned for
2535 2026.  Support is highly experimental, and will almost certainly
2536 change in incompatible ways in future releases.
2538 @item gnu++2c
2539 @itemx gnu++26
2540 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2541 and will almost certainly change in incompatible ways in future
2542 releases.
2543 @end table
2545 @opindex aux-info
2546 @item -aux-info @var{filename}
2547 Output to the given filename prototyped declarations for all functions
2548 declared and/or defined in a translation unit, including those in header
2549 files.  This option is silently ignored in any language other than C@.
2551 Besides declarations, the file indicates, in comments, the origin of
2552 each declaration (source file and line), whether the declaration was
2553 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2554 @samp{O} for old, respectively, in the first character after the line
2555 number and the colon), and whether it came from a declaration or a
2556 definition (@samp{C} or @samp{F}, respectively, in the following
2557 character).  In the case of function definitions, a K&R-style list of
2558 arguments followed by their declarations is also provided, inside
2559 comments, after the declaration.
2561 @opindex fno-asm
2562 @opindex fasm
2563 @item -fno-asm
2564 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2565 keyword, so that code can use these words as identifiers.  You can use
2566 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2567 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2569 In C++, @code{inline} is a standard keyword and is not affected by
2570 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2571 instead, which disables @code{typeof} but not @code{asm} and
2572 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2573 this switch only affects the @code{asm} and @code{typeof} keywords,
2574 since @code{inline} is a standard keyword in ISO C99.  In C23 mode
2575 (@option{-std=c23} or @option{-std=gnu23}), this switch only affects
2576 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2577 ISO C23.
2579 @opindex fno-builtin
2580 @opindex fbuiltin
2581 @cindex built-in functions
2582 @item -fno-builtin
2583 @itemx -fno-builtin-@var{function}
2584 Don't recognize built-in functions that do not begin with
2585 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2586 functions provided by GCC}, for details of the functions affected,
2587 including those which are not built-in functions when @option{-ansi} or
2588 @option{-std} options for strict ISO C conformance are used because they
2589 do not have an ISO standard meaning.
2591 GCC normally generates special code to handle certain built-in functions
2592 more efficiently; for instance, calls to @code{alloca} may become single
2593 instructions which adjust the stack directly, and calls to @code{memcpy}
2594 may become inline copy loops.  The resulting code is often both smaller
2595 and faster, but since the function calls no longer appear as such, you
2596 cannot set a breakpoint on those calls, nor can you change the behavior
2597 of the functions by linking with a different library.  In addition,
2598 when a function is recognized as a built-in function, GCC may use
2599 information about that function to warn about problems with calls to
2600 that function, or to generate more efficient code, even if the
2601 resulting code still contains calls to that function.  For example,
2602 warnings are given with @option{-Wformat} for bad calls to
2603 @code{printf} when @code{printf} is built in and @code{strlen} is
2604 known not to modify global memory.
2606 With the @option{-fno-builtin-@var{function}} option
2607 only the built-in function @var{function} is
2608 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2609 function is named that is not built-in in this version of GCC, this
2610 option is ignored.  There is no corresponding
2611 @option{-fbuiltin-@var{function}} option; if you wish to enable
2612 built-in functions selectively when using @option{-fno-builtin} or
2613 @option{-ffreestanding}, you may define macros such as:
2615 @smallexample
2616 #define abs(n)          __builtin_abs ((n))
2617 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2618 @end smallexample
2620 @opindex fcond-mismatch
2621 @item -fcond-mismatch
2622 Allow conditional expressions with mismatched types in the second and
2623 third arguments.  The value of such an expression is void.  This option
2624 is not supported for C++.
2626 @opindex ffreestanding
2627 @cindex hosted environment
2628 @item -ffreestanding
2630 Assert that compilation targets a freestanding environment.  This
2631 implies @option{-fno-builtin}.  A freestanding environment
2632 is one in which the standard library may not exist, and program startup may
2633 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2634 This is equivalent to @option{-fno-hosted}.
2636 @xref{Standards,,Language Standards Supported by GCC}, for details of
2637 freestanding and hosted environments.
2639 @opindex fgimple
2640 @item -fgimple
2642 Enable parsing of function definitions marked with @code{__GIMPLE}.
2643 This is an experimental feature that allows unit testing of GIMPLE
2644 passes.
2646 @opindex fgnu-tm
2647 @item -fgnu-tm
2648 When the option @option{-fgnu-tm} is specified, the compiler
2649 generates code for the Linux variant of Intel's current Transactional
2650 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2651 an experimental feature whose interface may change in future versions
2652 of GCC, as the official specification changes.  Please note that not
2653 all architectures are supported for this feature.
2655 For more information on GCC's support for transactional memory,
2656 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2657 Transactional Memory Library}.
2659 Note that the transactional memory feature is not supported with
2660 non-call exceptions (@option{-fnon-call-exceptions}).
2662 @opindex fgnu89-inline
2663 @item -fgnu89-inline
2664 The option @option{-fgnu89-inline} tells GCC to use the traditional
2665 GNU semantics for @code{inline} functions when in C99 mode.
2666 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2667 Using this option is roughly equivalent to adding the
2668 @code{gnu_inline} function attribute to all inline functions
2669 (@pxref{Function Attributes}).
2671 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2672 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2673 specifies the default behavior).
2674 This option is not supported in @option{-std=c90} or
2675 @option{-std=gnu90} mode.
2677 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2678 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2679 in effect for @code{inline} functions.  @xref{Common Predefined
2680 Macros,,,cpp,The C Preprocessor}.
2682 @opindex fhosted
2683 @cindex hosted environment
2684 @item -fhosted
2686 Assert that compilation targets a hosted environment.  This implies
2687 @option{-fbuiltin}.  A hosted environment is one in which the
2688 entire standard library is available, and in which @code{main} has a return
2689 type of @code{int}.  Examples are nearly everything except a kernel.
2690 This is equivalent to @option{-fno-freestanding}.
2692 @opindex flax-vector-conversions
2693 @item -flax-vector-conversions
2694 Allow implicit conversions between vectors with differing numbers of
2695 elements and/or incompatible element types.  This option should not be
2696 used for new code.
2698 @opindex fms-extensions
2699 @item -fms-extensions
2700 Accept some non-standard constructs used in Microsoft header files.
2702 In C++ code, this allows member names in structures to be similar
2703 to previous types declarations.
2705 @smallexample
2706 typedef int UOW;
2707 struct ABC @{
2708   UOW UOW;
2710 @end smallexample
2712 Some cases of unnamed fields in structures and unions are only
2713 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2714 fields within structs/unions}, for details.
2716 Note that this option is off for all targets except for x86
2717 targets using ms-abi.
2719 @opindex foffload
2720 @cindex Offloading targets
2721 @cindex OpenACC offloading targets
2722 @cindex OpenMP offloading targets
2723 @item -foffload=disable
2724 @itemx -foffload=default
2725 @itemx -foffload=@var{target-list}
2726 Specify for which OpenMP and OpenACC offload targets code should be generated.
2727 The default behavior, equivalent to @option{-foffload=default}, is to generate
2728 code for all supported offload targets.  The @option{-foffload=disable} form
2729 generates code only for the host fallback, while
2730 @option{-foffload=@var{target-list}} generates code only for the specified
2731 comma-separated list of offload targets.
2733 Offload targets are specified in GCC's internal target-triplet format. You can
2734 run the compiler with @option{-v} to show the list of configured offload targets
2735 under @code{OFFLOAD_TARGET_NAMES}.
2737 @opindex foffload-options
2738 @cindex Offloading options
2739 @cindex OpenACC offloading options
2740 @cindex OpenMP offloading options
2741 @item -foffload-options=@var{options}
2742 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2744 With @option{-foffload-options=@var{options}}, GCC passes the specified
2745 @var{options} to the compilers for all enabled offloading targets.  You can
2746 specify options that apply only to a specific target or targets by using
2747 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2748 @var{target-list} is a comma-separated list in the same format as for the
2749 @option{-foffload=} option.
2751 Typical command lines are
2753 @smallexample
2754 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2755 -foffload-options=amdgcn-amdhsa=-march=gfx906
2756 @end smallexample
2758 @opindex fopenacc
2759 @cindex OpenACC accelerator programming
2760 @item -fopenacc
2761 Enable handling of OpenACC directives @samp{#pragma acc} in C/C++ and
2762 @samp{!$acc} in free-form Fortran and @samp{!$acc}, @samp{c$acc} and
2763 @samp{*$acc} in fixed-form Fortran.  When @option{-fopenacc} is specified,
2764 the compiler generates accelerated code according to the OpenACC Application
2765 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2766 implies @option{-pthread}, and thus is only supported on targets that
2767 have support for @option{-pthread}.
2769 @opindex fopenacc-dim
2770 @cindex OpenACC accelerator programming
2771 @item -fopenacc-dim=@var{geom}
2772 Specify default compute dimensions for parallel offload regions that do
2773 not explicitly specify.  The @var{geom} value is a triple of
2774 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2775 can be omitted, to use a target-specific default value.
2777 @opindex fopenmp
2778 @cindex OpenMP parallel
2779 @item -fopenmp
2780 Enable handling of OpenMP directives @samp{#pragma omp},
2781 @samp{[[omp::directive(...)]]}, @samp{[[omp::sequence(...)]]} and
2782 @samp{[[omp::decl(...)]]} in C/C++ and @samp{!$omp} in Fortran.  It
2783 additionally enables the conditional compilation sentinel @samp{!$} in
2784 Fortran.  In fixed source form Fortran, the sentinels can also start with
2785 @samp{c} or @samp{*}.  When @option{-fopenmp} is specified, the
2786 compiler generates parallel code according to the OpenMP Application
2787 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2788 implies @option{-pthread}, and thus is only supported on targets that
2789 have support for @option{-pthread}. @option{-fopenmp} implies
2790 @option{-fopenmp-simd}.
2792 @opindex fopenmp-simd
2793 @cindex OpenMP SIMD
2794 @cindex SIMD
2795 @item -fopenmp-simd
2796 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2797 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan}
2798 and @code{loop} directive, and of combined or composite directives with
2799 @code{simd} as constituent with @code{#pragma omp},
2800 @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and
2801 @code{[[omp::decl(...)]]} in C/C++ and @code{!$omp} in Fortran.  It
2802 additionally enables the conditional compilation sentinel @samp{!$} in
2803 Fortran.  In fixed source form Fortran, the sentinels can also start with
2804 @samp{c} or @samp{*}.  Other OpenMP directives are ignored.  Unless
2805 @option{-fopenmp} is additionally specified, the @code{loop} region binds
2806 to the current task region, independent of the specified @code{bind} clause.
2808 @opindex fopenmp-target-simd-clone
2809 @cindex OpenMP target SIMD clone
2810 @item -fopenmp-target-simd-clone
2811 @item -fopenmp-target-simd-clone=@var{device-type}
2812 In addition to generating SIMD clones for functions marked with the
2813 @code{declare simd} directive, GCC also generates clones
2814 for functions marked with the OpenMP @code{declare target} directive
2815 that are suitable for vectorization when this option is in effect.  The
2816 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2817 and @code{any}, which correspond to keywords for the @code{device_type}
2818 clause of the @code{declare target} directive; clones are generated for
2819 the intersection of devices specified.
2820 @option{-fopenmp-target-simd-clone} is equivalent to
2821 @option{-fopenmp-target-simd-clone=any} and
2822 @option{-fno-openmp-target-simd-clone} is equivalent to
2823 @option{-fopenmp-target-simd-clone=none}.
2825 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2826 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2827 it is disabled by default.
2829 @opindex fpermitted-flt-eval-methods
2830 @opindex fpermitted-flt-eval-methods=c11
2831 @opindex fpermitted-flt-eval-methods=ts-18661-3
2832 @item -fpermitted-flt-eval-methods=@var{style}
2833 ISO/IEC TS 18661-3 defines new permissible values for
2834 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2835 a semantic type that is an interchange or extended format should be
2836 evaluated to the precision and range of that type.  These new values are
2837 a superset of those permitted under C99/C11, which does not specify the
2838 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2839 conforming to C11 may not have been written expecting the possibility of
2840 the new values.
2842 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2843 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2844 or the extended set of values specified in ISO/IEC TS 18661-3.
2846 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2848 The default when in a standards compliant mode (@option{-std=c11} or similar)
2849 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2850 dialect (@option{-std=gnu11} or similar) is
2851 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2853 @opindex fdeps-
2854 The @samp{-fdeps-*} options are used to extract structured dependency
2855 information for a source.  This involves determining what resources provided by
2856 other source files will be required to compile the source as well as what
2857 resources are provided by the source.  This information can be used to add
2858 required dependencies between compilation rules of dependent sources based on
2859 their contents rather than requiring such information be reflected within the
2860 build tools as well.
2862 @opindex fdeps-file
2863 @item -fdeps-file=@var{file}
2864 Where to write structured dependency information.
2866 @opindex fdeps-format
2867 @item -fdeps-format=@var{format}
2868 The format to use for structured dependency information. @samp{p1689r5} is the
2869 only supported format right now.  Note that when this argument is specified, the
2870 output of @samp{-MF} is stripped of some information (namely C++ modules) so
2871 that it does not use extended makefile syntax not understood by most tools.
2873 @opindex fdeps-target
2874 @item -fdeps-target=@var{file}
2875 Analogous to @option{-MT} but for structured dependency information.  This
2876 indicates the target which will ultimately need any required resources and
2877 provide any resources extracted from the source that may be required by other
2878 sources.
2880 @opindex fplan9-extensions
2881 @item -fplan9-extensions
2882 Accept some non-standard constructs used in Plan 9 code.
2884 This enables @option{-fms-extensions}, permits passing pointers to
2885 structures with anonymous fields to functions that expect pointers to
2886 elements of the type of the field, and permits referring to anonymous
2887 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2888 struct/union fields within structs/unions}, for details.  This is only
2889 supported for C, not C++.
2891 @opindex fsigned-bitfields
2892 @opindex funsigned-bitfields
2893 @opindex fno-signed-bitfields
2894 @opindex fno-unsigned-bitfields
2895 @item -fsigned-bitfields
2896 @itemx -funsigned-bitfields
2897 @itemx -fno-signed-bitfields
2898 @itemx -fno-unsigned-bitfields
2899 These options control whether a bit-field is signed or unsigned, when the
2900 declaration does not use either @code{signed} or @code{unsigned}.  By
2901 default, such a bit-field is signed, because this is consistent: the
2902 basic integer types such as @code{int} are signed types.
2904 @opindex fsigned-char
2905 @item -fsigned-char
2906 Let the type @code{char} be signed, like @code{signed char}.
2908 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2909 the negative form of @option{-funsigned-char}.  Likewise, the option
2910 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2912 @opindex funsigned-char
2913 @item -funsigned-char
2914 Let the type @code{char} be unsigned, like @code{unsigned char}.
2916 Each kind of machine has a default for what @code{char} should
2917 be.  It is either like @code{unsigned char} by default or like
2918 @code{signed char} by default.
2920 Ideally, a portable program should always use @code{signed char} or
2921 @code{unsigned char} when it depends on the signedness of an object.
2922 But many programs have been written to use plain @code{char} and
2923 expect it to be signed, or expect it to be unsigned, depending on the
2924 machines they were written for.  This option, and its inverse, let you
2925 make such a program work with the opposite default.
2927 The type @code{char} is always a distinct type from each of
2928 @code{signed char} or @code{unsigned char}, even though its behavior
2929 is always just like one of those two.
2931 @opindex fstrict-flex-arrays
2932 @opindex fno-strict-flex-arrays
2933 @item -fstrict-flex-arrays
2934 Control when to treat the trailing array of a structure as a flexible array
2935 member for the purpose of accessing the elements of such an array.
2936 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2937 strictest.  A trailing array is treated as a flexible array member only when it
2938 is declared as a flexible array member per C99 standard onwards.
2939 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2940 least strict.  All trailing arrays of structures are treated as flexible array
2941 members.
2943 @opindex fstrict-flex-arrays=@var{level}
2944 @item -fstrict-flex-arrays=@var{level}
2945 Control when to treat the trailing array of a structure as a flexible array
2946 member for the purpose of accessing the elements of such an array.  The value
2947 of @var{level} controls the level of strictness.
2949 The possible values of @var{level} are the same as for the
2950 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2952 You can control this behavior for a specific trailing array field of a
2953 structure by using the variable attribute @code{strict_flex_array} attribute
2954 (@pxref{Variable Attributes}).
2956 @opindex fsso-struct
2957 @item -fsso-struct=@var{endianness}
2958 Set the default scalar storage order of structures and unions to the
2959 specified endianness.  The accepted values are @samp{big-endian},
2960 @samp{little-endian} and @samp{native} for the native endianness of
2961 the target (the default).  This option is not supported for C++.
2963 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2964 code that is not binary compatible with code generated without it if the
2965 specified endianness is not the native endianness of the target.
2966 @end table
2968 @node C++ Dialect Options
2969 @section Options Controlling C++ Dialect
2971 @cindex compiler options, C++
2972 @cindex C++ options, command-line
2973 @cindex options, C++
2974 This section describes the command-line options that are only meaningful
2975 for C++ programs.  You can also use most of the GNU compiler options
2976 regardless of what language your program is in.  For example, you
2977 might compile a file @file{firstClass.C} like this:
2979 @smallexample
2980 g++ -g -fstrict-enums -O -c firstClass.C
2981 @end smallexample
2983 @noindent
2984 In this example, only @option{-fstrict-enums} is an option meant
2985 only for C++ programs; you can use the other options with any
2986 language supported by GCC@.
2988 Some options for compiling C programs, such as @option{-std}, are also
2989 relevant for C++ programs.
2990 @xref{C Dialect Options,,Options Controlling C Dialect}.
2992 Here is a list of options that are @emph{only} for compiling C++ programs:
2994 @table @gcctabopt
2996 @opindex fabi-version
2997 @item -fabi-version=@var{n}
2998 Use version @var{n} of the C++ ABI@.  The default is version 0.
3000 Version 0 refers to the version conforming most closely to
3001 the C++ ABI specification.  Therefore, the ABI obtained using version 0
3002 will change in different versions of G++ as ABI bugs are fixed.
3004 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
3006 Version 2 is the version of the C++ ABI that first appeared in G++
3007 3.4, and was the default through G++ 4.9.
3009 Version 3 corrects an error in mangling a constant address as a
3010 template argument.
3012 Version 4, which first appeared in G++ 4.5, implements a standard
3013 mangling for vector types.
3015 Version 5, which first appeared in G++ 4.6, corrects the mangling of
3016 attribute const/volatile on function pointer types, decltype of a
3017 plain decl, and use of a function parameter in the declaration of
3018 another parameter.
3020 Version 6, which first appeared in G++ 4.7, corrects the promotion
3021 behavior of C++11 scoped enums and the mangling of template argument
3022 packs, const/static_cast, prefix ++ and --, and a class scope function
3023 used as a template argument.
3025 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
3026 builtin type and corrects the mangling of lambdas in default argument
3027 scope.
3029 Version 8, which first appeared in G++ 4.9, corrects the substitution
3030 behavior of function types with function-cv-qualifiers.
3032 Version 9, which first appeared in G++ 5.2, corrects the alignment of
3033 @code{nullptr_t}.
3035 Version 10, which first appeared in G++ 6.1, adds mangling of
3036 attributes that affect type identity, such as ia32 calling convention
3037 attributes (e.g.@: @samp{stdcall}).
3039 Version 11, which first appeared in G++ 7, corrects the mangling of
3040 sizeof... expressions and operator names.  For multiple entities with
3041 the same name within a function, that are declared in different scopes,
3042 the mangling now changes starting with the twelfth occurrence.  It also
3043 implies @option{-fnew-inheriting-ctors}.
3045 Version 12, which first appeared in G++ 8, corrects the calling
3046 conventions for empty classes on the x86_64 target and for classes
3047 with only deleted copy/move constructors.  It accidentally changes the
3048 calling convention for classes with a deleted copy constructor and a
3049 trivial move constructor.
3051 Version 13, which first appeared in G++ 8.2, fixes the accidental
3052 change in version 12.
3054 Version 14, which first appeared in G++ 10, corrects the mangling of
3055 the nullptr expression.
3057 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3058 tag regression.
3060 Version 16, which first appeared in G++ 11, changes the mangling of
3061 @code{__alignof__} to be distinct from that of @code{alignof}, and
3062 dependent operator names.
3064 Version 17, which first appeared in G++ 12, fixes layout of classes
3065 that inherit from aggregate classes with default member initializers
3066 in C++14 and up.
3068 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3069 that have additional context.
3071 Version 19, which first appeard in G++ 14, fixes manglings of structured
3072 bindings to include ABI tags.
3074 See also @option{-Wabi}.
3076 @opindex fabi-compat-version
3077 @item -fabi-compat-version=@var{n}
3078 On targets that support strong aliases, G++
3079 works around mangling changes by creating an alias with the correct
3080 mangled name when defining a symbol with an incorrect mangled name.
3081 This switch specifies which ABI version to use for the alias.
3083 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3084 compatibility).  If another ABI version is explicitly selected, this
3085 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3086 use @option{-fabi-compat-version=2}.
3088 If this option is not provided but @option{-Wabi=@var{n}} is, that
3089 version is used for compatibility aliases.  If this option is provided
3090 along with @option{-Wabi} (without the version), the version from this
3091 option is used for the warning.
3093 @opindex fno-access-control
3094 @opindex faccess-control
3095 @item -fno-access-control
3096 Turn off all access checking.  This switch is mainly useful for working
3097 around bugs in the access control code.
3099 @opindex faligned-new
3100 @item -faligned-new
3101 Enable support for C++17 @code{new} of types that require more
3102 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3103 numeric argument such as @code{-faligned-new=32} can be used to
3104 specify how much alignment (in bytes) is provided by that function,
3105 but few users will need to override the default of
3106 @code{alignof(std::max_align_t)}.
3108 This flag is enabled by default for @option{-std=c++17}.
3110 @opindex fchar8_t
3111 @opindex fno-char8_t
3112 @item -fchar8_t
3113 @itemx -fno-char8_t
3114 Enable support for @code{char8_t} as adopted for C++20.  This includes
3115 the addition of a new @code{char8_t} fundamental type, changes to the
3116 types of UTF-8 string and character literals, new signatures for
3117 user-defined literals, associated standard library updates, and new
3118 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3120 This option enables functions to be overloaded for ordinary and UTF-8
3121 strings:
3123 @smallexample
3124 int f(const char *);    // #1
3125 int f(const char8_t *); // #2
3126 int v1 = f("text");     // Calls #1
3127 int v2 = f(u8"text");   // Calls #2
3128 @end smallexample
3130 @noindent
3131 and introduces new signatures for user-defined literals:
3133 @smallexample
3134 int operator""_udl1(char8_t);
3135 int v3 = u8'x'_udl1;
3136 int operator""_udl2(const char8_t*, std::size_t);
3137 int v4 = u8"text"_udl2;
3138 template<typename T, T...> int operator""_udl3();
3139 int v5 = u8"text"_udl3;
3140 @end smallexample
3142 @noindent
3143 The change to the types of UTF-8 string and character literals introduces
3144 incompatibilities with ISO C++11 and later standards.  For example, the
3145 following code is well-formed under ISO C++11, but is ill-formed when
3146 @option{-fchar8_t} is specified.
3148 @smallexample
3149 const char *cp = u8"xx";// error: invalid conversion from
3150                         //        `const char8_t*' to `const char*'
3151 int f(const char*);
3152 auto v = f(u8"xx");     // error: invalid conversion from
3153                         //        `const char8_t*' to `const char*'
3154 std::string s@{u8"xx"@};  // error: no matching function for call to
3155                         //        `std::basic_string<char>::basic_string()'
3156 using namespace std::literals;
3157 s = u8"xx"s;            // error: conversion from
3158                         //        `basic_string<char8_t>' to non-scalar
3159                         //        type `basic_string<char>' requested
3160 @end smallexample
3162 @opindex fcheck-new
3163 @item -fcheck-new
3164 Check that the pointer returned by @code{operator new} is non-null
3165 before attempting to modify the storage allocated.  This check is
3166 normally unnecessary because the C++ standard specifies that
3167 @code{operator new} only returns @code{0} if it is declared
3168 @code{throw()}, in which case the compiler always checks the
3169 return value even without this option.  In all other cases, when
3170 @code{operator new} has a non-empty exception specification, memory
3171 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3172 @samp{new (nothrow)}.
3174 @opindex fconcepts
3175 @opindex fconcepts-ts
3176 @item -fconcepts
3177 @itemx -fconcepts-ts
3178 Enable support for the C++ Concepts feature for constraining template
3179 arguments.  With @option{-std=c++20} and above, Concepts are part of
3180 the language standard, so @option{-fconcepts} defaults to on.
3182 Some constructs that were allowed by the earlier C++ Extensions for
3183 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3184 into the standard, can additionally be enabled by
3185 @option{-fconcepts-ts}.
3187 @opindex fconstexpr-depth
3188 @item -fconstexpr-depth=@var{n}
3189 Set the maximum nested evaluation depth for C++11 constexpr functions
3190 to @var{n}.  A limit is needed to detect endless recursion during
3191 constant expression evaluation.  The minimum specified by the standard
3192 is 512.
3194 @opindex fconstexpr-cache-depth
3195 @item -fconstexpr-cache-depth=@var{n}
3196 Set the maximum level of nested evaluation depth for C++11 constexpr
3197 functions that will be cached to @var{n}.  This is a heuristic that
3198 trades off compilation speed (when the cache avoids repeated
3199 calculations) against memory consumption (when the cache grows very
3200 large from highly recursive evaluations).  The default is 8.  Very few
3201 users are likely to want to adjust it, but if your code does heavy
3202 constexpr calculations you might want to experiment to find which
3203 value works best for you.
3205 @opindex fconstexpr-fp-except
3206 @item -fconstexpr-fp-except
3207 Annex F of the C standard specifies that IEC559 floating point
3208 exceptions encountered at compile time should not stop compilation.
3209 C++ compilers have historically not followed this guidance, instead
3210 treating floating point division by zero as non-constant even though
3211 it has a well defined value.  This flag tells the compiler to give
3212 Annex F priority over other rules saying that a particular operation
3213 is undefined.
3215 @smallexample
3216 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3217 @end smallexample
3219 @opindex fconstexpr-loop-limit
3220 @item -fconstexpr-loop-limit=@var{n}
3221 Set the maximum number of iterations for a loop in C++14 constexpr functions
3222 to @var{n}.  A limit is needed to detect infinite loops during
3223 constant expression evaluation.  The default is 262144 (1<<18).
3225 @opindex fconstexpr-ops-limit
3226 @item -fconstexpr-ops-limit=@var{n}
3227 Set the maximum number of operations during a single constexpr evaluation.
3228 Even when number of iterations of a single loop is limited with the above limit,
3229 if there are several nested loops and each of them has many iterations but still
3230 smaller than the above limit, or if in a body of some loop or even outside
3231 of a loop too many expressions need to be evaluated, the resulting constexpr
3232 evaluation might take too long.
3233 The default is 33554432 (1<<25).
3235 @opindex fcontracts
3236 @item -fcontracts
3237 Enable experimental support for the C++ Contracts feature, as briefly
3238 added to and then removed from the C++20 working paper (N4820).  The
3239 implementation also includes proposed enhancements from papers P1290,
3240 P1332, and P1429.  This functionality is intended mostly for those
3241 interested in experimentation towards refining the feature to get it
3242 into shape for a future C++ standard.
3244 On violation of a checked contract, the violation handler is called.
3245 Users can replace the violation handler by defining
3246 @smallexample
3247 void
3248 handle_contract_violation (const std::experimental::contract_violation&);
3249 @end smallexample
3251 There are different sets of additional flags that can be used together
3252 to specify which contracts will be checked and how, for N4820
3253 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3254 used together.
3256 @table @gcctabopt
3257 @opindex fcontract-mode
3258 @item -fcontract-mode=[on|off]
3259 Control whether any contracts have any semantics at all.  Defaults to on.
3261 @opindex fcontract-assumption-mode
3262 @item -fcontract-assumption-mode=[on|off]
3263 [N4820] Control whether contracts with level @samp{axiom}
3264 should have the assume semantic.  Defaults to on.
3266 @opindex fcontract-build-level
3267 @item -fcontract-build-level=[off|default|audit]
3268 [N4820] Specify which level of contracts to generate checks
3269 for.  Defaults to @samp{default}.
3271 @opindex fcontract-continuation-mode
3272 @item -fcontract-continuation-mode=[on|off]
3273 [N4820] Control whether to allow the program to continue executing
3274 after a contract violation.  That is, do checked contracts have the
3275 @samp{maybe} semantic described below rather than the @samp{never}
3276 semantic.  Defaults to off.
3278 @opindex fcontract-role
3279 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3280 [P1332] Specify the concrete semantics for each contract level
3281 of a particular contract role.
3283 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3284 [P1429] Specify the concrete semantic for a particular
3285 contract level.
3287 @opindex fcontract-strict-declarations
3288 @item -fcontract-strict-declarations=[on|off]
3289 Control whether to reject adding contracts to a function after its
3290 first declaration.  Defaults to off.
3291 @end table
3293 The possible concrete semantics for that can be specified with
3294 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3296 @table @code
3297 @item ignore
3298 This contract has no effect.
3300 @item assume
3301 This contract is treated like C++23 @code{[[assume]]}.
3303 @item check_never_continue
3304 @itemx never
3305 @itemx abort
3306 This contract is checked.  If it fails, the violation handler is
3307 called.  If the handler returns, @code{std::terminate} is called.
3309 @item check_maybe_continue
3310 @itemx maybe
3311 This contract is checked.  If it fails, the violation handler is
3312 called.  If the handler returns, execution continues normally.
3313 @end table
3315 @opindex fcoroutines
3316 @item -fcoroutines
3317 Enable support for the C++ coroutines extension (experimental).
3319 @opindex fno-elide-constructors
3320 @opindex felide-constructors
3321 @item -fno-elide-constructors
3322 The C++ standard allows an implementation to omit creating a temporary
3323 that is only used to initialize another object of the same type.
3324 Specifying this option disables that optimization, and forces G++ to
3325 call the copy constructor in all cases.  This option also causes G++
3326 to call trivial member functions which otherwise would be expanded inline.
3328 In C++17, the compiler is required to omit these temporaries, but this
3329 option still affects trivial member functions.
3331 @opindex fno-enforce-eh-specs
3332 @opindex fenforce-eh-specs
3333 @item -fno-enforce-eh-specs
3334 Don't generate code to check for violation of exception specifications
3335 at run time.  This option violates the C++ standard, but may be useful
3336 for reducing code size in production builds, much like defining
3337 @code{NDEBUG}.  This does not give user code permission to throw
3338 exceptions in violation of the exception specifications; the compiler
3339 still optimizes based on the specifications, so throwing an
3340 unexpected exception results in undefined behavior at run time.
3342 @opindex fextern-tls-init
3343 @opindex fno-extern-tls-init
3344 @item -fextern-tls-init
3345 @itemx -fno-extern-tls-init
3346 The C++11 and OpenMP standards allow @code{thread_local} and
3347 @code{threadprivate} variables to have dynamic (runtime)
3348 initialization.  To support this, any use of such a variable goes
3349 through a wrapper function that performs any necessary initialization.
3350 When the use and definition of the variable are in the same
3351 translation unit, this overhead can be optimized away, but when the
3352 use is in a different translation unit there is significant overhead
3353 even if the variable doesn't actually need dynamic initialization.  If
3354 the programmer can be sure that no use of the variable in a
3355 non-defining TU needs to trigger dynamic initialization (either
3356 because the variable is statically initialized, or a use of the
3357 variable in the defining TU will be executed before any uses in
3358 another TU), they can avoid this overhead with the
3359 @option{-fno-extern-tls-init} option.
3361 On targets that support symbol aliases, the default is
3362 @option{-fextern-tls-init}.  On targets that do not support symbol
3363 aliases, the default is @option{-fno-extern-tls-init}.
3365 @opindex ffold-simple-inlines
3366 @opindex fno-fold-simple-inlines
3367 @item -ffold-simple-inlines
3368 @itemx -fno-fold-simple-inlines
3369 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3370 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3371 means no debug information will be generated for such calls.  Since these
3372 functions are rarely interesting to debug, this flag is enabled by default
3373 unless @option{-fno-inline} is active.
3375 @opindex fno-gnu-keywords
3376 @opindex fgnu-keywords
3377 @item -fno-gnu-keywords
3378 Do not recognize @code{typeof} as a keyword, so that code can use this
3379 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3380 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3381 @option{-std=c++98}, @option{-std=c++11}, etc.
3383 @opindex fimplicit-constexpr
3384 @item -fimplicit-constexpr
3385 Make inline functions implicitly constexpr, if they satisfy the
3386 requirements for a constexpr function.  This option can be used in
3387 C++14 mode or later.  This can result in initialization changing from
3388 dynamic to static and other optimizations.
3390 @opindex fno-implicit-templates
3391 @opindex fimplicit-templates
3392 @item -fno-implicit-templates
3393 Never emit code for non-inline templates that are instantiated
3394 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3395 If you use this option, you must take care to structure your code to
3396 include all the necessary explicit instantiations to avoid getting
3397 undefined symbols at link time.
3398 @xref{Template Instantiation}, for more information.
3400 @opindex fno-implicit-inline-templates
3401 @opindex fimplicit-inline-templates
3402 @item -fno-implicit-inline-templates
3403 Don't emit code for implicit instantiations of inline templates, either.
3404 The default is to handle inlines differently so that compiles with and
3405 without optimization need the same set of explicit instantiations.
3407 @opindex fno-implement-inlines
3408 @opindex fimplement-inlines
3409 @item -fno-implement-inlines
3410 To save space, do not emit out-of-line copies of inline functions
3411 controlled by @code{#pragma implementation}.  This causes linker
3412 errors if these functions are not inlined everywhere they are called.
3414 @opindex fmodules-ts
3415 @opindex fno-modules-ts
3416 @item -fmodules-ts
3417 @itemx -fno-modules-ts
3418 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3419 @option{-fno-modules-ts} is usually not needed, as that is the
3420 default.  Even though this is a C++20 feature, it is not currently
3421 implicitly enabled by selecting that standard version.
3423 @opindex fmodule-header
3424 @item -fmodule-header
3425 @itemx -fmodule-header=user
3426 @itemx -fmodule-header=system
3427 Compile a header file to create an importable header unit.
3429 @opindex fmodule-implicit-inline
3430 @item -fmodule-implicit-inline
3431 Member functions defined in their class definitions are not implicitly
3432 inline for modular code.  This is different to traditional C++
3433 behavior, for good reasons.  However, it may result in a difficulty
3434 during code porting.  This option makes such function definitions
3435 implicitly inline.  It does however generate an ABI incompatibility,
3436 so you must use it everywhere or nowhere.  (Such definitions outside
3437 of a named module remain implicitly inline, regardless.)
3439 @opindex fno-module-lazy
3440 @opindex fmodule-lazy
3441 @item -fno-module-lazy
3442 Disable lazy module importing and module mapper creation.
3444 @vindex CXX_MODULE_MAPPER @r{environment variable}
3445 @opindex fmodule-mapper
3446 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3447 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3448 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3449 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3450 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3451 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3452 An oracle to query for module name to filename mappings.  If
3453 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3454 and if that is unset, an in-process default is provided.
3456 @opindex fmodule-only
3457 @item -fmodule-only
3458 Only emit the Compiled Module Interface, inhibiting any object file.
3460 @opindex fms-extensions
3461 @item -fms-extensions
3462 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3463 int and getting a pointer to member function via non-standard syntax.
3465 @opindex fnew-inheriting-ctors
3466 @item -fnew-inheriting-ctors
3467 Enable the P0136 adjustment to the semantics of C++11 constructor
3468 inheritance.  This is part of C++17 but also considered to be a Defect
3469 Report against C++11 and C++14.  This flag is enabled by default
3470 unless @option{-fabi-version=10} or lower is specified.
3472 @opindex fnew-ttp-matching
3473 @item -fnew-ttp-matching
3474 Enable the P0522 resolution to Core issue 150, template template
3475 parameters and default arguments: this allows a template with default
3476 template arguments as an argument for a template template parameter
3477 with fewer template parameters.  This flag is enabled by default for
3478 @option{-std=c++17}.
3480 @opindex fno-nonansi-builtins
3481 @opindex fnonansi-builtins
3482 @item -fno-nonansi-builtins
3483 Disable built-in declarations of functions that are not mandated by
3484 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3485 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3487 @opindex fnothrow-opt
3488 @item -fnothrow-opt
3489 Treat a @code{throw()} exception specification as if it were a
3490 @code{noexcept} specification to reduce or eliminate the text size
3491 overhead relative to a function with no exception specification.  If
3492 the function has local variables of types with non-trivial
3493 destructors, the exception specification actually makes the
3494 function smaller because the EH cleanups for those variables can be
3495 optimized away.  The semantic effect is that an exception thrown out of
3496 a function with such an exception specification results in a call
3497 to @code{terminate} rather than @code{unexpected}.
3499 @opindex fno-operator-names
3500 @opindex foperator-names
3501 @item -fno-operator-names
3502 Do not treat the operator name keywords @code{and}, @code{bitand},
3503 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3504 synonyms as keywords.
3506 @opindex fno-optional-diags
3507 @opindex foptional-diags
3508 @item -fno-optional-diags
3509 Disable diagnostics that the standard says a compiler does not need to
3510 issue.  Currently, the only such diagnostic issued by G++ is the one for
3511 a name having multiple meanings within a class.
3513 @opindex fno-pretty-templates
3514 @opindex fpretty-templates
3515 @item -fno-pretty-templates
3516 When an error message refers to a specialization of a function
3517 template, the compiler normally prints the signature of the
3518 template followed by the template arguments and any typedefs or
3519 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3520 rather than @code{void f(int)}) so that it's clear which template is
3521 involved.  When an error message refers to a specialization of a class
3522 template, the compiler omits any template arguments that match
3523 the default template arguments for that template.  If either of these
3524 behaviors make it harder to understand the error message rather than
3525 easier, you can use @option{-fno-pretty-templates} to disable them.
3527 @opindex fno-rtti
3528 @opindex frtti
3529 @item -fno-rtti
3530 Disable generation of information about every class with virtual
3531 functions for use by the C++ run-time type identification features
3532 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3533 of the language, you can save some space by using this flag.  Note that
3534 exception handling uses the same information, but G++ generates it as
3535 needed. The @code{dynamic_cast} operator can still be used for casts that
3536 do not require run-time type information, i.e.@: casts to @code{void *} or to
3537 unambiguous base classes.
3539 Mixing code compiled with @option{-frtti} with that compiled with
3540 @option{-fno-rtti} may not work.  For example, programs may
3541 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3542 for a class compiled with @option{-frtti}.  
3544 @opindex fsized-deallocation
3545 @item -fsized-deallocation
3546 Enable the built-in global declarations
3547 @smallexample
3548 void operator delete (void *, std::size_t) noexcept;
3549 void operator delete[] (void *, std::size_t) noexcept;
3550 @end smallexample
3551 as introduced in C++14.  This is useful for user-defined replacement
3552 deallocation functions that, for example, use the size of the object
3553 to make deallocation faster.  Enabled by default under
3554 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3555 warns about places that might want to add a definition.
3557 @opindex fstrict-enums
3558 @item -fstrict-enums
3559 Allow the compiler to optimize using the assumption that a value of
3560 enumerated type can only be one of the values of the enumeration (as
3561 defined in the C++ standard; basically, a value that can be
3562 represented in the minimum number of bits needed to represent all the
3563 enumerators).  This assumption may not be valid if the program uses a
3564 cast to convert an arbitrary integer value to the enumerated type.
3565 This option has no effect for an enumeration type with a fixed underlying
3566 type.
3568 @opindex fstrong-eval-order
3569 @item -fstrong-eval-order
3570 Evaluate member access, array subscripting, and shift expressions in
3571 left-to-right order, and evaluate assignment in right-to-left order,
3572 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3573 @option{-fstrong-eval-order=some} enables just the ordering of member
3574 access and shift expressions, and is the default without
3575 @option{-std=c++17}.
3577 @opindex ftemplate-backtrace-limit
3578 @item -ftemplate-backtrace-limit=@var{n}
3579 Set the maximum number of template instantiation notes for a single
3580 warning or error to @var{n}.  The default value is 10.
3582 @opindex ftemplate-depth
3583 @item -ftemplate-depth=@var{n}
3584 Set the maximum instantiation depth for template classes to @var{n}.
3585 A limit on the template instantiation depth is needed to detect
3586 endless recursions during template class instantiation.  ANSI/ISO C++
3587 conforming programs must not rely on a maximum depth greater than 17
3588 (changed to 1024 in C++11).  The default value is 900, as the compiler
3589 can run out of stack space before hitting 1024 in some situations.
3591 @opindex fno-threadsafe-statics
3592 @opindex fthreadsafe-statics
3593 @item -fno-threadsafe-statics
3594 Do not emit the extra code to use the routines specified in the C++
3595 ABI for thread-safe initialization of local statics.  You can use this
3596 option to reduce code size slightly in code that doesn't need to be
3597 thread-safe.
3599 @opindex fuse-cxa-atexit
3600 @item -fuse-cxa-atexit
3601 Register destructors for objects with static storage duration with the
3602 @code{__cxa_atexit} function rather than the @code{atexit} function.
3603 This option is required for fully standards-compliant handling of static
3604 destructors, but only works if your C library supports
3605 @code{__cxa_atexit}.
3607 @opindex fno-use-cxa-get-exception-ptr
3608 @opindex fuse-cxa-get-exception-ptr
3609 @item -fno-use-cxa-get-exception-ptr
3610 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3611 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3612 if the runtime routine is not available.
3614 @opindex fvisibility-inlines-hidden
3615 @item -fvisibility-inlines-hidden
3616 This switch declares that the user does not attempt to compare
3617 pointers to inline functions or methods where the addresses of the two functions
3618 are taken in different shared objects.
3620 The effect of this is that GCC may, effectively, mark inline methods with
3621 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3622 appear in the export table of a DSO and do not require a PLT indirection
3623 when used within the DSO@.  Enabling this option can have a dramatic effect
3624 on load and link times of a DSO as it massively reduces the size of the
3625 dynamic export table when the library makes heavy use of templates.
3627 The behavior of this switch is not quite the same as marking the
3628 methods as hidden directly, because it does not affect static variables
3629 local to the function or cause the compiler to deduce that
3630 the function is defined in only one shared object.
3632 You may mark a method as having a visibility explicitly to negate the
3633 effect of the switch for that method.  For example, if you do want to
3634 compare pointers to a particular inline method, you might mark it as
3635 having default visibility.  Marking the enclosing class with explicit
3636 visibility has no effect.
3638 Explicitly instantiated inline methods are unaffected by this option
3639 as their linkage might otherwise cross a shared library boundary.
3640 @xref{Template Instantiation}.
3642 @opindex fvisibility-ms-compat
3643 @item -fvisibility-ms-compat
3644 This flag attempts to use visibility settings to make GCC's C++
3645 linkage model compatible with that of Microsoft Visual Studio.
3647 The flag makes these changes to GCC's linkage model:
3649 @enumerate
3650 @item
3651 It sets the default visibility to @code{hidden}, like
3652 @option{-fvisibility=hidden}.
3654 @item
3655 Types, but not their members, are not hidden by default.
3657 @item
3658 The One Definition Rule is relaxed for types without explicit
3659 visibility specifications that are defined in more than one
3660 shared object: those declarations are permitted if they are
3661 permitted when this option is not used.
3662 @end enumerate
3664 In new code it is better to use @option{-fvisibility=hidden} and
3665 export those classes that are intended to be externally visible.
3666 Unfortunately it is possible for code to rely, perhaps accidentally,
3667 on the Visual Studio behavior.
3669 Among the consequences of these changes are that static data members
3670 of the same type with the same name but defined in different shared
3671 objects are different, so changing one does not change the other;
3672 and that pointers to function members defined in different shared
3673 objects may not compare equal.  When this flag is given, it is a
3674 violation of the ODR to define types with the same name differently.
3676 @opindex fno-weak
3677 @opindex fweak
3678 @item -fno-weak
3679 Do not use weak symbol support, even if it is provided by the linker.
3680 By default, G++ uses weak symbols if they are available.  This
3681 option exists only for testing, and should not be used by end-users;
3682 it results in inferior code and has no benefits.  This option may
3683 be removed in a future release of G++.
3685 @opindex fext-numeric-literals
3686 @opindex fno-ext-numeric-literals
3687 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3688 Accept imaginary, fixed-point, or machine-defined
3689 literal number suffixes as GNU extensions.
3690 When this option is turned off these suffixes are treated
3691 as C++11 user-defined literal numeric suffixes.
3692 This is on by default for all pre-C++11 dialects and all GNU dialects:
3693 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3694 @option{-std=gnu++14}.
3695 This option is off by default
3696 for ISO C++11 onwards (@option{-std=c++11}, ...).
3698 @opindex nostdinc++
3699 @item -nostdinc++
3700 Do not search for header files in the standard directories specific to
3701 C++, but do still search the other standard directories.  (This option
3702 is used when building the C++ library.)
3704 @opindex flang-info-include-translate
3705 @opindex flang-info-include-translate-not
3706 @item -flang-info-include-translate
3707 @itemx -flang-info-include-translate-not
3708 @itemx -flang-info-include-translate=@var{header}
3709 Inform of include translation events.  The first will note accepted
3710 include translations, the second will note declined include
3711 translations.  The @var{header} form will inform of include
3712 translations relating to that specific header.  If @var{header} is of
3713 the form @code{"user"} or @code{<system>} it will be resolved to a
3714 specific user or system header using the include path.
3716 @opindex flang-info-module-cmi
3717 @item -flang-info-module-cmi
3718 @itemx -flang-info-module-cmi=@var{module}
3719 Inform of Compiled Module Interface pathnames.  The first will note
3720 all read CMI pathnames.  The @var{module} form will not reading a
3721 specific module's CMI.  @var{module} may be a named module or a
3722 header-unit (the latter indicated by either being a pathname containing
3723 directory separators or enclosed in @code{<>} or @code{""}).
3725 @opindex stdlib
3726 @item -stdlib=@var{libstdc++,libc++}
3727 When G++ is configured to support this option, it allows specification of
3728 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3729 (the default, native C++ runtime for G++) and @var{libc++} which is the
3730 C++ runtime installed on some operating systems (e.g. Darwin versions from
3731 Darwin11 onwards).  The option switches G++ to use the headers from the
3732 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3733 when a C++ runtime is required for linking.
3734 @end table
3736 In addition, these warning options have meanings only for C++ programs:
3738 @table @gcctabopt
3739 @opindex Wabi-tag
3740 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3741 Warn when a type with an ABI tag is used in a context that does not
3742 have that ABI tag.  See @ref{C++ Attributes} for more information
3743 about ABI tags.
3745 @opindex Wcomma-subscript
3746 @opindex Wno-comma-subscript
3747 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3748 Warn about uses of a comma expression within a subscripting expression.
3749 This usage was deprecated in C++20 and is going to be removed in C++23.
3750 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3752 @smallexample
3753 @group
3754 void f(int *a, int b, int c) @{
3755     a[b,c];     // deprecated in C++20, invalid in C++23
3756     a[(b,c)];   // OK
3758 @end group
3759 @end smallexample
3761 In C++23 it is valid to have comma separated expressions in a subscript
3762 when an overloaded subscript operator is found and supports the right
3763 number and types of arguments.  G++ will accept the formerly valid syntax
3764 for code that is not valid in C++23 but used to be valid but deprecated
3765 in C++20 with a pedantic warning that can be disabled with
3766 @option{-Wno-comma-subscript}.
3768 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3769 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3771 This warning is upgraded to an error by @option{-pedantic-errors} in
3772 C++23 mode or later.
3774 @opindex Wctad-maybe-unsupported
3775 @opindex Wno-ctad-maybe-unsupported
3776 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3777 Warn when performing class template argument deduction (CTAD) on a type with
3778 no explicitly written deduction guides.  This warning will point out cases
3779 where CTAD succeeded only because the compiler synthesized the implicit
3780 deduction guides, which might not be what the programmer intended.  Certain
3781 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3782 types that are designed to support CTAD.  This warning can be suppressed with
3783 the following pattern:
3785 @smallexample
3786 struct allow_ctad_t; // any name works
3787 template <typename T> struct S @{
3788   S(T) @{ @}
3790 // Guide with incomplete parameter type will never be considered.
3791 S(allow_ctad_t) -> S<void>;
3792 @end smallexample
3794 @opindex Wctor-dtor-privacy
3795 @opindex Wno-ctor-dtor-privacy
3796 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3797 Warn when a class seems unusable because all the constructors or
3798 destructors in that class are private, and it has neither friends nor
3799 public static member functions.  Also warn if there are no non-private
3800 methods, and there's at least one private member function that isn't
3801 a constructor or destructor.
3803 @opindex Wdangling-reference
3804 @opindex Wno-dangling-reference
3805 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3806 Warn when a reference is bound to a temporary whose lifetime has ended.
3807 For example:
3809 @smallexample
3810 int n = 1;
3811 const int& r = std::max(n - 1, n + 1); // r is dangling
3812 @end smallexample
3814 In the example above, two temporaries are created, one for each
3815 argument, and a reference to one of the temporaries is returned.
3816 However, both temporaries are destroyed at the end of the full
3817 expression, so the reference @code{r} is dangling.  This warning
3818 also detects dangling references in member initializer lists:
3820 @smallexample
3821 const int& f(const int& i) @{ return i; @}
3822 struct S @{
3823   const int &r; // r is dangling
3824   S() : r(f(10)) @{ @}
3826 @end smallexample
3828 Member functions are checked as well, but only their object argument:
3830 @smallexample
3831 struct S @{
3832    const S& self () @{ return *this; @}
3834 const S& s = S().self(); // s is dangling
3835 @end smallexample
3837 Certain functions are safe in this respect, for example @code{std::use_facet}:
3838 they take and return a reference, but they don't return one of its arguments,
3839 which can fool the warning.  Such functions can be excluded from the warning
3840 by wrapping them in a @code{#pragma}:
3842 @smallexample
3843 #pragma GCC diagnostic push
3844 #pragma GCC diagnostic ignored "-Wdangling-reference"
3845 const T& foo (const T&) @{ @dots{} @}
3846 #pragma GCC diagnostic pop
3847 @end smallexample
3849 @option{-Wdangling-reference} also warns about code like
3851 @smallexample
3852 auto p = std::minmax(1, 2);
3853 @end smallexample
3855 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3856 both references dangle after the end of the full expression that contains
3857 the call to @code{std::minmax}.
3859 This warning is enabled by @option{-Wall}.
3861 @opindex Wdelete-non-virtual-dtor
3862 @opindex Wno-delete-non-virtual-dtor
3863 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3864 Warn when @code{delete} is used to destroy an instance of a class that
3865 has virtual functions and non-virtual destructor. It is unsafe to delete
3866 an instance of a derived class through a pointer to a base class if the
3867 base class does not have a virtual destructor.  This warning is enabled
3868 by @option{-Wall}.
3870 @opindex Wdeprecated-copy
3871 @opindex Wno-deprecated-copy
3872 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3873 Warn that the implicit declaration of a copy constructor or copy
3874 assignment operator is deprecated if the class has a user-provided
3875 copy constructor or copy assignment operator, in C++11 and up.  This
3876 warning is enabled by @option{-Wextra}.  With
3877 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3878 user-provided destructor.
3880 @opindex Wdeprecated-enum-enum-conversion
3881 @opindex Wno-deprecated-enum-enum-conversion
3882 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3883 Disable the warning about the case when the usual arithmetic conversions
3884 are applied on operands where one is of enumeration type and the other is
3885 of a different enumeration type.  This conversion was deprecated in C++20.
3886 For example:
3888 @smallexample
3889 enum E1 @{ e @};
3890 enum E2 @{ f @};
3891 int k = f - e;
3892 @end smallexample
3894 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3895 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3896 by @option{-Wenum-conversion}.
3898 @opindex Wdeprecated-enum-float-conversion
3899 @opindex Wno-deprecated-enum-float-conversion
3900 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3901 Disable the warning about the case when the usual arithmetic conversions
3902 are applied on operands where one is of enumeration type and the other is
3903 of a floating-point type.  This conversion was deprecated in C++20.  For
3904 example:
3906 @smallexample
3907 enum E1 @{ e @};
3908 enum E2 @{ f @};
3909 bool b = e <= 3.7;
3910 @end smallexample
3912 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3913 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3914 by @option{-Wenum-conversion}.
3916 @opindex Welaborated-enum-base
3917 @opindex Wno-elaborated-enum-base
3918 @item -Wno-elaborated-enum-base
3919 For C++11 and above, warn if an (invalid) additional enum-base is used
3920 in an elaborated-type-specifier.  That is, if an enum with given
3921 underlying type and no enumerator list is used in a declaration other
3922 than just a standalone declaration of the enum.  Enabled by default.  This
3923 warning is upgraded to an error with -pedantic-errors.
3925 @opindex Winit-list-lifetime
3926 @opindex Wno-init-list-lifetime
3927 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3928 Do not warn about uses of @code{std::initializer_list} that are likely
3929 to result in dangling pointers.  Since the underlying array for an
3930 @code{initializer_list} is handled like a normal C++ temporary object,
3931 it is easy to inadvertently keep a pointer to the array past the end
3932 of the array's lifetime.  For example:
3934 @itemize @bullet
3935 @item
3936 If a function returns a temporary @code{initializer_list}, or a local
3937 @code{initializer_list} variable, the array's lifetime ends at the end
3938 of the return statement, so the value returned has a dangling pointer.
3940 @item
3941 If a new-expression creates an @code{initializer_list}, the array only
3942 lives until the end of the enclosing full-expression, so the
3943 @code{initializer_list} in the heap has a dangling pointer.
3945 @item
3946 When an @code{initializer_list} variable is assigned from a
3947 brace-enclosed initializer list, the temporary array created for the
3948 right side of the assignment only lives until the end of the
3949 full-expression, so at the next statement the @code{initializer_list}
3950 variable has a dangling pointer.
3952 @smallexample
3953 // li's initial underlying array lives as long as li
3954 std::initializer_list<int> li = @{ 1,2,3 @};
3955 // assignment changes li to point to a temporary array
3956 li = @{ 4, 5 @};
3957 // now the temporary is gone and li has a dangling pointer
3958 int i = li.begin()[0] // undefined behavior
3959 @end smallexample
3961 @item
3962 When a list constructor stores the @code{begin} pointer from the
3963 @code{initializer_list} argument, this doesn't extend the lifetime of
3964 the array, so if a class variable is constructed from a temporary
3965 @code{initializer_list}, the pointer is left dangling by the end of
3966 the variable declaration statement.
3968 @end itemize
3970 @opindex Winvalid-constexpr
3971 @opindex Wno-invalid-constexpr
3972 @item -Winvalid-constexpr
3974 Warn when a function never produces a constant expression.  In C++20
3975 and earlier, for every @code{constexpr} function and function template,
3976 there must be at least one set of function arguments in at least one
3977 instantiation such that an invocation of the function or constructor
3978 could be an evaluated subexpression of a core constant expression.
3979 C++23 removed this restriction, so it's possible to have a function
3980 or a function template marked @code{constexpr} for which no invocation
3981 satisfies the requirements of a core constant expression.
3983 This warning is enabled as a pedantic warning by default in C++20 and
3984 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
3985 which case it will be an ordinary warning.  For example:
3987 @smallexample
3988 void f (int& i);
3989 constexpr void
3990 g (int& i)
3992   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3993   f(i);
3995 @end smallexample
3997 @opindex Winvalid-imported-macros
3998 @opindex Wno-invalid-imported-macros
3999 @item -Winvalid-imported-macros
4000 Verify all imported macro definitions are valid at the end of
4001 compilation.  This is not enabled by default, as it requires
4002 additional processing to determine.  It may be useful when preparing
4003 sets of header-units to ensure consistent macros.
4005 @opindex Wliteral-suffix
4006 @opindex Wno-literal-suffix
4007 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
4008 Do not warn when a string or character literal is followed by a
4009 ud-suffix which does not begin with an underscore.  As a conforming
4010 extension, GCC treats such suffixes as separate preprocessing tokens
4011 in order to maintain backwards compatibility with code that uses
4012 formatting macros from @code{<inttypes.h>}.  For example:
4014 @smallexample
4015 #define __STDC_FORMAT_MACROS
4016 #include <inttypes.h>
4017 #include <stdio.h>
4019 int main() @{
4020   int64_t i64 = 123;
4021   printf("My int64: %" PRId64"\n", i64);
4023 @end smallexample
4025 In this case, @code{PRId64} is treated as a separate preprocessing token.
4027 This option also controls warnings when a user-defined literal
4028 operator is declared with a literal suffix identifier that doesn't
4029 begin with an underscore. Literal suffix identifiers that don't begin
4030 with an underscore are reserved for future standardization.
4032 These warnings are enabled by default.
4034 @opindex Wnarrowing
4035 @opindex Wno-narrowing
4036 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
4037 For C++11 and later standards, narrowing conversions are diagnosed by default,
4038 as required by the standard.  A narrowing conversion from a constant produces
4039 an error, and a narrowing conversion from a non-constant produces a warning,
4040 but @option{-Wno-narrowing} suppresses the diagnostic.
4041 Note that this does not affect the meaning of well-formed code;
4042 narrowing conversions are still considered ill-formed in SFINAE contexts.
4044 With @option{-Wnarrowing} in C++98, warn when a narrowing
4045 conversion prohibited by C++11 occurs within
4046 @samp{@{ @}}, e.g.
4048 @smallexample
4049 int i = @{ 2.2 @}; // error: narrowing from double to int
4050 @end smallexample
4052 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4054 @opindex Wnoexcept
4055 @opindex Wno-noexcept
4056 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4057 Warn when a noexcept-expression evaluates to false because of a call
4058 to a function that does not have a non-throwing exception
4059 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4060 the compiler to never throw an exception.
4062 @opindex Wnoexcept-type
4063 @opindex Wno-noexcept-type
4064 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4065 Warn if the C++17 feature making @code{noexcept} part of a function
4066 type changes the mangled name of a symbol relative to C++14.  Enabled
4067 by @option{-Wabi} and @option{-Wc++17-compat}.
4069 As an example:
4071 @smallexample
4072 template <class T> void f(T t) @{ t(); @};
4073 void g() noexcept;
4074 void h() @{ f(g); @} 
4075 @end smallexample
4077 @noindent
4078 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4079 C++17 it calls @code{f<void(*)()noexcept>}.
4081 @opindex Wclass-memaccess
4082 @opindex Wno-class-memaccess
4083 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4084 Warn when the destination of a call to a raw memory function such as
4085 @code{memset} or @code{memcpy} is an object of class type, and when writing
4086 into such an object might bypass the class non-trivial or deleted constructor
4087 or copy assignment, violate const-correctness or encapsulation, or corrupt
4088 virtual table pointers.  Modifying the representation of such objects may
4089 violate invariants maintained by member functions of the class.  For example,
4090 the call to @code{memset} below is undefined because it modifies a non-trivial
4091 class object and is, therefore, diagnosed.  The safe way to either initialize
4092 or clear the storage of objects of such types is by using the appropriate
4093 constructor or assignment operator, if one is available.
4094 @smallexample
4095 std::string str = "abc";
4096 memset (&str, 0, sizeof str);
4097 @end smallexample
4098 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4099 Explicitly casting the pointer to the class object to @code{void *} or
4100 to a type that can be safely accessed by the raw memory function suppresses
4101 the warning.
4103 @opindex Wnon-virtual-dtor
4104 @opindex Wno-non-virtual-dtor
4105 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4106 Warn when a class has virtual functions and an accessible non-virtual
4107 destructor itself or in an accessible polymorphic base class, in which
4108 case it is possible but unsafe to delete an instance of a derived
4109 class through a pointer to the class itself or base class.  This
4110 warning is automatically enabled if @option{-Weffc++} is specified.
4111 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4112 should be preferred because it warns about the unsafe cases without false
4113 positives.
4115 @opindex Wregister
4116 @opindex Wno-register
4117 @item -Wregister @r{(C++ and Objective-C++ only)}
4118 Warn on uses of the @code{register} storage class specifier, except
4119 when it is part of the GNU @ref{Explicit Register Variables} extension.
4120 The use of the @code{register} keyword as storage class specifier has
4121 been deprecated in C++11 and removed in C++17.
4122 Enabled by default with @option{-std=c++17}.
4124 @opindex Wreorder
4125 @opindex Wno-reorder
4126 @cindex reordering, warning
4127 @cindex warning for reordering of member initializers
4128 @item -Wreorder @r{(C++ and Objective-C++ only)}
4129 Warn when the order of member initializers given in the code does not
4130 match the order in which they must be executed.  For instance:
4132 @smallexample
4133 struct A @{
4134   int i;
4135   int j;
4136   A(): j (0), i (1) @{ @}
4138 @end smallexample
4140 @noindent
4141 The compiler rearranges the member initializers for @code{i}
4142 and @code{j} to match the declaration order of the members, emitting
4143 a warning to that effect.  This warning is enabled by @option{-Wall}.
4145 @opindex Wpessimizing-move
4146 @opindex Wno-pessimizing-move
4147 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4148 This warning warns when a call to @code{std::move} prevents copy
4149 elision.  A typical scenario when copy elision can occur is when returning in
4150 a function with a class return type, when the expression being returned is the
4151 name of a non-volatile automatic object, and is not a function parameter, and
4152 has the same type as the function return type.
4154 @smallexample
4155 struct T @{
4156 @dots{}
4158 T fn()
4160   T t;
4161   @dots{}
4162   return std::move (t);
4164 @end smallexample
4166 But in this example, the @code{std::move} call prevents copy elision.
4168 This warning is enabled by @option{-Wall}.
4170 @opindex Wredundant-move
4171 @opindex Wno-redundant-move
4172 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4173 This warning warns about redundant calls to @code{std::move}; that is, when
4174 a move operation would have been performed even without the @code{std::move}
4175 call.  This happens because the compiler is forced to treat the object as if
4176 it were an rvalue in certain situations such as returning a local variable,
4177 where copy elision isn't applicable.  Consider:
4179 @smallexample
4180 struct T @{
4181 @dots{}
4183 T fn(T t)
4185   @dots{}
4186   return std::move (t);
4188 @end smallexample
4190 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4191 Issue 1579, another example is:
4193 @smallexample
4194 struct T @{ // convertible to U
4195 @dots{}
4197 struct U @{
4198 @dots{}
4200 U fn()
4202   T t;
4203   @dots{}
4204   return std::move (t);
4206 @end smallexample
4207 In this example, copy elision isn't applicable because the type of the
4208 expression being returned and the function return type differ, yet G++
4209 treats the return value as if it were designated by an rvalue.
4211 This warning is enabled by @option{-Wextra}.
4213 @opindex Wrange-loop-construct
4214 @opindex Wno-range-loop-construct
4215 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4216 This warning warns when a C++ range-based for-loop is creating an unnecessary
4217 copy.  This can happen when the range declaration is not a reference, but
4218 probably should be.  For example:
4220 @smallexample
4221 struct S @{ char arr[128]; @};
4222 void fn () @{
4223   S arr[5];
4224   for (const auto x : arr) @{ @dots{} @}
4226 @end smallexample
4228 It does not warn when the type being copied is a trivially-copyable type whose
4229 size is less than 64 bytes.
4231 This warning also warns when a loop variable in a range-based for-loop is
4232 initialized with a value of a different type resulting in a copy.  For example:
4234 @smallexample
4235 void fn() @{
4236   int arr[10];
4237   for (const double &x : arr) @{ @dots{} @}
4239 @end smallexample
4241 In the example above, in every iteration of the loop a temporary value of
4242 type @code{double} is created and destroyed, to which the reference
4243 @code{const double &} is bound.
4245 This warning is enabled by @option{-Wall}.
4247 @opindex Wredundant-tags
4248 @opindex Wno-redundant-tags
4249 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4250 Warn about redundant class-key and enum-key in references to class types
4251 and enumerated types in contexts where the key can be eliminated without
4252 causing an ambiguity.  For example:
4254 @smallexample
4255 struct foo;
4256 struct foo *p;   // warn that keyword struct can be eliminated
4257 @end smallexample
4259 @noindent
4260 On the other hand, in this example there is no warning:
4262 @smallexample
4263 struct foo;
4264 void foo ();   // "hides" struct foo
4265 void bar (struct foo&);  // no warning, keyword struct is necessary
4266 @end smallexample
4268 @opindex Wsubobject-linkage
4269 @opindex Wno-subobject-linkage
4270 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4271 Do not warn
4272 if a class type has a base or a field whose type uses the anonymous
4273 namespace or depends on a type with no linkage.  If a type A depends on
4274 a type B with no or internal linkage, defining it in multiple
4275 translation units would be an ODR violation because the meaning of B
4276 is different in each translation unit.  If A only appears in a single
4277 translation unit, the best way to silence the warning is to give it
4278 internal linkage by putting it in an anonymous namespace as well.  The
4279 compiler doesn't give this warning for types defined in the main .C
4280 file, as those are unlikely to have multiple definitions.
4281 @option{-Wsubobject-linkage} is enabled by default.
4283 @opindex Weffc++
4284 @opindex Wno-effc++
4285 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4286 Warn about violations of the following style guidelines from Scott Meyers'
4287 @cite{Effective C++} series of books:
4289 @itemize @bullet
4290 @item
4291 Define a copy constructor and an assignment operator for classes
4292 with dynamically-allocated memory.
4294 @item
4295 Prefer initialization to assignment in constructors.
4297 @item
4298 Have @code{operator=} return a reference to @code{*this}.
4300 @item
4301 Don't try to return a reference when you must return an object.
4303 @item
4304 Distinguish between prefix and postfix forms of increment and
4305 decrement operators.
4307 @item
4308 Never overload @code{&&}, @code{||}, or @code{,}.
4310 @end itemize
4312 This option also enables @option{-Wnon-virtual-dtor}, which is also
4313 one of the effective C++ recommendations.  However, the check is
4314 extended to warn about the lack of virtual destructor in accessible
4315 non-polymorphic bases classes too.
4317 When selecting this option, be aware that the standard library
4318 headers do not obey all of these guidelines; use @samp{grep -v}
4319 to filter out those warnings.
4321 @opindex Wexceptions
4322 @opindex Wno-exceptions
4323 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4324 Disable the warning about the case when an exception handler is shadowed by
4325 another handler, which can point out a wrong ordering of exception handlers.
4327 @opindex Wstrict-null-sentinel
4328 @opindex Wno-strict-null-sentinel
4329 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4330 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4331 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4332 to @code{__null}.  Although it is a null pointer constant rather than a
4333 null pointer, it is guaranteed to be of the same size as a pointer.
4334 But this use is not portable across different compilers.
4336 @opindex Wno-non-template-friend
4337 @opindex Wnon-template-friend
4338 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4339 Disable warnings when non-template friend functions are declared
4340 within a template.  In very old versions of GCC that predate implementation
4341 of the ISO standard, declarations such as 
4342 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4343 could be interpreted as a particular specialization of a template
4344 function; the warning exists to diagnose compatibility problems, 
4345 and is enabled by default.
4347 @opindex Wold-style-cast
4348 @opindex Wno-old-style-cast
4349 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4350 Warn if an old-style (C-style) cast to a non-void type is used within
4351 a C++ program.  The new-style casts (@code{dynamic_cast},
4352 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4353 less vulnerable to unintended effects and much easier to search for.
4355 @opindex Woverloaded-virtual
4356 @opindex Wno-overloaded-virtual
4357 @cindex overloaded virtual function, warning
4358 @cindex warning for overloaded virtual function
4359 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4360 @itemx -Woverloaded-virtual=@var{n}
4361 Warn when a function declaration hides virtual functions from a
4362 base class.  For example, in:
4364 @smallexample
4365 struct A @{
4366   virtual void f();
4369 struct B: public A @{
4370   void f(int); // does not override
4372 @end smallexample
4374 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4375 like:
4377 @smallexample
4378 B* b;
4379 b->f();
4380 @end smallexample
4382 @noindent
4383 fails to compile.
4385 In cases where the different signatures are not an accident, the
4386 simplest solution is to add a using-declaration to the derived class
4387 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4389 The optional level suffix controls the behavior when all the
4390 declarations in the derived class override virtual functions in the
4391 base class, even if not all of the base functions are overridden:
4393 @smallexample
4394 struct C @{
4395   virtual void f();
4396   virtual void f(int);
4399 struct D: public C @{
4400   void f(int); // does override
4402 @end smallexample
4404 This pattern is less likely to be a mistake; if D is only used
4405 virtually, the user might have decided that the base class semantics
4406 for some of the overloads are fine.
4408 At level 1, this case does not warn; at level 2, it does.
4409 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4410 included in @option{-Wall}.
4412 @opindex Wno-pmf-conversions
4413 @opindex Wpmf-conversions
4414 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4415 Disable the diagnostic for converting a bound pointer to member function
4416 to a plain pointer.
4418 @opindex Wsign-promo
4419 @opindex Wno-sign-promo
4420 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4421 Warn when overload resolution chooses a promotion from unsigned or
4422 enumerated type to a signed type, over a conversion to an unsigned type of
4423 the same size.  Previous versions of G++ tried to preserve
4424 unsignedness, but the standard mandates the current behavior.
4426 @opindex Wtemplates
4427 @opindex Wno-templates
4428 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4429 Warn when a primary template declaration is encountered.  Some coding
4430 rules disallow templates, and this may be used to enforce that rule.
4431 The warning is inactive inside a system header file, such as the STL, so
4432 one can still use the STL.  One may also instantiate or specialize
4433 templates.
4435 @opindex Wmismatched-new-delete
4436 @opindex Wno-mismatched-new-delete
4437 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4438 Warn for mismatches between calls to @code{operator new} or @code{operator
4439 delete} and the corresponding call to the allocation or deallocation function.
4440 This includes invocations of C++ @code{operator delete} with pointers
4441 returned from either mismatched forms of @code{operator new}, or from other
4442 functions that allocate objects for which the @code{operator delete} isn't
4443 a suitable deallocator, as well as calls to other deallocation functions
4444 with pointers returned from @code{operator new} for which the deallocation
4445 function isn't suitable.
4447 For example, the @code{delete} expression in the function below is diagnosed
4448 because it doesn't match the array form of the @code{new} expression
4449 the pointer argument was returned from.  Similarly, the call to @code{free}
4450 is also diagnosed.
4452 @smallexample
4453 void f ()
4455   int *a = new int[n];
4456   delete a;   // warning: mismatch in array forms of expressions
4458   char *p = new char[n];
4459   free (p);   // warning: mismatch between new and free
4461 @end smallexample
4463 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4464 involving allocation and deallocation functions other than @code{operator
4465 new} and @code{operator delete}.
4467 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4469 @opindex Wmismatched-tags
4470 @opindex Wno-mismatched-tags
4471 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4472 Warn for declarations of structs, classes, and class templates and their
4473 specializations with a class-key that does not match either the definition
4474 or the first declaration if no definition is provided.
4476 For example, the declaration of @code{struct Object} in the argument list
4477 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4478 class-key @code{struct} or replace it with @code{class} to match its definition.
4479 @smallexample
4480 class Object @{
4481 public:
4482   virtual ~Object () = 0;
4484 void draw (struct Object*);
4485 @end smallexample
4487 It is not wrong to declare a class with the class-key @code{struct} as
4488 the example above shows.  The @option{-Wmismatched-tags} option is intended
4489 to help achieve a consistent style of class declarations.  In code that is
4490 intended to be portable to Windows-based compilers the warning helps prevent
4491 unresolved references due to the difference in the mangling of symbols
4492 declared with different class-keys.  The option can be used either on its
4493 own or in conjunction with @option{-Wredundant-tags}.
4495 @opindex Wmultiple-inheritance
4496 @opindex Wno-multiple-inheritance
4497 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4498 Warn when a class is defined with multiple direct base classes.  Some
4499 coding rules disallow multiple inheritance, and this may be used to
4500 enforce that rule.  The warning is inactive inside a system header file,
4501 such as the STL, so one can still use the STL.  One may also define
4502 classes that indirectly use multiple inheritance.
4504 @opindex Wvirtual-inheritance
4505 @opindex Wno-virtual-inheritance
4506 @item -Wvirtual-inheritance
4507 Warn when a class is defined with a virtual direct base class.  Some
4508 coding rules disallow multiple inheritance, and this may be used to
4509 enforce that rule.  The warning is inactive inside a system header file,
4510 such as the STL, so one can still use the STL.  One may also define
4511 classes that indirectly use virtual inheritance.
4513 @opindex Wvirtual-move-assign
4514 @opindex Wno-virtual-move-assign
4515 @item -Wno-virtual-move-assign
4516 Suppress warnings about inheriting from a virtual base with a
4517 non-trivial C++11 move assignment operator.  This is dangerous because
4518 if the virtual base is reachable along more than one path, it is
4519 moved multiple times, which can mean both objects end up in the
4520 moved-from state.  If the move assignment operator is written to avoid
4521 moving from a moved-from object, this warning can be disabled.
4523 @opindex Wnamespaces
4524 @opindex Wno-namespaces
4525 @item -Wnamespaces
4526 Warn when a namespace definition is opened.  Some coding rules disallow
4527 namespaces, and this may be used to enforce that rule.  The warning is
4528 inactive inside a system header file, such as the STL, so one can still
4529 use the STL.  One may also use using directives and qualified names.
4531 @opindex Wterminate
4532 @opindex Wno-terminate
4533 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4534 Disable the warning about a throw-expression that will immediately
4535 result in a call to @code{terminate}.
4537 @opindex Wvexing-parse
4538 @opindex Wno-vexing-parse
4539 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4540 Warn about the most vexing parse syntactic ambiguity.  This warns about
4541 the cases when a declaration looks like a variable definition, but the
4542 C++ language requires it to be interpreted as a function declaration.
4543 For instance:
4545 @smallexample
4546 void f(double a) @{
4547   int i();        // extern int i (void);
4548   int n(int(a));  // extern int n (int);
4550 @end smallexample
4552 Another example:
4554 @smallexample
4555 struct S @{ S(int); @};
4556 void f(double a) @{
4557   S x(int(a));   // extern struct S x (int);
4558   S y(int());    // extern struct S y (int (*) (void));
4559   S z();         // extern struct S z (void);
4561 @end smallexample
4563 The warning will suggest options how to deal with such an ambiguity; e.g.,
4564 it can suggest removing the parentheses or using braces instead.
4566 This warning is enabled by default.
4568 @opindex Wno-class-conversion
4569 @opindex Wclass-conversion
4570 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4571 Do not warn when a conversion function converts an
4572 object to the same type, to a base class of that type, or to void; such
4573 a conversion function will never be called.
4575 @opindex Wvolatile
4576 @opindex Wno-volatile
4577 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4578 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4579 postfix and prefix @code{++} and @code{--} expressions of
4580 @code{volatile}-qualified types, using simple assignments where the left
4581 operand is a @code{volatile}-qualified non-class type for their value,
4582 compound assignments where the left operand is a @code{volatile}-qualified
4583 non-class type, @code{volatile}-qualified function return type,
4584 @code{volatile}-qualified parameter type, and structured bindings of a
4585 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4587 Enabled by default with @option{-std=c++20}.
4589 @opindex Wzero-as-null-pointer-constant
4590 @opindex Wno-zero-as-null-pointer-constant
4591 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4592 Warn when a literal @samp{0} is used as null pointer constant.  This can
4593 be useful to facilitate the conversion to @code{nullptr} in C++11.
4595 @opindex Waligned-new
4596 @opindex Wno-aligned-new
4597 @item -Waligned-new
4598 Warn about a new-expression of a type that requires greater alignment
4599 than the @code{alignof(std::max_align_t)} but uses an allocation
4600 function without an explicit alignment parameter. This option is
4601 enabled by @option{-Wall}.
4603 Normally this only warns about global allocation functions, but
4604 @option{-Waligned-new=all} also warns about class member allocation
4605 functions.
4607 @opindex Wplacement-new
4608 @opindex Wno-placement-new
4609 @item -Wno-placement-new
4610 @itemx -Wplacement-new=@var{n}
4611 Warn about placement new expressions with undefined behavior, such as
4612 constructing an object in a buffer that is smaller than the type of
4613 the object.  For example, the placement new expression below is diagnosed
4614 because it attempts to construct an array of 64 integers in a buffer only
4615 64 bytes large.
4616 @smallexample
4617 char buf [64];
4618 new (buf) int[64];
4619 @end smallexample
4620 This warning is enabled by default.
4622 @table @gcctabopt
4623 @item -Wplacement-new=1
4624 This is the default warning level of @option{-Wplacement-new}.  At this
4625 level the warning is not issued for some strictly undefined constructs that
4626 GCC allows as extensions for compatibility with legacy code.  For example,
4627 the following @code{new} expression is not diagnosed at this level even
4628 though it has undefined behavior according to the C++ standard because
4629 it writes past the end of the one-element array.
4630 @smallexample
4631 struct S @{ int n, a[1]; @};
4632 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4633 new (s->a)int [32]();
4634 @end smallexample
4636 @item -Wplacement-new=2
4637 At this level, in addition to diagnosing all the same constructs as at level
4638 1, a diagnostic is also issued for placement new expressions that construct
4639 an object in the last member of structure whose type is an array of a single
4640 element and whose size is less than the size of the object being constructed.
4641 While the previous example would be diagnosed, the following construct makes
4642 use of the flexible member array extension to avoid the warning at level 2.
4643 @smallexample
4644 struct S @{ int n, a[]; @};
4645 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4646 new (s->a)int [32]();
4647 @end smallexample
4649 @end table
4651 @opindex Wcatch-value
4652 @opindex Wno-catch-value
4653 @item -Wcatch-value
4654 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4655 Warn about catch handlers that do not catch via reference.
4656 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4657 warn about polymorphic class types that are caught by value.
4658 With @option{-Wcatch-value=2} warn about all class types that are caught
4659 by value. With @option{-Wcatch-value=3} warn about all types that are
4660 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4662 @opindex Wconditionally-supported
4663 @opindex Wno-conditionally-supported
4664 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4665 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4667 @opindex Wdelete-incomplete
4668 @opindex Wno-delete-incomplete
4669 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4670 Do not warn when deleting a pointer to incomplete type, which may cause
4671 undefined behavior at runtime.  This warning is enabled by default.
4673 @opindex Wextra-semi
4674 @opindex Wno-extra-semi
4675 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4676 Warn about redundant semicolons after in-class function definitions.
4678 @opindex Winaccessible-base
4679 @opindex Wno-inaccessible-base
4680 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4681 This option controls warnings
4682 when a base class is inaccessible in a class derived from it due to
4683 ambiguity.  The warning is enabled by default.
4684 Note that the warning for ambiguous virtual
4685 bases is enabled by the @option{-Wextra} option.
4686 @smallexample
4687 @group
4688 struct A @{ int a; @};
4690 struct B : A @{ @};
4692 struct C : B, A @{ @};
4693 @end group
4694 @end smallexample
4696 @opindex Winherited-variadic-ctor
4697 @opindex Wno-inherited-variadic-ctor
4698 @item -Wno-inherited-variadic-ctor
4699 Suppress warnings about use of C++11 inheriting constructors when the
4700 base class inherited from has a C variadic constructor; the warning is
4701 on by default because the ellipsis is not inherited.
4703 @opindex Wno-invalid-offsetof
4704 @opindex Winvalid-offsetof
4705 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4706 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4707 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4708 to a non-standard-layout type is undefined.  In existing C++ implementations,
4709 however, @code{offsetof} typically gives meaningful results.
4710 This flag is for users who are aware that they are
4711 writing nonportable code and who have deliberately chosen to ignore the
4712 warning about it.
4714 The restrictions on @code{offsetof} may be relaxed in a future version
4715 of the C++ standard.
4717 @opindex Wsized-deallocation
4718 @opindex Wno-sized-deallocation
4719 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4720 Warn about a definition of an unsized deallocation function
4721 @smallexample
4722 void operator delete (void *) noexcept;
4723 void operator delete[] (void *) noexcept;
4724 @end smallexample
4725 without a definition of the corresponding sized deallocation function
4726 @smallexample
4727 void operator delete (void *, std::size_t) noexcept;
4728 void operator delete[] (void *, std::size_t) noexcept;
4729 @end smallexample
4730 or vice versa.  Enabled by @option{-Wextra} along with
4731 @option{-fsized-deallocation}.
4733 @opindex Wno-suggest-final-types
4734 @opindex Wsuggest-final-types
4735 @item -Wsuggest-final-types
4736 Warn about types with virtual methods where code quality would be improved
4737 if the type were declared with the C++11 @code{final} specifier,
4738 or, if possible,
4739 declared in an anonymous namespace. This allows GCC to more aggressively
4740 devirtualize the polymorphic calls. This warning is more effective with
4741 link-time optimization,
4742 where the information about the class hierarchy graph is
4743 more complete.
4745 @opindex Wno-suggest-final-methods
4746 @opindex Wsuggest-final-methods
4747 @item -Wsuggest-final-methods
4748 Warn about virtual methods where code quality would be improved if the method
4749 were declared with the C++11 @code{final} specifier,
4750 or, if possible, its type were
4751 declared in an anonymous namespace or with the @code{final} specifier.
4752 This warning is
4753 more effective with link-time optimization, where the information about the
4754 class hierarchy graph is more complete. It is recommended to first consider
4755 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4756 annotations.
4758 @opindex Wsuggest-override
4759 @opindex Wno-suggest-override
4760 @item -Wsuggest-override
4761 Warn about overriding virtual functions that are not marked with the
4762 @code{override} keyword.
4764 @opindex Wuse-after-free
4765 @opindex Wno-use-after-free
4766 @item -Wuse-after-free
4767 @itemx -Wuse-after-free=@var{n}
4768 Warn about uses of pointers to dynamically allocated objects that have
4769 been rendered indeterminate by a call to a deallocation function.
4770 The warning is enabled at all optimization levels but may yield different
4771 results with optimization than without.
4773 @table @gcctabopt
4774 @item -Wuse-after-free=1
4775 At level 1 the warning attempts to diagnose only unconditional uses
4776 of pointers made indeterminate by a deallocation call or a successful
4777 call to @code{realloc}, regardless of whether or not the call resulted
4778 in an actual reallocatio of memory.  This includes double-@code{free}
4779 calls as well as uses in arithmetic and relational expressions.  Although
4780 undefined, uses of indeterminate pointers in equality (or inequality)
4781 expressions are not diagnosed at this level.
4782 @item -Wuse-after-free=2
4783 At level 2, in addition to unconditional uses, the warning also diagnoses
4784 conditional uses of pointers made indeterminate by a deallocation call.
4785 As at level 2, uses in equality (or inequality) expressions are not
4786 diagnosed.  For example, the second call to @code{free} in the following
4787 function is diagnosed at this level:
4788 @smallexample
4789 struct A @{ int refcount; void *data; @};
4791 void release (struct A *p)
4793   int refcount = --p->refcount;
4794   free (p);
4795   if (refcount == 0)
4796     free (p->data);   // warning: p may be used after free
4798 @end smallexample
4799 @item -Wuse-after-free=3
4800 At level 3, the warning also diagnoses uses of indeterminate pointers in
4801 equality expressions.  All uses of indeterminate pointers are undefined
4802 but equality tests sometimes appear after calls to @code{realloc} as
4803 an attempt to determine whether the call resulted in relocating the object
4804 to a different address.  They are diagnosed at a separate level to aid
4805 legacy code gradually transition to safe alternatives.  For example,
4806 the equality test in the function below is diagnosed at this level:
4807 @smallexample
4808 void adjust_pointers (int**, int);
4810 void grow (int **p, int n)
4812   int **q = (int**)realloc (p, n *= 2);
4813   if (q == p)
4814     return;
4815   adjust_pointers ((int**)q, n);
4817 @end smallexample
4818 To avoid the warning at this level, store offsets into allocated memory
4819 instead of pointers.  This approach obviates needing to adjust the stored
4820 pointers after reallocation.
4821 @end table
4823 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4825 @opindex Wuseless-cast
4826 @opindex Wno-useless-cast
4827 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
4828 Warn when an expression is cast to its own type.  This warning does not
4829 occur when a class object is converted to a non-reference type as that
4830 is a way to create a temporary:
4832 @smallexample
4833 struct S @{ @};
4834 void g (S&&);
4835 void f (S&& arg)
4837   g (S(arg)); // make arg prvalue so that it can bind to S&&
4839 @end smallexample
4841 @opindex Wconversion-null
4842 @opindex Wno-conversion-null
4843 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4844 Do not warn for conversions between @code{NULL} and non-pointer
4845 types. @option{-Wconversion-null} is enabled by default.
4847 @end table
4849 @node Objective-C and Objective-C++ Dialect Options
4850 @section Options Controlling Objective-C and Objective-C++ Dialects
4852 @cindex compiler options, Objective-C and Objective-C++
4853 @cindex Objective-C and Objective-C++ options, command-line
4854 @cindex options, Objective-C and Objective-C++
4855 (NOTE: This manual does not describe the Objective-C and Objective-C++
4856 languages themselves.  @xref{Standards,,Language Standards
4857 Supported by GCC}, for references.)
4859 This section describes the command-line options that are only meaningful
4860 for Objective-C and Objective-C++ programs.  You can also use most of
4861 the language-independent GNU compiler options.
4862 For example, you might compile a file @file{some_class.m} like this:
4864 @smallexample
4865 gcc -g -fgnu-runtime -O -c some_class.m
4866 @end smallexample
4868 @noindent
4869 In this example, @option{-fgnu-runtime} is an option meant only for
4870 Objective-C and Objective-C++ programs; you can use the other options with
4871 any language supported by GCC@.
4873 Note that since Objective-C is an extension of the C language, Objective-C
4874 compilations may also use options specific to the C front-end (e.g.,
4875 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4876 C++-specific options (e.g., @option{-Wabi}).
4878 Here is a list of options that are @emph{only} for compiling Objective-C
4879 and Objective-C++ programs:
4881 @table @gcctabopt
4882 @opindex fconstant-string-class
4883 @item -fconstant-string-class=@var{class-name}
4884 Use @var{class-name} as the name of the class to instantiate for each
4885 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4886 class name is @code{NXConstantString} if the GNU runtime is being used, and
4887 @code{NSConstantString} if the NeXT runtime is being used (see below).  On
4888 Darwin / macOS platforms, the @option{-fconstant-cfstrings} option, if
4889 also present, overrides the @option{-fconstant-string-class} setting and cause
4890 @code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings.
4891 Note that @option{-fconstant-cfstrings} is an alias for the target-specific
4892 @option{-mconstant-cfstrings} equivalent.
4894 @opindex fgnu-runtime
4895 @item -fgnu-runtime
4896 Generate object code compatible with the standard GNU Objective-C
4897 runtime.  This is the default for most types of systems.
4899 @opindex fnext-runtime
4900 @item -fnext-runtime
4901 Generate output compatible with the NeXT runtime.  This is the default
4902 for NeXT-based systems, including Darwin / macOS.  The macro
4903 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4904 used.
4906 @opindex fno-nil-receivers
4907 @opindex fnil-receivers
4908 @item -fno-nil-receivers
4909 Assume that all Objective-C message dispatches (@code{[receiver
4910 message:arg]}) in this translation unit ensure that the receiver is
4911 not @code{nil}.  This allows for more efficient entry points in the
4912 runtime to be used.  This option is only available in conjunction with
4913 the NeXT runtime and ABI version 0 or 1.
4915 @opindex fobjc-abi-version
4916 @item -fobjc-abi-version=@var{n}
4917 Use version @var{n} of the Objective-C ABI for the selected runtime.
4918 This option is currently supported only for the NeXT runtime.  In that
4919 case, Version 0 is the traditional (32-bit) ABI without support for
4920 properties and other Objective-C 2.0 additions.  Version 1 is the
4921 traditional (32-bit) ABI with support for properties and other
4922 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4923 nothing is specified, the default is Version 0 on 32-bit target
4924 machines, and Version 2 on 64-bit target machines.
4926 @opindex fobjc-call-cxx-cdtors
4927 @item -fobjc-call-cxx-cdtors
4928 For each Objective-C class, check if any of its instance variables is a
4929 C++ object with a non-trivial default constructor.  If so, synthesize a
4930 special @code{- (id) .cxx_construct} instance method which runs
4931 non-trivial default constructors on any such instance variables, in order,
4932 and then return @code{self}.  Similarly, check if any instance variable
4933 is a C++ object with a non-trivial destructor, and if so, synthesize a
4934 special @code{- (void) .cxx_destruct} method which runs
4935 all such default destructors, in reverse order.
4937 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4938 methods thusly generated only operate on instance variables
4939 declared in the current Objective-C class, and not those inherited
4940 from superclasses.  It is the responsibility of the Objective-C
4941 runtime to invoke all such methods in an object's inheritance
4942 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4943 by the runtime immediately after a new object instance is allocated;
4944 the @code{- (void) .cxx_destruct} methods are invoked immediately
4945 before the runtime deallocates an object instance.
4947 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4948 support for invoking the @code{- (id) .cxx_construct} and
4949 @code{- (void) .cxx_destruct} methods.
4951 @opindex fobjc-direct-dispatch
4952 @item -fobjc-direct-dispatch
4953 Allow fast jumps to the message dispatcher.  On Darwin this is
4954 accomplished via the comm page.
4956 @opindex fobjc-exceptions
4957 @item -fobjc-exceptions
4958 Enable syntactic support for structured exception handling in
4959 Objective-C, similar to what is offered by C++.  This option
4960 is required to use the Objective-C keywords @code{@@try},
4961 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4962 @code{@@synchronized}.  This option is available with both the GNU
4963 runtime and the NeXT runtime (but not available in conjunction with
4964 the NeXT runtime on Mac OS X 10.2 and earlier).
4966 @opindex fobjc-gc
4967 @item -fobjc-gc
4968 Enable garbage collection (GC) in Objective-C and Objective-C++
4969 programs.  This option is only available with the NeXT runtime; the
4970 GNU runtime has a different garbage collection implementation that
4971 does not require special compiler flags.
4973 @opindex fobjc-nilcheck
4974 @item -fobjc-nilcheck
4975 For the NeXT runtime with version 2 of the ABI, check for a nil
4976 receiver in method invocations before doing the actual method call.
4977 This is the default and can be disabled using
4978 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4979 checked for nil in this way no matter what this flag is set to.
4980 Currently this flag does nothing when the GNU runtime, or an older
4981 version of the NeXT runtime ABI, is used.
4983 @opindex fobjc-std
4984 @item -fobjc-std=objc1
4985 Conform to the language syntax of Objective-C 1.0, the language
4986 recognized by GCC 4.0.  This only affects the Objective-C additions to
4987 the C/C++ language; it does not affect conformance to C/C++ standards,
4988 which is controlled by the separate C/C++ dialect option flags.  When
4989 this option is used with the Objective-C or Objective-C++ compiler,
4990 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4991 This is useful if you need to make sure that your Objective-C code can
4992 be compiled with older versions of GCC@.
4994 @opindex freplace-objc-classes
4995 @item -freplace-objc-classes
4996 Emit a special marker instructing @command{ld(1)} not to statically link in
4997 the resulting object file, and allow @command{dyld(1)} to load it in at
4998 run time instead.  This is used in conjunction with the Fix-and-Continue
4999 debugging mode, where the object file in question may be recompiled and
5000 dynamically reloaded in the course of program execution, without the need
5001 to restart the program itself.  Currently, Fix-and-Continue functionality
5002 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
5003 and later.
5005 @opindex fzero-link
5006 @item -fzero-link
5007 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
5008 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
5009 compile time) with static class references that get initialized at load time,
5010 which improves run-time performance.  Specifying the @option{-fzero-link} flag
5011 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
5012 to be retained.  This is useful in Zero-Link debugging mode, since it allows
5013 for individual class implementations to be modified during program execution.
5014 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
5015 regardless of command-line options.
5017 @opindex fno-local-ivars
5018 @opindex flocal-ivars
5019 @item -fno-local-ivars
5020 By default instance variables in Objective-C can be accessed as if
5021 they were local variables from within the methods of the class they're
5022 declared in.  This can lead to shadowing between instance variables
5023 and other variables declared either locally inside a class method or
5024 globally with the same name.  Specifying the @option{-fno-local-ivars}
5025 flag disables this behavior thus avoiding variable shadowing issues.
5027 @opindex fivar-visibility
5028 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
5029 Set the default instance variable visibility to the specified option
5030 so that instance variables declared outside the scope of any access
5031 modifier directives default to the specified visibility.
5033 @opindex gen-decls
5034 @item -gen-decls
5035 Dump interface declarations for all classes seen in the source file to a
5036 file named @file{@var{sourcename}.decl}.
5038 @opindex Wassign-intercept
5039 @opindex Wno-assign-intercept
5040 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
5041 Warn whenever an Objective-C assignment is being intercepted by the
5042 garbage collector.
5044 @opindex Wproperty-assign-default
5045 @opindex Wno-property-assign-default
5046 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
5047 Do not warn if a property for an Objective-C object has no assign
5048 semantics specified.
5050 @opindex Wno-protocol
5051 @opindex Wprotocol
5052 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
5053 If a class is declared to implement a protocol, a warning is issued for
5054 every method in the protocol that is not implemented by the class.  The
5055 default behavior is to issue a warning for every method not explicitly
5056 implemented in the class, even if a method implementation is inherited
5057 from the superclass.  If you use the @option{-Wno-protocol} option, then
5058 methods inherited from the superclass are considered to be implemented,
5059 and no warning is issued for them.
5061 @opindex Wobjc-root-class
5062 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
5063 Warn if a class interface lacks a superclass. Most classes will inherit
5064 from @code{NSObject} (or @code{Object}) for example.  When declaring
5065 classes intended to be root classes, the warning can be suppressed by
5066 marking their interfaces with @code{__attribute__((objc_root_class))}.
5068 @opindex Wselector
5069 @opindex Wno-selector
5070 @item -Wselector @r{(Objective-C and Objective-C++ only)}
5071 Warn if multiple methods of different types for the same selector are
5072 found during compilation.  The check is performed on the list of methods
5073 in the final stage of compilation.  Additionally, a check is performed
5074 for each selector appearing in a @code{@@selector(@dots{})}
5075 expression, and a corresponding method for that selector has been found
5076 during compilation.  Because these checks scan the method table only at
5077 the end of compilation, these warnings are not produced if the final
5078 stage of compilation is not reached, for example because an error is
5079 found during compilation, or because the @option{-fsyntax-only} option is
5080 being used.
5082 @opindex Wstrict-selector-match
5083 @opindex Wno-strict-selector-match
5084 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5085 Warn if multiple methods with differing argument and/or return types are
5086 found for a given selector when attempting to send a message using this
5087 selector to a receiver of type @code{id} or @code{Class}.  When this flag
5088 is off (which is the default behavior), the compiler omits such warnings
5089 if any differences found are confined to types that share the same size
5090 and alignment.
5092 @opindex Wundeclared-selector
5093 @opindex Wno-undeclared-selector
5094 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5095 Warn if a @code{@@selector(@dots{})} expression referring to an
5096 undeclared selector is found.  A selector is considered undeclared if no
5097 method with that name has been declared before the
5098 @code{@@selector(@dots{})} expression, either explicitly in an
5099 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5100 an @code{@@implementation} section.  This option always performs its
5101 checks as soon as a @code{@@selector(@dots{})} expression is found,
5102 while @option{-Wselector} only performs its checks in the final stage of
5103 compilation.  This also enforces the coding style convention
5104 that methods and selectors must be declared before being used.
5106 @opindex print-objc-runtime-info
5107 @item -print-objc-runtime-info
5108 Generate C header describing the largest structure that is passed by
5109 value, if any.
5111 @end table
5113 @node Diagnostic Message Formatting Options
5114 @section Options to Control Diagnostic Messages Formatting
5115 @cindex options to control diagnostics formatting
5116 @cindex diagnostic messages
5117 @cindex message formatting
5119 Traditionally, diagnostic messages have been formatted irrespective of
5120 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5121 options described below
5122 to control the formatting algorithm for diagnostic messages, 
5123 e.g.@: how many characters per line, how often source location
5124 information should be reported.  Note that some language front ends may not
5125 honor these options.
5127 @table @gcctabopt
5128 @opindex fmessage-length
5129 @item -fmessage-length=@var{n}
5130 Try to format error messages so that they fit on lines of about
5131 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5132 done; each error message appears on a single line.  This is the
5133 default for all front ends.
5135 Note - this option also affects the display of the @samp{#error} and
5136 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5137 function/type/variable attribute.  It does not however affect the
5138 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5140 @item -fdiagnostics-plain-output
5141 This option requests that diagnostic output look as plain as possible, which
5142 may be useful when running @command{dejagnu} or other utilities that need to
5143 parse diagnostics output and prefer that it remain more stable over time.
5144 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5145 options:
5146 @gccoptlist{-fno-diagnostics-show-caret
5147 -fno-diagnostics-show-line-numbers
5148 -fdiagnostics-color=never
5149 -fdiagnostics-urls=never
5150 -fdiagnostics-path-format=separate-events
5151 -fdiagnostics-text-art-charset=none}
5152 In the future, if GCC changes the default appearance of its diagnostics, the
5153 corresponding option to disable the new behavior will be added to this list.
5155 @opindex fdiagnostics-show-location
5156 @item -fdiagnostics-show-location=once
5157 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5158 reporter to emit source location information @emph{once}; that is, in
5159 case the message is too long to fit on a single physical line and has to
5160 be wrapped, the source location won't be emitted (as prefix) again,
5161 over and over, in subsequent continuation lines.  This is the default
5162 behavior.
5164 @item -fdiagnostics-show-location=every-line
5165 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5166 messages reporter to emit the same source location information (as
5167 prefix) for physical lines that result from the process of breaking
5168 a message which is too long to fit on a single line.
5170 @opindex fdiagnostics-color
5171 @cindex highlight, color
5172 @vindex GCC_COLORS @r{environment variable}
5173 @item -fdiagnostics-color[=@var{WHEN}]
5174 @itemx -fno-diagnostics-color
5175 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5176 or @samp{auto}.  The default depends on how the compiler has been configured,
5177 it can be any of the above @var{WHEN} options or also @samp{never}
5178 if @env{GCC_COLORS} environment variable isn't present in the environment,
5179 and @samp{auto} otherwise.
5180 @samp{auto} makes GCC use color only when the standard error is a terminal,
5181 and when not executing in an emacs shell.
5182 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5183 aliases for @option{-fdiagnostics-color=always} and
5184 @option{-fdiagnostics-color=never}, respectively.
5186 The colors are defined by the environment variable @env{GCC_COLORS}.
5187 Its value is a colon-separated list of capabilities and Select Graphic
5188 Rendition (SGR) substrings. SGR commands are interpreted by the
5189 terminal or terminal emulator.  (See the section in the documentation
5190 of your text terminal for permitted values and their meanings as
5191 character attributes.)  These substring values are integers in decimal
5192 representation and can be concatenated with semicolons.
5193 Common values to concatenate include
5194 @samp{1} for bold,
5195 @samp{4} for underline,
5196 @samp{5} for blink,
5197 @samp{7} for inverse,
5198 @samp{39} for default foreground color,
5199 @samp{30} to @samp{37} for foreground colors,
5200 @samp{90} to @samp{97} for 16-color mode foreground colors,
5201 @samp{38;5;0} to @samp{38;5;255}
5202 for 88-color and 256-color modes foreground colors,
5203 @samp{49} for default background color,
5204 @samp{40} to @samp{47} for background colors,
5205 @samp{100} to @samp{107} for 16-color mode background colors,
5206 and @samp{48;5;0} to @samp{48;5;255}
5207 for 88-color and 256-color modes background colors.
5209 The default @env{GCC_COLORS} is
5210 @smallexample
5211 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5212 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5213 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5214 type-diff=01;32:fnname=01;32:targs=35
5215 @end smallexample
5216 @noindent
5217 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5218 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5219 @samp{01} is bold, and @samp{31} is red.
5220 Setting @env{GCC_COLORS} to the empty string disables colors.
5221 Supported capabilities are as follows.
5223 @table @code
5224 @vindex error GCC_COLORS @r{capability}
5225 @item error=
5226 SGR substring for error: markers.
5228 @vindex warning GCC_COLORS @r{capability}
5229 @item warning=
5230 SGR substring for warning: markers.
5232 @vindex note GCC_COLORS @r{capability}
5233 @item note=
5234 SGR substring for note: markers.
5236 @vindex path GCC_COLORS @r{capability}
5237 @item path=
5238 SGR substring for colorizing paths of control-flow events as printed
5239 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5240 individual events and lines indicating interprocedural calls and returns.
5242 @vindex range1 GCC_COLORS @r{capability}
5243 @item range1=
5244 SGR substring for first additional range.
5246 @vindex range2 GCC_COLORS @r{capability}
5247 @item range2=
5248 SGR substring for second additional range.
5250 @vindex locus GCC_COLORS @r{capability}
5251 @item locus=
5252 SGR substring for location information, @samp{file:line} or
5253 @samp{file:line:column} etc.
5255 @vindex quote GCC_COLORS @r{capability}
5256 @item quote=
5257 SGR substring for information printed within quotes.
5259 @vindex fnname GCC_COLORS @r{capability}
5260 @item fnname=
5261 SGR substring for names of C++ functions.
5263 @vindex targs GCC_COLORS @r{capability}
5264 @item targs=
5265 SGR substring for C++ function template parameter bindings.
5267 @vindex fixit-insert GCC_COLORS @r{capability}
5268 @item fixit-insert=
5269 SGR substring for fix-it hints suggesting text to
5270 be inserted or replaced.
5272 @vindex fixit-delete GCC_COLORS @r{capability}
5273 @item fixit-delete=
5274 SGR substring for fix-it hints suggesting text to
5275 be deleted.
5277 @vindex diff-filename GCC_COLORS @r{capability}
5278 @item diff-filename=
5279 SGR substring for filename headers within generated patches.
5281 @vindex diff-hunk GCC_COLORS @r{capability}
5282 @item diff-hunk=
5283 SGR substring for the starts of hunks within generated patches.
5285 @vindex diff-delete GCC_COLORS @r{capability}
5286 @item diff-delete=
5287 SGR substring for deleted lines within generated patches.
5289 @vindex diff-insert GCC_COLORS @r{capability}
5290 @item diff-insert=
5291 SGR substring for inserted lines within generated patches.
5293 @vindex type-diff GCC_COLORS @r{capability}
5294 @item type-diff=
5295 SGR substring for highlighting mismatching types within template
5296 arguments in the C++ frontend.
5297 @end table
5299 @opindex fdiagnostics-urls
5300 @cindex urls
5301 @vindex GCC_URLS @r{environment variable}
5302 @vindex TERM_URLS @r{environment variable}
5303 @item -fdiagnostics-urls[=@var{WHEN}]
5304 Use escape sequences to embed URLs in diagnostics.  For example, when
5305 @option{-fdiagnostics-show-option} emits text showing the command-line
5306 option controlling a diagnostic, embed a URL for documentation of that
5307 option.
5309 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5310 @samp{auto} makes GCC use URL escape sequences only when the standard error
5311 is a terminal, and when not executing in an emacs shell or any graphical
5312 terminal which is known to be incompatible with this feature, see below.
5314 The default depends on how the compiler has been configured.
5315 It can be any of the above @var{WHEN} options.
5317 GCC can also be configured (via the
5318 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5319 so that the default is affected by environment variables.
5320 Under such a configuration, GCC defaults to using @samp{auto}
5321 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5322 present and non-empty in the environment of the compiler, or @samp{never}
5323 if neither are.
5325 However, even with @option{-fdiagnostics-urls=always} the behavior is
5326 dependent on those environment variables:
5327 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5328 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5329 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5330 Any other non-empty value enables the feature.
5331 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5332 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5333 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5335 At this time GCC tries to detect also a few terminals that are known to
5336 not implement the URL feature, and have bugs or at least had bugs in
5337 some versions that are still in use, where the URL escapes are likely
5338 to misbehave, i.e. print garbage on the screen.
5339 That list is currently xfce4-terminal, certain known to be buggy
5340 gnome-terminal versions, the linux console, and mingw.
5341 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5343 @opindex fno-diagnostics-show-option
5344 @opindex fdiagnostics-show-option
5345 @item -fno-diagnostics-show-option
5346 By default, each diagnostic emitted includes text indicating the
5347 command-line option that directly controls the diagnostic (if such an
5348 option is known to the diagnostic machinery).  Specifying the
5349 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5351 @opindex fno-diagnostics-show-caret
5352 @opindex fdiagnostics-show-caret
5353 @item -fno-diagnostics-show-caret
5354 By default, each diagnostic emitted includes the original source line
5355 and a caret @samp{^} indicating the column.  This option suppresses this
5356 information.  The source line is truncated to @var{n} characters, if
5357 the @option{-fmessage-length=n} option is given.  When the output is done
5358 to the terminal, the width is limited to the width given by the
5359 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5361 @opindex fno-diagnostics-show-labels
5362 @opindex fdiagnostics-show-labels
5363 @item -fno-diagnostics-show-labels
5364 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5365 diagnostics can label ranges of source code with pertinent information, such
5366 as the types of expressions:
5368 @smallexample
5369     printf ("foo %s bar", long_i + long_j);
5370                  ~^       ~~~~~~~~~~~~~~~
5371                   |              |
5372                   char *         long int
5373 @end smallexample
5375 This option suppresses the printing of these labels (in the example above,
5376 the vertical bars and the ``char *'' and ``long int'' text).
5378 @opindex fno-diagnostics-show-cwe
5379 @opindex fdiagnostics-show-cwe
5380 @item -fno-diagnostics-show-cwe
5381 Diagnostic messages can optionally have an associated
5382 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5383 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5384 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5385 By default, if this information is present, it will be printed with
5386 the diagnostic.  This option suppresses the printing of this metadata.
5388 @opindex fno-diagnostics-show-rules
5389 @opindex fdiagnostics-show-rules
5390 @item -fno-diagnostics-show-rules
5391 Diagnostic messages can optionally have rules associated with them, such
5392 as from a coding standard, or a specification.
5393 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5394 By default, if this information is present, it will be printed with
5395 the diagnostic.  This option suppresses the printing of this metadata.
5397 @opindex fno-diagnostics-show-line-numbers
5398 @opindex fdiagnostics-show-line-numbers
5399 @item -fno-diagnostics-show-line-numbers
5400 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5401 a left margin is printed, showing line numbers.  This option suppresses this
5402 left margin.
5404 @opindex fdiagnostics-minimum-margin-width
5405 @item -fdiagnostics-minimum-margin-width=@var{width}
5406 This option controls the minimum width of the left margin printed by
5407 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5409 @opindex fdiagnostics-parseable-fixits
5410 @item -fdiagnostics-parseable-fixits
5411 Emit fix-it hints in a machine-parseable format, suitable for consumption
5412 by IDEs.  For each fix-it, a line will be printed after the relevant
5413 diagnostic, starting with the string ``fix-it:''.  For example:
5415 @smallexample
5416 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5417 @end smallexample
5419 The location is expressed as a half-open range, expressed as a count of
5420 bytes, starting at byte 1 for the initial column.  In the above example,
5421 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5422 given string:
5424 @smallexample
5425 00000000011111111112222222222
5426 12345678901234567890123456789
5427   gtk_widget_showall (dlg);
5428   ^^^^^^^^^^^^^^^^^^
5429   gtk_widget_show_all
5430 @end smallexample
5432 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5433 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5434 (e.g. vertical tab as ``\013'').
5436 An empty replacement string indicates that the given range is to be removed.
5437 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5438 be inserted at the given position.
5440 @opindex fdiagnostics-generate-patch
5441 @item -fdiagnostics-generate-patch
5442 Print fix-it hints to stderr in unified diff format, after any diagnostics
5443 are printed.  For example:
5445 @smallexample
5446 --- test.c
5447 +++ test.c
5448 @@ -42,5 +42,5 @@
5450  void show_cb(GtkDialog *dlg)
5451  @{
5452 -  gtk_widget_showall(dlg);
5453 +  gtk_widget_show_all(dlg);
5454  @}
5456 @end smallexample
5458 The diff may or may not be colorized, following the same rules
5459 as for diagnostics (see @option{-fdiagnostics-color}).
5461 @opindex fdiagnostics-show-template-tree
5462 @item -fdiagnostics-show-template-tree
5464 In the C++ frontend, when printing diagnostics showing mismatching
5465 template types, such as:
5467 @smallexample
5468   could not convert 'std::map<int, std::vector<double> >()'
5469     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5470 @end smallexample
5472 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5473 tree-like structure showing the common and differing parts of the types,
5474 such as:
5476 @smallexample
5477   map<
5478     [...],
5479     vector<
5480       [double != float]>>
5481 @end smallexample
5483 The parts that differ are highlighted with color (``double'' and
5484 ``float'' in this case).
5486 @opindex fno-elide-type
5487 @opindex felide-type
5488 @item -fno-elide-type
5489 By default when the C++ frontend prints diagnostics showing mismatching
5490 template types, common parts of the types are printed as ``[...]'' to
5491 simplify the error message.  For example:
5493 @smallexample
5494   could not convert 'std::map<int, std::vector<double> >()'
5495     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5496 @end smallexample
5498 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5499 This flag also affects the output of the
5500 @option{-fdiagnostics-show-template-tree} flag.
5502 @opindex fdiagnostics-path-format
5503 @item -fdiagnostics-path-format=@var{KIND}
5504 Specify how to print paths of control-flow events for diagnostics that
5505 have such a path associated with them.
5507 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5508 the default.
5510 @samp{none} means to not print diagnostic paths.
5512 @samp{separate-events} means to print a separate ``note'' diagnostic for
5513 each event within the diagnostic.  For example:
5515 @smallexample
5516 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5517 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5518 test.c:27:3: note: (2) when 'i < count'
5519 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5520 @end smallexample
5522 @samp{inline-events} means to print the events ``inline'' within the source
5523 code.  This view attempts to consolidate the events into runs of
5524 sufficiently-close events, printing them as labelled ranges within the source.
5526 For example, the same events as above might be printed as:
5528 @smallexample
5529   'test': events 1-3
5530     |
5531     |   25 |   list = PyList_New(0);
5532     |      |          ^~~~~~~~~~~~~
5533     |      |          |
5534     |      |          (1) when 'PyList_New' fails, returning NULL
5535     |   26 |
5536     |   27 |   for (i = 0; i < count; i++) @{
5537     |      |   ~~~
5538     |      |   |
5539     |      |   (2) when 'i < count'
5540     |   28 |     item = PyLong_FromLong(random());
5541     |   29 |     PyList_Append(list, item);
5542     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5543     |      |     |
5544     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5545     |
5546 @end smallexample
5548 Interprocedural control flow is shown by grouping the events by stack frame,
5549 and using indentation to show how stack frames are nested, pushed, and popped.
5551 For example:
5553 @smallexample
5554   'test': events 1-2
5555     |
5556     |  133 | @{
5557     |      | ^
5558     |      | |
5559     |      | (1) entering 'test'
5560     |  134 |   boxed_int *obj = make_boxed_int (i);
5561     |      |                    ~~~~~~~~~~~~~~~~~~
5562     |      |                    |
5563     |      |                    (2) calling 'make_boxed_int'
5564     |
5565     +--> 'make_boxed_int': events 3-4
5566            |
5567            |  120 | @{
5568            |      | ^
5569            |      | |
5570            |      | (3) entering 'make_boxed_int'
5571            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5572            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5573            |      |                                    |
5574            |      |                                    (4) calling 'wrapped_malloc'
5575            |
5576            +--> 'wrapped_malloc': events 5-6
5577                   |
5578                   |    7 | @{
5579                   |      | ^
5580                   |      | |
5581                   |      | (5) entering 'wrapped_malloc'
5582                   |    8 |   return malloc (size);
5583                   |      |          ~~~~~~~~~~~~~
5584                   |      |          |
5585                   |      |          (6) calling 'malloc'
5586                   |
5587     <-------------+
5588     |
5589  'test': event 7
5590     |
5591     |  138 |   free_boxed_int (obj);
5592     |      |   ^~~~~~~~~~~~~~~~~~~~
5593     |      |   |
5594     |      |   (7) calling 'free_boxed_int'
5595     |
5596 (etc)
5597 @end smallexample
5599 @opindex fdiagnostics-show-path-depths
5600 @item -fdiagnostics-show-path-depths
5601 This option provides additional information when printing control-flow paths
5602 associated with a diagnostic.
5604 If this is option is provided then the stack depth will be printed for
5605 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5606 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5607 the stack depth and function declaration will be appended when printing
5608 each event.
5610 This is intended for use by GCC developers and plugin developers when
5611 debugging diagnostics that report interprocedural control flow.
5613 @opindex fno-show-column
5614 @opindex fshow-column
5615 @item -fno-show-column
5616 Do not print column numbers in diagnostics.  This may be necessary if
5617 diagnostics are being scanned by a program that does not understand the
5618 column numbers, such as @command{dejagnu}.
5620 @opindex fdiagnostics-column-unit
5621 @item -fdiagnostics-column-unit=@var{UNIT}
5622 Select the units for the column number.  This affects traditional diagnostics
5623 (in the absence of @option{-fno-show-column}), as well as JSON format
5624 diagnostics if requested.
5626 The default @var{UNIT}, @samp{display}, considers the number of display
5627 columns occupied by each character.  This may be larger than the number
5628 of bytes required to encode the character, in the case of tab
5629 characters, or it may be smaller, in the case of multibyte characters.
5630 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5631 display column, and its UTF-8 encoding requires two bytes; the character
5632 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5633 its UTF-8 encoding requires four bytes.
5635 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5636 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5638 @opindex fdiagnostics-column-origin
5639 @item -fdiagnostics-column-origin=@var{ORIGIN}
5640 Select the origin for column numbers, i.e. the column number assigned to the
5641 first column.  The default value of 1 corresponds to traditional GCC
5642 behavior and to the GNU style guide.  Some utilities may perform better with an
5643 origin of 0; any non-negative value may be specified.
5645 @opindex fdiagnostics-escape-format
5646 @item -fdiagnostics-escape-format=@var{FORMAT}
5647 When GCC prints pertinent source lines for a diagnostic it normally attempts
5648 to print the source bytes directly.  However, some diagnostics relate to encoding
5649 issues in the source file, such as malformed UTF-8, or issues with Unicode
5650 normalization.  These diagnostics are flagged so that GCC will escape bytes
5651 that are not printable ASCII when printing their pertinent source lines.
5653 This option controls how such bytes should be escaped.
5655 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5656 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5657 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5658 displayed as hexadecimal in the form @samp{<XX>}.
5660 For example, a source line containing the string @samp{before} followed by the
5661 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5662 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5663 the string @samp{after} will be printed for such a diagnostic as:
5665 @smallexample
5666  before<U+03C0><BF>after
5667 @end smallexample
5669 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5670 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5671 Unicode characters.  For the example above, the following will be printed:
5673 @smallexample
5674  before<CF><80><BF>after
5675 @end smallexample
5677 @opindex fdiagnostics-text-art-charset
5678 @item -fdiagnostics-text-art-charset=@var{CHARSET}
5679 Some diagnostics can contain ``text art'' diagrams: visualizations created
5680 from text, intended to be viewed in a monospaced font.
5682 This option selects which characters should be used for printing such
5683 diagrams, if any.  @var{CHARSET} is @samp{none}, @samp{ascii}, @samp{unicode},
5684 or @samp{emoji}.
5686 The @samp{none} value suppresses the printing of such diagrams.
5687 The @samp{ascii} value will ensure that such diagrams are pure ASCII
5688 (``ASCII art'').  The @samp{unicode} value will allow for conservative use of
5689 unicode drawing characters (such as box-drawing characters).  The @samp{emoji}
5690 value further adds the possibility of emoji in the output (such as emitting
5691 U+26A0 WARNING SIGN followed by U+FE0F VARIATION SELECTOR-16 to select the
5692 emoji variant of the character).
5694 The default is @samp{emoji}, except when the environment variable @env{LANG}
5695 is set to @samp{C}, in which case the default is @samp{ascii}.
5697 @opindex fdiagnostics-format
5698 @item -fdiagnostics-format=@var{FORMAT}
5699 Select a different format for printing diagnostics.
5700 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5701 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5703 The default is @samp{text}.
5705 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5706 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5707 named @file{@var{source}.sarif}, respectively.
5709 The @samp{json} format is a synonym for @samp{json-stderr}.
5710 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5711 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5712 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5714 The emitted JSON consists of a top-level JSON array containing JSON objects
5715 representing the diagnostics.  The JSON is emitted as one line, without
5716 formatting; the examples below have been formatted for clarity.
5718 Diagnostics can have child diagnostics.  For example, this error and note:
5720 @smallexample
5721 misleading-indentation.c:15:3: warning: this 'if' clause does not
5722   guard... [-Wmisleading-indentation]
5723    15 |   if (flag)
5724       |   ^~
5725 misleading-indentation.c:17:5: note: ...this statement, but the latter
5726   is misleadingly indented as if it were guarded by the 'if'
5727    17 |     y = 2;
5728       |     ^
5729 @end smallexample
5731 @noindent
5732 might be printed in JSON form (after formatting) like this:
5734 @smallexample
5736     @{
5737         "kind": "warning",
5738         "locations": [
5739             @{
5740                 "caret": @{
5741                     "display-column": 3,
5742                     "byte-column": 3,
5743                     "column": 3,
5744                     "file": "misleading-indentation.c",
5745                     "line": 15
5746                 @},
5747                 "finish": @{
5748                     "display-column": 4,
5749                     "byte-column": 4,
5750                     "column": 4,
5751                     "file": "misleading-indentation.c",
5752                     "line": 15
5753                 @}
5754             @}
5755         ],
5756         "message": "this \u2018if\u2019 clause does not guard...",
5757         "option": "-Wmisleading-indentation",
5758         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5759         "children": [
5760             @{
5761                 "kind": "note",
5762                 "locations": [
5763                     @{
5764                         "caret": @{
5765                             "display-column": 5,
5766                             "byte-column": 5,
5767                             "column": 5,
5768                             "file": "misleading-indentation.c",
5769                             "line": 17
5770                         @}
5771                     @}
5772                 ],
5773                 "escape-source": false,
5774                 "message": "...this statement, but the latter is @dots{}"
5775             @}
5776         ]
5777         "escape-source": false,
5778         "column-origin": 1,
5779     @}
5781 @end smallexample
5783 @noindent
5784 where the @code{note} is a child of the @code{warning}.
5786 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5787 an @code{option} key describing the command-line option controlling the
5788 warning.
5790 A diagnostic can contain zero or more locations.  Each location has an
5791 optional @code{label} string and up to three positions within it: a
5792 @code{caret} position and optional @code{start} and @code{finish} positions.
5793 A position is described by a @code{file} name, a @code{line} number, and
5794 three numbers indicating a column position:
5795 @itemize @bullet
5797 @item
5798 @code{display-column} counts display columns, accounting for tabs and
5799 multibyte characters.
5801 @item
5802 @code{byte-column} counts raw bytes.
5804 @item
5805 @code{column} is equal to one of
5806 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5807 option.
5809 @end itemize
5810 All three columns are relative to the origin specified by
5811 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5812 be set, for instance, to 0 for compatibility with other utilities that
5813 number columns from 0.  The column origin is recorded in the JSON output in
5814 the @code{column-origin} tag.  In the remaining examples below, the extra
5815 column number outputs have been omitted for brevity.
5817 For example, this error:
5819 @smallexample
5820 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5821    'struct s'@} and 'T' @{aka 'struct t'@})
5822    64 |   return callee_4a () + callee_4b ();
5823       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5824       |          |              |
5825       |          |              T @{aka struct t@}
5826       |          S @{aka struct s@}
5827 @end smallexample
5829 @noindent
5830 has three locations.  Its primary location is at the ``+'' token at column
5831 23.  It has two secondary locations, describing the left and right-hand sides
5832 of the expression, which have labels.  It might be printed in JSON form as:
5834 @smallexample
5835     @{
5836         "children": [],
5837         "kind": "error",
5838         "locations": [
5839             @{
5840                 "caret": @{
5841                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5842                 @}
5843             @},
5844             @{
5845                 "caret": @{
5846                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5847                 @},
5848                 "finish": @{
5849                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5850                 @},
5851                 "label": "S @{aka struct s@}"
5852             @},
5853             @{
5854                 "caret": @{
5855                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5856                 @},
5857                 "finish": @{
5858                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5859                 @},
5860                 "label": "T @{aka struct t@}"
5861             @}
5862         ],
5863         "escape-source": false,
5864         "message": "invalid operands to binary + @dots{}"
5865     @}
5866 @end smallexample
5868 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5869 consisting of half-open intervals, similar to the output of
5870 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5871 with a replacement fix-it hint:
5873 @smallexample
5874 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5875   mean 'color'?
5876     8 |   return ptr->colour;
5877       |               ^~~~~~
5878       |               color
5879 @end smallexample
5881 @noindent
5882 might be printed in JSON form as:
5884 @smallexample
5885     @{
5886         "children": [],
5887         "fixits": [
5888             @{
5889                 "next": @{
5890                     "column": 21,
5891                     "file": "demo.c",
5892                     "line": 8
5893                 @},
5894                 "start": @{
5895                     "column": 15,
5896                     "file": "demo.c",
5897                     "line": 8
5898                 @},
5899                 "string": "color"
5900             @}
5901         ],
5902         "kind": "error",
5903         "locations": [
5904             @{
5905                 "caret": @{
5906                     "column": 15,
5907                     "file": "demo.c",
5908                     "line": 8
5909                 @},
5910                 "finish": @{
5911                     "column": 20,
5912                     "file": "demo.c",
5913                     "line": 8
5914                 @}
5915             @}
5916         ],
5917         "escape-source": false,
5918         "message": "\u2018struct s\u2019 has no member named @dots{}"
5919     @}
5920 @end smallexample
5922 @noindent
5923 where the fix-it hint suggests replacing the text from @code{start} up
5924 to but not including @code{next} with @code{string}'s value.  Deletions
5925 are expressed via an empty value for @code{string}, insertions by
5926 having @code{start} equal @code{next}.
5928 If the diagnostic has a path of control-flow events associated with it,
5929 it has a @code{path} array of objects representing the events.  Each
5930 event object has a @code{description} string, a @code{location} object,
5931 along with a @code{function} string and a @code{depth} number for
5932 representing interprocedural paths.  The @code{function} represents the
5933 current function at that event, and the @code{depth} represents the
5934 stack depth relative to some baseline: the higher, the more frames are
5935 within the stack.
5937 For example, the intraprocedural example shown for
5938 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5940 @smallexample
5941     "path": [
5942         @{
5943             "depth": 0,
5944             "description": "when 'PyList_New' fails, returning NULL",
5945             "function": "test",
5946             "location": @{
5947                 "column": 10,
5948                 "file": "test.c",
5949                 "line": 25
5950             @}
5951         @},
5952         @{
5953             "depth": 0,
5954             "description": "when 'i < count'",
5955             "function": "test",
5956             "location": @{
5957                 "column": 3,
5958                 "file": "test.c",
5959                 "line": 27
5960             @}
5961         @},
5962         @{
5963             "depth": 0,
5964             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5965             "function": "test",
5966             "location": @{
5967                 "column": 5,
5968                 "file": "test.c",
5969                 "line": 29
5970             @}
5971         @}
5972     ]
5973 @end smallexample
5975 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5976 non-ASCII bytes should be escaped when printing the pertinent lines of
5977 source code (@code{true} for diagnostics involving source encoding issues).
5979 @end table
5981 @node Warning Options
5982 @section Options to Request or Suppress Warnings
5983 @cindex options to control warnings
5984 @cindex warning messages
5985 @cindex messages, warning
5986 @cindex suppressing warnings
5988 Warnings are diagnostic messages that report constructions that
5989 are not inherently erroneous but that are risky or suggest there
5990 may have been an error.
5992 The following language-independent options do not enable specific
5993 warnings but control the kinds of diagnostics produced by GCC@.
5995 @table @gcctabopt
5996 @cindex syntax checking
5997 @opindex fsyntax-only
5998 @item -fsyntax-only
5999 Check the code for syntax errors, but don't do anything beyond that.
6001 @opindex fmax-errors
6002 @item -fmax-errors=@var{n}
6003 Limits the maximum number of error messages to @var{n}, at which point
6004 GCC bails out rather than attempting to continue processing the source
6005 code.  If @var{n} is 0 (the default), there is no limit on the number
6006 of error messages produced.  If @option{-Wfatal-errors} is also
6007 specified, then @option{-Wfatal-errors} takes precedence over this
6008 option.
6010 @opindex w
6011 @item -w
6012 Inhibit all warning messages.
6014 @opindex Werror
6015 @opindex Wno-error
6016 @item -Werror
6017 Make all warnings into errors.
6019 @opindex Werror=
6020 @opindex Wno-error=
6021 @item -Werror=
6022 Make the specified warning into an error.  The specifier for a warning
6023 is appended; for example @option{-Werror=switch} turns the warnings
6024 controlled by @option{-Wswitch} into errors.  This switch takes a
6025 negative form, to be used to negate @option{-Werror} for specific
6026 warnings; for example @option{-Wno-error=switch} makes
6027 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
6028 is in effect.
6030 The warning message for each controllable warning includes the
6031 option that controls the warning.  That option can then be used with
6032 @option{-Werror=} and @option{-Wno-error=} as described above.
6033 (Printing of the option in the warning message can be disabled using the
6034 @option{-fno-diagnostics-show-option} flag.)
6036 Note that specifying @option{-Werror=}@var{foo} automatically implies
6037 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
6038 imply anything.
6040 @opindex Wfatal-errors
6041 @opindex Wno-fatal-errors
6042 @item -Wfatal-errors
6043 This option causes the compiler to abort compilation on the first error
6044 occurred rather than trying to keep going and printing further error
6045 messages.
6047 @end table
6049 You can request many specific warnings with options beginning with
6050 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6051 implicit declarations.  Each of these specific warning options also
6052 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6053 example, @option{-Wno-implicit}.  This manual lists only one of the
6054 two forms, whichever is not the default.  For further
6055 language-specific options also refer to @ref{C++ Dialect Options} and
6056 @ref{Objective-C and Objective-C++ Dialect Options}.
6057 Additional warnings can be produced by enabling the static analyzer;
6058 @xref{Static Analyzer Options}.
6060 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6061 options, such as @option{-Wunused}, which may turn on further options,
6062 such as @option{-Wunused-value}. The combined effect of positive and
6063 negative forms is that more specific options have priority over less
6064 specific ones, independently of their position in the command-line. For
6065 options of the same specificity, the last one takes effect. Options
6066 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6067 as if they appeared at the end of the command-line.
6069 When an unrecognized warning option is requested (e.g.,
6070 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6071 that the option is not recognized.  However, if the @option{-Wno-} form
6072 is used, the behavior is slightly different: no diagnostic is
6073 produced for @option{-Wno-unknown-warning} unless other diagnostics
6074 are being produced.  This allows the use of new @option{-Wno-} options
6075 with old compilers, but if something goes wrong, the compiler
6076 warns that an unrecognized option is present.
6078 The effectiveness of some warnings depends on optimizations also being
6079 enabled. For example @option{-Wsuggest-final-types} is more effective
6080 with link-time optimization and some instances of other warnings may
6081 not be issued at all unless optimization is enabled.  While optimization
6082 in general improves the efficacy of control and data flow sensitive
6083 warnings, in some cases it may also cause false positives.
6085 @table @gcctabopt
6086 @opindex pedantic
6087 @opindex Wpedantic
6088 @opindex Wno-pedantic
6089 @item -Wpedantic
6090 @itemx -pedantic
6091 Issue all the warnings demanded by strict ISO C and ISO C++;
6092 diagnose all programs that use forbidden extensions, and some other
6093 programs that do not follow ISO C and ISO C++.  This follows the version
6094 of the ISO C or C++ standard specified by any @option{-std} option used.
6096 Valid ISO C and ISO C++ programs should compile properly with or without
6097 this option (though a rare few require @option{-ansi} or a
6098 @option{-std} option specifying the version of the standard)@.  However,
6099 without this option, certain GNU extensions and traditional C and C++
6100 features are supported as well.  With this option, they are diagnosed
6101 (or rejected with @option{-pedantic-errors}).
6103 @option{-Wpedantic} does not cause warning messages for use of the
6104 alternate keywords whose names begin and end with @samp{__}.  This alternate
6105 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6106 i.e. @samp{__intN__}.
6107 Pedantic warnings are also disabled in the expression that follows
6108 @code{__extension__}.  However, only system header files should use
6109 these escape routes; application programs should avoid them.
6110 @xref{Alternate Keywords}.
6112 Some warnings about non-conforming programs are controlled by options
6113 other than @option{-Wpedantic}; in many cases they are implied by
6114 @option{-Wpedantic} but can be disabled separately by their specific
6115 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6117 Where the standard specified with @option{-std} represents a GNU
6118 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6119 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6120 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6121 where they are required by the base standard.  (It does not make sense
6122 for such warnings to be given only for features not in the specified GNU
6123 C dialect, since by definition the GNU dialects of C include all
6124 features the compiler supports with the given option, and there would be
6125 nothing to warn about.)
6127 @opindex pedantic-errors
6128 @item -pedantic-errors
6129 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6130 requires a diagnostic, in some cases where there is undefined behavior
6131 at compile-time and in some other cases that do not prevent compilation
6132 of programs that are valid according to the standard. This is not
6133 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6134 useful, as it only makes errors of the diagnostics that are controlled by
6135 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6136 are always enabled or controlled by options other than @option{-Wpedantic}.
6138 If you want the required diagnostics that are warnings by default to
6139 be errors instead, but don't also want to enable the @option{-Wpedantic}
6140 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6141 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6142 only as warnings).
6144 Some required diagnostics are errors by default, but can be reduced to
6145 warnings using @option{-fpermissive} or their specific warning option,
6146 e.g. @option{-Wno-error=narrowing}.
6148 Some diagnostics for non-ISO practices are controlled by specific
6149 warning options other than @option{-Wpedantic}, but are also made
6150 errors by @option{-pedantic-errors}.  For instance:
6152 @gccoptlist{
6153 -Wattributes @r{(for standard attributes)}
6154 -Wchanges-meaning @r{(C++)}
6155 -Wcomma-subscript @r{(C++23 or later)}
6156 -Wdeclaration-after-statement @r{(C90 or earlier)}
6157 -Welaborated-enum-base @r{(C++11 or later)}
6158 -Wimplicit-int @r{(C99 or later)}
6159 -Wimplicit-function-declaration @r{(C99 or later)}
6160 -Wincompatible-pointer-types
6161 -Wint-conversion
6162 -Wlong-long @r{(C90 or earlier)}
6163 -Wmain
6164 -Wnarrowing @r{(C++11 or later)}
6165 -Wpointer-arith
6166 -Wpointer-sign
6167 -Wincompatible-pointer-types
6168 -Wregister @r{(C++17 or later)}
6169 -Wvla @r{(C90 or earlier)}
6170 -Wwrite-strings @r{(C++11 or later)}
6173 @opindex fpermissive
6174 @item -fpermissive
6175 Downgrade some required diagnostics about nonconformant code from
6176 errors to warnings.  Thus, using @option{-fpermissive} allows some
6177 nonconforming code to compile.  Some C++ diagnostics are controlled
6178 only by this flag, but it also downgrades some C and C++ diagnostics
6179 that have their own flag:
6181 @gccoptlist{
6182 -Wnarrowing @r{(C++)}
6185 The @option{-fpermissive} option is the default for historic C language
6186 modes (@option{-std=c89}, @option{-std=gnu89}, @option{-std=c90},
6187 @option{-std=gnu90}).
6189 @opindex Wall
6190 @opindex Wno-all
6191 @item -Wall
6192 This enables all the warnings about constructions that some users
6193 consider questionable, and that are easy to avoid (or modify to
6194 prevent the warning), even in conjunction with macros.  This also
6195 enables some language-specific warnings described in @ref{C++ Dialect
6196 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6198 @option{-Wall} turns on the following warning flags:
6200 @gccoptlist{-Waddress
6201 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6202 -Warray-compare
6203 -Warray-parameter=2 @r{(C and Objective-C only)}
6204 -Wbool-compare
6205 -Wbool-operation
6206 -Wc++11-compat  -Wc++14-compat
6207 -Wcatch-value @r{(C++ and Objective-C++ only)}
6208 -Wchar-subscripts
6209 -Wcomment
6210 -Wdangling-pointer=2
6211 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6212 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6213 -Wenum-int-mismatch @r{(C and Objective-C only)}
6214 -Wformat
6215 -Wformat-overflow
6216 -Wformat-truncation
6217 -Wint-in-bool-context
6218 -Wimplicit @r{(C and Objective-C only)}
6219 -Wimplicit-int @r{(C and Objective-C only)}
6220 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6221 -Winit-self @r{(only for C++)}
6222 -Wlogical-not-parentheses
6223 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6224 -Wmaybe-uninitialized
6225 -Wmemset-elt-size
6226 -Wmemset-transposed-args
6227 -Wmisleading-indentation @r{(only for C/C++)}
6228 -Wmismatched-dealloc
6229 -Wmismatched-new-delete @r{(only for C/C++)}
6230 -Wmissing-attributes
6231 -Wmissing-braces @r{(only for C/ObjC)}
6232 -Wmultistatement-macros
6233 -Wnarrowing @r{(only for C++)}
6234 -Wnonnull
6235 -Wnonnull-compare
6236 -Wopenmp-simd
6237 -Wparentheses
6238 -Wpessimizing-move @r{(only for C++)}
6239 -Wpointer-sign
6240 -Wrange-loop-construct @r{(only for C++)}
6241 -Wreorder
6242 -Wrestrict
6243 -Wreturn-type
6244 -Wself-move @r{(only for C++)}
6245 -Wsequence-point
6246 -Wsign-compare @r{(only in C++)}
6247 -Wsizeof-array-div
6248 -Wsizeof-pointer-div
6249 -Wsizeof-pointer-memaccess
6250 -Wstrict-aliasing
6251 -Wstrict-overflow=1
6252 -Wswitch
6253 -Wtautological-compare
6254 -Wtrigraphs
6255 -Wuninitialized
6256 -Wunknown-pragmas
6257 -Wunused-function
6258 -Wunused-label
6259 -Wunused-value
6260 -Wunused-variable
6261 -Wuse-after-free=2
6262 -Wvla-parameter @r{(C and Objective-C only)}
6263 -Wvolatile-register-var
6264 -Wzero-length-bounds}
6266 Note that some warning flags are not implied by @option{-Wall}.  Some of
6267 them warn about constructions that users generally do not consider
6268 questionable, but which occasionally you might wish to check for;
6269 others warn about constructions that are necessary or hard to avoid in
6270 some cases, and there is no simple way to modify the code to suppress
6271 the warning. Some of them are enabled by @option{-Wextra} but many of
6272 them must be enabled individually.
6274 @opindex W
6275 @opindex Wextra
6276 @opindex Wno-extra
6277 @item -Wextra
6278 This enables some extra warning flags that are not enabled by
6279 @option{-Wall}. (This option used to be called @option{-W}.  The older
6280 name is still supported, but the newer name is more descriptive.)
6282 @gccoptlist{-Wclobbered
6283 -Wcast-function-type
6284 -Wdeprecated-copy @r{(C++ only)}
6285 -Wempty-body
6286 -Wenum-conversion @r{(C only)}
6287 -Wignored-qualifiers
6288 -Wimplicit-fallthrough=3
6289 -Wmissing-field-initializers
6290 -Wmissing-parameter-type @r{(C only)}
6291 -Wold-style-declaration @r{(C only)}
6292 -Woverride-init
6293 -Wsign-compare @r{(C only)}
6294 -Wstring-compare
6295 -Wredundant-move @r{(only for C++)}
6296 -Wtype-limits
6297 -Wuninitialized
6298 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6299 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6300 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6303 The option @option{-Wextra} also prints warning messages for the
6304 following cases:
6306 @itemize @bullet
6308 @item
6309 A pointer is compared against integer zero with @code{<}, @code{<=},
6310 @code{>}, or @code{>=}.
6312 @item
6313 (C++ only) An enumerator and a non-enumerator both appear in a
6314 conditional expression.
6316 @item
6317 (C++ only) Ambiguous virtual bases.
6319 @item
6320 (C++ only) Subscripting an array that has been declared @code{register}.
6322 @item
6323 (C++ only) Taking the address of a variable that has been declared
6324 @code{register}.
6326 @item
6327 (C++ only) A base class is not initialized in the copy constructor
6328 of a derived class.
6330 @end itemize
6332 @opindex Wabi
6333 @opindex Wno-abi
6334 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6336 Warn about code affected by ABI changes.  This includes code that may
6337 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6338 for the particular target.
6340 Since G++ now defaults to updating the ABI with each major release,
6341 normally @option{-Wabi} warns only about C++ ABI compatibility
6342 problems if there is a check added later in a release series for an
6343 ABI issue discovered since the initial release.  @option{-Wabi} warns
6344 about more things if an older ABI version is selected (with
6345 @option{-fabi-version=@var{n}}).
6347 @option{-Wabi} can also be used with an explicit version number to
6348 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6349 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6350 @option{-fabi-version=2}.
6352 If an explicit version number is provided and
6353 @option{-fabi-compat-version} is not specified, the version number
6354 from this option is used for compatibility aliases.  If no explicit
6355 version number is provided with this option, but
6356 @option{-fabi-compat-version} is specified, that version number is
6357 used for C++ ABI warnings.
6359 Although an effort has been made to warn about
6360 all such cases, there are probably some cases that are not warned about,
6361 even though G++ is generating incompatible code.  There may also be
6362 cases where warnings are emitted even though the code that is generated
6363 is compatible.
6365 You should rewrite your code to avoid these warnings if you are
6366 concerned about the fact that code generated by G++ may not be binary
6367 compatible with code generated by other compilers.
6369 Known incompatibilities in @option{-fabi-version=2} (which was the
6370 default from GCC 3.4 to 4.9) include:
6372 @itemize @bullet
6374 @item
6375 A template with a non-type template parameter of reference type was
6376 mangled incorrectly:
6377 @smallexample
6378 extern int N;
6379 template <int &> struct S @{@};
6380 void n (S<N>) @{2@}
6381 @end smallexample
6383 This was fixed in @option{-fabi-version=3}.
6385 @item
6386 SIMD vector types declared using @code{__attribute ((vector_size))} were
6387 mangled in a non-standard way that does not allow for overloading of
6388 functions taking vectors of different sizes.
6390 The mangling was changed in @option{-fabi-version=4}.
6392 @item
6393 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6394 qualifiers, and @code{decltype} of a plain declaration was folded away.
6396 These mangling issues were fixed in @option{-fabi-version=5}.
6398 @item
6399 Scoped enumerators passed as arguments to a variadic function are
6400 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6401 On most targets this does not actually affect the parameter passing
6402 ABI, as there is no way to pass an argument smaller than @code{int}.
6404 Also, the ABI changed the mangling of template argument packs,
6405 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6406 a class scope function used as a template argument.
6408 These issues were corrected in @option{-fabi-version=6}.
6410 @item
6411 Lambdas in default argument scope were mangled incorrectly, and the
6412 ABI changed the mangling of @code{nullptr_t}.
6414 These issues were corrected in @option{-fabi-version=7}.
6416 @item
6417 When mangling a function type with function-cv-qualifiers, the
6418 un-qualified function type was incorrectly treated as a substitution
6419 candidate.
6421 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6423 @item
6424 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6425 unaligned accesses.  Note that this did not affect the ABI of a
6426 function with a @code{nullptr_t} parameter, as parameters have a
6427 minimum alignment.
6429 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6431 @item
6432 Target-specific attributes that affect the identity of a type, such as
6433 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6434 did not affect the mangled name, leading to name collisions when
6435 function pointers were used as template arguments.
6437 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6439 @end itemize
6441 This option also enables warnings about psABI-related changes.
6442 The known psABI changes at this point include:
6444 @itemize @bullet
6446 @item
6447 For SysV/x86-64, unions with @code{long double} members are
6448 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6449 the case.  For example:
6451 @smallexample
6452 union U @{
6453   long double ld;
6454   int i;
6456 @end smallexample
6458 @noindent
6459 @code{union U} is now always passed in memory.
6461 @end itemize
6463 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6464 C++ requires that unqualified uses of a name within a class have the
6465 same meaning in the complete scope of the class, so declaring the name
6466 after using it is ill-formed:
6467 @smallexample
6468 struct A;
6469 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6470 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6471 @end smallexample
6472 By default, the B1 case is only a warning because the two declarations
6473 have the same type, while the B2 case is an error.  Both diagnostics
6474 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6475 error case can be reduced to a warning with
6476 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6478 Both diagnostics are also suppressed by @option{-fms-extensions}.
6480 @opindex Wchar-subscripts
6481 @opindex Wno-char-subscripts
6482 @item -Wchar-subscripts
6483 Warn if an array subscript has type @code{char}.  This is a common cause
6484 of error, as programmers often forget that this type is signed on some
6485 machines.
6486 This warning is enabled by @option{-Wall}.
6488 @opindex Wno-coverage-mismatch
6489 @opindex Wcoverage-mismatch
6490 @item -Wno-coverage-mismatch
6491 Warn if feedback profiles do not match when using the
6492 @option{-fprofile-use} option.
6493 If a source file is changed between compiling with @option{-fprofile-generate}
6494 and with @option{-fprofile-use}, the files with the profile feedback can fail
6495 to match the source file and GCC cannot use the profile feedback
6496 information.  By default, this warning is enabled and is treated as an
6497 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6498 warning or @option{-Wno-error=coverage-mismatch} can be used to
6499 disable the error.  Disabling the error for this warning can result in
6500 poorly optimized code and is useful only in the
6501 case of very minor changes such as bug fixes to an existing code-base.
6502 Completely disabling the warning is not recommended.
6504 @opindex Wno-coverage-invalid-line-number
6505 @opindex Wcoverage-invalid-line-number
6506 @item -Wno-coverage-invalid-line-number
6507 Warn in case a function ends earlier than it begins due
6508 to an invalid linenum macros.  The warning is emitted only
6509 with @option{--coverage} enabled.
6511 By default, this warning is enabled and is treated as an
6512 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6513 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6514 disable the error.
6516 @opindex Wno-cpp
6517 @opindex Wcpp
6518 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6519 Suppress warning messages emitted by @code{#warning} directives.
6521 @opindex Wdouble-promotion
6522 @opindex Wno-double-promotion
6523 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6524 Give a warning when a value of type @code{float} is implicitly
6525 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6526 floating-point unit implement @code{float} in hardware, but emulate
6527 @code{double} in software.  On such a machine, doing computations
6528 using @code{double} values is much more expensive because of the
6529 overhead required for software emulation.
6531 It is easy to accidentally do computations with @code{double} because
6532 floating-point literals are implicitly of type @code{double}.  For
6533 example, in:
6534 @smallexample
6535 @group
6536 float area(float radius)
6538    return 3.14159 * radius * radius;
6540 @end group
6541 @end smallexample
6542 the compiler performs the entire computation with @code{double}
6543 because the floating-point literal is a @code{double}.
6545 @opindex Wduplicate-decl-specifier
6546 @opindex Wno-duplicate-decl-specifier
6547 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6548 Warn if a declaration has duplicate @code{const}, @code{volatile},
6549 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6550 @option{-Wall}.
6552 @opindex Wformat
6553 @opindex Wno-format
6554 @opindex ffreestanding
6555 @opindex fno-builtin
6556 @opindex Wformat=
6557 @item -Wformat
6558 @itemx -Wformat=@var{n}
6559 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6560 the arguments supplied have types appropriate to the format string
6561 specified, and that the conversions specified in the format string make
6562 sense.  This includes standard functions, and others specified by format
6563 attributes (@pxref{Function Attributes}), in the @code{printf},
6564 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6565 not in the C standard) families (or other target-specific families).
6566 Which functions are checked without format attributes having been
6567 specified depends on the standard version selected, and such checks of
6568 functions without the attribute specified are disabled by
6569 @option{-ffreestanding} or @option{-fno-builtin}.
6571 The formats are checked against the format features supported by GNU
6572 libc version 2.2.  These include all ISO C90 and C99 features, as well
6573 as features from the Single Unix Specification and some BSD and GNU
6574 extensions.  Other library implementations may not support all these
6575 features; GCC does not support warning about features that go beyond a
6576 particular library's limitations.  However, if @option{-Wpedantic} is used
6577 with @option{-Wformat}, warnings are given about format features not
6578 in the selected standard version (but not for @code{strfmon} formats,
6579 since those are not in any version of the C standard).  @xref{C Dialect
6580 Options,,Options Controlling C Dialect}.
6582 @table @gcctabopt
6583 @opindex Wformat
6584 @opindex Wformat=1
6585 @item -Wformat=1
6586 @itemx -Wformat
6587 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6588 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6589 @option{-Wformat} also checks for null format arguments for several
6590 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6591 aspects of this level of format checking can be disabled by the
6592 options: @option{-Wno-format-contains-nul},
6593 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6594 @option{-Wformat} is enabled by @option{-Wall}.
6596 @opindex Wformat=2
6597 @item -Wformat=2
6598 Enable @option{-Wformat} plus additional format checks.  Currently
6599 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6600 -Wformat-y2k}.
6601 @end table
6603 @opindex Wno-format-contains-nul
6604 @opindex Wformat-contains-nul
6605 @item -Wno-format-contains-nul
6606 If @option{-Wformat} is specified, do not warn about format strings that
6607 contain NUL bytes.
6609 @opindex Wno-format-extra-args
6610 @opindex Wformat-extra-args
6611 @item -Wno-format-extra-args
6612 If @option{-Wformat} is specified, do not warn about excess arguments to a
6613 @code{printf} or @code{scanf} format function.  The C standard specifies
6614 that such arguments are ignored.
6616 Where the unused arguments lie between used arguments that are
6617 specified with @samp{$} operand number specifications, normally
6618 warnings are still given, since the implementation could not know what
6619 type to pass to @code{va_arg} to skip the unused arguments.  However,
6620 in the case of @code{scanf} formats, this option suppresses the
6621 warning if the unused arguments are all pointers, since the Single
6622 Unix Specification says that such unused arguments are allowed.
6624 @opindex Wformat-overflow
6625 @opindex Wno-format-overflow
6626 @item -Wformat-overflow
6627 @itemx -Wformat-overflow=@var{level}
6628 Warn about calls to formatted input/output functions such as @code{sprintf}
6629 and @code{vsprintf} that might overflow the destination buffer.  When the
6630 exact number of bytes written by a format directive cannot be determined
6631 at compile-time it is estimated based on heuristics that depend on the
6632 @var{level} argument and on optimization.  While enabling optimization
6633 will in most cases improve the accuracy of the warning, it may also
6634 result in false positives.
6636 @table @gcctabopt
6637 @opindex Wformat-overflow
6638 @opindex Wno-format-overflow
6639 @item -Wformat-overflow
6640 @itemx -Wformat-overflow=1
6641 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6642 employs a conservative approach that warns only about calls that most
6643 likely overflow the buffer.  At this level, numeric arguments to format
6644 directives with unknown values are assumed to have the value of one, and
6645 strings of unknown length to be empty.  Numeric arguments that are known
6646 to be bounded to a subrange of their type, or string arguments whose output
6647 is bounded either by their directive's precision or by a finite set of
6648 string literals, are assumed to take on the value within the range that
6649 results in the most bytes on output.  For example, the call to @code{sprintf}
6650 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6651 the terminating NUL character (@code{'\0'}) appended by the function
6652 to the destination buffer will be written past its end.  Increasing
6653 the size of the buffer by a single byte is sufficient to avoid the
6654 warning, though it may not be sufficient to avoid the overflow.
6656 @smallexample
6657 void f (int a, int b)
6659   char buf [13];
6660   sprintf (buf, "a = %i, b = %i\n", a, b);
6662 @end smallexample
6664 @item -Wformat-overflow=2
6665 Level @var{2} warns also about calls that might overflow the destination
6666 buffer given an argument of sufficient length or magnitude.  At level
6667 @var{2}, unknown numeric arguments are assumed to have the minimum
6668 representable value for signed types with a precision greater than 1, and
6669 the maximum representable value otherwise.  Unknown string arguments whose
6670 length cannot be assumed to be bounded either by the directive's precision,
6671 or by a finite set of string literals they may evaluate to, or the character
6672 array they may point to, are assumed to be 1 character long.
6674 At level @var{2}, the call in the example above is again diagnosed, but
6675 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6676 @code{%i} directive will write some of its digits beyond the end of
6677 the destination buffer.  To make the call safe regardless of the values
6678 of the two variables, the size of the destination buffer must be increased
6679 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6680 an informational note following the warning.
6682 An alternative to increasing the size of the destination buffer is to
6683 constrain the range of formatted values.  The maximum length of string
6684 arguments can be bounded by specifying the precision in the format
6685 directive.  When numeric arguments of format directives can be assumed
6686 to be bounded by less than the precision of their type, choosing
6687 an appropriate length modifier to the format specifier will reduce
6688 the required buffer size.  For example, if @var{a} and @var{b} in the
6689 example above can be assumed to be within the precision of
6690 the @code{short int} type then using either the @code{%hi} format
6691 directive or casting the argument to @code{short} reduces the maximum
6692 required size of the buffer to 24 bytes.
6694 @smallexample
6695 void f (int a, int b)
6697   char buf [23];
6698   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6700 @end smallexample
6701 @end table
6703 @opindex Wno-format-zero-length
6704 @opindex Wformat-zero-length
6705 @item -Wno-format-zero-length
6706 If @option{-Wformat} is specified, do not warn about zero-length formats.
6707 The C standard specifies that zero-length formats are allowed.
6709 @opindex Wformat-nonliteral
6710 @opindex Wno-format-nonliteral
6711 @item -Wformat-nonliteral
6712 If @option{-Wformat} is specified, also warn if the format string is not a
6713 string literal and so cannot be checked, unless the format function
6714 takes its format arguments as a @code{va_list}.
6716 @opindex Wformat-security
6717 @opindex Wno-format-security
6718 @item -Wformat-security
6719 If @option{-Wformat} is specified, also warn about uses of format
6720 functions that represent possible security problems.  At present, this
6721 warns about calls to @code{printf} and @code{scanf} functions where the
6722 format string is not a string literal and there are no format arguments,
6723 as in @code{printf (foo);}.  This may be a security hole if the format
6724 string came from untrusted input and contains @samp{%n}.  (This is
6725 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6726 in future warnings may be added to @option{-Wformat-security} that are not
6727 included in @option{-Wformat-nonliteral}.)
6729 @opindex Wformat-signedness
6730 @opindex Wno-format-signedness
6731 @item -Wformat-signedness
6732 If @option{-Wformat} is specified, also warn if the format string
6733 requires an unsigned argument and the argument is signed and vice versa.
6735 @opindex Wformat-truncation
6736 @opindex Wno-format-truncation
6737 @item -Wformat-truncation
6738 @itemx -Wformat-truncation=@var{level}
6739 Warn about calls to formatted input/output functions such as @code{snprintf}
6740 and @code{vsnprintf} that might result in output truncation.  When the exact
6741 number of bytes written by a format directive cannot be determined at
6742 compile-time it is estimated based on heuristics that depend on
6743 the @var{level} argument and on optimization.  While enabling optimization
6744 will in most cases improve the accuracy of the warning, it may also result
6745 in false positives.  Except as noted otherwise, the option uses the same
6746 logic @option{-Wformat-overflow}.
6748 @table @gcctabopt
6749 @opindex Wformat-truncation
6750 @opindex Wno-format-truncation
6751 @item -Wformat-truncation
6752 @itemx -Wformat-truncation=1
6753 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6754 employs a conservative approach that warns only about calls to bounded
6755 functions whose return value is unused and that will most likely result
6756 in output truncation.
6758 @item -Wformat-truncation=2
6759 Level @var{2} warns also about calls to bounded functions whose return
6760 value is used and that might result in truncation given an argument of
6761 sufficient length or magnitude.
6762 @end table
6764 @opindex Wformat-y2k
6765 @opindex Wno-format-y2k
6766 @item -Wformat-y2k
6767 If @option{-Wformat} is specified, also warn about @code{strftime}
6768 formats that may yield only a two-digit year.
6770 @opindex Wnonnull
6771 @opindex Wno-nonnull
6772 @item -Wnonnull
6773 Warn about passing a null pointer for arguments marked as
6774 requiring a non-null value by the @code{nonnull} function attribute.
6776 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6777 can be disabled with the @option{-Wno-nonnull} option.
6779 @opindex Wnonnull-compare
6780 @opindex Wno-nonnull-compare
6781 @item -Wnonnull-compare
6782 Warn when comparing an argument marked with the @code{nonnull}
6783 function attribute against null inside the function.
6785 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6786 can be disabled with the @option{-Wno-nonnull-compare} option.
6788 @opindex Wnull-dereference
6789 @opindex Wno-null-dereference
6790 @item -Wnull-dereference
6791 Warn if the compiler detects paths that trigger erroneous or
6792 undefined behavior due to dereferencing a null pointer.  This option
6793 is only active when @option{-fdelete-null-pointer-checks} is active,
6794 which is enabled by optimizations in most targets.  The precision of
6795 the warnings depends on the optimization options used.
6797 @opindex Wnrvo
6798 @opindex Wno-nrvo
6799 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6800 Warn if the compiler does not elide the copy from a local variable to
6801 the return value of a function in a context where it is allowed by
6802 [class.copy.elision].  This elision is commonly known as the Named
6803 Return Value Optimization.  For instance, in the example below the
6804 compiler cannot elide copies from both v1 and v2, so it elides neither.
6806 @smallexample
6807 std::vector<int> f()
6809   std::vector<int> v1, v2;
6810   // ...
6811   if (cond) return v1;
6812   else return v2; // warning: not eliding copy
6814 @end smallexample
6816 @opindex Winfinite-recursion
6817 @opindex Wno-infinite-recursion
6818 @item -Winfinite-recursion
6819 Warn about infinitely recursive calls.  The warning is effective at all
6820 optimization levels but requires optimization in order to detect infinite
6821 recursion in calls between two or more functions.
6822 @option{-Winfinite-recursion} is included in @option{-Wall}.
6824 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6825 similar diagnostic, but is implemented in a different way (as part of
6826 @option{-fanalyzer}).
6828 @opindex Winit-self
6829 @opindex Wno-init-self
6830 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6831 Warn about uninitialized variables that are initialized with themselves.
6832 Note this option can only be used with the @option{-Wuninitialized} option.
6834 For example, GCC warns about @code{i} being uninitialized in the
6835 following snippet only when @option{-Winit-self} has been specified:
6836 @smallexample
6837 @group
6838 int f()
6840   int i = i;
6841   return i;
6843 @end group
6844 @end smallexample
6846 This warning is enabled by @option{-Wall} in C++.
6848 @opindex Wimplicit-int
6849 @opindex Wno-implicit-int
6850 @item -Wno-implicit-int @r{(C and Objective-C only)}
6851 This option controls warnings when a declaration does not specify a type.
6852 This warning is enabled by default in C99 and later dialects of C,
6853 and also by @option{-Wall}.
6855 This warning is upgraded to an error by @option{-pedantic-errors}.
6857 @opindex Wimplicit-function-declaration
6858 @opindex Wno-implicit-function-declaration
6859 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6860 This option controls warnings when a function is used before being declared.
6861 This warning is enabled by default in C99 and later dialects of C,
6862 and also by @option{-Wall}.
6864 This warning is upgraded to an error by @option{-pedantic-errors}.
6866 @opindex Wimplicit
6867 @opindex Wno-implicit
6868 @item -Wimplicit @r{(C and Objective-C only)}
6869 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6870 This warning is enabled by @option{-Wall}.
6872 @opindex Wimplicit-fallthrough
6873 @opindex Wno-implicit-fallthrough
6874 @item -Wimplicit-fallthrough
6875 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6876 and @option{-Wno-implicit-fallthrough} is the same as
6877 @option{-Wimplicit-fallthrough=0}.
6879 @opindex Wimplicit-fallthrough=
6880 @item -Wimplicit-fallthrough=@var{n}
6881 Warn when a switch case falls through.  For example:
6883 @smallexample
6884 @group
6885 switch (cond)
6886   @{
6887   case 1:
6888     a = 1;
6889     break;
6890   case 2:
6891     a = 2;
6892   case 3:
6893     a = 3;
6894     break;
6895   @}
6896 @end group
6897 @end smallexample
6899 This warning does not warn when the last statement of a case cannot
6900 fall through, e.g. when there is a return statement or a call to function
6901 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6902 also takes into account control flow statements, such as ifs, and only
6903 warns when appropriate.  E.g.@:
6905 @smallexample
6906 @group
6907 switch (cond)
6908   @{
6909   case 1:
6910     if (i > 3) @{
6911       bar (5);
6912       break;
6913     @} else if (i < 1) @{
6914       bar (0);
6915     @} else
6916       return;
6917   default:
6918     @dots{}
6919   @}
6920 @end group
6921 @end smallexample
6923 Since there are occasions where a switch case fall through is desirable,
6924 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6925 to be used along with a null statement to suppress this warning that
6926 would normally occur:
6928 @smallexample
6929 @group
6930 switch (cond)
6931   @{
6932   case 1:
6933     bar (0);
6934     __attribute__ ((fallthrough));
6935   default:
6936     @dots{}
6937   @}
6938 @end group
6939 @end smallexample
6941 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6942 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6943 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6944 Instead of these attributes, it is also possible to add a fallthrough comment
6945 to silence the warning.  The whole body of the C or C++ style comment should
6946 match the given regular expressions listed below.  The option argument @var{n}
6947 specifies what kind of comments are accepted:
6949 @itemize @bullet
6951 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6953 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6954 expression, any comment is used as fallthrough comment.
6956 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6957 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6959 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6960 following regular expressions:
6962 @itemize @bullet
6964 @item @code{-fallthrough}
6966 @item @code{@@fallthrough@@}
6968 @item @code{lint -fallthrough[ \t]*}
6970 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6972 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6974 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6976 @end itemize
6978 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6979 following regular expressions:
6981 @itemize @bullet
6983 @item @code{-fallthrough}
6985 @item @code{@@fallthrough@@}
6987 @item @code{lint -fallthrough[ \t]*}
6989 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6991 @end itemize
6993 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6994 fallthrough comments, only attributes disable the warning.
6996 @end itemize
6998 The comment needs to be followed after optional whitespace and other comments
6999 by @code{case} or @code{default} keywords or by a user label that precedes some
7000 @code{case} or @code{default} label.
7002 @smallexample
7003 @group
7004 switch (cond)
7005   @{
7006   case 1:
7007     bar (0);
7008     /* FALLTHRU */
7009   default:
7010     @dots{}
7011   @}
7012 @end group
7013 @end smallexample
7015 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
7017 @opindex Wif-not-aligned
7018 @opindex Wno-if-not-aligned
7019 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7020 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
7021 should be issued.  These warnings are enabled by default.
7023 @opindex Wignored-qualifiers
7024 @opindex Wno-ignored-qualifiers
7025 @item -Wignored-qualifiers @r{(C and C++ only)}
7026 Warn if the return type of a function has a type qualifier
7027 such as @code{const}.  For ISO C such a type qualifier has no effect,
7028 since the value returned by a function is not an lvalue.
7029 For C++, the warning is only emitted for scalar types or @code{void}.
7030 ISO C prohibits qualified @code{void} return types on function
7031 definitions, so such return types always receive a warning
7032 even without this option.
7034 This warning is also enabled by @option{-Wextra}.
7036 @opindex Wignored-attributes
7037 @opindex Wno-ignored-attributes
7038 @item -Wno-ignored-attributes @r{(C and C++ only)}
7039 This option controls warnings when an attribute is ignored.
7040 This is different from the
7041 @option{-Wattributes} option in that it warns whenever the compiler decides
7042 to drop an attribute, not that the attribute is either unknown, used in a
7043 wrong place, etc.  This warning is enabled by default.
7045 @opindex Wmain
7046 @opindex Wno-main
7047 @item -Wmain
7048 Warn if the type of @code{main} is suspicious.  @code{main} should be
7049 a function with external linkage, returning int, taking either zero
7050 arguments, two, or three arguments of appropriate types.  This warning
7051 is enabled by default in C++ and is enabled by either @option{-Wall}
7052 or @option{-Wpedantic}.
7054 This warning is upgraded to an error by @option{-pedantic-errors}.
7056 @opindex Wmisleading-indentation
7057 @opindex Wno-misleading-indentation
7058 @item -Wmisleading-indentation @r{(C and C++ only)}
7059 Warn when the indentation of the code does not reflect the block structure.
7060 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
7061 @code{for} clauses with a guarded statement that does not use braces,
7062 followed by an unguarded statement with the same indentation.
7064 In the following example, the call to ``bar'' is misleadingly indented as
7065 if it were guarded by the ``if'' conditional.
7067 @smallexample
7068   if (some_condition ())
7069     foo ();
7070     bar ();  /* Gotcha: this is not guarded by the "if".  */
7071 @end smallexample
7073 In the case of mixed tabs and spaces, the warning uses the
7074 @option{-ftabstop=} option to determine if the statements line up
7075 (defaulting to 8).
7077 The warning is not issued for code involving multiline preprocessor logic
7078 such as the following example.
7080 @smallexample
7081   if (flagA)
7082     foo (0);
7083 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7084   if (flagB)
7085 #endif
7086     foo (1);
7087 @end smallexample
7089 The warning is not issued after a @code{#line} directive, since this
7090 typically indicates autogenerated code, and no assumptions can be made
7091 about the layout of the file that the directive references.
7093 This warning is enabled by @option{-Wall} in C and C++.
7095 @opindex Wmissing-attributes
7096 @opindex Wno-missing-attributes
7097 @item -Wmissing-attributes
7098 Warn when a declaration of a function is missing one or more attributes
7099 that a related function is declared with and whose absence may adversely
7100 affect the correctness or efficiency of generated code.  For example,
7101 the warning is issued for declarations of aliases that use attributes
7102 to specify less restrictive requirements than those of their targets.
7103 This typically represents a potential optimization opportunity.
7104 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7105 issued when the alias is more restrictive than the target, which could
7106 lead to incorrect code generation.
7107 Attributes considered include @code{alloc_align}, @code{alloc_size},
7108 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7109 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7110 @code{returns_nonnull}, and @code{returns_twice}.
7112 In C++, the warning is issued when an explicit specialization of a primary
7113 template declared with attribute @code{alloc_align}, @code{alloc_size},
7114 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7115 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7116 @code{error}, and @code{warning} suppress the warning.
7117 (@pxref{Function Attributes}).
7119 You can use the @code{copy} attribute to apply the same
7120 set of attributes to a declaration as that on another declaration without
7121 explicitly enumerating the attributes. This attribute can be applied
7122 to declarations of functions (@pxref{Common Function Attributes}),
7123 variables (@pxref{Common Variable Attributes}), or types
7124 (@pxref{Common Type Attributes}).
7126 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7128 For example, since the declaration of the primary function template
7129 below makes use of both attribute @code{malloc} and @code{alloc_size}
7130 the declaration of the explicit specialization of the template is
7131 diagnosed because it is missing one of the attributes.
7133 @smallexample
7134 template <class T>
7135 T* __attribute__ ((malloc, alloc_size (1)))
7136 allocate (size_t);
7138 template <>
7139 void* __attribute__ ((malloc))   // missing alloc_size
7140 allocate<void> (size_t);
7141 @end smallexample
7143 @opindex Wmissing-braces
7144 @opindex Wno-missing-braces
7145 @item -Wmissing-braces
7146 Warn if an aggregate or union initializer is not fully bracketed.  In
7147 the following example, the initializer for @code{a} is not fully
7148 bracketed, but that for @code{b} is fully bracketed.
7150 @smallexample
7151 int a[2][2] = @{ 0, 1, 2, 3 @};
7152 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7153 @end smallexample
7155 This warning is enabled by @option{-Wall}.
7157 @opindex Wmissing-include-dirs
7158 @opindex Wno-missing-include-dirs
7159 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7160 Warn if a user-supplied include directory does not exist. This option is disabled
7161 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7162 enabled by default by warning for -I and -J, only.
7164 @opindex Wmissing-profile
7165 @opindex Wno-missing-profile
7166 @item -Wno-missing-profile
7167 This option controls warnings if feedback profiles are missing when using the
7168 @option{-fprofile-use} option.
7169 This option diagnoses those cases where a new function or a new file is added
7170 between compiling with @option{-fprofile-generate} and with
7171 @option{-fprofile-use}, without regenerating the profiles.
7172 In these cases, the profile feedback data files do not contain any
7173 profile feedback information for
7174 the newly added function or file respectively.  Also, in the case when profile
7175 count data (.gcda) files are removed, GCC cannot use any profile feedback
7176 information.  In all these cases, warnings are issued to inform you that a
7177 profile generation step is due.
7178 Ignoring the warning can result in poorly optimized code.
7179 @option{-Wno-missing-profile} can be used to
7180 disable the warning, but this is not recommended and should be done only
7181 when non-existent profile data is justified.
7183 @opindex Wmismatched-dealloc
7184 @opindex Wno-mismatched-dealloc
7185 @item -Wmismatched-dealloc
7187 Warn for calls to deallocation functions with pointer arguments returned
7188 from from allocations functions for which the former isn't a suitable
7189 deallocator.  A pair of functions can be associated as matching allocators
7190 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7191 the @option{-fno-builtin} option the standard functions @code{calloc},
7192 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7193 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7194 associated as matching allocators and deallocators.  In the following
7195 example @code{mydealloc} is the deallocator for pointers returned from
7196 @code{myalloc}.
7198 @smallexample
7199 void mydealloc (void*);
7201 __attribute__ ((malloc (mydealloc, 1))) void*
7202 myalloc (size_t);
7204 void f (void)
7206   void *p = myalloc (32);
7207   // @dots{}use p@dots{}
7208   free (p);   // warning: not a matching deallocator for myalloc
7209   mydealloc (p);   // ok
7211 @end smallexample
7213 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7214 mismatches involving either @code{operator new} or @code{operator delete}.
7216 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7218 @opindex Wmultistatement-macros
7219 @opindex Wno-multistatement-macros
7220 @item -Wmultistatement-macros
7221 Warn about unsafe multiple statement macros that appear to be guarded
7222 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7223 @code{while}, in which only the first statement is actually guarded after
7224 the macro is expanded.
7226 For example:
7228 @smallexample
7229 #define DOIT x++; y++
7230 if (c)
7231   DOIT;
7232 @end smallexample
7234 will increment @code{y} unconditionally, not just when @code{c} holds.
7235 The can usually be fixed by wrapping the macro in a do-while loop:
7236 @smallexample
7237 #define DOIT do @{ x++; y++; @} while (0)
7238 if (c)
7239   DOIT;
7240 @end smallexample
7242 This warning is enabled by @option{-Wall} in C and C++.
7244 @opindex Wparentheses
7245 @opindex Wno-parentheses
7246 @item -Wparentheses
7247 Warn if parentheses are omitted in certain contexts, such
7248 as when there is an assignment in a context where a truth value
7249 is expected, or when operators are nested whose precedence people
7250 often get confused about.
7252 Also warn if a comparison like @code{x<=y<=z} appears; this is
7253 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7254 interpretation from that of ordinary mathematical notation.
7256 Also warn for dangerous uses of the GNU extension to
7257 @code{?:} with omitted middle operand. When the condition
7258 in the @code{?}: operator is a boolean expression, the omitted value is
7259 always 1.  Often programmers expect it to be a value computed
7260 inside the conditional expression instead.
7262 For C++ this also warns for some cases of unnecessary parentheses in
7263 declarations, which can indicate an attempt at a function call instead
7264 of a declaration:
7265 @smallexample
7267   // Declares a local variable called mymutex.
7268   std::unique_lock<std::mutex> (mymutex);
7269   // User meant std::unique_lock<std::mutex> lock (mymutex);
7271 @end smallexample
7273 This warning is enabled by @option{-Wall}.
7275 @opindex Wself-move
7276 @opindex Wno-self-move
7277 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7278 This warning warns when a value is moved to itself with @code{std::move}.
7279 Such a @code{std::move} typically has no effect.
7281 @smallexample
7282 struct T @{
7283 @dots{}
7285 void fn()
7287   T t;
7288   @dots{}
7289   t = std::move (t);
7291 @end smallexample
7293 This warning is enabled by @option{-Wall}.
7295 @opindex Wsequence-point
7296 @opindex Wno-sequence-point
7297 @item -Wsequence-point
7298 Warn about code that may have undefined semantics because of violations
7299 of sequence point rules in the C and C++ standards.
7301 The C and C++ standards define the order in which expressions in a C/C++
7302 program are evaluated in terms of @dfn{sequence points}, which represent
7303 a partial ordering between the execution of parts of the program: those
7304 executed before the sequence point, and those executed after it.  These
7305 occur after the evaluation of a full expression (one which is not part
7306 of a larger expression), after the evaluation of the first operand of a
7307 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7308 function is called (but after the evaluation of its arguments and the
7309 expression denoting the called function), and in certain other places.
7310 Other than as expressed by the sequence point rules, the order of
7311 evaluation of subexpressions of an expression is not specified.  All
7312 these rules describe only a partial order rather than a total order,
7313 since, for example, if two functions are called within one expression
7314 with no sequence point between them, the order in which the functions
7315 are called is not specified.  However, the standards committee have
7316 ruled that function calls do not overlap.
7318 It is not specified when between sequence points modifications to the
7319 values of objects take effect.  Programs whose behavior depends on this
7320 have undefined behavior; the C and C++ standards specify that ``Between
7321 the previous and next sequence point an object shall have its stored
7322 value modified at most once by the evaluation of an expression.
7323 Furthermore, the prior value shall be read only to determine the value
7324 to be stored.''.  If a program breaks these rules, the results on any
7325 particular implementation are entirely unpredictable.
7327 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7328 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7329 diagnosed by this option, and it may give an occasional false positive
7330 result, but in general it has been found fairly effective at detecting
7331 this sort of problem in programs.
7333 The C++17 standard will define the order of evaluation of operands in
7334 more cases: in particular it requires that the right-hand side of an
7335 assignment be evaluated before the left-hand side, so the above
7336 examples are no longer undefined.  But this option will still warn
7337 about them, to help people avoid writing code that is undefined in C
7338 and earlier revisions of C++.
7340 The standard is worded confusingly, therefore there is some debate
7341 over the precise meaning of the sequence point rules in subtle cases.
7342 Links to discussions of the problem, including proposed formal
7343 definitions, may be found on the GCC readings page, at
7344 @uref{https://gcc.gnu.org/@/readings.html}.
7346 This warning is enabled by @option{-Wall} for C and C++.
7348 @opindex Wno-return-local-addr
7349 @opindex Wreturn-local-addr
7350 @item -Wno-return-local-addr
7351 Do not warn about returning a pointer (or in C++, a reference) to a
7352 variable that goes out of scope after the function returns.
7354 @opindex Wreturn-mismatch
7355 @opindex Wno-return-mismatch
7356 @item -Wreturn-mismatch
7357 Warn about return statements without an expressions in functions which
7358 do not return @code{void}.  Also warn about a @code{return} statement
7359 with an expression in a function whose return type is @code{void},
7360 unless the expression type is also @code{void}.  As a GNU extension, the
7361 latter case is accepted without a warning unless @option{-Wpedantic} is
7362 used.
7364 Attempting to use the return value of a non-@code{void} function other
7365 than @code{main} that flows off the end by reaching the closing curly
7366 brace that terminates the function is undefined.
7368 This warning is specific to C and enabled by default.
7370 @opindex Wreturn-type
7371 @opindex Wno-return-type
7372 @item -Wreturn-type
7373 Warn whenever a function is defined with a return type that defaults to
7374 @code{int} (unless @option{-Wimplicit-int} is active, which takes
7375 precedence).  Also warn if execution may reach the end of the function
7376 body, or if the function does not contain any return statement at all.
7378 Attempting to use the return value of a non-@code{void} function other
7379 than @code{main} that flows off the end by reaching the closing curly
7380 brace that terminates the function is undefined.
7382 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7383 than @code{main} results in undefined behavior even when the value of
7384 the function is not used.
7386 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7388 @opindex Wshift-count-negative
7389 @opindex Wno-shift-count-negative
7390 @item -Wno-shift-count-negative
7391 Controls warnings if a shift count is negative.
7392 This warning is enabled by default.
7394 @opindex Wshift-count-overflow
7395 @opindex Wno-shift-count-overflow
7396 @item -Wno-shift-count-overflow
7397 Controls warnings if a shift count is greater than or equal to the bit width
7398 of the type.  This warning is enabled by default.
7400 @opindex Wshift-negative-value
7401 @opindex Wno-shift-negative-value
7402 @item -Wshift-negative-value
7403 Warn if left shifting a negative value.  This warning is enabled by
7404 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7406 @opindex Wshift-overflow
7407 @opindex Wno-shift-overflow
7408 @item -Wno-shift-overflow
7409 @itemx -Wshift-overflow=@var{n}
7410 These options control warnings about left shift overflows.
7412 @table @gcctabopt
7413 @item -Wshift-overflow=1
7414 This is the warning level of @option{-Wshift-overflow} and is enabled
7415 by default in C99 and C++11 modes (and newer).  This warning level does
7416 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7417 an overflow is still rejected in contexts where an integer constant expression
7418 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7419 shifts always wrap.
7421 @item -Wshift-overflow=2
7422 This warning level also warns about left-shifting 1 into the sign bit,
7423 unless C++14 mode (or newer) is active.
7424 @end table
7426 @opindex Wswitch
7427 @opindex Wno-switch
7428 @item -Wswitch
7429 Warn whenever a @code{switch} statement has an index of enumerated type
7430 and lacks a @code{case} for one or more of the named codes of that
7431 enumeration.  (The presence of a @code{default} label prevents this
7432 warning.)  @code{case} labels outside the enumeration range also
7433 provoke warnings when this option is used (even if there is a
7434 @code{default} label).
7435 This warning is enabled by @option{-Wall}.
7437 @opindex Wswitch-default
7438 @opindex Wno-switch-default
7439 @item -Wswitch-default
7440 Warn whenever a @code{switch} statement does not have a @code{default}
7441 case.
7443 @opindex Wswitch-enum
7444 @opindex Wno-switch-enum
7445 @item -Wswitch-enum
7446 Warn whenever a @code{switch} statement has an index of enumerated type
7447 and lacks a @code{case} for one or more of the named codes of that
7448 enumeration.  @code{case} labels outside the enumeration range also
7449 provoke warnings when this option is used.  The only difference
7450 between @option{-Wswitch} and this option is that this option gives a
7451 warning about an omitted enumeration code even if there is a
7452 @code{default} label.
7454 @opindex Wswitch-bool
7455 @opindex Wno-switch-bool
7456 @item -Wno-switch-bool
7457 Do not warn when a @code{switch} statement has an index of boolean type
7458 and the case values are outside the range of a boolean type.
7459 It is possible to suppress this warning by casting the controlling
7460 expression to a type other than @code{bool}.  For example:
7461 @smallexample
7462 @group
7463 switch ((int) (a == 4))
7464   @{
7465   @dots{}
7466   @}
7467 @end group
7468 @end smallexample
7469 This warning is enabled by default for C and C++ programs.
7471 @opindex Wswitch-outside-range
7472 @opindex Wno-switch-outside-range
7473 @item -Wno-switch-outside-range
7474 This option controls warnings when a @code{switch} case has a value
7475 that is outside of its
7476 respective type range.  This warning is enabled by default for
7477 C and C++ programs.
7479 @opindex Wswitch-unreachable
7480 @opindex Wno-switch-unreachable
7481 @item -Wno-switch-unreachable
7482 Do not warn when a @code{switch} statement contains statements between the
7483 controlling expression and the first case label, which will never be
7484 executed.  For example:
7485 @smallexample
7486 @group
7487 switch (cond)
7488   @{
7489    i = 15;
7490   @dots{}
7491    case 5:
7492   @dots{}
7493   @}
7494 @end group
7495 @end smallexample
7496 @option{-Wswitch-unreachable} does not warn if the statement between the
7497 controlling expression and the first case label is just a declaration:
7498 @smallexample
7499 @group
7500 switch (cond)
7501   @{
7502    int i;
7503   @dots{}
7504    case 5:
7505    i = 5;
7506   @dots{}
7507   @}
7508 @end group
7509 @end smallexample
7510 This warning is enabled by default for C and C++ programs.
7512 @opindex Wsync-nand
7513 @opindex Wno-sync-nand
7514 @item -Wsync-nand @r{(C and C++ only)}
7515 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7516 built-in functions are used.  These functions changed semantics in GCC 4.4.
7518 @opindex Wtrivial-auto-var-init
7519 @opindex Wno-trivial-auto-var-init
7520 @item -Wtrivial-auto-var-init
7521 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7522 variable.  A common situation is an automatic variable that is declared
7523 between the controlling expression and the first case label of a @code{switch}
7524 statement.
7526 @opindex Wunused-but-set-parameter
7527 @opindex Wno-unused-but-set-parameter
7528 @item -Wunused-but-set-parameter
7529 Warn whenever a function parameter is assigned to, but otherwise unused
7530 (aside from its declaration).
7532 To suppress this warning use the @code{unused} attribute
7533 (@pxref{Variable Attributes}).
7535 This warning is also enabled by @option{-Wunused} together with
7536 @option{-Wextra}.
7538 @opindex Wunused-but-set-variable
7539 @opindex Wno-unused-but-set-variable
7540 @item -Wunused-but-set-variable
7541 Warn whenever a local variable is assigned to, but otherwise unused
7542 (aside from its declaration).
7543 This warning is enabled by @option{-Wall}.
7545 To suppress this warning use the @code{unused} attribute
7546 (@pxref{Variable Attributes}).
7548 This warning is also enabled by @option{-Wunused}, which is enabled
7549 by @option{-Wall}.
7551 @opindex Wunused-function
7552 @opindex Wno-unused-function
7553 @item -Wunused-function
7554 Warn whenever a static function is declared but not defined or a
7555 non-inline static function is unused.
7556 This warning is enabled by @option{-Wall}.
7558 @opindex Wunused-label
7559 @opindex Wno-unused-label
7560 @item -Wunused-label
7561 Warn whenever a label is declared but not used.
7562 This warning is enabled by @option{-Wall}.
7564 To suppress this warning use the @code{unused} attribute
7565 (@pxref{Variable Attributes}).
7567 @opindex Wunused-local-typedefs
7568 @opindex Wno-unused-local-typedefs
7569 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7570 Warn when a typedef locally defined in a function is not used.
7571 This warning is enabled by @option{-Wall}.
7573 @opindex Wunused-parameter
7574 @opindex Wno-unused-parameter
7575 @item -Wunused-parameter
7576 Warn whenever a function parameter is unused aside from its declaration.
7578 To suppress this warning use the @code{unused} attribute
7579 (@pxref{Variable Attributes}).
7581 @opindex Wunused-result
7582 @opindex Wno-unused-result
7583 @item -Wno-unused-result
7584 Do not warn if a caller of a function marked with attribute
7585 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7586 its return value. The default is @option{-Wunused-result}.
7588 @opindex Wunused-variable
7589 @opindex Wno-unused-variable
7590 @item -Wunused-variable
7591 Warn whenever a local or static variable is unused aside from its
7592 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7593 but not for C++. This warning is enabled by @option{-Wall}.
7595 To suppress this warning use the @code{unused} attribute
7596 (@pxref{Variable Attributes}).
7598 @opindex Wunused-const-variable
7599 @opindex Wno-unused-const-variable
7600 @item -Wunused-const-variable
7601 @itemx -Wunused-const-variable=@var{n}
7602 Warn whenever a constant static variable is unused aside from its declaration.
7603 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7604 for C, but not for C++. In C this declares variable storage, but in C++ this
7605 is not an error since const variables take the place of @code{#define}s.
7607 To suppress this warning use the @code{unused} attribute
7608 (@pxref{Variable Attributes}).
7610 @table @gcctabopt
7611 @item -Wunused-const-variable=1
7612 This is the warning level that is enabled by @option{-Wunused-variable} for
7613 C.  It warns only about unused static const variables defined in the main
7614 compilation unit, but not about static const variables declared in any
7615 header included.
7617 @item -Wunused-const-variable=2
7618 This warning level also warns for unused constant static variables in
7619 headers (excluding system headers).  This is the warning level of
7620 @option{-Wunused-const-variable} and must be explicitly requested since
7621 in C++ this isn't an error and in C it might be harder to clean up all
7622 headers included.
7623 @end table
7625 @opindex Wunused-value
7626 @opindex Wno-unused-value
7627 @item -Wunused-value
7628 Warn whenever a statement computes a result that is explicitly not
7629 used. To suppress this warning cast the unused expression to
7630 @code{void}. This includes an expression-statement or the left-hand
7631 side of a comma expression that contains no side effects. For example,
7632 an expression such as @code{x[i,j]} causes a warning, while
7633 @code{x[(void)i,j]} does not.
7635 This warning is enabled by @option{-Wall}.
7637 @opindex Wunused
7638 @opindex Wno-unused
7639 @item -Wunused
7640 All the above @option{-Wunused} options combined.
7642 In order to get a warning about an unused function parameter, you must
7643 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7644 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7646 @opindex Wuninitialized
7647 @opindex Wno-uninitialized
7648 @item -Wuninitialized
7649 Warn if an object with automatic or allocated storage duration is used
7650 without having been initialized.  In C++, also warn if a non-static
7651 reference or non-static @code{const} member appears in a class without
7652 constructors.
7654 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7655 object to a @code{const}-qualified argument of a built-in function known to
7656 read the object is also diagnosed by this warning.
7657 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7659 If you want to warn about code that uses the uninitialized value of the
7660 variable in its own initializer, use the @option{-Winit-self} option.
7662 These warnings occur for individual uninitialized elements of
7663 structure, union or array variables as well as for variables that are
7664 uninitialized as a whole.  They do not occur for variables or elements
7665 declared @code{volatile}.  Because these warnings depend on
7666 optimization, the exact variables or elements for which there are
7667 warnings depend on the precise optimization options and version of GCC
7668 used.
7670 Note that there may be no warning about a variable that is used only
7671 to compute a value that itself is never used, because such
7672 computations may be deleted by data flow analysis before the warnings
7673 are printed.
7675 In C++, this warning also warns about using uninitialized objects in
7676 member-initializer-lists.  For example, GCC warns about @code{b} being
7677 uninitialized in the following snippet:
7679 @smallexample
7680 struct A @{
7681   int a;
7682   int b;
7683   A() : a(b) @{ @}
7685 @end smallexample
7687 @opindex Winvalid-memory-model
7688 @opindex Wno-invalid-memory-model
7689 @item -Wno-invalid-memory-model
7690 This option controls warnings
7691 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7692 and the C11 atomic generic functions with a memory consistency argument
7693 that is either invalid for the operation or outside the range of values
7694 of the @code{memory_order} enumeration.  For example, since the
7695 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7696 defined for the relaxed, release, and sequentially consistent memory
7697 orders the following code is diagnosed:
7699 @smallexample
7700 void store (int *i)
7702   __atomic_store_n (i, 0, memory_order_consume);
7704 @end smallexample
7706 @option{-Winvalid-memory-model} is enabled by default.
7708 @opindex Wmaybe-uninitialized
7709 @opindex Wno-maybe-uninitialized
7710 @item -Wmaybe-uninitialized
7711 For an object with automatic or allocated storage duration, if there exists
7712 a path from the function entry to a use of the object that is initialized,
7713 but there exist some other paths for which the object is not initialized,
7714 the compiler emits a warning if it cannot prove the uninitialized paths
7715 are not executed at run time.
7717 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7718 object to a @code{const}-qualified function argument is also diagnosed by
7719 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7720 known to read the object.)  Annotating the function with attribute
7721 @code{access (none)} indicates that the argument isn't used to access
7722 the object and avoids the warning (@pxref{Common Function Attributes}).
7724 These warnings are only possible in optimizing compilation, because otherwise
7725 GCC does not keep track of the state of variables.
7727 These warnings are made optional because GCC may not be able to determine when
7728 the code is correct in spite of appearing to have an error.  Here is one
7729 example of how this can happen:
7731 @smallexample
7732 @group
7734   int x;
7735   switch (y)
7736     @{
7737     case 1: x = 1;
7738       break;
7739     case 2: x = 4;
7740       break;
7741     case 3: x = 5;
7742     @}
7743   foo (x);
7745 @end group
7746 @end smallexample
7748 @noindent
7749 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7750 always initialized, but GCC doesn't know this. To suppress the
7751 warning, you need to provide a default case with assert(0) or
7752 similar code.
7754 @cindex @code{longjmp} warnings
7755 This option also warns when a non-volatile automatic variable might be
7756 changed by a call to @code{longjmp}.
7757 The compiler sees only the calls to @code{setjmp}.  It cannot know
7758 where @code{longjmp} will be called; in fact, a signal handler could
7759 call it at any point in the code.  As a result, you may get a warning
7760 even when there is in fact no problem because @code{longjmp} cannot
7761 in fact be called at the place that would cause a problem.
7763 Some spurious warnings can be avoided if you declare all the functions
7764 you use that never return as @code{noreturn}.  @xref{Function
7765 Attributes}.
7767 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7769 @opindex Wunknown-pragmas
7770 @opindex Wno-unknown-pragmas
7771 @cindex warning for unknown pragmas
7772 @cindex unknown pragmas, warning
7773 @cindex pragmas, warning of unknown
7774 @item -Wunknown-pragmas
7775 Warn when a @code{#pragma} directive is encountered that is not understood by 
7776 GCC@.  If this command-line option is used, warnings are even issued
7777 for unknown pragmas in system header files.  This is not the case if
7778 the warnings are only enabled by the @option{-Wall} command-line option.
7780 @opindex Wno-pragmas
7781 @opindex Wpragmas
7782 @item -Wno-pragmas
7783 Do not warn about misuses of pragmas, such as incorrect parameters,
7784 invalid syntax, or conflicts between pragmas.  See also
7785 @option{-Wunknown-pragmas}.
7787 @opindex Wno-prio-ctor-dtor
7788 @opindex Wprio-ctor-dtor
7789 @item -Wno-prio-ctor-dtor
7790 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7791 The use of constructor and destructor attributes allow you to assign a
7792 priority to the constructor/destructor to control its order of execution
7793 before @code{main} is called or after it returns.  The priority values must be
7794 greater than 100 as the compiler reserves priority values between 0--100 for
7795 the implementation.
7797 @opindex Wstrict-aliasing
7798 @opindex Wno-strict-aliasing
7799 @item -Wstrict-aliasing
7800 This option is only active when @option{-fstrict-aliasing} is active.
7801 It warns about code that might break the strict aliasing rules that the
7802 compiler is using for optimization.  The warning does not catch all
7803 cases, but does attempt to catch the more common pitfalls.  It is
7804 included in @option{-Wall}.
7805 It is equivalent to @option{-Wstrict-aliasing=3}
7807 @opindex Wstrict-aliasing=n
7808 @item -Wstrict-aliasing=n
7809 This option is only active when @option{-fstrict-aliasing} is active.
7810 It warns about code that might break the strict aliasing rules that the
7811 compiler is using for optimization.
7812 Higher levels correspond to higher accuracy (fewer false positives).
7813 Higher levels also correspond to more effort, similar to the way @option{-O} 
7814 works.
7815 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7817 Level 1: Most aggressive, quick, least accurate.
7818 Possibly useful when higher levels
7819 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7820 false negatives.  However, it has many false positives.
7821 Warns for all pointer conversions between possibly incompatible types,
7822 even if never dereferenced.  Runs in the front end only.
7824 Level 2: Aggressive, quick, not too precise.
7825 May still have many false positives (not as many as level 1 though),
7826 and few false negatives (but possibly more than level 1).
7827 Unlike level 1, it only warns when an address is taken.  Warns about
7828 incomplete types.  Runs in the front end only.
7830 Level 3 (default for @option{-Wstrict-aliasing}):
7831 Should have very few false positives and few false
7832 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7833 Takes care of the common pun+dereference pattern in the front end:
7834 @code{*(int*)&some_float}.
7835 If optimization is enabled, it also runs in the back end, where it deals
7836 with multiple statement cases using flow-sensitive points-to information.
7837 Only warns when the converted pointer is dereferenced.
7838 Does not warn about incomplete types.
7840 @opindex Wstrict-overflow
7841 @opindex Wno-strict-overflow
7842 @item -Wstrict-overflow
7843 @itemx -Wstrict-overflow=@var{n}
7844 This option is only active when signed overflow is undefined.
7845 It warns about cases where the compiler optimizes based on the
7846 assumption that signed overflow does not occur.  Note that it does not
7847 warn about all cases where the code might overflow: it only warns
7848 about cases where the compiler implements some optimization.  Thus
7849 this warning depends on the optimization level.
7851 An optimization that assumes that signed overflow does not occur is
7852 perfectly safe if the values of the variables involved are such that
7853 overflow never does, in fact, occur.  Therefore this warning can
7854 easily give a false positive: a warning about code that is not
7855 actually a problem.  To help focus on important issues, several
7856 warning levels are defined.  No warnings are issued for the use of
7857 undefined signed overflow when estimating how many iterations a loop
7858 requires, in particular when determining whether a loop will be
7859 executed at all.
7861 @table @gcctabopt
7862 @item -Wstrict-overflow=1
7863 Warn about cases that are both questionable and easy to avoid.  For
7864 example the compiler simplifies
7865 @code{x + 1 > x} to @code{1}.  This level of
7866 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7867 are not, and must be explicitly requested.
7869 @item -Wstrict-overflow=2
7870 Also warn about other cases where a comparison is simplified to a
7871 constant.  For example: @code{abs (x) >= 0}.  This can only be
7872 simplified when signed integer overflow is undefined, because
7873 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7874 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7875 @option{-Wstrict-overflow=2}.
7877 @item -Wstrict-overflow=3
7878 Also warn about other cases where a comparison is simplified.  For
7879 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7881 @item -Wstrict-overflow=4
7882 Also warn about other simplifications not covered by the above cases.
7883 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7885 @item -Wstrict-overflow=5
7886 Also warn about cases where the compiler reduces the magnitude of a
7887 constant involved in a comparison.  For example: @code{x + 2 > y} is
7888 simplified to @code{x + 1 >= y}.  This is reported only at the
7889 highest warning level because this simplification applies to many
7890 comparisons, so this warning level gives a very large number of
7891 false positives.
7892 @end table
7894 @opindex Wstring-compare
7895 @opindex Wno-string-compare
7896 @item -Wstring-compare
7897 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7898 determined to be either zero or non-zero in tests for such equality
7899 owing to the length of one argument being greater than the size of
7900 the array the other argument is stored in (or the bound in the case
7901 of @code{strncmp}).  Such calls could be mistakes.  For example,
7902 the call to @code{strcmp} below is diagnosed because its result is
7903 necessarily non-zero irrespective of the contents of the array @code{a}.
7905 @smallexample
7906 extern char a[4];
7907 void f (char *d)
7909   strcpy (d, "string");
7910   @dots{}
7911   if (0 == strcmp (a, d))   // cannot be true
7912     puts ("a and d are the same");
7914 @end smallexample
7916 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7918 @opindex Wstringop-overflow
7919 @opindex Wno-stringop-overflow
7920 @item -Wno-stringop-overflow
7921 @item -Wstringop-overflow
7922 @itemx -Wstringop-overflow=@var{type}
7923 Warn for calls to string manipulation functions such as @code{memcpy} and
7924 @code{strcpy} that are determined to overflow the destination buffer.  The
7925 optional argument is one greater than the type of Object Size Checking to
7926 perform to determine the size of the destination.  @xref{Object Size Checking}.
7927 The argument is meaningful only for functions that operate on character arrays
7928 but not for raw memory functions like @code{memcpy} which always make use
7929 of Object Size type-0.  The option also warns for calls that specify a size
7930 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7931 The option produces the best results with optimization enabled but can detect
7932 a small subset of simple buffer overflows even without optimization in
7933 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7934 correspond to the standard functions.  In any case, the option warns about
7935 just a subset of buffer overflows detected by the corresponding overflow
7936 checking built-ins.  For example, the option issues a warning for
7937 the @code{strcpy} call below because it copies at least 5 characters
7938 (the string @code{"blue"} including the terminating NUL) into the buffer
7939 of size 4.
7941 @smallexample
7942 enum Color @{ blue, purple, yellow @};
7943 const char* f (enum Color clr)
7945   static char buf [4];
7946   const char *str;
7947   switch (clr)
7948     @{
7949       case blue: str = "blue"; break;
7950       case purple: str = "purple"; break;
7951       case yellow: str = "yellow"; break;
7952     @}
7954   return strcpy (buf, str);   // warning here
7956 @end smallexample
7958 Option @option{-Wstringop-overflow=2} is enabled by default.
7960 @table @gcctabopt
7961 @opindex Wstringop-overflow
7962 @opindex Wno-stringop-overflow
7963 @item -Wstringop-overflow
7964 @itemx -Wstringop-overflow=1
7965 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7966 to determine the sizes of destination objects.  At this setting the option
7967 does not warn for writes past the end of subobjects of larger objects accessed
7968 by pointers unless the size of the largest surrounding object is known.  When
7969 the destination may be one of several objects it is assumed to be the largest
7970 one of them.  On Linux systems, when optimization is enabled at this setting
7971 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7972 is defined to a non-zero value.
7974 @item -Wstringop-overflow=2
7975 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7976 to determine the sizes of destination objects.  At this setting the option
7977 warns about overflows when writing to members of the largest complete
7978 objects whose exact size is known.  However, it does not warn for excessive
7979 writes to the same members of unknown objects referenced by pointers since
7980 they may point to arrays containing unknown numbers of elements.  This is
7981 the default setting of the option.
7983 @item -Wstringop-overflow=3
7984 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7985 to determine the sizes of destination objects.  At this setting the option
7986 warns about overflowing the smallest object or data member.  This is the
7987 most restrictive setting of the option that may result in warnings for safe
7988 code.
7990 @item -Wstringop-overflow=4
7991 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7992 to determine the sizes of destination objects.  At this setting the option
7993 warns about overflowing any data members, and when the destination is
7994 one of several objects it uses the size of the largest of them to decide
7995 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7996 setting of the option may result in warnings for benign code.
7997 @end table
7999 @opindex Wstringop-overread
8000 @opindex Wno-stringop-overread
8001 @item -Wno-stringop-overread
8002 Warn for calls to string manipulation functions such as @code{memchr}, or
8003 @code{strcpy} that are determined to read past the end of the source
8004 sequence.
8006 Option @option{-Wstringop-overread} is enabled by default.
8008 @opindex Wstringop-truncation
8009 @opindex Wno-stringop-truncation
8010 @item -Wno-stringop-truncation
8011 Do not warn for calls to bounded string manipulation functions
8012 such as @code{strncat},
8013 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
8014 or leave the destination unchanged.
8016 In the following example, the call to @code{strncat} specifies a bound that
8017 is less than the length of the source string.  As a result, the copy of
8018 the source will be truncated and so the call is diagnosed.  To avoid the
8019 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
8021 @smallexample
8022 void append (char *buf, size_t bufsize)
8024   strncat (buf, ".txt", 3);
8026 @end smallexample
8028 As another example, the following call to @code{strncpy} results in copying
8029 to @code{d} just the characters preceding the terminating NUL, without
8030 appending the NUL to the end.  Assuming the result of @code{strncpy} is
8031 necessarily a NUL-terminated string is a common mistake, and so the call
8032 is diagnosed.  To avoid the warning when the result is not expected to be
8033 NUL-terminated, call @code{memcpy} instead.
8035 @smallexample
8036 void copy (char *d, const char *s)
8038   strncpy (d, s, strlen (s));
8040 @end smallexample
8042 In the following example, the call to @code{strncpy} specifies the size
8043 of the destination buffer as the bound.  If the length of the source
8044 string is equal to or greater than this size the result of the copy will
8045 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
8046 the warning, specify @code{sizeof buf - 1} as the bound and set the last
8047 element of the buffer to @code{NUL}.
8049 @smallexample
8050 void copy (const char *s)
8052   char buf[80];
8053   strncpy (buf, s, sizeof buf);
8054   @dots{}
8056 @end smallexample
8058 In situations where a character array is intended to store a sequence
8059 of bytes with no terminating @code{NUL} such an array may be annotated
8060 with attribute @code{nonstring} to avoid this warning.  Such arrays,
8061 however, are not suitable arguments to functions that expect
8062 @code{NUL}-terminated strings.  To help detect accidental misuses of
8063 such arrays GCC issues warnings unless it can prove that the use is
8064 safe.  @xref{Common Variable Attributes}.
8066 @opindex Wstrict-flex-arrays
8067 @opindex Wno-strict-flex-arrays
8068 @item -Wstrict-flex-arrays
8069 Warn about inproper usages of flexible array members
8070 according to the @var{level} of the @code{strict_flex_array (@var{level})}
8071 attribute attached to the trailing array field of a structure if it's
8072 available, otherwise according to the @var{level} of the option
8073 @option{-fstrict-flex-arrays=@var{level}}.
8075 This option is effective only when @var{level} is bigger than 0.  Otherwise,
8076 it will be ignored with a warning.
8078 when @var{level}=1, warnings will be issued for a trailing array reference
8079 of a structure that have 2 or more elements if the trailing array is referenced
8080 as a flexible array member.
8082 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
8083 issued for a trailing one-element array reference of a structure
8084 if the array is referenced as a flexible array member.
8086 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8087 issued for a trailing zero-length array reference of a structure
8088 if the array is referenced as a flexible array member.
8091 @opindex Wsuggest-attribute=
8092 @opindex Wno-suggest-attribute=
8093 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
8094 Warn for cases where adding an attribute may be beneficial. The
8095 attributes currently supported are listed below.
8097 @table @gcctabopt
8098 @opindex Wsuggest-attribute=pure
8099 @opindex Wno-suggest-attribute=pure
8100 @opindex Wsuggest-attribute=const
8101 @opindex Wno-suggest-attribute=const
8102 @opindex Wsuggest-attribute=noreturn
8103 @opindex Wno-suggest-attribute=noreturn
8104 @opindex Wmissing-noreturn
8105 @opindex Wno-missing-noreturn
8106 @opindex Wsuggest-attribute=malloc
8107 @opindex Wno-suggest-attribute=malloc
8108 @item -Wsuggest-attribute=pure
8109 @itemx -Wsuggest-attribute=const
8110 @itemx -Wsuggest-attribute=noreturn
8111 @itemx -Wmissing-noreturn
8112 @itemx -Wsuggest-attribute=malloc
8114 Warn about functions that might be candidates for attributes
8115 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
8116 only warns for functions visible in other compilation units or (in the case of
8117 @code{pure} and @code{const}) if it cannot prove that the function returns
8118 normally. A function returns normally if it doesn't contain an infinite loop or
8119 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8120 requires option @option{-fipa-pure-const}, which is enabled by default at
8121 @option{-O} and higher.  Higher optimization levels improve the accuracy
8122 of the analysis.
8124 @opindex Wsuggest-attribute=format
8125 @opindex Wmissing-format-attribute
8126 @opindex Wno-suggest-attribute=format
8127 @opindex Wno-missing-format-attribute
8128 @opindex Wformat
8129 @opindex Wno-format
8130 @item -Wsuggest-attribute=format
8131 @itemx -Wmissing-format-attribute
8133 Warn about function pointers that might be candidates for @code{format}
8134 attributes.  Note these are only possible candidates, not absolute ones.
8135 GCC guesses that function pointers with @code{format} attributes that
8136 are used in assignment, initialization, parameter passing or return
8137 statements should have a corresponding @code{format} attribute in the
8138 resulting type.  I.e.@: the left-hand side of the assignment or
8139 initialization, the type of the parameter variable, or the return type
8140 of the containing function respectively should also have a @code{format}
8141 attribute to avoid the warning.
8143 GCC also warns about function definitions that might be
8144 candidates for @code{format} attributes.  Again, these are only
8145 possible candidates.  GCC guesses that @code{format} attributes
8146 might be appropriate for any function that calls a function like
8147 @code{vprintf} or @code{vscanf}, but this might not always be the
8148 case, and some functions for which @code{format} attributes are
8149 appropriate may not be detected.
8151 @opindex Wsuggest-attribute=cold
8152 @opindex Wno-suggest-attribute=cold
8153 @item -Wsuggest-attribute=cold
8155 Warn about functions that might be candidates for @code{cold} attribute.  This
8156 is based on static detection and generally only warns about functions which
8157 always leads to a call to another @code{cold} function such as wrappers of
8158 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8159 @end table
8161 @opindex Wno-alloc-size
8162 @opindex Walloc-size
8163 @item -Walloc-size
8164 Warn about calls to allocation functions decorated with attribute
8165 @code{alloc_size} that specify insufficient size for the target type of
8166 the pointer the result is assigned to, including those to the built-in
8167 forms of the functions @code{aligned_alloc}, @code{alloca},
8168 @code{calloc},
8169 @code{malloc}, and @code{realloc}.
8171 @opindex Wno-alloc-zero
8172 @opindex Walloc-zero
8173 @item -Walloc-zero
8174 Warn about calls to allocation functions decorated with attribute
8175 @code{alloc_size} that specify zero bytes, including those to the built-in
8176 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8177 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8178 when called with a zero size differs among implementations (and in the case
8179 of @code{realloc} has been deprecated) relying on it may result in subtle
8180 portability bugs and should be avoided.
8182 @opindex Walloc-size-larger-than=
8183 @opindex Wno-alloc-size-larger-than
8184 @item -Walloc-size-larger-than=@var{byte-size}
8185 Warn about calls to functions decorated with attribute @code{alloc_size}
8186 that attempt to allocate objects larger than the specified number of bytes,
8187 or where the result of the size computation in an integer type with infinite
8188 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8189 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8190 Warnings controlled by the option can be disabled either by specifying
8191 @var{byte-size} of @samp{SIZE_MAX} or more or by
8192 @option{-Wno-alloc-size-larger-than}.
8193 @xref{Function Attributes}.
8195 @opindex Wno-alloc-size-larger-than
8196 @item -Wno-alloc-size-larger-than
8197 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8198 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8199 larger.
8201 @opindex Wno-alloca
8202 @opindex Walloca
8203 @item -Walloca
8204 This option warns on all uses of @code{alloca} in the source.
8206 @opindex Walloca-larger-than=
8207 @opindex Wno-alloca-larger-than
8208 @item -Walloca-larger-than=@var{byte-size}
8209 This option warns on calls to @code{alloca} with an integer argument whose
8210 value is either zero, or that is not bounded by a controlling predicate
8211 that limits its value to at most @var{byte-size}.  It also warns for calls
8212 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8213 types are considered unbounded even if they appear to be constrained to
8214 the expected range.
8216 For example, a bounded case of @code{alloca} could be:
8218 @smallexample
8219 void func (size_t n)
8221   void *p;
8222   if (n <= 1000)
8223     p = alloca (n);
8224   else
8225     p = malloc (n);
8226   f (p);
8228 @end smallexample
8230 In the above example, passing @code{-Walloca-larger-than=1000} would not
8231 issue a warning because the call to @code{alloca} is known to be at most
8232 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8233 the compiler would emit a warning.
8235 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8236 controlling predicate constraining its integer argument.  For example:
8238 @smallexample
8239 void func ()
8241   void *p = alloca (n);
8242   f (p);
8244 @end smallexample
8246 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8247 a warning, but this time because of the lack of bounds checking.
8249 Note, that even seemingly correct code involving signed integers could
8250 cause a warning:
8252 @smallexample
8253 void func (signed int n)
8255   if (n < 500)
8256     @{
8257       p = alloca (n);
8258       f (p);
8259     @}
8261 @end smallexample
8263 In the above example, @var{n} could be negative, causing a larger than
8264 expected argument to be implicitly cast into the @code{alloca} call.
8266 This option also warns when @code{alloca} is used in a loop.
8268 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8269 but is usually only effective  when @option{-ftree-vrp} is active (default
8270 for @option{-O2} and above).
8272 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8274 @opindex Wno-alloca-larger-than
8275 @item -Wno-alloca-larger-than
8276 Disable @option{-Walloca-larger-than=} warnings.  The option is
8277 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8279 @opindex Warith-conversion
8280 @opindex Wno-arith-conversion
8281 @item -Warith-conversion
8282 Do warn about implicit conversions from arithmetic operations even
8283 when conversion of the operands to the same type cannot change their
8284 values.  This affects warnings from @option{-Wconversion},
8285 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8287 @smallexample
8288 @group
8289 void f (char c, int i)
8291   c = c + i; // warns with @option{-Wconversion}
8292   c = c + 1; // only warns with @option{-Warith-conversion}
8294 @end group
8295 @end smallexample
8297 @opindex Wno-array-bounds
8298 @opindex Warray-bounds
8299 @item -Warray-bounds
8300 @itemx -Warray-bounds=@var{n}
8301 Warn about out of bounds subscripts or offsets into arrays.  This warning
8302 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8303 is active (the default for @option{-O2} and above) but a subset of instances
8304 are issued even without optimization.
8306 By default, the trailing array of a structure will be treated as a flexible
8307 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8308 if it is declared as either a flexible array member per C99 standard onwards
8309 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8310 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8311 zero-length arrays or one-element arrays are not warned by default.
8313 You can add the option @option{-fstrict-flex-arrays} or
8314 @option{-fstrict-flex-arrays=@var{level}} to control how this
8315 option treat trailing array of a structure as a flexible array member:
8317 when @var{level}<=1, no change to the default behavior.
8319 when @var{level}=2, additional warnings will be issued for out of bounds
8320 subscripts or offsets into one-element arrays;
8322 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8323 issued for out of bounds subscripts or offsets into zero-length arrays.
8325 @table @gcctabopt
8326 @item -Warray-bounds=1
8327 This is the default warning level of @option{-Warray-bounds} and is enabled
8328 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8330 @item -Warray-bounds=2
8331 This warning level also warns about the intermediate results of pointer
8332 arithmetic that may yield out of bounds values. This warning level may
8333 give a larger number of false positives and is deactivated by default.
8334 @end table
8336 @opindex Warray-compare
8337 @opindex Wno-array-compare
8338 @item -Warray-compare
8339 Warn about equality and relational comparisons between two operands of array
8340 type.  This comparison was deprecated in C++20.  For example:
8342 @smallexample
8343 int arr1[5];
8344 int arr2[5];
8345 bool same = arr1 == arr2;
8346 @end smallexample
8348 @option{-Warray-compare} is enabled by @option{-Wall}.
8350 @opindex Wno-array-parameter
8351 @item -Warray-parameter
8352 @itemx -Warray-parameter=@var{n}
8353 Warn about redeclarations of functions involving arguments of array or
8354 pointer types of inconsistent kinds or forms, and enable the detection
8355 of out-of-bounds accesses to such parameters by warnings such as
8356 @option{-Warray-bounds}.
8358 If the first function declaration uses the array form the bound specified
8359 in the array is assumed to be the minimum number of elements expected to
8360 be provided in calls to the function and the maximum number of elements
8361 accessed by it.  Failing to provide arguments of sufficient size or accessing
8362 more than the maximum number of elements may be diagnosed by warnings such
8363 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
8364 involving array parameters declared using the @code{T[static N]} form.
8366 For example, the warning triggers for the following redeclarations because
8367 the first one allows an array of any size to be passed to @code{f} while
8368 the second one with the keyword @code{static} specifies that the array
8369 argument must have at least four elements.
8371 @smallexample
8372 void f (int[static 4]);
8373 void f (int[]);           // warning (inconsistent array form)
8375 void g (void)
8377   int *p = (int *)malloc (4);
8378   f (p);                  // warning (array too small)
8379   @dots{}
8381 @end smallexample
8383 At level 2 the warning also triggers for redeclarations involving any other
8384 inconsistency in array or pointer argument forms denoting array sizes.
8385 Pointers and arrays of unspecified bound are considered equivalent and do
8386 not trigger a warning.
8388 @smallexample
8389 void g (int*);
8390 void g (int[]);     // no warning
8391 void g (int[8]);    // warning (inconsistent array bound)
8392 @end smallexample
8394 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8395 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8396 involving Variable Length Array arguments.
8398 @opindex Wattribute-alias
8399 @opindex Wno-attribute-alias
8400 @item -Wattribute-alias=@var{n}
8401 @itemx -Wno-attribute-alias
8402 Warn about declarations using the @code{alias} and similar attributes whose
8403 target is incompatible with the type of the alias.
8404 @xref{Function Attributes,,Declaring Attributes of Functions}.
8406 @table @gcctabopt
8407 @item -Wattribute-alias=1
8408 The default warning level of the @option{-Wattribute-alias} option diagnoses
8409 incompatibilities between the type of the alias declaration and that of its
8410 target.  Such incompatibilities are typically indicative of bugs.
8412 @item -Wattribute-alias=2
8414 At this level @option{-Wattribute-alias} also diagnoses cases where
8415 the attributes of the alias declaration are more restrictive than the
8416 attributes applied to its target.  These mismatches can potentially
8417 result in incorrect code generation.  In other cases they may be
8418 benign and could be resolved simply by adding the missing attribute to
8419 the target.  For comparison, see the @option{-Wmissing-attributes}
8420 option, which controls diagnostics when the alias declaration is less
8421 restrictive than the target, rather than more restrictive.
8423 Attributes considered include @code{alloc_align}, @code{alloc_size},
8424 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8425 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8426 @code{returns_nonnull}, and @code{returns_twice}.
8427 @end table
8429 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8430 This is the default.  You can disable these warnings with either
8431 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8433 @opindex Wbidi-chars=
8434 @opindex Wbidi-chars
8435 @opindex Wno-bidi-chars
8436 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8437 Warn about possibly misleading UTF-8 bidirectional control characters in
8438 comments, string literals, character constants, and identifiers.  Such
8439 characters can change left-to-right writing direction into right-to-left
8440 (and vice versa), which can cause confusion between the logical order and
8441 visual order.  This may be dangerous; for instance, it may seem that a piece
8442 of code is not commented out, whereas it in fact is.
8444 There are three levels of warning supported by GCC@.  The default is
8445 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8446 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8447 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8448 characters.
8450 By default, this warning does not warn about UCNs.  It is, however, possible
8451 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8452 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8453 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8454 @option{-Wbidi-chars=any} was specified.
8456 @opindex Wno-bool-compare
8457 @opindex Wbool-compare
8458 @item -Wbool-compare
8459 Warn about boolean expression compared with an integer value different from
8460 @code{true}/@code{false}.  For instance, the following comparison is
8461 always false:
8462 @smallexample
8463 int n = 5;
8464 @dots{}
8465 if ((n > 1) == 2) @{ @dots{} @}
8466 @end smallexample
8467 This warning is enabled by @option{-Wall}.
8469 @opindex Wno-bool-operation
8470 @opindex Wbool-operation
8471 @item -Wbool-operation
8472 Warn about suspicious operations on expressions of a boolean type.  For
8473 instance, bitwise negation of a boolean is very likely a bug in the program.
8474 For C, this warning also warns about incrementing or decrementing a boolean,
8475 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8476 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8478 This warning is enabled by @option{-Wall}.
8480 @opindex Wno-duplicated-branches
8481 @opindex Wduplicated-branches
8482 @item -Wduplicated-branches
8483 Warn when an if-else has identical branches.  This warning detects cases like
8484 @smallexample
8485 if (p != NULL)
8486   return 0;
8487 else
8488   return 0;
8489 @end smallexample
8490 It doesn't warn when both branches contain just a null statement.  This warning
8491 also warn for conditional operators:
8492 @smallexample
8493   int i = x ? *p : *p;
8494 @end smallexample
8496 @opindex Wno-duplicated-cond
8497 @opindex Wduplicated-cond
8498 @item -Wduplicated-cond
8499 Warn about duplicated conditions in an if-else-if chain.  For instance,
8500 warn for the following code:
8501 @smallexample
8502 if (p->q != NULL) @{ @dots{} @}
8503 else if (p->q != NULL) @{ @dots{} @}
8504 @end smallexample
8506 @opindex Wno-frame-address
8507 @opindex Wframe-address
8508 @item -Wframe-address
8509 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8510 is called with an argument greater than 0.  Such calls may return indeterminate
8511 values or crash the program.  The warning is included in @option{-Wall}.
8513 @opindex Wno-discarded-qualifiers
8514 @opindex Wdiscarded-qualifiers
8515 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8516 Do not warn if type qualifiers on pointers are being discarded.
8517 Typically, the compiler warns if a @code{const char *} variable is
8518 passed to a function that takes a @code{char *} parameter.  This option
8519 can be used to suppress such a warning.
8521 @opindex Wno-discarded-array-qualifiers
8522 @opindex Wdiscarded-array-qualifiers
8523 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8524 Do not warn if type qualifiers on arrays which are pointer targets
8525 are being discarded.  Typically, the compiler warns if a
8526 @code{const int (*)[]} variable is passed to a function that
8527 takes a @code{int (*)[]} parameter.  This option can be used to
8528 suppress such a warning.
8530 @opindex Wno-incompatible-pointer-types
8531 @opindex Wincompatible-pointer-types
8532 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8533 Do not warn when there is a conversion between pointers that have incompatible
8534 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8535 which warns for pointer argument passing or assignment with different
8536 signedness.
8538 This warning is upgraded to an error by @option{-pedantic-errors}.
8540 @opindex Wno-int-conversion
8541 @opindex Wint-conversion
8542 @item -Wno-int-conversion @r{(C and Objective-C only)}
8543 Do not warn about incompatible integer to pointer and pointer to integer
8544 conversions.  This warning is about implicit conversions; for explicit
8545 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8546 @option{-Wno-pointer-to-int-cast} may be used.
8548 This warning is upgraded to an error by @option{-pedantic-errors}.
8550 @opindex Wzero-length-bounds
8551 @opindex Wzero-length-bounds
8552 @item -Wzero-length-bounds
8553 Warn about accesses to elements of zero-length array members that might
8554 overlap other members of the same object.  Declaring interior zero-length
8555 arrays is discouraged because accesses to them are undefined.
8556 @xref{Zero Length}.
8558 For example, the first two stores in function @code{bad} are diagnosed
8559 because the array elements overlap the subsequent members @code{b} and
8560 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8561 because it is beyond the bounds of the enclosing object.
8563 @smallexample
8564 struct X @{ int a[0]; int b, c; @};
8565 struct X x;
8567 void bad (void)
8569   x.a[0] = 0;   // -Wzero-length-bounds
8570   x.a[1] = 1;   // -Wzero-length-bounds
8571   x.a[2] = 2;   // -Warray-bounds
8573 @end smallexample
8575 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8577 @opindex Wno-div-by-zero
8578 @opindex Wdiv-by-zero
8579 @item -Wno-div-by-zero
8580 Do not warn about compile-time integer division by zero.  Floating-point
8581 division by zero is not warned about, as it can be a legitimate way of
8582 obtaining infinities and NaNs.
8584 @opindex Wsystem-headers
8585 @opindex Wno-system-headers
8586 @cindex warnings from system headers
8587 @cindex system headers, warnings from
8588 @item -Wsystem-headers
8589 Print warning messages for constructs found in system header files.
8590 Warnings from system headers are normally suppressed, on the assumption
8591 that they usually do not indicate real problems and would only make the
8592 compiler output harder to read.  Using this command-line option tells
8593 GCC to emit warnings from system headers as if they occurred in user
8594 code.  However, note that using @option{-Wall} in conjunction with this
8595 option does @emph{not} warn about unknown pragmas in system
8596 headers---for that, @option{-Wunknown-pragmas} must also be used.
8598 @opindex Wtautological-compare
8599 @opindex Wno-tautological-compare
8600 @item -Wtautological-compare
8601 Warn if a self-comparison always evaluates to true or false.  This
8602 warning detects various mistakes such as:
8603 @smallexample
8604 int i = 1;
8605 @dots{}
8606 if (i > i) @{ @dots{} @}
8607 @end smallexample
8609 This warning also warns about bitwise comparisons that always evaluate
8610 to true or false, for instance:
8611 @smallexample
8612 if ((a & 16) == 10) @{ @dots{} @}
8613 @end smallexample
8614 will always be false.
8616 This warning is enabled by @option{-Wall}.
8618 @opindex Wtrampolines
8619 @opindex Wno-trampolines
8620 @item -Wtrampolines
8621 Warn about trampolines generated for pointers to nested functions.
8622 A trampoline is a small piece of data or code that is created at run
8623 time on the stack when the address of a nested function is taken, and is
8624 used to call the nested function indirectly.  For some targets, it is
8625 made up of data only and thus requires no special treatment.  But, for
8626 most targets, it is made up of code and thus requires the stack to be
8627 made executable in order for the program to work properly.
8629 @opindex Wfloat-equal
8630 @opindex Wno-float-equal
8631 @item -Wfloat-equal
8632 Warn if floating-point values are used in equality comparisons.
8634 The idea behind this is that sometimes it is convenient (for the
8635 programmer) to consider floating-point values as approximations to
8636 infinitely precise real numbers.  If you are doing this, then you need
8637 to compute (by analyzing the code, or in some other way) the maximum or
8638 likely maximum error that the computation introduces, and allow for it
8639 when performing comparisons (and when producing output, but that's a
8640 different problem).  In particular, instead of testing for equality, you
8641 should check to see whether the two values have ranges that overlap; and
8642 this is done with the relational operators, so equality comparisons are
8643 probably mistaken.
8645 @opindex Wtraditional
8646 @opindex Wno-traditional
8647 @item -Wtraditional @r{(C and Objective-C only)}
8648 Warn about certain constructs that behave differently in traditional and
8649 ISO C@.  Also warn about ISO C constructs that have no traditional C
8650 equivalent, and/or problematic constructs that should be avoided.
8652 @itemize @bullet
8653 @item
8654 Macro parameters that appear within string literals in the macro body.
8655 In traditional C macro replacement takes place within string literals,
8656 but in ISO C it does not.
8658 @item
8659 In traditional C, some preprocessor directives did not exist.
8660 Traditional preprocessors only considered a line to be a directive
8661 if the @samp{#} appeared in column 1 on the line.  Therefore
8662 @option{-Wtraditional} warns about directives that traditional C
8663 understands but ignores because the @samp{#} does not appear as the
8664 first character on the line.  It also suggests you hide directives like
8665 @code{#pragma} not understood by traditional C by indenting them.  Some
8666 traditional implementations do not recognize @code{#elif}, so this option
8667 suggests avoiding it altogether.
8669 @item
8670 A function-like macro that appears without arguments.
8672 @item
8673 The unary plus operator.
8675 @item
8676 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8677 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8678 constants.)  Note, these suffixes appear in macros defined in the system
8679 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8680 Use of these macros in user code might normally lead to spurious
8681 warnings, however GCC's integrated preprocessor has enough context to
8682 avoid warning in these cases.
8684 @item
8685 A function declared external in one block and then used after the end of
8686 the block.
8688 @item
8689 A @code{switch} statement has an operand of type @code{long}.
8691 @item
8692 A non-@code{static} function declaration follows a @code{static} one.
8693 This construct is not accepted by some traditional C compilers.
8695 @item
8696 The ISO type of an integer constant has a different width or
8697 signedness from its traditional type.  This warning is only issued if
8698 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8699 typically represent bit patterns, are not warned about.
8701 @item
8702 Usage of ISO string concatenation is detected.
8704 @item
8705 Initialization of automatic aggregates.
8707 @item
8708 Identifier conflicts with labels.  Traditional C lacks a separate
8709 namespace for labels.
8711 @item
8712 Initialization of unions.  If the initializer is zero, the warning is
8713 omitted.  This is done under the assumption that the zero initializer in
8714 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8715 initializer warnings and relies on default initialization to zero in the
8716 traditional C case.
8718 @item
8719 Conversions by prototypes between fixed/floating-point values and vice
8720 versa.  The absence of these prototypes when compiling with traditional
8721 C causes serious problems.  This is a subset of the possible
8722 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8724 @item
8725 Use of ISO C style function definitions.  This warning intentionally is
8726 @emph{not} issued for prototype declarations or variadic functions
8727 because these ISO C features appear in your code when using
8728 libiberty's traditional C compatibility macros, @code{PARAMS} and
8729 @code{VPARAMS}.  This warning is also bypassed for nested functions
8730 because that feature is already a GCC extension and thus not relevant to
8731 traditional C compatibility.
8732 @end itemize
8734 @opindex Wtraditional-conversion
8735 @opindex Wno-traditional-conversion
8736 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8737 Warn if a prototype causes a type conversion that is different from what
8738 would happen to the same argument in the absence of a prototype.  This
8739 includes conversions of fixed point to floating and vice versa, and
8740 conversions changing the width or signedness of a fixed-point argument
8741 except when the same as the default promotion.
8743 @opindex Wdeclaration-after-statement
8744 @opindex Wno-declaration-after-statement
8745 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8746 Warn when a declaration is found after a statement in a block.  This
8747 construct, known from C++, was introduced with ISO C99 and is by default
8748 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8750 This warning is upgraded to an error by @option{-pedantic-errors}.
8752 @opindex Wshadow
8753 @opindex Wno-shadow
8754 @item -Wshadow
8755 Warn whenever a local variable or type declaration shadows another
8756 variable, parameter, type, class member (in C++), or instance variable
8757 (in Objective-C) or whenever a built-in function is shadowed.  Note
8758 that in C++, the compiler warns if a local variable shadows an
8759 explicit typedef, but not if it shadows a struct/class/enum.
8760 If this warning is enabled, it includes also all instances of
8761 local shadowing.  This means that @option{-Wno-shadow=local}
8762 and @option{-Wno-shadow=compatible-local} are ignored when
8763 @option{-Wshadow} is used.
8764 Same as @option{-Wshadow=global}.
8766 @opindex Wno-shadow-ivar
8767 @opindex Wshadow-ivar
8768 @item -Wno-shadow-ivar @r{(Objective-C only)}
8769 Do not warn whenever a local variable shadows an instance variable in an
8770 Objective-C method.
8772 @opindex Wshadow=global
8773 @item -Wshadow=global
8774 Warn for any shadowing.
8775 Same as @option{-Wshadow}.
8777 @opindex Wshadow=local
8778 @item -Wshadow=local
8779 Warn when a local variable shadows another local variable or parameter.
8781 @opindex Wshadow=compatible-local
8782 @item -Wshadow=compatible-local
8783 Warn when a local variable shadows another local variable or parameter
8784 whose type is compatible with that of the shadowing variable.  In C++,
8785 type compatibility here means the type of the shadowing variable can be
8786 converted to that of the shadowed variable.  The creation of this flag
8787 (in addition to @option{-Wshadow=local}) is based on the idea that when
8788 a local variable shadows another one of incompatible type, it is most
8789 likely intentional, not a bug or typo, as shown in the following example:
8791 @smallexample
8792 @group
8793 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8795   for (int i = 0; i < N; ++i)
8796   @{
8797     ...
8798   @}
8799   ...
8801 @end group
8802 @end smallexample
8804 Since the two variable @code{i} in the example above have incompatible types,
8805 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8806 Because their types are incompatible, if a programmer accidentally uses one
8807 in place of the other, type checking is expected to catch that and emit an
8808 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8809 possibly reduce the number of warnings triggered by intentional shadowing.
8810 Note that this also means that shadowing @code{const char *i} by
8811 @code{char *i} does not emit a warning.
8813 This warning is also enabled by @option{-Wshadow=local}.
8815 @opindex Wlarger-than=
8816 @opindex Wlarger-than-@var{byte-size}
8817 @item -Wlarger-than=@var{byte-size}
8818 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8819 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8820 Warnings controlled by the option can be disabled either by specifying
8821 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8823 Also warn for calls to bounded functions such as @code{memchr} or
8824 @code{strnlen} that specify a bound greater than the largest possible
8825 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8826 can only be disabled by @option{-Wno-larger-than}.
8828 @opindex Wno-larger-than
8829 @item -Wno-larger-than
8830 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8831 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8833 @opindex Wframe-larger-than=
8834 @opindex Wno-frame-larger-than
8835 @item -Wframe-larger-than=@var{byte-size}
8836 Warn if the size of a function frame exceeds @var{byte-size}.
8837 The computation done to determine the stack frame size is approximate
8838 and not conservative.
8839 The actual requirements may be somewhat greater than @var{byte-size}
8840 even if you do not get a warning.  In addition, any space allocated
8841 via @code{alloca}, variable-length arrays, or related constructs
8842 is not included by the compiler when determining
8843 whether or not to issue a warning.
8844 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8845 Warnings controlled by the option can be disabled either by specifying
8846 @var{byte-size} of @samp{SIZE_MAX} or more or by
8847 @option{-Wno-frame-larger-than}.
8849 @opindex Wno-frame-larger-than
8850 @item -Wno-frame-larger-than
8851 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8852 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8854 @opindex Wfree-nonheap-object
8855 @opindex Wno-free-nonheap-object
8856 @item -Wfree-nonheap-object
8857 Warn when attempting to deallocate an object that was either not allocated
8858 on the heap, or by using a pointer that was not returned from a prior call
8859 to the corresponding allocation function.  For example, because the call
8860 to @code{stpcpy} returns a pointer to the terminating nul character and
8861 not to the beginning of the object, the call to @code{free} below is
8862 diagnosed.
8864 @smallexample
8865 void f (char *p)
8867   p = stpcpy (p, "abc");
8868   // ...
8869   free (p);   // warning
8871 @end smallexample
8873 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8875 @opindex Wstack-usage
8876 @opindex Wno-stack-usage
8877 @item -Wstack-usage=@var{byte-size}
8878 Warn if the stack usage of a function might exceed @var{byte-size}.
8879 The computation done to determine the stack usage is conservative.
8880 Any space allocated via @code{alloca}, variable-length arrays, or related
8881 constructs is included by the compiler when determining whether or not to
8882 issue a warning.
8884 The message is in keeping with the output of @option{-fstack-usage}.
8886 @itemize
8887 @item
8888 If the stack usage is fully static but exceeds the specified amount, it's:
8890 @smallexample
8891   warning: stack usage is 1120 bytes
8892 @end smallexample
8893 @item
8894 If the stack usage is (partly) dynamic but bounded, it's:
8896 @smallexample
8897   warning: stack usage might be 1648 bytes
8898 @end smallexample
8899 @item
8900 If the stack usage is (partly) dynamic and not bounded, it's:
8902 @smallexample
8903   warning: stack usage might be unbounded
8904 @end smallexample
8905 @end itemize
8907 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8908 Warnings controlled by the option can be disabled either by specifying
8909 @var{byte-size} of @samp{SIZE_MAX} or more or by
8910 @option{-Wno-stack-usage}.
8912 @opindex Wno-stack-usage
8913 @item -Wno-stack-usage
8914 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8915 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8917 @opindex Wunsafe-loop-optimizations
8918 @opindex Wno-unsafe-loop-optimizations
8919 @item -Wunsafe-loop-optimizations
8920 Warn if the loop cannot be optimized because the compiler cannot
8921 assume anything on the bounds of the loop indices.  With
8922 @option{-funsafe-loop-optimizations} warn if the compiler makes
8923 such assumptions.
8925 @opindex Wno-pedantic-ms-format
8926 @opindex Wpedantic-ms-format
8927 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8928 When used in combination with @option{-Wformat}
8929 and @option{-pedantic} without GNU extensions, this option
8930 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8931 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8932 which depend on the MS runtime.
8934 @opindex Wpointer-arith
8935 @opindex Wno-pointer-arith
8936 @item -Wpointer-arith
8937 Warn about anything that depends on the ``size of'' a function type or
8938 of @code{void}.  GNU C assigns these types a size of 1, for
8939 convenience in calculations with @code{void *} pointers and pointers
8940 to functions.  In C++, warn also when an arithmetic operation involves
8941 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8943 This warning is upgraded to an error by @option{-pedantic-errors}.
8945 @opindex Wpointer-compare
8946 @opindex Wno-pointer-compare
8947 @item -Wno-pointer-compare
8948 Do not warn if a pointer is compared with a zero character constant.
8949 This usually
8950 means that the pointer was meant to be dereferenced.  For example:
8952 @smallexample
8953 const char *p = foo ();
8954 if (p == '\0')
8955   return 42;
8956 @end smallexample
8958 Note that the code above is invalid in C++11.
8960 This warning is enabled by default.
8962 @opindex Wtsan
8963 @opindex Wno-tsan
8964 @item -Wtsan
8965 Warn about unsupported features in ThreadSanitizer.
8967 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8968 can report false positives.
8970 This warning is enabled by default.
8972 @opindex Wtype-limits
8973 @opindex Wno-type-limits
8974 @item -Wtype-limits
8975 Warn if a comparison is always true or always false due to the limited
8976 range of the data type, but do not warn for constant expressions.  For
8977 example, warn if an unsigned variable is compared against zero with
8978 @code{<} or @code{>=}.  This warning is also enabled by
8979 @option{-Wextra}.
8981 @opindex Wabsolute-value
8982 @opindex Wno-absolute-value
8983 @item -Wabsolute-value @r{(C and Objective-C only)}
8984 Warn for calls to standard functions that compute the absolute value
8985 of an argument when a more appropriate standard function is available.
8986 For example, calling @code{abs(3.14)} triggers the warning because the
8987 appropriate function to call to compute the absolute value of a double
8988 argument is @code{fabs}.  The option also triggers warnings when the
8989 argument in a call to such a function has an unsigned type.  This
8990 warning can be suppressed with an explicit type cast and it is also
8991 enabled by @option{-Wextra}.
8993 @include cppwarnopts.texi
8995 @opindex Wbad-function-cast
8996 @opindex Wno-bad-function-cast
8997 @item -Wbad-function-cast @r{(C and Objective-C only)}
8998 Warn when a function call is cast to a non-matching type.
8999 For example, warn if a call to a function returning an integer type 
9000 is cast to a pointer type.
9002 @opindex Wc90-c99-compat
9003 @opindex Wno-c90-c99-compat
9004 @item -Wc90-c99-compat @r{(C and Objective-C only)}
9005 Warn about features not present in ISO C90, but present in ISO C99.
9006 For instance, warn about use of variable length arrays, @code{long long}
9007 type, @code{bool} type, compound literals, designated initializers, and so
9008 on.  This option is independent of the standards mode.  Warnings are disabled
9009 in the expression that follows @code{__extension__}.
9011 @opindex Wc99-c11-compat
9012 @opindex Wno-c99-c11-compat
9013 @item -Wc99-c11-compat @r{(C and Objective-C only)}
9014 Warn about features not present in ISO C99, but present in ISO C11.
9015 For instance, warn about use of anonymous structures and unions,
9016 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
9017 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
9018 and so on.  This option is independent of the standards mode.  Warnings are
9019 disabled in the expression that follows @code{__extension__}.
9021 @opindex Wc11-c23-compat
9022 @opindex Wno-c11-c23-compat
9023 @item -Wc11-c23-compat @r{(C and Objective-C only)}
9024 @itemx -Wc11-c2x-compat @r{(C and Objective-C only)}
9025 Warn about features not present in ISO C11, but present in ISO C23.
9026 For instance, warn about omitting the string in @code{_Static_assert},
9027 use of @samp{[[]]} syntax for attributes, use of decimal
9028 floating-point types, and so on.  This option is independent of the
9029 standards mode.  Warnings are disabled in the expression that follows
9030 @code{__extension__}.  The name @option{-Wc11-c2x-compat} is
9031 deprecated.
9033 When not compiling in C23 mode, these warnings are upgraded to errors
9034 by @option{-pedantic-errors}.
9036 @opindex Wc++-compat
9037 @opindex Wno-c++-compat
9038 @item -Wc++-compat @r{(C and Objective-C only)}
9039 Warn about ISO C constructs that are outside of the common subset of
9040 ISO C and ISO C++, e.g.@: request for implicit conversion from
9041 @code{void *} to a pointer to non-@code{void} type.
9043 @opindex Wc++11-compat
9044 @opindex Wno-c++11-compat
9045 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
9046 Warn about C++ constructs whose meaning differs between ISO C++ 1998
9047 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
9048 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
9049 enabled by @option{-Wall}.
9051 @opindex Wc++14-compat
9052 @opindex Wno-c++14-compat
9053 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
9054 Warn about C++ constructs whose meaning differs between ISO C++ 2011
9055 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
9057 @opindex Wc++17-compat
9058 @opindex Wno-c++17-compat
9059 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
9060 Warn about C++ constructs whose meaning differs between ISO C++ 2014
9061 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
9063 @opindex Wc++20-compat
9064 @opindex Wno-c++20-compat
9065 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
9066 Warn about C++ constructs whose meaning differs between ISO C++ 2017
9067 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
9069 @opindex Wc++11-extensions
9070 @opindex Wno-c++11-extensions
9071 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
9072 Do not warn about C++11 constructs in code being compiled using
9073 an older C++ standard.  Even without this option, some C++11 constructs
9074 will only be diagnosed if @option{-Wpedantic} is used.
9076 @opindex Wc++14-extensions
9077 @opindex Wno-c++14-extensions
9078 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
9079 Do not warn about C++14 constructs in code being compiled using
9080 an older C++ standard.  Even without this option, some C++14 constructs
9081 will only be diagnosed if @option{-Wpedantic} is used.
9083 @opindex Wc++17-extensions
9084 @opindex Wno-c++17-extensions
9085 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9086 Do not warn about C++17 constructs in code being compiled using
9087 an older C++ standard.  Even without this option, some C++17 constructs
9088 will only be diagnosed if @option{-Wpedantic} is used.
9090 @opindex Wc++20-extensions
9091 @opindex Wno-c++20-extensions
9092 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9093 Do not warn about C++20 constructs in code being compiled using
9094 an older C++ standard.  Even without this option, some C++20 constructs
9095 will only be diagnosed if @option{-Wpedantic} is used.
9097 @opindex Wc++23-extensions
9098 @opindex Wno-c++23-extensions
9099 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9100 Do not warn about C++23 constructs in code being compiled using
9101 an older C++ standard.  Even without this option, some C++23 constructs
9102 will only be diagnosed if @option{-Wpedantic} is used.
9104 @opindex Wcast-qual
9105 @opindex Wno-cast-qual
9106 @item -Wcast-qual
9107 Warn whenever a pointer is cast so as to remove a type qualifier from
9108 the target type.  For example, warn if a @code{const char *} is cast
9109 to an ordinary @code{char *}.
9111 Also warn when making a cast that introduces a type qualifier in an
9112 unsafe way.  For example, casting @code{char **} to @code{const char **}
9113 is unsafe, as in this example:
9115 @smallexample
9116   /* p is char ** value.  */
9117   const char **q = (const char **) p;
9118   /* Assignment of readonly string to const char * is OK.  */
9119   *q = "string";
9120   /* Now char** pointer points to read-only memory.  */
9121   **p = 'b';
9122 @end smallexample
9124 @opindex Wcast-align
9125 @opindex Wno-cast-align
9126 @item -Wcast-align
9127 Warn whenever a pointer is cast such that the required alignment of the
9128 target is increased.  For example, warn if a @code{char *} is cast to
9129 an @code{int *} on machines where integers can only be accessed at
9130 two- or four-byte boundaries.
9132 @opindex Wcast-align=strict
9133 @item -Wcast-align=strict
9134 Warn whenever a pointer is cast such that the required alignment of the
9135 target is increased.  For example, warn if a @code{char *} is cast to
9136 an @code{int *} regardless of the target machine.
9138 @opindex Wcast-function-type
9139 @opindex Wno-cast-function-type
9140 @item -Wcast-function-type
9141 Warn when a function pointer is cast to an incompatible function pointer.
9142 In a cast involving function types with a variable argument list only
9143 the types of initial arguments that are provided are considered.
9144 Any parameter of pointer-type matches any other pointer-type.  Any benign
9145 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9146 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9147 type @code{void (*) (void)} is special and matches everything, which can
9148 be used to suppress this warning.
9149 In a cast involving pointer to member types this warning warns whenever
9150 the type cast is changing the pointer to member type.
9151 This warning is enabled by @option{-Wextra}.
9153 @opindex Wwrite-strings
9154 @opindex Wno-write-strings
9155 @item -Wwrite-strings
9156 When compiling C, give string constants the type @code{const
9157 char[@var{length}]} so that copying the address of one into a
9158 non-@code{const} @code{char *} pointer produces a warning.  These
9159 warnings help you find at compile time code that can try to write
9160 into a string constant, but only if you have been very careful about
9161 using @code{const} in declarations and prototypes.  Otherwise, it is
9162 just a nuisance. This is why we did not make @option{-Wall} request
9163 these warnings.
9165 When compiling C++, warn about the deprecated conversion from string
9166 literals to @code{char *}.  This warning is enabled by default for C++
9167 programs.
9169 This warning is upgraded to an error by @option{-pedantic-errors} in
9170 C++11 mode or later.
9172 @opindex Wclobbered
9173 @opindex Wno-clobbered
9174 @item -Wclobbered
9175 Warn for variables that might be changed by @code{longjmp} or
9176 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9178 @opindex Wcomplain-wrong-lang
9179 @opindex Wno-complain-wrong-lang
9180 @item -Wno-complain-wrong-lang
9181 By default, language front ends complain when a command-line option is
9182 valid, but not applicable to that front end.
9183 This may be disabled with @option{-Wno-complain-wrong-lang},
9184 which is mostly useful when invoking a single compiler driver for
9185 multiple source files written in different languages, for example:
9187 @smallexample
9188 $ g++ -fno-rtti a.cc b.f90
9189 @end smallexample
9191 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9192 and the Fortran front end to compile @file{b.f90}.
9193 The latter front end diagnoses
9194 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9195 which may be disabled with @option{-Wno-complain-wrong-lang}.
9197 @opindex Wcompare-distinct-pointer-types
9198 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9199 Warn if pointers of distinct types are compared without a cast.  This
9200 warning is enabled by default.
9202 @opindex Wconversion
9203 @opindex Wno-conversion
9204 @item -Wconversion
9205 Warn for implicit conversions that may alter a value. This includes
9206 conversions between real and integer, like @code{abs (x)} when
9207 @code{x} is @code{double}; conversions between signed and unsigned,
9208 like @code{unsigned ui = -1}; and conversions to smaller types, like
9209 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9210 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9211 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9212 conversions between signed and unsigned integers can be disabled by
9213 using @option{-Wno-sign-conversion}.
9215 For C++, also warn for confusing overload resolution for user-defined
9216 conversions; and conversions that never use a type conversion
9217 operator: conversions to @code{void}, the same type, a base class or a
9218 reference to them. Warnings about conversions between signed and
9219 unsigned integers are disabled by default in C++ unless
9220 @option{-Wsign-conversion} is explicitly enabled.
9222 Warnings about conversion from arithmetic on a small type back to that
9223 type are only given with @option{-Warith-conversion}.
9225 @opindex Wdangling-else
9226 @opindex Wno-dangling-else
9227 @item -Wdangling-else
9228 Warn about constructions where there may be confusion to which
9229 @code{if} statement an @code{else} branch belongs.  Here is an example of
9230 such a case:
9232 @smallexample
9233 @group
9235   if (a)
9236     if (b)
9237       foo ();
9238   else
9239     bar ();
9241 @end group
9242 @end smallexample
9244 In C/C++, every @code{else} branch belongs to the innermost possible
9245 @code{if} statement, which in this example is @code{if (b)}.  This is
9246 often not what the programmer expected, as illustrated in the above
9247 example by indentation the programmer chose.  When there is the
9248 potential for this confusion, GCC issues a warning when this flag
9249 is specified.  To eliminate the warning, add explicit braces around
9250 the innermost @code{if} statement so there is no way the @code{else}
9251 can belong to the enclosing @code{if}.  The resulting code
9252 looks like this:
9254 @smallexample
9255 @group
9257   if (a)
9258     @{
9259       if (b)
9260         foo ();
9261       else
9262         bar ();
9263     @}
9265 @end group
9266 @end smallexample
9268 This warning is enabled by @option{-Wparentheses}.
9270 @opindex Wdangling-pointer
9271 @opindex Wno-dangling-pointer
9272 @item -Wdangling-pointer
9273 @itemx -Wdangling-pointer=@var{n}
9274 Warn about uses of pointers (or C++ references) to objects with automatic
9275 storage duration after their lifetime has ended.  This includes local
9276 variables declared in nested blocks, compound literals and other unnamed
9277 temporary objects.  In addition, warn about storing the address of such
9278 objects in escaped pointers.  The warning is enabled at all optimization
9279 levels but may yield different results with optimization than without.
9281 @table @gcctabopt
9282 @item -Wdangling-pointer=1
9283 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9284 For example
9285 @smallexample
9286 int f (int c1, int c2, x)
9288   char *p = strchr ((char[])@{ c1, c2 @}, c3);
9289   // warning: dangling pointer to a compound literal
9290   return p ? *p : 'x';
9292 @end smallexample
9293 In the following function the store of the address of the local variable
9294 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9295 @smallexample
9296 void g (int **p)
9298   int x = 7;
9299   // warning: storing the address of a local variable in *p
9300   *p = &x;
9302 @end smallexample
9304 @item -Wdangling-pointer=2
9305 At level 2, in addition to unconditional uses the warning also diagnoses
9306 conditional uses of dangling pointers.
9308 For example, because the array @var{a} in the following function is out of
9309 scope when the pointer @var{s} that was set to point is used, the warning
9310 triggers at this level.
9312 @smallexample
9313 void f (char *s)
9315   if (!s)
9316     @{
9317       char a[12] = "tmpname";
9318       s = a;
9319     @}
9320   // warning: dangling pointer to a may be used
9321   strcat (s, ".tmp");
9322   ...
9324 @end smallexample
9325 @end table
9327 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9329 @opindex Wdate-time
9330 @opindex Wno-date-time
9331 @item -Wdate-time
9332 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9333 are encountered as they might prevent bit-wise-identical reproducible
9334 compilations.
9336 @opindex Wempty-body
9337 @opindex Wno-empty-body
9338 @item -Wempty-body
9339 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9340 while} statement.  This warning is also enabled by @option{-Wextra}.
9342 @opindex Wendif-labels
9343 @opindex Wno-endif-labels
9344 @item -Wno-endif-labels
9345 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9347 @opindex Wenum-compare
9348 @opindex Wno-enum-compare
9349 @item -Wenum-compare
9350 Warn about a comparison between values of different enumerated types.
9351 In C++ enumerated type mismatches in conditional expressions are also
9352 diagnosed and the warning is enabled by default.  In C this warning is 
9353 enabled by @option{-Wall}.
9355 @opindex Wenum-conversion
9356 @opindex Wno-enum-conversion
9357 @item -Wenum-conversion
9358 Warn when a value of enumerated type is implicitly converted to a 
9359 different enumerated type.  This warning is enabled by @option{-Wextra}
9360 in C@.
9362 @opindex Wenum-int-mismatch
9363 @opindex Wno-enum-int-mismatch
9364 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9365 Warn about mismatches between an enumerated type and an integer type in
9366 declarations.  For example:
9368 @smallexample
9369 enum E @{ l = -1, z = 0, g = 1 @};
9370 int foo(void);
9371 enum E foo(void);
9372 @end smallexample
9374 In C, an enumerated type is compatible with @code{char}, a signed
9375 integer type, or an unsigned integer type.  However, since the choice
9376 of the underlying type of an enumerated type is implementation-defined,
9377 such mismatches may cause portability issues.  In C++, such mismatches
9378 are an error.  In C, this warning is enabled by @option{-Wall} and
9379 @option{-Wc++-compat}.
9381 @opindex Wjump-misses-init
9382 @opindex Wno-jump-misses-init
9383 @item -Wjump-misses-init @r{(C, Objective-C only)}
9384 Warn if a @code{goto} statement or a @code{switch} statement jumps
9385 forward across the initialization of a variable, or jumps backward to a
9386 label after the variable has been initialized.  This only warns about
9387 variables that are initialized when they are declared.  This warning is
9388 only supported for C and Objective-C; in C++ this sort of branch is an
9389 error in any case.
9391 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9392 can be disabled with the @option{-Wno-jump-misses-init} option.
9394 @opindex Wsign-compare
9395 @opindex Wno-sign-compare
9396 @cindex warning for comparison of signed and unsigned values
9397 @cindex comparison of signed and unsigned values, warning
9398 @cindex signed and unsigned values, comparison warning
9399 @item -Wsign-compare
9400 Warn when a comparison between signed and unsigned values could produce
9401 an incorrect result when the signed value is converted to unsigned.
9402 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9403 also enabled by @option{-Wextra}.
9405 @opindex Wsign-conversion
9406 @opindex Wno-sign-conversion
9407 @item -Wsign-conversion
9408 Warn for implicit conversions that may change the sign of an integer
9409 value, like assigning a signed integer expression to an unsigned
9410 integer variable. An explicit cast silences the warning. In C, this
9411 option is enabled also by @option{-Wconversion}.
9413 @opindex Wflex-array-member-not-at-end
9414 @opindex Wno-flex-array-member-not-at-end
9415 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9416 Warn when a structure containing a C99 flexible array member as the last
9417 field is not at the end of another structure.
9418 This warning warns e.g. about
9420 @smallexample
9421 struct flex  @{ int length; char data[]; @};
9422 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9423 @end smallexample
9425 @opindex Wfloat-conversion
9426 @opindex Wno-float-conversion
9427 @item -Wfloat-conversion
9428 Warn for implicit conversions that reduce the precision of a real value.
9429 This includes conversions from real to integer, and from higher precision
9430 real to lower precision real values.  This option is also enabled by
9431 @option{-Wconversion}.
9433 @opindex Wno-scalar-storage-order
9434 @opindex Wscalar-storage-order
9435 @item -Wno-scalar-storage-order
9436 Do not warn on suspicious constructs involving reverse scalar storage order.
9438 @opindex Wsizeof-array-div
9439 @opindex Wno-sizeof-array-div
9440 @item -Wsizeof-array-div
9441 Warn about divisions of two sizeof operators when the first one is applied
9442 to an array and the divisor does not equal the size of the array element.
9443 In such a case, the computation will not yield the number of elements in the
9444 array, which is likely what the user intended.  This warning warns e.g. about
9445 @smallexample
9446 int fn ()
9448   int arr[10];
9449   return sizeof (arr) / sizeof (short);
9451 @end smallexample
9453 This warning is enabled by @option{-Wall}.
9455 @opindex Wsizeof-pointer-div
9456 @opindex Wno-sizeof-pointer-div
9457 @item -Wsizeof-pointer-div
9458 Warn for suspicious divisions of two sizeof expressions that divide
9459 the pointer size by the element size, which is the usual way to compute
9460 the array size but won't work out correctly with pointers.  This warning
9461 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9462 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9464 @opindex Wsizeof-pointer-memaccess
9465 @opindex Wno-sizeof-pointer-memaccess
9466 @item -Wsizeof-pointer-memaccess
9467 Warn for suspicious length parameters to certain string and memory built-in
9468 functions if the argument uses @code{sizeof}.  This warning triggers for
9469 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9470 an array, but a pointer, and suggests a possible fix, or about
9471 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9472 also warns about calls to bounded string copy functions like @code{strncat}
9473 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9474 the source array.  For example, in the following function the call to
9475 @code{strncat} specifies the size of the source string as the bound.  That
9476 is almost certainly a mistake and so the call is diagnosed.
9477 @smallexample
9478 void make_file (const char *name)
9480   char path[PATH_MAX];
9481   strncpy (path, name, sizeof path - 1);
9482   strncat (path, ".text", sizeof ".text");
9483   @dots{}
9485 @end smallexample
9487 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9489 @opindex Wsizeof-array-argument
9490 @opindex Wno-sizeof-array-argument
9491 @item -Wno-sizeof-array-argument
9492 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9493 declared as an array in a function definition.  This warning is enabled by
9494 default for C and C++ programs.
9496 @opindex Wmemset-elt-size
9497 @opindex Wno-memset-elt-size
9498 @item -Wmemset-elt-size
9499 Warn for suspicious calls to the @code{memset} built-in function, if the
9500 first argument references an array, and the third argument is a number
9501 equal to the number of elements, but not equal to the size of the array
9502 in memory.  This indicates that the user has omitted a multiplication by
9503 the element size.  This warning is enabled by @option{-Wall}.
9505 @opindex Wmemset-transposed-args
9506 @opindex Wno-memset-transposed-args
9507 @item -Wmemset-transposed-args
9508 Warn for suspicious calls to the @code{memset} built-in function where
9509 the second argument is not zero and the third argument is zero.  For
9510 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9511 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9512 is only emitted if the third argument is a literal zero.  Otherwise, if
9513 it is an expression that is folded to zero, or a cast of zero to some
9514 type, it is far less likely that the arguments have been mistakenly
9515 transposed and no warning is emitted.  This warning is enabled
9516 by @option{-Wall}.
9518 @opindex Waddress
9519 @opindex Wno-address
9520 @item -Waddress
9521 Warn about suspicious uses of address expressions. These include comparing
9522 the address of a function or a declared object to the null pointer constant
9523 such as in
9524 @smallexample
9525 void f (void);
9526 void g (void)
9528   if (!f)   // warning: expression evaluates to false
9529     abort ();
9531 @end smallexample
9532 comparisons of a pointer to a string literal, such as in
9533 @smallexample
9534 void f (const char *x)
9536   if (x == "abc")   // warning: expression evaluates to false
9537     puts ("equal");
9539 @end smallexample
9540 and tests of the results of pointer addition or subtraction for equality
9541 to null, such as in
9542 @smallexample
9543 void f (const int *p, int i)
9545   return p + i == NULL;
9547 @end smallexample
9548 Such uses typically indicate a programmer error: the address of most
9549 functions and objects necessarily evaluates to true (the exception are
9550 weak symbols), so their use in a conditional might indicate missing
9551 parentheses in a function call or a missing dereference in an array
9552 expression.  The subset of the warning for object pointers can be
9553 suppressed by casting the pointer operand to an integer type such
9554 as @code{intptr_t} or @code{uintptr_t}.
9555 Comparisons against string literals result in unspecified behavior
9556 and are not portable, and suggest the intent was to call @code{strcmp}.
9557 The warning is suppressed if the suspicious expression is the result
9558 of macro expansion.
9559 @option{-Waddress} warning is enabled by @option{-Wall}.
9561 @opindex Waddress-of-packed-member
9562 @opindex Wno-address-of-packed-member
9563 @item -Wno-address-of-packed-member
9564 Do not warn when the address of packed member of struct or union is taken,
9565 which usually results in an unaligned pointer value.  This is
9566 enabled by default.
9568 @opindex Wlogical-op
9569 @opindex Wno-logical-op
9570 @item -Wlogical-op
9571 Warn about suspicious uses of logical operators in expressions.
9572 This includes using logical operators in contexts where a
9573 bit-wise operator is likely to be expected.  Also warns when
9574 the operands of a logical operator are the same:
9575 @smallexample
9576 extern int a;
9577 if (a < 0 && a < 0) @{ @dots{} @}
9578 @end smallexample
9580 @opindex Wlogical-not-parentheses
9581 @opindex Wno-logical-not-parentheses
9582 @item -Wlogical-not-parentheses
9583 Warn about logical not used on the left hand side operand of a comparison.
9584 This option does not warn if the right operand is considered to be a boolean
9585 expression.  Its purpose is to detect suspicious code like the following:
9586 @smallexample
9587 int a;
9588 @dots{}
9589 if (!a > 1) @{ @dots{} @}
9590 @end smallexample
9592 It is possible to suppress the warning by wrapping the LHS into
9593 parentheses:
9594 @smallexample
9595 if ((!a) > 1) @{ @dots{} @}
9596 @end smallexample
9598 This warning is enabled by @option{-Wall}.
9600 @opindex Waggregate-return
9601 @opindex Wno-aggregate-return
9602 @item -Waggregate-return
9603 Warn if any functions that return structures or unions are defined or
9604 called.  (In languages where you can return an array, this also elicits
9605 a warning.)
9607 @opindex Wno-aggressive-loop-optimizations
9608 @opindex Waggressive-loop-optimizations
9609 @item -Wno-aggressive-loop-optimizations
9610 Warn if in a loop with constant number of iterations the compiler detects
9611 undefined behavior in some statement during one or more of the iterations.
9613 @opindex Wno-attributes
9614 @opindex Wattributes
9615 @item -Wno-attributes
9616 Do not warn if an unexpected @code{__attribute__} is used, such as
9617 unrecognized attributes, function attributes applied to variables,
9618 etc.  This does not stop errors for incorrect use of supported
9619 attributes.
9621 Warnings about ill-formed uses of standard attributes are upgraded to
9622 errors by @option{-pedantic-errors}.
9624 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9625 warnings about unknown scoped attributes (in C++11 and C23).  For example,
9626 @option{-Wno-attributes=vendor::attr} disables warning about the following
9627 declaration:
9629 @smallexample
9630 [[vendor::attr]] void f();
9631 @end smallexample
9633 It is also possible to disable warning about all attributes in a namespace
9634 using @option{-Wno-attributes=vendor::} which prevents warning about both
9635 of these declarations:
9637 @smallexample
9638 [[vendor::safe]] void f();
9639 [[vendor::unsafe]] void f2();
9640 @end smallexample
9642 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9644 @opindex Wno-builtin-declaration-mismatch
9645 @opindex Wbuiltin-declaration-mismatch
9646 @item -Wno-builtin-declaration-mismatch
9647 Warn if a built-in function is declared with an incompatible signature
9648 or as a non-function, or when a built-in function declared with a type
9649 that does not include a prototype is called with arguments whose promoted
9650 types do not match those expected by the function.  When @option{-Wextra}
9651 is specified, also warn when a built-in function that takes arguments is
9652 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9653 warning is enabled by default.  To avoid the warning include the appropriate
9654 header to bring the prototypes of built-in functions into scope.
9656 For example, the call to @code{memset} below is diagnosed by the warning
9657 because the function expects a value of type @code{size_t} as its argument
9658 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9659 the declaration of the function is diagnosed as well.
9660 @smallexample
9661 extern void* memset ();
9662 void f (void *d)
9664   memset (d, '\0', 32);
9666 @end smallexample
9668 @opindex Wno-builtin-macro-redefined
9669 @opindex Wbuiltin-macro-redefined
9670 @item -Wno-builtin-macro-redefined
9671 Do not warn if certain built-in macros are redefined.  This suppresses
9672 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9673 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9675 @opindex Wstrict-prototypes
9676 @opindex Wno-strict-prototypes
9677 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9678 Warn if a function is declared or defined without specifying the
9679 argument types.  (An old-style function definition is permitted without
9680 a warning if preceded by a declaration that specifies the argument
9681 types.)
9683 @opindex Wold-style-declaration
9684 @opindex Wno-old-style-declaration
9685 @item -Wold-style-declaration @r{(C and Objective-C only)}
9686 Warn for obsolescent usages, according to the C Standard, in a
9687 declaration. For example, warn if storage-class specifiers like
9688 @code{static} are not the first things in a declaration.  This warning
9689 is also enabled by @option{-Wextra}.
9691 @opindex Wold-style-definition
9692 @opindex Wno-old-style-definition
9693 @item -Wold-style-definition @r{(C and Objective-C only)}
9694 Warn if an old-style function definition is used.  A warning is given
9695 even if there is a previous prototype.  A definition using @samp{()}
9696 is not considered an old-style definition in C23 mode, because it is
9697 equivalent to @samp{(void)} in that case, but is considered an
9698 old-style definition for older standards.
9700 @opindex Wmissing-parameter-type
9701 @opindex Wno-missing-parameter-type
9702 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9703 A function parameter is declared without a type specifier in K&R-style
9704 functions:
9706 @smallexample
9707 void foo(bar) @{ @}
9708 @end smallexample
9710 This warning is also enabled by @option{-Wextra}.
9712 @opindex Wmissing-prototypes
9713 @opindex Wno-missing-prototypes
9714 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9715 Warn if a global function is defined without a previous prototype
9716 declaration.  This warning is issued even if the definition itself
9717 provides a prototype.  Use this option to detect global functions
9718 that do not have a matching prototype declaration in a header file.
9719 This option is not valid for C++ because all function declarations
9720 provide prototypes and a non-matching declaration declares an
9721 overload rather than conflict with an earlier declaration.
9722 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9724 @opindex Wmissing-variable-declarations
9725 @opindex Wno-missing-variable-declarations
9726 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9727 Warn if a global variable is defined without a previous declaration.
9728 Use this option to detect global variables that do not have a matching
9729 extern declaration in a header file.
9731 @opindex Wmissing-declarations
9732 @opindex Wno-missing-declarations
9733 @item -Wmissing-declarations
9734 Warn if a global function is defined without a previous declaration.
9735 Do so even if the definition itself provides a prototype.
9736 Use this option to detect global functions that are not declared in
9737 header files.  In C, no warnings are issued for functions with previous
9738 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9739 missing prototypes.  In C++, no warnings are issued for function templates,
9740 or for inline functions, or for functions in anonymous namespaces.
9742 @opindex Wmissing-field-initializers
9743 @opindex Wno-missing-field-initializers
9744 @opindex W
9745 @opindex Wextra
9746 @opindex Wno-extra
9747 @item -Wmissing-field-initializers
9748 Warn if a structure's initializer has some fields missing.  For
9749 example, the following code causes such a warning, because
9750 @code{x.h} is implicitly zero:
9752 @smallexample
9753 struct s @{ int f, g, h; @};
9754 struct s x = @{ 3, 4 @};
9755 @end smallexample
9757 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
9758 In C this option does not warn about designated initializers, so the
9759 following modification does not trigger a warning:
9761 @smallexample
9762 struct s @{ int f, g, h; @};
9763 struct s x = @{ .f = 3, .g = 4 @};
9764 @end smallexample
9766 In C this option does not warn about the universal zero initializer
9767 @samp{@{ 0 @}}:
9769 @smallexample
9770 struct s @{ int f, g, h; @};
9771 struct s x = @{ 0 @};
9772 @end smallexample
9774 Likewise, in C++ this option does not warn about the empty @{ @}
9775 initializer, for example:
9777 @smallexample
9778 struct s @{ int f, g, h; @};
9779 s x = @{ @};
9780 @end smallexample
9782 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9783 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9785 @opindex Wmissing-requires
9786 @opindex Wno-missing-requires
9787 @item -Wno-missing-requires
9789 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9791 @smallexample
9792 bool satisfied = requires @{ C<T> @};
9793 @end smallexample
9795 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9796 expression, which it is for all T.  Presumably the user meant to write
9798 @smallexample
9799 bool satisfied = requires @{ requires C<T> @};
9800 @end smallexample
9802 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9803 type @samp{T}.
9805 This warning can be disabled with @option{-Wno-missing-requires}.
9807 @opindex Wmissing-template-keyword
9808 @opindex Wno-missing-template-keyword
9809 @item -Wno-missing-template-keyword
9811 The member access tokens ., -> and :: must be followed by the @code{template}
9812 keyword if the parent object is dependent and the member being named is a
9813 template.
9815 @smallexample
9816 template <class X>
9817 void DoStuff (X x)
9819   x.template DoSomeOtherStuff<X>(); // Good.
9820   x.DoMoreStuff<X>(); // Warning, x is dependent.
9822 @end smallexample
9824 In rare cases it is possible to get false positives. To silence this, wrap
9825 the expression in parentheses. For example, the following is treated as a
9826 template, even where m and N are integers:
9828 @smallexample
9829 void NotATemplate (my_class t)
9831   int N = 5;
9833   bool test = t.m < N > (0); // Treated as a template.
9834   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9836 @end smallexample
9838 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9840 @opindex Wno-multichar
9841 @opindex Wmultichar
9842 @item -Wno-multichar
9843 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9844 Usually they indicate a typo in the user's code, as they have
9845 implementation-defined values, and should not be used in portable code.
9847 @opindex Wnormalized=
9848 @opindex Wnormalized
9849 @opindex Wno-normalized
9850 @cindex NFC
9851 @cindex NFKC
9852 @cindex character set, input normalization
9853 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9854 In ISO C and ISO C++, two identifiers are different if they are
9855 different sequences of characters.  However, sometimes when characters
9856 outside the basic ASCII character set are used, you can have two
9857 different character sequences that look the same.  To avoid confusion,
9858 the ISO 10646 standard sets out some @dfn{normalization rules} which
9859 when applied ensure that two sequences that look the same are turned into
9860 the same sequence.  GCC can warn you if you are using identifiers that
9861 have not been normalized; this option controls that warning.
9863 There are four levels of warning supported by GCC@.  The default is
9864 @option{-Wnormalized=nfc}, which warns about any identifier that is
9865 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9866 recommended form for most uses.  It is equivalent to
9867 @option{-Wnormalized}.
9869 Unfortunately, there are some characters allowed in identifiers by
9870 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9871 identifiers.  That is, there's no way to use these symbols in portable
9872 ISO C or C++ and have all your identifiers in NFC@.
9873 @option{-Wnormalized=id} suppresses the warning for these characters.
9874 It is hoped that future versions of the standards involved will correct
9875 this, which is why this option is not the default.
9877 You can switch the warning off for all characters by writing
9878 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9879 only do this if you are using some other normalization scheme (like
9880 ``D''), because otherwise you can easily create bugs that are
9881 literally impossible to see.
9883 Some characters in ISO 10646 have distinct meanings but look identical
9884 in some fonts or display methodologies, especially once formatting has
9885 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9886 LETTER N'', displays just like a regular @code{n} that has been
9887 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9888 normalization scheme to convert all these into a standard form as
9889 well, and GCC warns if your code is not in NFKC if you use
9890 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9891 about every identifier that contains the letter O because it might be
9892 confused with the digit 0, and so is not the default, but may be
9893 useful as a local coding convention if the programming environment 
9894 cannot be fixed to display these characters distinctly.
9896 @opindex Wno-attribute-warning
9897 @opindex Wattribute-warning
9898 @item -Wno-attribute-warning
9899 Do not warn about usage of functions (@pxref{Function Attributes})
9900 declared with @code{warning} attribute.  By default, this warning is
9901 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9902 warning or @option{-Wno-error=attribute-warning} can be used to
9903 disable the error when compiled with @option{-Werror} flag.
9905 @opindex Wno-deprecated
9906 @opindex Wdeprecated
9907 @item -Wno-deprecated
9908 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9910 @opindex Wno-deprecated-declarations
9911 @opindex Wdeprecated-declarations
9912 @item -Wno-deprecated-declarations
9913 Do not warn about uses of functions (@pxref{Function Attributes}),
9914 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9915 Attributes}) marked as deprecated by using the @code{deprecated}
9916 attribute.
9918 @opindex Wno-overflow
9919 @opindex Woverflow
9920 @item -Wno-overflow
9921 Do not warn about compile-time overflow in constant expressions.
9923 @opindex Wno-odr
9924 @opindex Wodr
9925 @item -Wno-odr
9926 Warn about One Definition Rule violations during link-time optimization.
9927 Enabled by default.
9929 @opindex Wopenacc-parallelism
9930 @opindex Wno-openacc-parallelism
9931 @cindex OpenACC accelerator programming
9932 @item -Wopenacc-parallelism
9933 Warn about potentially suboptimal choices related to OpenACC parallelism.
9935 @opindex Wopenmp-simd
9936 @opindex Wno-openmp-simd
9937 @item -Wopenmp-simd
9938 Warn if the vectorizer cost model overrides the OpenMP
9939 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9940 option can be used to relax the cost model.
9942 @opindex Woverride-init
9943 @opindex Wno-override-init
9944 @opindex W
9945 @opindex Wextra
9946 @opindex Wno-extra
9947 @item -Woverride-init @r{(C and Objective-C only)}
9948 Warn if an initialized field without side effects is overridden when
9949 using designated initializers (@pxref{Designated Inits, , Designated
9950 Initializers}).
9952 This warning is included in @option{-Wextra}.  To get other
9953 @option{-Wextra} warnings without this one, use @option{-Wextra
9954 -Wno-override-init}.
9956 @opindex Woverride-init-side-effects
9957 @opindex Wno-override-init-side-effects
9958 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9959 Do not warn if an initialized field with side effects is overridden when
9960 using designated initializers (@pxref{Designated Inits, , Designated
9961 Initializers}).  This warning is enabled by default.
9963 @opindex Wpacked
9964 @opindex Wno-packed
9965 @item -Wpacked
9966 Warn if a structure is given the packed attribute, but the packed
9967 attribute has no effect on the layout or size of the structure.
9968 Such structures may be mis-aligned for little benefit.  For
9969 instance, in this code, the variable @code{f.x} in @code{struct bar}
9970 is misaligned even though @code{struct bar} does not itself
9971 have the packed attribute:
9973 @smallexample
9974 @group
9975 struct foo @{
9976   int x;
9977   char a, b, c, d;
9978 @} __attribute__((packed));
9979 struct bar @{
9980   char z;
9981   struct foo f;
9983 @end group
9984 @end smallexample
9986 @opindex Wpacked-bitfield-compat
9987 @opindex Wno-packed-bitfield-compat
9988 @item -Wnopacked-bitfield-compat
9989 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9990 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9991 the change can lead to differences in the structure layout.  GCC
9992 informs you when the offset of such a field has changed in GCC 4.4.
9993 For example there is no longer a 4-bit padding between field @code{a}
9994 and @code{b} in this structure:
9996 @smallexample
9997 struct foo
9999   char a:4;
10000   char b:8;
10001 @} __attribute__ ((packed));
10002 @end smallexample
10004 This warning is enabled by default.  Use
10005 @option{-Wno-packed-bitfield-compat} to disable this warning.
10007 @opindex Wpacked-not-aligned
10008 @opindex Wno-packed-not-aligned
10009 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
10010 Warn if a structure field with explicitly specified alignment in a
10011 packed struct or union is misaligned.  For example, a warning will
10012 be issued on @code{struct S}, like, @code{warning: alignment 1 of
10013 'struct S' is less than 8}, in this code:
10015 @smallexample
10016 @group
10017 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
10018 struct __attribute__ ((packed)) S @{
10019   struct S8 s8;
10021 @end group
10022 @end smallexample
10024 This warning is enabled by @option{-Wall}.
10026 @opindex Wpadded
10027 @opindex Wno-padded
10028 @item -Wpadded
10029 Warn if padding is included in a structure, either to align an element
10030 of the structure or to align the whole structure.  Sometimes when this
10031 happens it is possible to rearrange the fields of the structure to
10032 reduce the padding and so make the structure smaller.
10034 @opindex Wredundant-decls
10035 @opindex Wno-redundant-decls
10036 @item -Wredundant-decls
10037 Warn if anything is declared more than once in the same scope, even in
10038 cases where multiple declaration is valid and changes nothing.
10040 @opindex Wrestrict
10041 @opindex Wno-restrict
10042 @item -Wrestrict
10043 Warn when an object referenced by a @code{restrict}-qualified parameter
10044 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
10045 argument, or when copies between such objects overlap.  For example,
10046 the call to the @code{strcpy} function below attempts to truncate the string
10047 by replacing its initial characters with the last four.  However, because
10048 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
10049 the call is diagnosed.
10051 @smallexample
10052 void foo (void)
10054   char a[] = "abcd1234";
10055   strcpy (a, a + 4);
10056   @dots{}
10058 @end smallexample
10059 The @option{-Wrestrict} option detects some instances of simple overlap
10060 even without optimization but works best at @option{-O2} and above.  It
10061 is included in @option{-Wall}.
10063 @opindex Wnested-externs
10064 @opindex Wno-nested-externs
10065 @item -Wnested-externs @r{(C and Objective-C only)}
10066 Warn if an @code{extern} declaration is encountered within a function.
10068 @opindex Winline
10069 @opindex Wno-inline
10070 @item -Winline
10071 Warn if a function that is declared as inline cannot be inlined.
10072 Even with this option, the compiler does not warn about failures to
10073 inline functions declared in system headers.
10075 The compiler uses a variety of heuristics to determine whether or not
10076 to inline a function.  For example, the compiler takes into account
10077 the size of the function being inlined and the amount of inlining
10078 that has already been done in the current function.  Therefore,
10079 seemingly insignificant changes in the source program can cause the
10080 warnings produced by @option{-Winline} to appear or disappear.
10082 @opindex Winterference-size
10083 @item -Winterference-size
10084 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10085 without specifying its value with @option{--param destructive-interference-size}.
10086 Also warn about questionable values for that option.
10088 This variable is intended to be used for controlling class layout, to
10089 avoid false sharing in concurrent code:
10091 @smallexample
10092 struct independent_fields @{
10093   alignas(std::hardware_destructive_interference_size)
10094     std::atomic<int> one;
10095   alignas(std::hardware_destructive_interference_size)
10096     std::atomic<int> two;
10098 @end smallexample
10100 Here @samp{one} and @samp{two} are intended to be far enough apart
10101 that stores to one won't require accesses to the other to reload the
10102 cache line.
10104 By default, @option{--param destructive-interference-size} and
10105 @option{--param constructive-interference-size} are set based on the
10106 current @option{-mtune} option, typically to the L1 cache line size
10107 for the particular target CPU, sometimes to a range if tuning for a
10108 generic target.  So all translation units that depend on ABI
10109 compatibility for the use of these variables must be compiled with
10110 the same @option{-mtune} (or @option{-mcpu}).
10112 If ABI stability is important, such as if the use is in a header for a
10113 library, you should probably not use the hardware interference size
10114 variables at all.  Alternatively, you can force a particular value
10115 with @option{--param}.
10117 If you are confident that your use of the variable does not affect ABI
10118 outside a single build of your project, you can turn off the warning
10119 with @option{-Wno-interference-size}.
10121 @opindex Wint-in-bool-context
10122 @opindex Wno-int-in-bool-context
10123 @item -Wint-in-bool-context
10124 Warn for suspicious use of integer values where boolean values are expected,
10125 such as conditional expressions (?:) using non-boolean integer constants in
10126 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10127 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10128 for all kinds of multiplications regardless of the data type.
10129 This warning is enabled by @option{-Wall}.
10131 @opindex Wno-int-to-pointer-cast
10132 @opindex Wint-to-pointer-cast
10133 @item -Wno-int-to-pointer-cast
10134 Suppress warnings from casts to pointer type of an integer of a
10135 different size. In C++, casting to a pointer type of smaller size is
10136 an error. @option{Wint-to-pointer-cast} is enabled by default.
10139 @opindex Wno-pointer-to-int-cast
10140 @opindex Wpointer-to-int-cast
10141 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10142 Suppress warnings from casts from a pointer to an integer type of a
10143 different size.
10145 @opindex Winvalid-pch
10146 @opindex Wno-invalid-pch
10147 @item -Winvalid-pch
10148 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10149 the search path but cannot be used.
10151 @opindex Winvalid-utf8
10152 @opindex Wno-invalid-utf8
10153 @item -Winvalid-utf8
10154 Warn if an invalid UTF-8 character is found.
10155 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10156 is used and turned into error with @option{-pedantic-errors}.
10158 @opindex Wunicode
10159 @opindex Wno-unicode
10160 @item -Wno-unicode
10161 Don't diagnose invalid forms of delimited or named escape sequences which are
10162 treated as separate tokens.  @option{Wunicode} is enabled by default.
10164 @opindex Wlong-long
10165 @opindex Wno-long-long
10166 @item -Wlong-long
10167 Warn if @code{long long} type is used.  This is enabled by either
10168 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10169 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10171 This warning is upgraded to an error by @option{-pedantic-errors}.
10173 @opindex Wvariadic-macros
10174 @opindex Wno-variadic-macros
10175 @item -Wvariadic-macros
10176 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10177 alternate syntax is used in ISO C99 mode.  This is enabled by either
10178 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10179 messages, use @option{-Wno-variadic-macros}.
10181 @opindex Wvarargs
10182 @opindex Wno-varargs
10183 @item -Wno-varargs
10184 Do not warn upon questionable usage of the macros used to handle variable
10185 arguments like @code{va_start}.  These warnings are enabled by default.
10187 @opindex Wvector-operation-performance
10188 @opindex Wno-vector-operation-performance
10189 @item -Wvector-operation-performance
10190 Warn if vector operation is not implemented via SIMD capabilities of the
10191 architecture.  Mainly useful for the performance tuning.
10192 Vector operation can be implemented @code{piecewise}, which means that the
10193 scalar operation is performed on every vector element; 
10194 @code{in parallel}, which means that the vector operation is implemented
10195 using scalars of wider type, which normally is more performance efficient;
10196 and @code{as a single scalar}, which means that vector fits into a
10197 scalar type.
10199 @opindex Wvla
10200 @opindex Wno-vla
10201 @item -Wvla
10202 Warn if a variable-length array is used in the code.
10203 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10204 the variable-length array.
10206 This warning is upgraded to an error by @option{-pedantic-errors}.
10208 @opindex Wvla-larger-than=
10209 @opindex Wno-vla-larger-than
10210 @item -Wvla-larger-than=@var{byte-size}
10211 If this option is used, the compiler warns for declarations of
10212 variable-length arrays whose size is either unbounded, or bounded
10213 by an argument that allows the array size to exceed @var{byte-size}
10214 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10215 works, but with variable-length arrays.
10217 Note that GCC may optimize small variable-length arrays of a known
10218 value into plain arrays, so this warning may not get triggered for
10219 such arrays.
10221 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10222 is typically only effective when @option{-ftree-vrp} is active (default
10223 for @option{-O2} and above).
10225 See also @option{-Walloca-larger-than=@var{byte-size}}.
10227 @opindex Wno-vla-larger-than
10228 @item -Wno-vla-larger-than
10229 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10230 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10232 @opindex Wno-vla-parameter
10233 @item -Wvla-parameter
10234 Warn about redeclarations of functions involving arguments of Variable
10235 Length Array types of inconsistent kinds or forms, and enable the detection
10236 of out-of-bounds accesses to such parameters by warnings such as
10237 @option{-Warray-bounds}.
10239 If the first function declaration uses the VLA form the bound specified
10240 in the array is assumed to be the minimum number of elements expected to
10241 be provided in calls to the function and the maximum number of elements
10242 accessed by it.  Failing to provide arguments of sufficient size or
10243 accessing more than the maximum number of elements may be diagnosed.
10245 For example, the warning triggers for the following redeclarations because
10246 the first one allows an array of any size to be passed to @code{f} while
10247 the second one specifies that the array argument must have at least @code{n}
10248 elements.  In addition, calling @code{f} with the associated VLA bound
10249 parameter in excess of the actual VLA bound triggers a warning as well.
10251 @smallexample
10252 void f (int n, int[n]);
10253 // warning: argument 2 previously declared as a VLA
10254 void f (int, int[]);
10256 void g (int n)
10258     if (n > 4)
10259       return;
10260     int a[n];
10261     // warning: access to a by f may be out of bounds
10262     f (sizeof a, a);
10263   @dots{}
10266 @end smallexample
10268 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10269 @option{-Warray-parameter} option triggers warnings for similar problems
10270 involving ordinary array arguments.
10272 @opindex Wvolatile-register-var
10273 @opindex Wno-volatile-register-var
10274 @item -Wvolatile-register-var
10275 Warn if a register variable is declared volatile.  The volatile
10276 modifier does not inhibit all optimizations that may eliminate reads
10277 and/or writes to register variables.  This warning is enabled by
10278 @option{-Wall}.
10280 @opindex Wxor-used-as-pow
10281 @opindex Wno-xor-used-as-pow
10282 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10283 Warn about uses of @code{^}, the exclusive or operator, where it appears
10284 the user meant exponentiation.  Specifically, the warning occurs when the
10285 left-hand side is the decimal constant 2 or 10 and the right-hand side
10286 is also a decimal constant.
10288 In C and C++, @code{^} means exclusive or, whereas in some other languages
10289 (e.g. TeX and some versions of BASIC) it means exponentiation.
10291 This warning is enabled by default.  It can be silenced by converting one
10292 of the operands to hexadecimal.
10294 @opindex Wdisabled-optimization
10295 @opindex Wno-disabled-optimization
10296 @item -Wdisabled-optimization
10297 Warn if a requested optimization pass is disabled.  This warning does
10298 not generally indicate that there is anything wrong with your code; it
10299 merely indicates that GCC's optimizers are unable to handle the code
10300 effectively.  Often, the problem is that your code is too big or too
10301 complex; GCC refuses to optimize programs when the optimization
10302 itself is likely to take inordinate amounts of time.
10304 @opindex Wpointer-sign
10305 @opindex Wno-pointer-sign
10306 @item -Wpointer-sign @r{(C and Objective-C only)}
10307 Warn for pointer argument passing or assignment with different signedness.
10308 This option is only supported for C and Objective-C@.  It is implied by
10309 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10310 @option{-Wno-pointer-sign}.
10312 This warning is upgraded to an error by @option{-pedantic-errors}.
10314 @opindex Wstack-protector
10315 @opindex Wno-stack-protector
10316 @item -Wstack-protector
10317 This option is only active when @option{-fstack-protector} is active.  It
10318 warns about functions that are not protected against stack smashing.
10320 @opindex Woverlength-strings
10321 @opindex Wno-overlength-strings
10322 @item -Woverlength-strings
10323 Warn about string constants that are longer than the ``minimum
10324 maximum'' length specified in the C standard.  Modern compilers
10325 generally allow string constants that are much longer than the
10326 standard's minimum limit, but very portable programs should avoid
10327 using longer strings.
10329 The limit applies @emph{after} string constant concatenation, and does
10330 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10331 C99, it was raised to 4095.  C++98 does not specify a normative
10332 minimum maximum, so we do not diagnose overlength strings in C++@.
10334 This option is implied by @option{-Wpedantic}, and can be disabled with
10335 @option{-Wno-overlength-strings}.
10337 @opindex Wunsuffixed-float-constants
10338 @opindex Wno-unsuffixed-float-constants
10339 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10341 Issue a warning for any floating constant that does not have
10342 a suffix.  When used together with @option{-Wsystem-headers} it
10343 warns about such constants in system header files.  This can be useful
10344 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10345 from the decimal floating-point extension to C99.
10347 @opindex Wlto-type-mismatch
10348 @opindex Wno-lto-type-mismatch
10349 @item -Wno-lto-type-mismatch
10351 During the link-time optimization, do not warn about type mismatches in
10352 global declarations from different compilation units.
10353 Requires @option{-flto} to be enabled.  Enabled by default.
10355 @opindex Wdesignated-init
10356 @opindex Wno-designated-init
10357 @item -Wno-designated-init @r{(C and Objective-C only)}
10358 Suppress warnings when a positional initializer is used to initialize
10359 a structure that has been marked with the @code{designated_init}
10360 attribute.
10362 @end table
10364 @node Static Analyzer Options
10365 @section Options That Control Static Analysis
10367 @table @gcctabopt
10368 @opindex analyzer
10369 @opindex fanalyzer
10370 @opindex fno-analyzer
10371 @item -fanalyzer
10372 This option enables an static analysis of program flow which looks
10373 for ``interesting'' interprocedural paths through the
10374 code, and issues warnings for problems found on them.
10376 This analysis is much more expensive than other GCC warnings.
10378 In technical terms, it performs coverage-guided symbolic execution of
10379 the code being compiled.  It is neither sound nor complete: it can
10380 have false positives and false negatives.  It is a bug-finding tool,
10381 rather than a tool for proving program correctness.
10383 The analyzer is only suitable for use on C code in this release.
10385 Enabling this option effectively enables the following warnings:
10387 @gccoptlist{
10388 -Wanalyzer-allocation-size
10389 -Wanalyzer-deref-before-check
10390 -Wanalyzer-double-fclose
10391 -Wanalyzer-double-free
10392 -Wanalyzer-exposure-through-output-file
10393 -Wanalyzer-exposure-through-uninit-copy
10394 -Wanalyzer-fd-access-mode-mismatch
10395 -Wanalyzer-fd-double-close
10396 -Wanalyzer-fd-leak
10397 -Wanalyzer-fd-phase-mismatch
10398 -Wanalyzer-fd-type-mismatch
10399 -Wanalyzer-fd-use-after-close
10400 -Wanalyzer-fd-use-without-check
10401 -Wanalyzer-file-leak
10402 -Wanalyzer-free-of-non-heap
10403 -Wanalyzer-imprecise-fp-arithmetic
10404 -Wanalyzer-infinite-recursion
10405 -Wanalyzer-jump-through-null
10406 -Wanalyzer-malloc-leak
10407 -Wanalyzer-mismatching-deallocation
10408 -Wanalyzer-null-argument
10409 -Wanalyzer-null-dereference
10410 -Wanalyzer-out-of-bounds
10411 -Wanalyzer-overlapping-buffers
10412 -Wanalyzer-possible-null-argument
10413 -Wanalyzer-possible-null-dereference
10414 -Wanalyzer-putenv-of-auto-var
10415 -Wanalyzer-shift-count-negative
10416 -Wanalyzer-shift-count-overflow
10417 -Wanalyzer-stale-setjmp-buffer
10418 -Wanalyzer-tainted-allocation-size
10419 -Wanalyzer-tainted-array-index
10420 -Wanalyzer-tainted-assertion
10421 -Wanalyzer-tainted-divisor
10422 -Wanalyzer-tainted-offset
10423 -Wanalyzer-tainted-size
10424 -Wanalyzer-unsafe-call-within-signal-handler
10425 -Wanalyzer-use-after-free
10426 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10427 -Wanalyzer-use-of-uninitialized-value
10428 -Wanalyzer-va-arg-type-mismatch
10429 -Wanalyzer-va-list-exhausted
10430 -Wanalyzer-va-list-leak
10431 -Wanalyzer-va-list-use-after-va-end
10432 -Wanalyzer-write-to-const
10433 -Wanalyzer-write-to-string-literal
10436 This option is only available if GCC was configured with analyzer
10437 support enabled.
10439 @opindex Wanalyzer-too-complex
10440 @opindex Wno-analyzer-too-complex
10441 @item -Wanalyzer-too-complex
10442 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10443 to attempt to explore the control flow and data flow in the program,
10444 but these can be defeated by sufficiently complicated code.
10446 By default, the analysis silently stops if the code is too
10447 complicated for the analyzer to fully explore and it reaches an internal
10448 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10450 @opindex Wanalyzer-allocation-size
10451 @opindex Wno-analyzer-allocation-size
10452 @item -Wno-analyzer-allocation-size
10453 This warning requires @option{-fanalyzer}, which enables it;
10454 to disable it, use @option{-Wno-analyzer-allocation-size}.
10456 This diagnostic warns for paths through the code in which a pointer to
10457 a buffer is assigned to point at a buffer with a size that is not a
10458 multiple of @code{sizeof (*pointer)}.
10460 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10462 @opindex Wanalyzer-deref-before-check
10463 @opindex Wno-analyzer-deref-before-check
10464 @item -Wno-analyzer-deref-before-check
10465 This warning requires @option{-fanalyzer}, which enables it; use
10466 @option{-Wno-analyzer-deref-before-check}
10467 to disable it.
10469 This diagnostic warns for paths through the code in which a pointer
10470 is checked for @code{NULL} *after* it has already been
10471 dereferenced, suggesting that the pointer could have been NULL.
10472 Such cases suggest that the check for NULL is either redundant,
10473 or that it needs to be moved to before the pointer is dereferenced.
10475 This diagnostic also considers values passed to a function argument
10476 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10477 value, and thus will complain if such values are checked for @code{NULL}
10478 after returning from such a function call.
10480 This diagnostic is unlikely to be reported when any level of optimization
10481 is enabled, as GCC's optimization logic will typically consider such
10482 checks for NULL as being redundant, and optimize them away before the
10483 analyzer "sees" them.  Hence optimization should be disabled when
10484 attempting to trigger this diagnostic.
10486 @opindex Wanalyzer-double-fclose
10487 @opindex Wno-analyzer-double-fclose
10488 @item -Wno-analyzer-double-fclose
10489 This warning requires @option{-fanalyzer}, which enables it; use
10490 @option{-Wno-analyzer-double-fclose} to disable it.
10492 This diagnostic warns for paths through the code in which a @code{FILE *}
10493 can have @code{fclose} called on it more than once.
10495 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10497 @opindex Wanalyzer-double-free
10498 @opindex Wno-analyzer-double-free
10499 @item -Wno-analyzer-double-free
10500 This warning requires @option{-fanalyzer}, which enables it; use
10501 @option{-Wno-analyzer-double-free} to disable it.
10503 This diagnostic warns for paths through the code in which a pointer
10504 can have a deallocator called on it more than once, either @code{free},
10505 or a deallocator referenced by attribute @code{malloc}.
10507 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10509 @opindex Wanalyzer-exposure-through-output-file
10510 @opindex Wno-analyzer-exposure-through-output-file
10511 @item -Wno-analyzer-exposure-through-output-file
10512 This warning requires @option{-fanalyzer}, which enables it; use
10513 @option{-Wno-analyzer-exposure-through-output-file}
10514 to disable it.
10516 This diagnostic warns for paths through the code in which a
10517 security-sensitive value is written to an output file
10518 (such as writing a password to a log file).
10520 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10522 @opindex Wanalyzer-exposure-through-uninit-copy
10523 @opindex Wno-analyzer-exposure-through-uninit-copy
10524 @item -Wanalyzer-exposure-through-uninit-copy
10525 This warning requires both @option{-fanalyzer} and the use of a plugin
10526 to specify a function that copies across a ``trust boundary''.  Use
10527 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10529 This diagnostic warns for ``infoleaks'' - paths through the code in which
10530 uninitialized values are copied across a security boundary
10531 (such as code within an OS kernel that copies a partially-initialized
10532 struct on the stack to user space).
10534 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10536 @opindex Wanalyzer-fd-access-mode-mismatch
10537 @opindex Wno-analyzer-fd-access-mode-mismatch
10538 @item -Wno-analyzer-fd-access-mode-mismatch
10539 This warning requires @option{-fanalyzer}, which enables it; use
10540 @option{-Wno-analyzer-fd-access-mode-mismatch}
10541 to disable it.
10543 This diagnostic warns for paths through code in which a
10544 @code{read} on a write-only file descriptor is attempted, or vice versa.
10546 This diagnostic also warns for code paths in a which a function with attribute
10547 @code{fd_arg_read (N)} is called with a file descriptor opened with
10548 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10549 @code{fd_arg_write (N)} is called with a file descriptor opened with
10550 @code{O_RDONLY} at referenced argument @var{N}.
10552 @opindex Wanalyzer-fd-double-close
10553 @opindex Wno-analyzer-fd-double-close
10554 @item -Wno-analyzer-fd-double-close
10555 This warning requires @option{-fanalyzer}, which enables it; use
10556 @option{-Wno-analyzer-fd-double-close}
10557 to disable it.
10559 This diagnostic warns for paths through code in which a
10560 file descriptor can be closed more than once.
10562 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10564 @opindex Wanalyzer-fd-leak
10565 @opindex Wno-analyzer-fd-leak
10566 @item -Wno-analyzer-fd-leak
10567 This warning requires @option{-fanalyzer}, which enables it; use
10568 @option{-Wno-analyzer-fd-leak}
10569 to disable it.
10571 This diagnostic warns for paths through code in which an
10572 open file descriptor is leaked.
10574 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10576 @opindex Wanalyzer-fd-phase-mismatch
10577 @opindex Wno-analyzer-fd-phase-mismatch
10578 @item -Wno-analyzer-fd-phase-mismatch
10579 This warning requires @option{-fanalyzer}, which enables it; use
10580 @option{-Wno-analyzer-fd-phase-mismatch}
10581 to disable it.
10583 This diagnostic warns for paths through code in which an operation is
10584 attempted in the wrong phase of a file descriptor's lifetime.
10585 For example, it will warn on attempts to call @code{accept} on a stream
10586 socket that has not yet had @code{listen} successfully called on it.
10588 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10590 @opindex Wanalyzer-fd-type-mismatch
10591 @opindex Wno-analyzer-fd-type-mismatch
10592 @item -Wno-analyzer-fd-type-mismatch
10593 This warning requires @option{-fanalyzer}, which enables it; use
10594 @option{-Wno-analyzer-fd-type-mismatch}
10595 to disable it.
10597 This diagnostic warns for paths through code in which an
10598 operation is attempted on the wrong type of file descriptor.
10599 For example, it will warn on attempts to use socket operations
10600 on a file descriptor obtained via @code{open}, or when attempting
10601 to use a stream socket operation on a datagram socket.
10603 @opindex Wanalyzer-fd-use-after-close
10604 @opindex Wno-analyzer-fd-use-after-close
10605 @item -Wno-analyzer-fd-use-after-close
10606 This warning requires @option{-fanalyzer}, which enables it; use
10607 @option{-Wno-analyzer-fd-use-after-close}
10608 to disable it.
10610 This diagnostic warns for paths through code in which a
10611 read or write is called on a closed file descriptor.
10613 This diagnostic also warns for paths through code in which
10614 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10615 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10616 referenced argument @code{N}.
10618 @opindex Wanalyzer-fd-use-without-check
10619 @opindex Wno-analyzer-fd-use-without-check
10620 @item -Wno-analyzer-fd-use-without-check
10621 This warning requires @option{-fanalyzer}, which enables it; use
10622 @option{-Wno-analyzer-fd-use-without-check}
10623 to disable it.
10625 This diagnostic warns for paths through code in which a
10626 file descriptor is used without being checked for validity.
10628 This diagnostic also warns for paths through code in which
10629 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10630 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10631 argument @code{N}, without being checked for validity.
10633 @opindex Wanalyzer-file-leak
10634 @opindex Wno-analyzer-file-leak
10635 @item -Wno-analyzer-file-leak
10636 This warning requires @option{-fanalyzer}, which enables it; use
10637 @option{-Wno-analyzer-file-leak}
10638 to disable it.
10640 This diagnostic warns for paths through the code in which a
10641 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10643 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10645 @opindex Wanalyzer-free-of-non-heap
10646 @opindex Wno-analyzer-free-of-non-heap
10647 @item -Wno-analyzer-free-of-non-heap
10648 This warning requires @option{-fanalyzer}, which enables it; use
10649 @option{-Wno-analyzer-free-of-non-heap}
10650 to disable it.
10652 This diagnostic warns for paths through the code in which @code{free}
10653 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10655 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10657 @opindex Wanalyzer-imprecise-fp-arithmetic
10658 @opindex Wno-analyzer-imprecise-fp-arithmetic
10659 @item -Wno-analyzer-imprecise-fp-arithmetic
10660 This warning requires @option{-fanalyzer}, which enables it; use
10661 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10662 to disable it.
10664 This diagnostic warns for paths through the code in which floating-point
10665 arithmetic is used in locations where precise computation is needed.  This
10666 diagnostic only warns on use of floating-point operands inside the
10667 calculation of an allocation size at the moment.
10669 @opindex Wanalyzer-infinite-recursion
10670 @opindex Wno-analyzer-infinite-recursion
10671 @item -Wno-analyzer-infinite-recursion
10672 This warning requires @option{-fanalyzer}, which enables it; use
10673 @option{-Wno-analyzer-infinite-recursion} to disable it.
10675 This diagnostics warns for paths through the code which appear to
10676 lead to infinite recursion.
10678 Specifically, when the analyzer "sees" a recursive call, it will compare
10679 the state of memory at the entry to the new frame with that at the entry
10680 to the previous frame of that function on the stack.  The warning is
10681 issued if nothing in memory appears to be changing; any changes observed
10682 to parameters or globals are assumed to lead to termination of the
10683 recursion and thus suppress the warning.
10685 This diagnostic is likely to miss cases of infinite recursion that
10686 are convered to iteration by the optimizer before the analyzer "sees"
10687 them.  Hence optimization should be disabled when attempting to trigger
10688 this diagnostic.
10690 Compare with @option{-Winfinite-recursion}, which provides a similar
10691 diagnostic, but is implemented in a different way.
10693 @opindex Wanalyzer-jump-through-null
10694 @opindex Wno-analyzer-jump-through-null
10695 @item -Wno-analyzer-jump-through-null
10696 This warning requires @option{-fanalyzer}, which enables it; use
10697 @option{-Wno-analyzer-jump-through-null}
10698 to disable it.
10700 This diagnostic warns for paths through the code in which a @code{NULL}
10701 function pointer is called.
10703 @opindex Wanalyzer-malloc-leak
10704 @opindex Wno-analyzer-malloc-leak
10705 @item -Wno-analyzer-malloc-leak
10706 This warning requires @option{-fanalyzer}, which enables it; use
10707 @option{-Wno-analyzer-malloc-leak}
10708 to disable it.
10710 This diagnostic warns for paths through the code in which a
10711 pointer allocated via an allocator is leaked: either @code{malloc},
10712 or a function marked with attribute @code{malloc}.
10714 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10716 @opindex Wanalyzer-mismatching-deallocation
10717 @opindex Wno-analyzer-mismatching-deallocation
10718 @item -Wno-analyzer-mismatching-deallocation
10719 This warning requires @option{-fanalyzer}, which enables it; use
10720 @option{-Wno-analyzer-mismatching-deallocation}
10721 to disable it.
10723 This diagnostic warns for paths through the code in which the
10724 wrong deallocation function is called on a pointer value, based on
10725 which function was used to allocate the pointer value.  The diagnostic
10726 will warn about mismatches between @code{free}, scalar @code{delete}
10727 and vector @code{delete[]}, and those marked as allocator/deallocator
10728 pairs using attribute @code{malloc}.
10730 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10732 @opindex Wanalyzer-out-of-bounds
10733 @opindex Wno-analyzer-out-of-bounds
10734 @item -Wno-analyzer-out-of-bounds
10735 This warning requires @option{-fanalyzer}, which enables it; use
10736 @option{-Wno-analyzer-out-of-bounds} to disable it.
10738 This diagnostic warns for paths through the code in which a buffer is
10739 definitely read or written out-of-bounds.  The diagnostic applies for
10740 cases where the analyzer is able to determine a constant offset and for
10741 accesses past the end of a buffer, also a constant capacity.  Further,
10742 the diagnostic does limited checking for accesses past the end when the
10743 offset as well as the capacity is symbolic.
10745 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10747 For cases where the analyzer is able, it will emit a text art diagram
10748 visualizing the spatial relationship between the memory region that the
10749 analyzer predicts would be accessed, versus the range of memory that is
10750 valid to access: whether they overlap, are touching, are close or far
10751 apart; which one is before or after in memory, the relative sizes
10752 involved, the direction of the access (read vs write), and, in some
10753 cases, the values of data involved.  This diagram can be suppressed
10754 using @option{-fdiagnostics-text-art-charset=none}.
10756 @opindex Wanalyzer-overlapping-buffers
10757 @opindex Wno-analyzer-overlapping-buffers
10758 @item -Wno-analyzer-overlapping-buffers
10759 This warning requires @option{-fanalyzer}, which enables it; use
10760 @option{-Wno-analyzer-overlapping-buffers} to disable it.
10762 This diagnostic warns for paths through the code in which overlapping
10763 buffers are passed to an API for which the behavior on such buffers
10764 is undefined.
10766 Specifically, the diagnostic occurs on calls to the following functions
10767 @itemize @bullet
10768 @item @code{memcpy}
10769 @item @code{strcat}
10770 @item @code{strcpy}
10771 @end itemize
10772 for cases where the buffers are known to overlap.
10774 @opindex Wanalyzer-possible-null-argument
10775 @opindex Wno-analyzer-possible-null-argument
10776 @item -Wno-analyzer-possible-null-argument
10777 This warning requires @option{-fanalyzer}, which enables it; use
10778 @option{-Wno-analyzer-possible-null-argument} to disable it.
10780 This diagnostic warns for paths through the code in which a
10781 possibly-NULL value is passed to a function argument marked
10782 with @code{__attribute__((nonnull))} as requiring a non-NULL
10783 value.
10785 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10787 @opindex Wanalyzer-possible-null-dereference
10788 @opindex Wno-analyzer-possible-null-dereference
10789 @item -Wno-analyzer-possible-null-dereference
10790 This warning requires @option{-fanalyzer}, which enables it; use
10791 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10793 This diagnostic warns for paths through the code in which a
10794 possibly-NULL value is dereferenced.
10796 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10798 @opindex Wanalyzer-null-argument
10799 @opindex Wno-analyzer-null-argument
10800 @item -Wno-analyzer-null-argument
10801 This warning requires @option{-fanalyzer}, which enables it; use
10802 @option{-Wno-analyzer-null-argument} to disable it.
10804 This diagnostic warns for paths through the code in which a
10805 value known to be NULL is passed to a function argument marked
10806 with @code{__attribute__((nonnull))} as requiring a non-NULL
10807 value.
10809 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10811 @opindex Wanalyzer-null-dereference
10812 @opindex Wno-analyzer-null-dereference
10813 @item -Wno-analyzer-null-dereference
10814 This warning requires @option{-fanalyzer}, which enables it; use
10815 @option{-Wno-analyzer-null-dereference} to disable it.
10817 This diagnostic warns for paths through the code in which a
10818 value known to be NULL is dereferenced.
10820 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10822 @opindex Wanalyzer-putenv-of-auto-var
10823 @opindex Wno-analyzer-putenv-of-auto-var
10824 @item -Wno-analyzer-putenv-of-auto-var
10825 This warning requires @option{-fanalyzer}, which enables it; use
10826 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10828 This diagnostic warns for paths through the code in which a
10829 call to @code{putenv} is passed a pointer to an automatic variable
10830 or an on-stack buffer.
10832 See @uref{https://wiki.sei.cmu.edu/confluence/x/6NYxBQ, POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument}.
10834 @opindex Wanalyzer-shift-count-negative
10835 @opindex Wno-analyzer-shift-count-negative
10836 @item -Wno-analyzer-shift-count-negative
10837 This warning requires @option{-fanalyzer}, which enables it; use
10838 @option{-Wno-analyzer-shift-count-negative} to disable it.
10840 This diagnostic warns for paths through the code in which a
10841 shift is attempted with a negative count.  It is analogous to
10842 the @option{-Wshift-count-negative} diagnostic implemented in
10843 the C/C++ front ends, but is implemented based on analyzing
10844 interprocedural paths, rather than merely parsing the syntax tree.
10845 However, the analyzer does not prioritize detection of such paths, so
10846 false negatives are more likely relative to other warnings.
10848 @opindex Wanalyzer-shift-count-overflow
10849 @opindex Wno-analyzer-shift-count-overflow
10850 @item -Wno-analyzer-shift-count-overflow
10851 This warning requires @option{-fanalyzer}, which enables it; use
10852 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10854 This diagnostic warns for paths through the code in which a
10855 shift is attempted with a count greater than or equal to the
10856 precision of the operand's type.  It is analogous to
10857 the @option{-Wshift-count-overflow} diagnostic implemented in
10858 the C/C++ front ends, but is implemented based on analyzing
10859 interprocedural paths, rather than merely parsing the syntax tree.
10860 However, the analyzer does not prioritize detection of such paths, so
10861 false negatives are more likely relative to other warnings.
10863 @opindex Wanalyzer-stale-setjmp-buffer
10864 @opindex Wno-analyzer-stale-setjmp-buffer
10865 @item -Wno-analyzer-stale-setjmp-buffer
10866 This warning requires @option{-fanalyzer}, which enables it; use
10867 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10869 This diagnostic warns for paths through the code in which
10870 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10871 to a @code{setjmp} call in a function that has returned.
10873 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10874 location, it records the stack frame.  The stack frame becomes invalid
10875 when the function containing the @code{setjmp} call returns.  Attempting
10876 to rewind to it via @code{longjmp} would reference a stack frame that
10877 no longer exists, and likely lead to a crash (or worse).
10879 @opindex Wanalyzer-tainted-allocation-size
10880 @opindex Wno-analyzer-tainted-allocation-size
10881 @item -Wno-analyzer-tainted-allocation-size
10882 This warning requires @option{-fanalyzer} which enables it;
10883 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10885 This diagnostic warns for paths through the code in which a value
10886 that could be under an attacker's control is used as the size
10887 of an allocation without being sanitized, so that an attacker could
10888 inject an excessively large allocation and potentially cause a denial
10889 of service attack.
10891 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10893 @opindex Wanalyzer-tainted-assertion
10894 @opindex Wno-analyzer-tainted-assertion
10895 @item -Wno-analyzer-tainted-assertion
10897 This warning requires @option{-fanalyzer} which enables it;
10898 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10900 This diagnostic warns for paths through the code in which a value
10901 that could be under an attacker's control is used as part of a
10902 condition without being first sanitized, and that condition guards a
10903 call to a function marked with attribute @code{noreturn}
10904 (such as the function @code{__builtin_unreachable}).  Such functions
10905 typically indicate abnormal termination of the program, such as for
10906 assertion failure handlers.  For example:
10908 @smallexample
10909 assert (some_tainted_value < SOME_LIMIT);
10910 @end smallexample
10912 In such cases:
10914 @itemize
10915 @item
10916 when assertion-checking is enabled: an attacker could trigger
10917 a denial of service by injecting an assertion failure
10919 @item
10920 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10921 an attacker could inject data that subverts the process, since it
10922 presumably violates a precondition that is being assumed by the code.
10924 @end itemize
10926 Note that when assertion-checking is disabled, the assertions are
10927 typically removed by the preprocessor before the analyzer has a chance
10928 to "see" them, so this diagnostic can only generate warnings on builds
10929 in which assertion-checking is enabled.
10931 For the purpose of this warning, any function marked with attribute
10932 @code{noreturn} is considered as a possible assertion failure
10933 handler, including @code{__builtin_unreachable}.  Note that these functions
10934 are sometimes removed by the optimizer before the analyzer "sees" them.
10935 Hence optimization should be disabled when attempting to trigger this
10936 diagnostic.
10938 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10940 The warning can also report problematic constructions such as
10942 @smallexample
10943 switch (some_tainted_value) @{
10944 case 0:
10945   /* [...etc; various valid cases omitted...] */
10946   break;
10948 default:
10949   __builtin_unreachable (); /* BUG: attacker can trigger this  */
10951 @end smallexample
10953 despite the above not being an assertion failure, strictly speaking.
10955 @opindex Wanalyzer-tainted-array-index
10956 @opindex Wno-analyzer-tainted-array-index
10957 @item -Wno-analyzer-tainted-array-index
10958 This warning requires @option{-fanalyzer} which enables it;
10959 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10961 This diagnostic warns for paths through the code in which a value
10962 that could be under an attacker's control is used as the index
10963 of an array access without being sanitized, so that an attacker
10964 could inject an out-of-bounds access.
10966 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10968 @opindex Wanalyzer-tainted-divisor
10969 @opindex Wno-analyzer-tainted-divisor
10970 @item -Wno-analyzer-tainted-divisor
10971 This warning requires @option{-fanalyzer} which enables it;
10972 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10974 This diagnostic warns for paths through the code in which a value
10975 that could be under an attacker's control is used as the divisor
10976 in a division or modulus operation without being sanitized, so that
10977 an attacker could inject a division-by-zero.
10979 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10981 @opindex Wanalyzer-tainted-offset
10982 @opindex Wno-analyzer-tainted-offset
10983 @item -Wno-analyzer-tainted-offset
10984 This warning requires @option{-fanalyzer} which enables it;
10985 use @option{-Wno-analyzer-tainted-offset} to disable it.
10987 This diagnostic warns for paths through the code in which a value
10988 that could be under an attacker's control is used as a pointer offset
10989 without being sanitized, so that an attacker could inject an out-of-bounds
10990 access.
10992 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10994 @opindex Wanalyzer-tainted-size
10995 @opindex Wno-analyzer-tainted-size
10996 @item -Wno-analyzer-tainted-size
10997 This warning requires @option{-fanalyzer} which enables it;
10998 use @option{-Wno-analyzer-tainted-size} to disable it.
11000 This diagnostic warns for paths through the code in which a value
11001 that could be under an attacker's control is used as the size of
11002 an operation such as @code{memset} without being sanitized, so that an
11003 attacker could inject an out-of-bounds access.
11005 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11007 @opindex Wanalyzer-unsafe-call-within-signal-handler
11008 @opindex Wno-analyzer-unsafe-call-within-signal-handler
11009 @item -Wno-analyzer-unsafe-call-within-signal-handler
11010 This warning requires @option{-fanalyzer}, which enables it; use
11011 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
11013 This diagnostic warns for paths through the code in which a
11014 function known to be async-signal-unsafe (such as @code{fprintf}) is
11015 called from a signal handler.
11017 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
11019 @opindex Wanalyzer-use-after-free
11020 @opindex Wno-analyzer-use-after-free
11021 @item -Wno-analyzer-use-after-free
11022 This warning requires @option{-fanalyzer}, which enables it; use
11023 @option{-Wno-analyzer-use-after-free} to disable it.
11025 This diagnostic warns for paths through the code in which a
11026 pointer is used after a deallocator is called on it: either @code{free},
11027 or a deallocator referenced by attribute @code{malloc}.
11029 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
11031 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
11032 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
11033 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
11034 This warning requires @option{-fanalyzer}, which enables it; use
11035 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
11036 to disable it.
11038 This diagnostic warns for paths through the code in which a pointer
11039 is dereferenced that points to a variable in a stale stack frame.
11041 @opindex Wanalyzer-va-arg-type-mismatch
11042 @opindex Wno-analyzer-va-arg-type-mismatch
11043 @item -Wno-analyzer-va-arg-type-mismatch
11044 This warning requires @option{-fanalyzer}, which enables it; use
11045 @option{-Wno-analyzer-va-arg-type-mismatch}
11046 to disable it.
11048 This diagnostic warns for interprocedural paths through the code for which
11049 the analyzer detects an attempt to use @code{va_arg} to extract a value
11050 passed to a variadic call, but uses a type that does not match that of
11051 the expression passed to the call.
11053 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11055 @opindex Wanalyzer-va-list-exhausted
11056 @opindex Wno-analyzer-va-list-exhausted
11057 @item -Wno-analyzer-va-list-exhausted
11058 This warning requires @option{-fanalyzer}, which enables it; use
11059 @option{-Wno-analyzer-va-list-exhausted}
11060 to disable it.
11062 This diagnostic warns for interprocedural paths through the code for which
11063 the analyzer detects an attempt to use @code{va_arg} to access the next
11064 value passed to a variadic call, but all of the values in the
11065 @code{va_list} have already been consumed.
11067 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11069 @opindex Wanalyzer-va-list-leak
11070 @opindex Wno-analyzer-va-list-leak
11071 @item -Wno-analyzer-va-list-leak
11072 This warning requires @option{-fanalyzer}, which enables it; use
11073 @option{-Wno-analyzer-va-list-leak}
11074 to disable it.
11076 This diagnostic warns for interprocedural paths through the code for which
11077 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11078 on a @code{va_list} without a corresponding call to @code{va_end}.
11080 @opindex Wanalyzer-va-list-use-after-va-end
11081 @opindex Wno-analyzer-va-list-use-after-va-end
11082 @item -Wno-analyzer-va-list-use-after-va-end
11083 This warning requires @option{-fanalyzer}, which enables it; use
11084 @option{-Wno-analyzer-va-list-use-after-va-end}
11085 to disable it.
11087 This diagnostic warns for interprocedural paths through the code for which
11088 the analyzer detects an attempt to use a @code{va_list}  after
11089 @code{va_end} has been called on it.
11090 @code{va_list}.
11092 @opindex Wanalyzer-write-to-const
11093 @opindex Wno-analyzer-write-to-const
11094 @item -Wno-analyzer-write-to-const
11095 This warning requires @option{-fanalyzer}, which enables it; use
11096 @option{-Wno-analyzer-write-to-const}
11097 to disable it.
11099 This diagnostic warns for paths through the code in which the analyzer
11100 detects an attempt to write through a pointer to a @code{const} object.
11101 However, the analyzer does not prioritize detection of such paths, so
11102 false negatives are more likely relative to other warnings.
11104 @opindex Wanalyzer-write-to-string-literal
11105 @opindex Wno-analyzer-write-to-string-literal
11106 @item -Wno-analyzer-write-to-string-literal
11107 This warning requires @option{-fanalyzer}, which enables it; use
11108 @option{-Wno-analyzer-write-to-string-literal}
11109 to disable it.
11111 This diagnostic warns for paths through the code in which the analyzer
11112 detects an attempt to write through a pointer to a string literal.
11113 However, the analyzer does not prioritize detection of such paths, so
11114 false negatives are more likely relative to other warnings.
11116 @opindex Wanalyzer-use-of-uninitialized-value
11117 @opindex Wno-analyzer-use-of-uninitialized-value
11118 @item -Wno-analyzer-use-of-uninitialized-value
11119 This warning requires @option{-fanalyzer}, which enables it; use
11120 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11122 This diagnostic warns for paths through the code in which an uninitialized
11123 value is used.
11125 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11127 @end table
11129 The analyzer has hardcoded knowledge about the behavior of the following
11130 memory-management functions:
11132 @itemize @bullet
11133 @item @code{alloca}
11134 @item The built-in functions @code{__builtin_alloc},
11135 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11136 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11137 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11138 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11139 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11140 @item @code{calloc}
11141 @item @code{free}
11142 @item @code{malloc}
11143 @item @code{memset}
11144 @item @code{operator delete}
11145 @item @code{operator delete []}
11146 @item @code{operator new}
11147 @item @code{operator new []}
11148 @item @code{realloc}
11149 @item @code{strdup}
11150 @item @code{strndup}
11151 @end itemize
11153 @noindent
11154 of the following functions for working with file descriptors:
11156 @itemize @bullet
11157 @item @code{open}
11158 @item @code{close}
11159 @item @code{creat}
11160 @item @code{dup}, @code{dup2} and @code{dup3}
11161 @item @code{isatty}
11162 @item @code{pipe}, and @code{pipe2}
11163 @item @code{read}
11164 @item @code{write}
11165 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11166 @end itemize
11168 @noindent
11169 of the following functions for working with @code{<stdio.h>} streams:
11170 @itemize @bullet
11171 @item The built-in functions @code{__builtin_fprintf},
11172 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11173 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11174 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11175 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11176 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11177 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11178 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11179 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11180 @code{__builtin_vprintf}
11181 @item @code{fopen}
11182 @item @code{fclose}
11183 @item @code{ferror}
11184 @item @code{fgets}
11185 @item @code{fgets_unlocked}
11186 @item @code{fileno}
11187 @item @code{fread}
11188 @item @code{getc}
11189 @item @code{getchar}
11190 @item @code{fprintf}
11191 @item @code{printf}
11192 @item @code{fwrite}
11193 @end itemize
11195 @noindent
11196 and of the following functions:
11198 @itemize @bullet
11199 @item The built-in functions @code{__builtin_expect},
11200 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11201 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11202 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11203 @code{__builtin_va_start}
11204 @item The GNU extensions @code{error} and @code{error_at_line}
11205 @item @code{getpass}
11206 @item @code{longjmp}
11207 @item @code{putenv}
11208 @item @code{setjmp}
11209 @item @code{siglongjmp}
11210 @item @code{signal}
11211 @item @code{sigsetjmp}
11212 @item @code{strcat}
11213 @item @code{strchr}
11214 @item @code{strlen}
11215 @end itemize
11217 In addition, various functions with an @code{__analyzer_} prefix have
11218 special meaning to the analyzer, described in the GCC Internals manual.
11220 Pertinent parameters for controlling the exploration are:
11221 @itemize @bullet
11222 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11223 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11224 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11225 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11226 @end itemize
11228 The following options control the analyzer.
11230 @table @gcctabopt
11232 @opindex fanalyzer-call-summaries
11233 @opindex fno-analyzer-call-summaries
11234 @item -fanalyzer-call-summaries
11235 Simplify interprocedural analysis by computing the effect of certain calls,
11236 rather than exploring all paths through the function from callsite to each
11237 possible return.
11239 If enabled, call summaries are only used for functions with more than one
11240 call site, and that are sufficiently complicated (as per
11241 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11243 @opindex fanalyzer-checker
11244 @item -fanalyzer-checker=@var{name}
11245 Restrict the analyzer to run just the named checker, and enable it.
11247 @opindex fanalyzer-debug-text-art
11248 @opindex fno-analyzer-debug-text-art
11249 @item -fanalyzer-debug-text-art-headings
11250 This option is intended for analyzer developers.  If enabled,
11251 the analyzer will add extra annotations to any diagrams it generates.
11253 @opindex fanalyzer-feasibility
11254 @opindex fno-analyzer-feasibility
11255 @item -fno-analyzer-feasibility
11256 This option is intended for analyzer developers.
11258 By default the analyzer verifies that there is a feasible control flow path
11259 for each diagnostic it emits: that the conditions that hold are not mutually
11260 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11261 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11262 debugging issues in this code.
11264 @opindex fanalyzer-fine-grained
11265 @opindex fno-analyzer-fine-grained
11266 @item -fanalyzer-fine-grained
11267 This option is intended for analyzer developers.
11269 Internally the analyzer builds an ``exploded graph'' that combines
11270 control flow graphs with data flow information.
11272 By default, an edge in this graph can contain the effects of a run
11273 of multiple statements within a basic block.  With
11274 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11276 @opindex fanalyzer-show-duplicate-count
11277 @opindex fno-analyzer-show-duplicate-count
11278 @item -fanalyzer-show-duplicate-count
11279 This option is intended for analyzer developers: if multiple diagnostics
11280 have been detected as being duplicates of each other, it emits a note when
11281 reporting the best diagnostic, giving the number of additional diagnostics
11282 that were suppressed by the deduplication logic.
11284 @opindex fanalyzer-show-events-in-system-headers
11285 @opindex fno-analyzer-show-events-in-system-headers
11286 @item -fanalyzer-show-events-in-system-headers
11287 By default the analyzer emits simplified diagnostics paths by hiding
11288 events fully located within a system header.
11289 With @option{-fanalyzer-show-events-in-system-headers} such
11290 events are no longer suppressed.
11292 @opindex fanalyzer-state-merge
11293 @opindex fno-analyzer-state-merge
11294 @item -fno-analyzer-state-merge
11295 This option is intended for analyzer developers.
11297 By default the analyzer attempts to simplify analysis by merging
11298 sufficiently similar states at each program point as it builds its
11299 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11300 merging can be suppressed, for debugging state-handling issues.
11302 @opindex fanalyzer-state-purge
11303 @opindex fno-analyzer-state-purge
11304 @item -fno-analyzer-state-purge
11305 This option is intended for analyzer developers.
11307 By default the analyzer attempts to simplify analysis by purging
11308 aspects of state at a program point that appear to no longer be relevant
11309 e.g. the values of locals that aren't accessed later in the function
11310 and which aren't relevant to leak analysis.
11312 With @option{-fno-analyzer-state-purge} this purging of state can
11313 be suppressed, for debugging state-handling issues.
11315 @opindex fanalyzer-suppress-followups
11316 @opindex fno-analyzer-suppress-followups
11317 @item -fno-analyzer-suppress-followups
11318 This option is intended for analyzer developers.
11320 By default the analyzer will stop exploring an execution path after
11321 encountering certain diagnostics, in order to avoid potentially issuing a
11322 cascade of follow-up diagnostics.
11324 The diagnostics that terminate analysis along a path are:
11326 @itemize
11327 @item @option{-Wanalyzer-null-argument}
11328 @item @option{-Wanalyzer-null-dereference}
11329 @item @option{-Wanalyzer-use-after-free}
11330 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11331 @item @option{-Wanalyzer-use-of-uninitialized-value}
11332 @end itemize
11334 With @option{-fno-analyzer-suppress-followups} the analyzer will
11335 continue to explore such paths even after such diagnostics, which may
11336 be helpful for debugging issues in the analyzer, or for microbenchmarks
11337 for detecting undefined behavior.
11339 @opindex fanalyzer-transitivity
11340 @opindex fno-analyzer-transitivity
11341 @item -fanalyzer-transitivity
11342 This option enables transitivity of constraints within the analyzer.
11344 @opindex fanalyzer-undo-inlining
11345 @opindex fno-analyzer-undo-inlining
11346 @item -fno-analyzer-undo-inlining
11347 This option is intended for analyzer developers.
11349 @option{-fanalyzer} runs relatively late compared to other code analysis
11350 tools, and some optimizations have already been applied to the code.  In
11351 particular function inlining may have occurred, leading to the
11352 interprocedural execution paths emitted by the analyzer containing
11353 function frames that don't correspond to those in the original source
11354 code.
11356 By default the analyzer attempts to reconstruct the original function
11357 frames, and to emit events showing the inlined calls.
11359 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11360 the original frame information can be be disabled, which may be of help
11361 when debugging issues in the analyzer.
11363 @item -fanalyzer-verbose-edges
11364 This option is intended for analyzer developers.  It enables more
11365 verbose, lower-level detail in the descriptions of control flow
11366 within diagnostic paths.
11368 @item -fanalyzer-verbose-state-changes
11369 This option is intended for analyzer developers.  It enables more
11370 verbose, lower-level detail in the descriptions of events relating
11371 to state machines within diagnostic paths.
11373 @item -fanalyzer-verbosity=@var{level}
11374 This option controls the complexity of the control flow paths that are
11375 emitted for analyzer diagnostics.
11377 The @var{level} can be one of:
11379 @table @samp
11380 @item 0
11381 At this level, interprocedural call and return events are displayed,
11382 along with the most pertinent state-change events relating to
11383 a diagnostic.  For example, for a double-@code{free} diagnostic,
11384 both calls to @code{free} will be shown.
11386 @item 1
11387 As per the previous level, but also show events for the entry
11388 to each function.
11390 @item 2
11391 As per the previous level, but also show events relating to
11392 control flow that are significant to triggering the issue
11393 (e.g. ``true path taken'' at a conditional).
11395 This level is the default.
11397 @item 3
11398 As per the previous level, but show all control flow events, not
11399 just significant ones.
11401 @item 4
11402 This level is intended for analyzer developers; it adds various
11403 other events intended for debugging the analyzer.
11405 @end table
11407 @opindex fdump-analyzer
11408 @item -fdump-analyzer
11409 Dump internal details about what the analyzer is doing to
11410 @file{@var{file}.analyzer.txt}.
11411 @option{-fdump-analyzer-stderr} overrides this option.
11413 @opindex fdump-analyzer-stderr
11414 @item -fdump-analyzer-stderr
11415 Dump internal details about what the analyzer is doing to stderr.
11416 This option overrides @option{-fdump-analyzer}.
11418 @opindex fdump-analyzer-callgraph
11419 @item -fdump-analyzer-callgraph
11420 Dump a representation of the call graph suitable for viewing with
11421 GraphViz to @file{@var{file}.callgraph.dot}.
11423 @opindex fdump-analyzer-exploded-graph
11424 @item -fdump-analyzer-exploded-graph
11425 Dump a representation of the ``exploded graph'' suitable for viewing with
11426 GraphViz to @file{@var{file}.eg.dot}.
11427 Nodes are color-coded based on state-machine states to emphasize
11428 state changes.
11430 @opindex dump-analyzer-exploded-nodes
11431 @item -fdump-analyzer-exploded-nodes
11432 Emit diagnostics showing where nodes in the ``exploded graph'' are
11433 in relation to the program source.
11435 @opindex dump-analyzer-exploded-nodes-2
11436 @item -fdump-analyzer-exploded-nodes-2
11437 Dump a textual representation of the ``exploded graph'' to
11438 @file{@var{file}.eg.txt}.
11440 @opindex dump-analyzer-exploded-nodes-3
11441 @item -fdump-analyzer-exploded-nodes-3
11442 Dump a textual representation of the ``exploded graph'' to
11443 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11444 This is typically a large number of dump files.
11446 @opindex fdump-analyzer-exploded-paths
11447 @item -fdump-analyzer-exploded-paths
11448 Dump a textual representation of the ``exploded path'' for each
11449 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11451 @opindex dump-analyzer-feasibility
11452 @item -fdump-analyzer-feasibility
11453 Dump internal details about the analyzer's search for feasible paths.
11454 The details are written in a form suitable for viewing with GraphViz
11455 to filenames of the form @file{@var{file}.*.fg.dot},
11456 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11458 @opindex fdump-analyzer-json
11459 @item -fdump-analyzer-json
11460 Dump a compressed JSON representation of analyzer internals to
11461 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11462 to change.
11464 @opindex fdump-analyzer-state-purge
11465 @item -fdump-analyzer-state-purge
11466 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11467 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11468 graph with information on what state will be purged at each node.
11469 The graph is written to @file{@var{file}.state-purge.dot}.
11471 @opindex fdump-analyzer-supergraph
11472 @item -fdump-analyzer-supergraph
11473 Dump representations of the ``supergraph'' suitable for viewing with
11474 GraphViz to @file{@var{file}.supergraph.dot} and to
11475 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11476 control flow graphs in the program, with interprocedural edges for
11477 calls and returns.  The second dump contains annotations showing nodes
11478 in the ``exploded graph'' and diagnostics associated with them.
11480 @opindex fdump-analyzer-untracked
11481 @item -fdump-analyzer-untracked
11482 Emit custom warnings with internal details intended for analyzer developers.
11484 @end table
11486 @node Debugging Options
11487 @section Options for Debugging Your Program
11488 @cindex options, debugging
11489 @cindex debugging information options
11491 To tell GCC to emit extra information for use by a debugger, in almost 
11492 all cases you need only to add @option{-g} to your other options.  Some debug
11493 formats can co-exist (like DWARF with CTF) when each of them is enabled
11494 explicitly by adding the respective command line option to your other options.
11496 GCC allows you to use @option{-g} with
11497 @option{-O}.  The shortcuts taken by optimized code may occasionally
11498 be surprising: some variables you declared may not exist
11499 at all; flow of control may briefly move where you did not expect it;
11500 some statements may not be executed because they compute constant
11501 results or their values are already at hand; some statements may
11502 execute in different places because they have been moved out of loops.
11503 Nevertheless it is possible to debug optimized output.  This makes
11504 it reasonable to use the optimizer for programs that might have bugs.
11506 If you are not using some other optimization option, consider
11507 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11508 With no @option{-O} option at all, some compiler passes that collect
11509 information useful for debugging do not run at all, so that
11510 @option{-Og} may result in a better debugging experience.
11512 @table @gcctabopt
11513 @opindex g
11514 @item -g
11515 Produce debugging information in the operating system's native format
11516 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11517 information.
11519 On most systems that use stabs format, @option{-g} enables use of extra
11520 debugging information that only GDB can use; this extra information
11521 makes debugging work better in GDB but probably makes other debuggers
11522 crash or refuse to read the program.  If you want to control for certain whether
11523 to generate the extra information, use @option{-gvms} (see below).
11525 @opindex ggdb
11526 @item -ggdb
11527 Produce debugging information for use by GDB@.  This means to use the
11528 most expressive format available (DWARF, stabs, or the native format
11529 if neither of those are supported), including GDB extensions if at all
11530 possible.
11532 @opindex gdwarf
11533 @item -gdwarf
11534 @itemx -gdwarf-@var{version}
11535 Produce debugging information in DWARF format (if that is supported).
11536 The value of @var{version} may be either 2, 3, 4 or 5; the default
11537 version for most targets is 5 (with the exception of VxWorks, TPF and
11538 Darwin / macOS, which default to version 2, and AIX, which defaults
11539 to version 4).
11541 Note that with DWARF Version 2, some ports require and always
11542 use some non-conflicting DWARF 3 extensions in the unwind tables.
11544 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11545 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11547 GCC no longer supports DWARF Version 1, which is substantially
11548 different than Version 2 and later.  For historical reasons, some
11549 other DWARF-related options such as
11550 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11551 in their names, but apply to all currently-supported versions of DWARF.
11553 @opindex gbtf
11554 @item -gbtf
11555 Request BTF debug information.  BTF is the default debugging format for the
11556 eBPF target.  On other targets, like x86, BTF debug information can be
11557 generated along with DWARF debug information when both of the debug formats are
11558 enabled explicitly via their respective command line options.
11560 @opindex gctf
11561 @item -gctf
11562 @itemx -gctf@var{level}
11563 Request CTF debug information and use level to specify how much CTF debug
11564 information should be produced.  If @option{-gctf} is specified
11565 without a value for level, the default level of CTF debug information is 2.
11567 CTF debug information can be generated along with DWARF debug information when
11568 both of the debug formats are enabled explicitly via their respective command
11569 line options.
11571 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11572 negates @option{-gctf}.
11574 Level 1 produces CTF information for tracebacks only.  This includes callsite
11575 information, but does not include type information.
11577 Level 2 produces type information for entities (functions, data objects etc.)
11578 at file-scope or global-scope only.
11580 @opindex gvms
11581 @item -gvms
11582 Produce debugging information in Alpha/VMS debug format (if that is
11583 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11585 @item -gcodeview
11586 @opindex gcodeview
11587 Produce debugging information in CodeView debug format (if that is
11588 supported).  This is the format used by Microsoft Visual C++ on
11589 Windows.
11591 @item -g@var{level}
11592 @itemx -ggdb@var{level}
11593 @itemx -gvms@var{level}
11594 Request debugging information and also use @var{level} to specify how
11595 much information.  The default level is 2.
11597 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11598 @option{-g}.
11600 Level 1 produces minimal information, enough for making backtraces in
11601 parts of the program that you don't plan to debug.  This includes
11602 descriptions of functions and external variables, and line number
11603 tables, but no information about local variables.
11605 Level 3 includes extra information, such as all the macro definitions
11606 present in the program.  Some debuggers support macro expansion when
11607 you use @option{-g3}.
11609 If you use multiple @option{-g} options, with or without level numbers,
11610 the last such option is the one that is effective.
11612 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11613 confusion with @option{-gdwarf-@var{level}}.
11614 Instead use an additional @option{-g@var{level}} option to change the
11615 debug level for DWARF.
11617 @opindex feliminate-unused-debug-symbols
11618 @opindex fno-eliminate-unused-debug-symbols
11619 @item -fno-eliminate-unused-debug-symbols
11620 By default, no debug information is produced for symbols that are not actually
11621 used. Use this option if you want debug information for all symbols.
11623 @opindex femit-class-debug-always
11624 @item -femit-class-debug-always
11625 Instead of emitting debugging information for a C++ class in only one
11626 object file, emit it in all object files using the class.  This option
11627 should be used only with debuggers that are unable to handle the way GCC
11628 normally emits debugging information for classes because using this
11629 option increases the size of debugging information by as much as a
11630 factor of two.
11632 @opindex fmerge-debug-strings
11633 @opindex fno-merge-debug-strings
11634 @item -fno-merge-debug-strings
11635 Direct the linker to not merge together strings in the debugging
11636 information that are identical in different object files.  Merging is
11637 not supported by all assemblers or linkers.  Merging decreases the size
11638 of the debug information in the output file at the cost of increasing
11639 link processing time.  Merging is enabled by default.
11641 @opindex fdebug-prefix-map
11642 @item -fdebug-prefix-map=@var{old}=@var{new}
11643 When compiling files residing in directory @file{@var{old}}, record
11644 debugging information describing them as if the files resided in
11645 directory @file{@var{new}} instead.  This can be used to replace a
11646 build-time path with an install-time path in the debug info.  It can
11647 also be used to change an absolute path to a relative path by using
11648 @file{.} for @var{new}.  This can give more reproducible builds, which
11649 are location independent, but may require an extra command to tell GDB
11650 where to find the source files. See also @option{-ffile-prefix-map}
11651 and @option{-fcanon-prefix-map}.
11653 @opindex fvar-tracking
11654 @item -fvar-tracking
11655 Run variable tracking pass.  It computes where variables are stored at each
11656 position in code.  Better debugging information is then generated
11657 (if the debugging information format supports this information).
11659 It is enabled by default when compiling with optimization (@option{-Os},
11660 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11661 the debug info format supports it.
11663 @opindex fvar-tracking-assignments
11664 @opindex fno-var-tracking-assignments
11665 @item -fvar-tracking-assignments
11666 Annotate assignments to user variables early in the compilation and
11667 attempt to carry the annotations over throughout the compilation all the
11668 way to the end, in an attempt to improve debug information while
11669 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11671 It can be enabled even if var-tracking is disabled, in which case
11672 annotations are created and maintained, but discarded at the end.
11673 By default, this flag is enabled together with @option{-fvar-tracking},
11674 except when selective scheduling is enabled.
11676 @opindex gsplit-dwarf
11677 @item -gsplit-dwarf
11678 If DWARF debugging information is enabled, separate as much debugging
11679 information as possible into a separate output file with the extension
11680 @file{.dwo}.  This option allows the build system to avoid linking files with
11681 debug information.  To be useful, this option requires a debugger capable of
11682 reading @file{.dwo} files.
11684 @opindex gdwarf32
11685 @opindex gdwarf64
11686 @item -gdwarf32
11687 @itemx -gdwarf64
11688 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11689 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11690 DWARF format.  The default is target specific, on most targets it is
11691 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11692 can't support more than 2GiB of debug information in any of the DWARF
11693 debug information sections.  The 64-bit DWARF format allows larger debug
11694 information and might not be well supported by all consumers yet.
11696 @opindex gdescribe-dies
11697 @item -gdescribe-dies
11698 Add description attributes to some DWARF DIEs that have no name attribute,
11699 such as artificial variables, external references and call site
11700 parameter DIEs.
11702 @opindex gpubnames
11703 @item -gpubnames
11704 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11706 @opindex ggnu-pubnames
11707 @item -ggnu-pubnames
11708 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11709 suitable for conversion into a GDB@ index.  This option is only useful
11710 with a linker that can produce GDB@ index version 7.
11712 @opindex fdebug-types-section
11713 @opindex fno-debug-types-section
11714 @item -fdebug-types-section
11715 When using DWARF Version 4 or higher, type DIEs can be put into
11716 their own @code{.debug_types} section instead of making them part of the
11717 @code{.debug_info} section.  It is more efficient to put them in a separate
11718 comdat section since the linker can then remove duplicates.
11719 But not all DWARF consumers support @code{.debug_types} sections yet
11720 and on some objects @code{.debug_types} produces larger instead of smaller
11721 debugging information.
11723 @opindex grecord-gcc-switches
11724 @opindex gno-record-gcc-switches
11725 @item -grecord-gcc-switches
11726 @itemx -gno-record-gcc-switches
11727 This switch causes the command-line options used to invoke the
11728 compiler that may affect code generation to be appended to the
11729 DW_AT_producer attribute in DWARF debugging information.  The options
11730 are concatenated with spaces separating them from each other and from
11731 the compiler version.  
11732 It is enabled by default.
11733 See also @option{-frecord-gcc-switches} for another
11734 way of storing compiler options into the object file.  
11736 @opindex gstrict-dwarf
11737 @item -gstrict-dwarf
11738 Disallow using extensions of later DWARF standard version than selected
11739 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11740 DWARF extensions from later standard versions is allowed.
11742 @opindex gno-strict-dwarf
11743 @item -gno-strict-dwarf
11744 Allow using extensions of later DWARF standard version than selected with
11745 @option{-gdwarf-@var{version}}.
11747 @opindex gas-loc-support
11748 @item -gas-loc-support
11749 Inform the compiler that the assembler supports @code{.loc} directives.
11750 It may then use them for the assembler to generate DWARF2+ line number
11751 tables.
11753 This is generally desirable, because assembler-generated line-number
11754 tables are a lot more compact than those the compiler can generate
11755 itself.
11757 This option will be enabled by default if, at GCC configure time, the
11758 assembler was found to support such directives.
11760 @opindex gno-as-loc-support
11761 @item -gno-as-loc-support
11762 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11763 line number tables are to be generated.
11765 @opindex gas-locview-support
11766 @item -gas-locview-support
11767 Inform the compiler that the assembler supports @code{view} assignment
11768 and reset assertion checking in @code{.loc} directives.
11770 This option will be enabled by default if, at GCC configure time, the
11771 assembler was found to support them.
11773 @item -gno-as-locview-support
11774 Force GCC to assign view numbers internally, if
11775 @option{-gvariable-location-views} are explicitly requested.
11777 @opindex gcolumn-info
11778 @opindex gno-column-info
11779 @item -gcolumn-info
11780 @itemx -gno-column-info
11781 Emit location column information into DWARF debugging information, rather
11782 than just file and line.
11783 This option is enabled by default.
11785 @opindex gstatement-frontiers
11786 @opindex gno-statement-frontiers
11787 @item -gstatement-frontiers
11788 @itemx -gno-statement-frontiers
11789 This option causes GCC to create markers in the internal representation
11790 at the beginning of statements, and to keep them roughly in place
11791 throughout compilation, using them to guide the output of @code{is_stmt}
11792 markers in the line number table.  This is enabled by default when
11793 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11794 @dots{}), and outputting DWARF 2 debug information at the normal level.
11796 @opindex gvariable-location-views
11797 @opindex gvariable-location-views=incompat5
11798 @opindex gno-variable-location-views
11799 @item -gvariable-location-views
11800 @itemx -gvariable-location-views=incompat5
11801 @itemx -gno-variable-location-views
11802 Augment variable location lists with progressive view numbers implied
11803 from the line number table.  This enables debug information consumers to
11804 inspect state at certain points of the program, even if no instructions
11805 associated with the corresponding source locations are present at that
11806 point.  If the assembler lacks support for view numbers in line number
11807 tables, this will cause the compiler to emit the line number table,
11808 which generally makes them somewhat less compact.  The augmented line
11809 number tables and location lists are fully backward-compatible, so they
11810 can be consumed by debug information consumers that are not aware of
11811 these augmentations, but they won't derive any benefit from them either.
11813 This is enabled by default when outputting DWARF 2 debug information at
11814 the normal level, as long as there is assembler support,
11815 @option{-fvar-tracking-assignments} is enabled and
11816 @option{-gstrict-dwarf} is not.  When assembler support is not
11817 available, this may still be enabled, but it will force GCC to output
11818 internal line number tables, and if
11819 @option{-ginternal-reset-location-views} is not enabled, that will most
11820 certainly lead to silently mismatching location views.
11822 There is a proposed representation for view numbers that is not backward
11823 compatible with the location list format introduced in DWARF 5, that can
11824 be enabled with @option{-gvariable-location-views=incompat5}.  This
11825 option may be removed in the future, is only provided as a reference
11826 implementation of the proposed representation.  Debug information
11827 consumers are not expected to support this extended format, and they
11828 would be rendered unable to decode location lists using it.
11830 @opindex ginternal-reset-location-views
11831 @opindex gno-internal-reset-location-views
11832 @item -ginternal-reset-location-views
11833 @itemx -gno-internal-reset-location-views
11834 Attempt to determine location views that can be omitted from location
11835 view lists.  This requires the compiler to have very accurate insn
11836 length estimates, which isn't always the case, and it may cause
11837 incorrect view lists to be generated silently when using an assembler
11838 that does not support location view lists.  The GNU assembler will flag
11839 any such error as a @code{view number mismatch}.  This is only enabled
11840 on ports that define a reliable estimation function.
11842 @opindex ginline-points
11843 @opindex gno-inline-points
11844 @item -ginline-points
11845 @itemx -gno-inline-points
11846 Generate extended debug information for inlined functions.  Location
11847 view tracking markers are inserted at inlined entry points, so that
11848 address and view numbers can be computed and output in debug
11849 information.  This can be enabled independently of location views, in
11850 which case the view numbers won't be output, but it can only be enabled
11851 along with statement frontiers, and it is only enabled by default if
11852 location views are enabled.
11854 @opindex gz
11855 @item -gz@r{[}=@var{type}@r{]}
11856 Produce compressed debug sections in DWARF format, if that is supported.
11857 If @var{type} is not given, the default type depends on the capabilities
11858 of the assembler and linker used.  @var{type} may be one of
11859 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11860 compression in ELF gABI format).  If the linker doesn't support writing
11861 compressed debug sections, the option is rejected.  Otherwise, if the
11862 assembler does not support them, @option{-gz} is silently ignored when
11863 producing object files.
11865 @opindex femit-struct-debug-baseonly
11866 @item -femit-struct-debug-baseonly
11867 Emit debug information for struct-like types
11868 only when the base name of the compilation source file
11869 matches the base name of file in which the struct is defined.
11871 This option substantially reduces the size of debugging information,
11872 but at significant potential loss in type information to the debugger.
11873 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11874 See @option{-femit-struct-debug-detailed} for more detailed control.
11876 This option works only with DWARF debug output.
11878 @opindex femit-struct-debug-reduced
11879 @item -femit-struct-debug-reduced
11880 Emit debug information for struct-like types
11881 only when the base name of the compilation source file
11882 matches the base name of file in which the type is defined,
11883 unless the struct is a template or defined in a system header.
11885 This option significantly reduces the size of debugging information,
11886 with some potential loss in type information to the debugger.
11887 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11888 See @option{-femit-struct-debug-detailed} for more detailed control.
11890 This option works only with DWARF debug output.
11892 @opindex femit-struct-debug-detailed
11893 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11894 Specify the struct-like types
11895 for which the compiler generates debug information.
11896 The intent is to reduce duplicate struct debug information
11897 between different object files within the same program.
11899 This option is a detailed version of
11900 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11901 which serves for most needs.
11903 A specification has the syntax@*
11904 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11906 The optional first word limits the specification to
11907 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11908 A struct type is used directly when it is the type of a variable, member.
11909 Indirect uses arise through pointers to structs.
11910 That is, when use of an incomplete struct is valid, the use is indirect.
11911 An example is
11912 @samp{struct one direct; struct two * indirect;}.
11914 The optional second word limits the specification to
11915 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11916 Generic structs are a bit complicated to explain.
11917 For C++, these are non-explicit specializations of template classes,
11918 or non-template classes within the above.
11919 Other programming languages have generics,
11920 but @option{-femit-struct-debug-detailed} does not yet implement them.
11922 The third word specifies the source files for those
11923 structs for which the compiler should emit debug information.
11924 The values @samp{none} and @samp{any} have the normal meaning.
11925 The value @samp{base} means that
11926 the base of name of the file in which the type declaration appears
11927 must match the base of the name of the main compilation file.
11928 In practice, this means that when compiling @file{foo.c}, debug information
11929 is generated for types declared in that file and @file{foo.h},
11930 but not other header files.
11931 The value @samp{sys} means those types satisfying @samp{base}
11932 or declared in system or compiler headers.
11934 You may need to experiment to determine the best settings for your application.
11936 The default is @option{-femit-struct-debug-detailed=all}.
11938 This option works only with DWARF debug output.
11940 @opindex fdwarf2-cfi-asm
11941 @opindex fno-dwarf2-cfi-asm
11942 @item -fno-dwarf2-cfi-asm
11943 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11944 instead of using GAS @code{.cfi_*} directives.
11946 @opindex feliminate-unused-debug-types
11947 @opindex fno-eliminate-unused-debug-types
11948 @item -fno-eliminate-unused-debug-types
11949 Normally, when producing DWARF output, GCC avoids producing debug symbol 
11950 output for types that are nowhere used in the source file being compiled.
11951 Sometimes it is useful to have GCC emit debugging
11952 information for all types declared in a compilation
11953 unit, regardless of whether or not they are actually used
11954 in that compilation unit, for example 
11955 if, in the debugger, you want to cast a value to a type that is
11956 not actually used in your program (but is declared).  More often,
11957 however, this results in a significant amount of wasted space.
11958 @end table
11960 @node Optimize Options
11961 @section Options That Control Optimization
11962 @cindex optimize options
11963 @cindex options, optimization
11965 These options control various sorts of optimizations.
11967 Without any optimization option, the compiler's goal is to reduce the
11968 cost of compilation and to make debugging produce the expected
11969 results.  Statements are independent: if you stop the program with a
11970 breakpoint between statements, you can then assign a new value to any
11971 variable or change the program counter to any other statement in the
11972 function and get exactly the results you expect from the source
11973 code.
11975 Turning on optimization flags makes the compiler attempt to improve
11976 the performance and/or code size at the expense of compilation time
11977 and possibly the ability to debug the program.
11979 The compiler performs optimization based on the knowledge it has of the
11980 program.  Compiling multiple files at once to a single output file mode allows
11981 the compiler to use information gained from all of the files when compiling
11982 each of them.
11984 Not all optimizations are controlled directly by a flag.  Only
11985 optimizations that have a flag are listed in this section.
11987 Most optimizations are completely disabled at @option{-O0} or if an
11988 @option{-O} level is not set on the command line, even if individual
11989 optimization flags are specified.  Similarly, @option{-Og} suppresses
11990 many optimization passes.
11992 Depending on the target and how GCC was configured, a slightly different
11993 set of optimizations may be enabled at each @option{-O} level than
11994 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
11995 to find out the exact set of optimizations that are enabled at each level.
11996 @xref{Overall Options}, for examples.
11998 @table @gcctabopt
11999 @opindex O
12000 @opindex O1
12001 @item -O
12002 @itemx -O1
12003 Optimize.  Optimizing compilation takes somewhat more time, and a lot
12004 more memory for a large function.
12006 With @option{-O}, the compiler tries to reduce code size and execution
12007 time, without performing any optimizations that take a great deal of
12008 compilation time.
12010 @c Note that in addition to the default_options_table list in opts.cc,
12011 @c several optimization flags default to true but control optimization
12012 @c passes that are explicitly disabled at -O0.
12014 @option{-O} turns on the following optimization flags:
12016 @c Please keep the following list alphabetized.
12017 @gccoptlist{-fauto-inc-dec
12018 -fbranch-count-reg
12019 -fcombine-stack-adjustments
12020 -fcompare-elim
12021 -fcprop-registers
12022 -fdce
12023 -fdefer-pop
12024 -fdelayed-branch
12025 -fdse
12026 -fforward-propagate
12027 -fguess-branch-probability
12028 -fif-conversion
12029 -fif-conversion2
12030 -finline-functions-called-once
12031 -fipa-modref
12032 -fipa-profile
12033 -fipa-pure-const
12034 -fipa-reference
12035 -fipa-reference-addressable
12036 -fmerge-constants
12037 -fmove-loop-invariants
12038 -fmove-loop-stores
12039 -fomit-frame-pointer
12040 -freorder-blocks
12041 -fshrink-wrap
12042 -fshrink-wrap-separate
12043 -fsplit-wide-types
12044 -fssa-backprop
12045 -fssa-phiopt
12046 -ftree-bit-ccp
12047 -ftree-ccp
12048 -ftree-ch
12049 -ftree-coalesce-vars
12050 -ftree-copy-prop
12051 -ftree-dce
12052 -ftree-dominator-opts
12053 -ftree-dse
12054 -ftree-forwprop
12055 -ftree-fre
12056 -ftree-phiprop
12057 -ftree-pta
12058 -ftree-scev-cprop
12059 -ftree-sink
12060 -ftree-slsr
12061 -ftree-sra
12062 -ftree-ter
12063 -funit-at-a-time}
12065 @opindex O2
12066 @item -O2
12067 Optimize even more.  GCC performs nearly all supported optimizations
12068 that do not involve a space-speed tradeoff.
12069 As compared to @option{-O}, this option increases both compilation time
12070 and the performance of the generated code.
12072 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12073 also turns on the following optimization flags:
12075 @c Please keep the following list alphabetized!
12076 @gccoptlist{-falign-functions  -falign-jumps
12077 -falign-labels  -falign-loops
12078 -fcaller-saves
12079 -fcode-hoisting
12080 -fcrossjumping
12081 -fcse-follow-jumps  -fcse-skip-blocks
12082 -fdelete-null-pointer-checks
12083 -fdevirtualize  -fdevirtualize-speculatively
12084 -fexpensive-optimizations
12085 -ffinite-loops
12086 -fgcse  -fgcse-lm
12087 -fhoist-adjacent-loads
12088 -finline-functions
12089 -finline-small-functions
12090 -findirect-inlining
12091 -fipa-bit-cp  -fipa-cp  -fipa-icf
12092 -fipa-ra  -fipa-sra  -fipa-vrp
12093 -fisolate-erroneous-paths-dereference
12094 -flra-remat
12095 -foptimize-sibling-calls
12096 -foptimize-strlen
12097 -fpartial-inlining
12098 -fpeephole2
12099 -freorder-blocks-algorithm=stc
12100 -freorder-blocks-and-partition  -freorder-functions
12101 -frerun-cse-after-loop
12102 -fschedule-insns  -fschedule-insns2
12103 -fsched-interblock  -fsched-spec
12104 -fstore-merging
12105 -fstrict-aliasing
12106 -fthread-jumps
12107 -ftree-builtin-call-dce
12108 -ftree-loop-vectorize
12109 -ftree-pre
12110 -ftree-slp-vectorize
12111 -ftree-switch-conversion  -ftree-tail-merge
12112 -ftree-vrp
12113 -fvect-cost-model=very-cheap}
12115 Please note the warning under @option{-fgcse} about
12116 invoking @option{-O2} on programs that use computed gotos.
12118 @opindex O3
12119 @item -O3
12120 Optimize yet more.  @option{-O3} turns on all optimizations specified
12121 by @option{-O2} and also turns on the following optimization flags:
12123 @c Please keep the following list alphabetized!
12124 @gccoptlist{-fgcse-after-reload
12125 -fipa-cp-clone
12126 -floop-interchange
12127 -floop-unroll-and-jam
12128 -fpeel-loops
12129 -fpredictive-commoning
12130 -fsplit-loops
12131 -fsplit-paths
12132 -ftree-loop-distribution
12133 -ftree-partial-pre
12134 -funswitch-loops
12135 -fvect-cost-model=dynamic
12136 -fversion-loops-for-strides}
12138 @opindex O0
12139 @item -O0
12140 Reduce compilation time and make debugging produce the expected
12141 results.  This is the default.
12143 @opindex Os
12144 @item -Os
12145 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12146 except those that often increase code size:
12148 @gccoptlist{-falign-functions  -falign-jumps
12149 -falign-labels  -falign-loops
12150 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12152 It also enables @option{-finline-functions}, causes the compiler to tune for
12153 code size rather than execution speed, and performs further optimizations
12154 designed to reduce code size.
12156 @opindex Ofast
12157 @item -Ofast
12158 Disregard strict standards compliance.  @option{-Ofast} enables all
12159 @option{-O3} optimizations.  It also enables optimizations that are not
12160 valid for all standard-compliant programs.
12161 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12162 and the Fortran-specific @option{-fstack-arrays}, unless
12163 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12164 It turns off @option{-fsemantic-interposition}.
12166 @opindex Og
12167 @item -Og
12168 Optimize debugging experience.  @option{-Og} should be the optimization
12169 level of choice for the standard edit-compile-debug cycle, offering
12170 a reasonable level of optimization while maintaining fast compilation
12171 and a good debugging experience.  It is a better choice than @option{-O0}
12172 for producing debuggable code because some compiler passes
12173 that collect debug information are disabled at @option{-O0}.
12175 Like @option{-O0}, @option{-Og} completely disables a number of 
12176 optimization passes so that individual options controlling them have
12177 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12178 optimization flags except for those that may interfere with debugging:
12180 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12181 -fdse  -fif-conversion  -fif-conversion2
12182 -finline-functions-called-once
12183 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12184 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12186 @opindex Oz
12187 @item -Oz
12188 Optimize aggressively for size rather than speed.  This may increase
12189 the number of instructions executed if those instructions require
12190 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12191 including enabling most @option{-O2} optimizations.
12193 @end table
12195 If you use multiple @option{-O} options, with or without level numbers,
12196 the last such option is the one that is effective.
12198 Options of the form @option{-f@var{flag}} specify machine-independent
12199 flags.  Most flags have both positive and negative forms; the negative
12200 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12201 below, only one of the forms is listed---the one you typically 
12202 use.  You can figure out the other form by either removing @samp{no-}
12203 or adding it.
12205 The following options control specific optimizations.  They are either
12206 activated by @option{-O} options or are related to ones that are.  You
12207 can use the following flags in the rare cases when ``fine-tuning'' of
12208 optimizations to be performed is desired.
12210 @table @gcctabopt
12211 @opindex fno-defer-pop
12212 @opindex fdefer-pop
12213 @item -fno-defer-pop
12214 For machines that must pop arguments after a function call, always pop 
12215 the arguments as soon as each function returns.  
12216 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12217 this allows the compiler to let arguments accumulate on the stack for several
12218 function calls and pop them all at once.
12220 @opindex fforward-propagate
12221 @item -fforward-propagate
12222 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12223 instructions and checks if the result can be simplified.  If loop unrolling
12224 is active, two passes are performed and the second is scheduled after
12225 loop unrolling.
12227 This option is enabled by default at optimization levels @option{-O1},
12228 @option{-O2}, @option{-O3}, @option{-Os}.
12230 @opindex ffp-contract
12231 @item -ffp-contract=@var{style}
12232 @option{-ffp-contract=off} disables floating-point expression contraction.
12233 @option{-ffp-contract=fast} enables floating-point expression contraction
12234 such as forming of fused multiply-add operations if the target has
12235 native support for them.
12236 @option{-ffp-contract=on} enables floating-point expression contraction
12237 if allowed by the language standard.  This is implemented for C and C++,
12238 where it enables contraction within one expression, but not across
12239 different statements.
12241 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12242 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12244 @opindex fomit-frame-pointer
12245 @item -fomit-frame-pointer
12246 Omit the frame pointer in functions that don't need one.  This avoids the
12247 instructions to save, set up and restore the frame pointer; on many targets
12248 it also makes an extra register available.
12250 On some targets this flag has no effect because the standard calling sequence
12251 always uses a frame pointer, so it cannot be omitted.
12253 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12254 is used in all functions.  Several targets always omit the frame pointer in
12255 leaf functions.
12257 Enabled by default at @option{-O1} and higher.
12259 @opindex foptimize-sibling-calls
12260 @item -foptimize-sibling-calls
12261 Optimize sibling and tail recursive calls.
12263 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12265 @opindex foptimize-strlen
12266 @item -foptimize-strlen
12267 Optimize various standard C string functions (e.g.@: @code{strlen},
12268 @code{strchr} or @code{strcpy}) and
12269 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12271 Enabled at levels @option{-O2}, @option{-O3}.
12273 @opindex fno-inline
12274 @opindex finline
12275 @item -fno-inline
12276 Do not expand any functions inline apart from those marked with
12277 the @code{always_inline} attribute.  This is the default when not
12278 optimizing.
12280 Single functions can be exempted from inlining by marking them
12281 with the @code{noinline} attribute.
12283 @opindex finline-small-functions
12284 @item -finline-small-functions
12285 Integrate functions into their callers when their body is smaller than expected
12286 function call code (so overall size of program gets smaller).  The compiler
12287 heuristically decides which functions are simple enough to be worth integrating
12288 in this way.  This inlining applies to all functions, even those not declared
12289 inline.
12291 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12293 @opindex findirect-inlining
12294 @item -findirect-inlining
12295 Inline also indirect calls that are discovered to be known at compile
12296 time thanks to previous inlining.  This option has any effect only
12297 when inlining itself is turned on by the @option{-finline-functions}
12298 or @option{-finline-small-functions} options.
12300 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12302 @opindex finline-functions
12303 @item -finline-functions
12304 Consider all functions for inlining, even if they are not declared inline.
12305 The compiler heuristically decides which functions are worth integrating
12306 in this way.
12308 If all calls to a given function are integrated, and the function is
12309 declared @code{static}, then the function is normally not output as
12310 assembler code in its own right.
12312 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12313 by @option{-fprofile-use} and @option{-fauto-profile}.
12315 @opindex finline-functions-called-once
12316 @item -finline-functions-called-once
12317 Consider all @code{static} functions called once for inlining into their
12318 caller even if they are not marked @code{inline}.  If a call to a given
12319 function is integrated, then the function is not output as assembler code
12320 in its own right.
12322 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12323 but not @option{-Og}.
12325 @opindex fearly-inlining
12326 @item -fearly-inlining
12327 Inline functions marked by @code{always_inline} and functions whose body seems
12328 smaller than the function call overhead early before doing
12329 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12330 makes profiling significantly cheaper and usually inlining faster on programs
12331 having large chains of nested wrapper functions.
12333 Enabled by default.
12335 @opindex fipa-sra
12336 @item -fipa-sra
12337 Perform interprocedural scalar replacement of aggregates, removal of
12338 unused parameters and replacement of parameters passed by reference
12339 by parameters passed by value.
12341 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12343 @opindex finline-limit
12344 @item -finline-limit=@var{n}
12345 By default, GCC limits the size of functions that can be inlined.  This flag
12346 allows coarse control of this limit.  @var{n} is the size of functions that
12347 can be inlined in number of pseudo instructions.
12349 Inlining is actually controlled by a number of parameters, which may be
12350 specified individually by using @option{--param @var{name}=@var{value}}.
12351 The @option{-finline-limit=@var{n}} option sets some of these parameters
12352 as follows:
12354 @table @gcctabopt
12355 @item max-inline-insns-single
12356 is set to @var{n}/2.
12357 @item max-inline-insns-auto
12358 is set to @var{n}/2.
12359 @end table
12361 See below for a documentation of the individual
12362 parameters controlling inlining and for the defaults of these parameters.
12364 @emph{Note:} there may be no value to @option{-finline-limit} that results
12365 in default behavior.
12367 @emph{Note:} pseudo instruction represents, in this particular context, an
12368 abstract measurement of function's size.  In no way does it represent a count
12369 of assembly instructions and as such its exact meaning might change from one
12370 release to an another.
12372 @opindex fno-keep-inline-dllexport
12373 @opindex fkeep-inline-dllexport
12374 @item -fno-keep-inline-dllexport
12375 This is a more fine-grained version of @option{-fkeep-inline-functions},
12376 which applies only to functions that are declared using the @code{dllexport}
12377 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12378 Functions}.
12380 @opindex fkeep-inline-functions
12381 @item -fkeep-inline-functions
12382 In C, emit @code{static} functions that are declared @code{inline}
12383 into the object file, even if the function has been inlined into all
12384 of its callers.  This switch does not affect functions using the
12385 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12386 inline functions into the object file.
12388 @opindex fkeep-static-functions
12389 @item -fkeep-static-functions
12390 Emit @code{static} functions into the object file, even if the function
12391 is never used.
12393 @opindex fkeep-static-consts
12394 @item -fkeep-static-consts
12395 Emit variables declared @code{static const} when optimization isn't turned
12396 on, even if the variables aren't referenced.
12398 GCC enables this option by default.  If you want to force the compiler to
12399 check if a variable is referenced, regardless of whether or not
12400 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12402 @opindex fmerge-constants
12403 @item -fmerge-constants
12404 Attempt to merge identical constants (string constants and floating-point
12405 constants) across compilation units.
12407 This option is the default for optimized compilation if the assembler and
12408 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12409 behavior.
12411 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12413 @opindex fmerge-all-constants
12414 @item -fmerge-all-constants
12415 Attempt to merge identical constants and identical variables.
12417 This option implies @option{-fmerge-constants}.  In addition to
12418 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12419 arrays or initialized constant variables with integral or floating-point
12420 types.  Languages like C or C++ require each variable, including multiple
12421 instances of the same variable in recursive calls, to have distinct locations,
12422 so using this option results in non-conforming
12423 behavior.
12425 @opindex fmodulo-sched
12426 @item -fmodulo-sched
12427 Perform swing modulo scheduling immediately before the first scheduling
12428 pass.  This pass looks at innermost loops and reorders their
12429 instructions by overlapping different iterations.
12431 @opindex fmodulo-sched-allow-regmoves
12432 @item -fmodulo-sched-allow-regmoves
12433 Perform more aggressive SMS-based modulo scheduling with register moves
12434 allowed.  By setting this flag certain anti-dependences edges are
12435 deleted, which triggers the generation of reg-moves based on the
12436 life-range analysis.  This option is effective only with
12437 @option{-fmodulo-sched} enabled.
12439 @opindex fno-branch-count-reg
12440 @opindex fbranch-count-reg
12441 @item -fno-branch-count-reg
12442 Disable the optimization pass that scans for opportunities to use 
12443 ``decrement and branch'' instructions on a count register instead of
12444 instruction sequences that decrement a register, compare it against zero, and
12445 then branch based upon the result.  This option is only meaningful on
12446 architectures that support such instructions, which include x86, PowerPC,
12447 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12448 doesn't remove the decrement and branch instructions from the generated
12449 instruction stream introduced by other optimization passes.
12451 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12452 except for @option{-Og}.
12454 @opindex fno-function-cse
12455 @opindex ffunction-cse
12456 @item -fno-function-cse
12457 Do not put function addresses in registers; make each instruction that
12458 calls a constant function contain the function's address explicitly.
12460 This option results in less efficient code, but some strange hacks
12461 that alter the assembler output may be confused by the optimizations
12462 performed when this option is not used.
12464 The default is @option{-ffunction-cse}
12466 @opindex fno-zero-initialized-in-bss
12467 @opindex fzero-initialized-in-bss
12468 @item -fno-zero-initialized-in-bss
12469 If the target supports a BSS section, GCC by default puts variables that
12470 are initialized to zero into BSS@.  This can save space in the resulting
12471 code.
12473 This option turns off this behavior because some programs explicitly
12474 rely on variables going to the data section---e.g., so that the
12475 resulting executable can find the beginning of that section and/or make
12476 assumptions based on that.
12478 The default is @option{-fzero-initialized-in-bss}.
12480 @opindex fthread-jumps
12481 @item -fthread-jumps
12482 Perform optimizations that check to see if a jump branches to a
12483 location where another comparison subsumed by the first is found.  If
12484 so, the first branch is redirected to either the destination of the
12485 second branch or a point immediately following it, depending on whether
12486 the condition is known to be true or false.
12488 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12490 @opindex fsplit-wide-types
12491 @item -fsplit-wide-types
12492 When using a type that occupies multiple registers, such as @code{long
12493 long} on a 32-bit system, split the registers apart and allocate them
12494 independently.  This normally generates better code for those types,
12495 but may make debugging more difficult.
12497 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12498 @option{-Os}.
12500 @opindex fsplit-wide-types-early
12501 @item -fsplit-wide-types-early
12502 Fully split wide types early, instead of very late.
12503 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12505 This is the default on some targets.
12507 @opindex fcse-follow-jumps
12508 @item -fcse-follow-jumps
12509 In common subexpression elimination (CSE), scan through jump instructions
12510 when the target of the jump is not reached by any other path.  For
12511 example, when CSE encounters an @code{if} statement with an
12512 @code{else} clause, CSE follows the jump when the condition
12513 tested is false.
12515 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12517 @opindex fcse-skip-blocks
12518 @item -fcse-skip-blocks
12519 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12520 follow jumps that conditionally skip over blocks.  When CSE
12521 encounters a simple @code{if} statement with no else clause,
12522 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12523 body of the @code{if}.
12525 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12527 @opindex frerun-cse-after-loop
12528 @item -frerun-cse-after-loop
12529 Re-run common subexpression elimination after loop optimizations are
12530 performed.
12532 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12534 @opindex fgcse
12535 @item -fgcse
12536 Perform a global common subexpression elimination pass.
12537 This pass also performs global constant and copy propagation.
12539 @emph{Note:} When compiling a program using computed gotos, a GCC
12540 extension, you may get better run-time performance if you disable
12541 the global common subexpression elimination pass by adding
12542 @option{-fno-gcse} to the command line.
12544 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12546 @opindex fgcse-lm
12547 @item -fgcse-lm
12548 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12549 attempts to move loads that are only killed by stores into themselves.  This
12550 allows a loop containing a load/store sequence to be changed to a load outside
12551 the loop, and a copy/store within the loop.
12553 Enabled by default when @option{-fgcse} is enabled.
12555 @opindex fgcse-sm
12556 @item -fgcse-sm
12557 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12558 global common subexpression elimination.  This pass attempts to move
12559 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12560 loops containing a load/store sequence can be changed to a load before
12561 the loop and a store after the loop.
12563 Not enabled at any optimization level.
12565 @opindex fgcse-las
12566 @item -fgcse-las
12567 When @option{-fgcse-las} is enabled, the global common subexpression
12568 elimination pass eliminates redundant loads that come after stores to the
12569 same memory location (both partial and full redundancies).
12571 Not enabled at any optimization level.
12573 @opindex fgcse-after-reload
12574 @item -fgcse-after-reload
12575 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12576 pass is performed after reload.  The purpose of this pass is to clean up
12577 redundant spilling.
12579 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12581 @opindex faggressive-loop-optimizations
12582 @item -faggressive-loop-optimizations
12583 This option tells the loop optimizer to use language constraints to
12584 derive bounds for the number of iterations of a loop.  This assumes that
12585 loop code does not invoke undefined behavior by for example causing signed
12586 integer overflows or out-of-bound array accesses.  The bounds for the
12587 number of iterations of a loop are used to guide loop unrolling and peeling
12588 and loop exit test optimizations.
12589 This option is enabled by default.
12591 @opindex funconstrained-commons
12592 @item -funconstrained-commons
12593 This option tells the compiler that variables declared in common blocks
12594 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12595 prevents certain optimizations that depend on knowing the array bounds.
12597 @opindex fcrossjumping
12598 @item -fcrossjumping
12599 Perform cross-jumping transformation.
12600 This transformation unifies equivalent code and saves code size.  The
12601 resulting code may or may not perform better than without cross-jumping.
12603 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12605 @opindex fauto-inc-dec
12606 @item -fauto-inc-dec
12607 Combine increments or decrements of addresses with memory accesses.
12608 This pass is always skipped on architectures that do not have
12609 instructions to support this.  Enabled by default at @option{-O1} and
12610 higher on architectures that support this.
12612 @opindex fdce
12613 @item -fdce
12614 Perform dead code elimination (DCE) on RTL@.
12615 Enabled by default at @option{-O1} and higher.
12617 @opindex fdse
12618 @item -fdse
12619 Perform dead store elimination (DSE) on RTL@.
12620 Enabled by default at @option{-O1} and higher.
12622 @opindex fif-conversion
12623 @item -fif-conversion
12624 Attempt to transform conditional jumps into branch-less equivalents.  This
12625 includes use of conditional moves, min, max, set flags and abs instructions, and
12626 some tricks doable by standard arithmetics.  The use of conditional execution
12627 on chips where it is available is controlled by @option{-fif-conversion2}.
12629 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12630 not with @option{-Og}.
12632 @opindex fif-conversion2
12633 @item -fif-conversion2
12634 Use conditional execution (where available) to transform conditional jumps into
12635 branch-less equivalents.
12637 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12638 not with @option{-Og}.
12640 @opindex fdeclone-ctor-dtor
12641 @item -fdeclone-ctor-dtor
12642 The C++ ABI requires multiple entry points for constructors and
12643 destructors: one for a base subobject, one for a complete object, and
12644 one for a virtual destructor that calls operator delete afterwards.
12645 For a hierarchy with virtual bases, the base and complete variants are
12646 clones, which means two copies of the function.  With this option, the
12647 base and complete variants are changed to be thunks that call a common
12648 implementation.
12650 Enabled by @option{-Os}.
12652 @opindex fdelete-null-pointer-checks
12653 @item -fdelete-null-pointer-checks
12654 Assume that programs cannot safely dereference null pointers, and that
12655 no code or data element resides at address zero.
12656 This option enables simple constant
12657 folding optimizations at all optimization levels.  In addition, other
12658 optimization passes in GCC use this flag to control global dataflow
12659 analyses that eliminate useless checks for null pointers; these assume
12660 that a memory access to address zero always results in a trap, so
12661 that if a pointer is checked after it has already been dereferenced,
12662 it cannot be null.
12664 Note however that in some environments this assumption is not true.
12665 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12666 for programs that depend on that behavior.
12668 This option is enabled by default on most targets.  On Nios II ELF, it
12669 defaults to off.  On AVR and MSP430, this option is completely disabled.
12671 Passes that use the dataflow information
12672 are enabled independently at different optimization levels.
12674 @opindex fdevirtualize
12675 @item -fdevirtualize
12676 Attempt to convert calls to virtual functions to direct calls.  This
12677 is done both within a procedure and interprocedurally as part of
12678 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12679 propagation (@option{-fipa-cp}).
12680 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12682 @opindex fdevirtualize-speculatively
12683 @item -fdevirtualize-speculatively
12684 Attempt to convert calls to virtual functions to speculative direct calls.
12685 Based on the analysis of the type inheritance graph, determine for a given call
12686 the set of likely targets. If the set is small, preferably of size 1, change
12687 the call into a conditional deciding between direct and indirect calls.  The
12688 speculative calls enable more optimizations, such as inlining.  When they seem
12689 useless after further optimization, they are converted back into original form.
12691 @opindex fdevirtualize-at-ltrans
12692 @item -fdevirtualize-at-ltrans
12693 Stream extra information needed for aggressive devirtualization when running
12694 the link-time optimizer in local transformation mode.  
12695 This option enables more devirtualization but
12696 significantly increases the size of streamed data. For this reason it is
12697 disabled by default.
12699 @opindex fexpensive-optimizations
12700 @item -fexpensive-optimizations
12701 Perform a number of minor optimizations that are relatively expensive.
12703 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12705 @opindex free
12706 @item -free
12707 Attempt to remove redundant extension instructions.  This is especially
12708 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12709 registers after writing to their lower 32-bit half.
12711 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
12712 levels @option{-O2}, @option{-O3}, @option{-Os}.
12714 @opindex fno-lifetime-dse
12715 @opindex flifetime-dse
12716 @item -fno-lifetime-dse
12717 In C++ the value of an object is only affected by changes within its
12718 lifetime: when the constructor begins, the object has an indeterminate
12719 value, and any changes during the lifetime of the object are dead when
12720 the object is destroyed.  Normally dead store elimination will take
12721 advantage of this; if your code relies on the value of the object
12722 storage persisting beyond the lifetime of the object, you can use this
12723 flag to disable this optimization.  To preserve stores before the
12724 constructor starts (e.g.@: because your operator new clears the object
12725 storage) but still treat the object as dead after the destructor, you
12726 can use @option{-flifetime-dse=1}.  The default behavior can be
12727 explicitly selected with @option{-flifetime-dse=2}.
12728 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12730 @opindex flive-range-shrinkage
12731 @item -flive-range-shrinkage
12732 Attempt to decrease register pressure through register live range
12733 shrinkage.  This is helpful for fast processors with small or moderate
12734 size register sets.
12736 @opindex fira-algorithm
12737 @item -fira-algorithm=@var{algorithm}
12738 Use the specified coloring algorithm for the integrated register
12739 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12740 specifies Chow's priority coloring, or @samp{CB}, which specifies
12741 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12742 for all architectures, but for those targets that do support it, it is
12743 the default because it generates better code.
12745 @opindex fira-region
12746 @item -fira-region=@var{region}
12747 Use specified regions for the integrated register allocator.  The
12748 @var{region} argument should be one of the following:
12750 @table @samp
12752 @item all
12753 Use all loops as register allocation regions.
12754 This can give the best results for machines with a small and/or
12755 irregular register set.
12757 @item mixed
12758 Use all loops except for loops with small register pressure 
12759 as the regions.  This value usually gives
12760 the best results in most cases and for most architectures,
12761 and is enabled by default when compiling with optimization for speed
12762 (@option{-O}, @option{-O2}, @dots{}).
12764 @item one
12765 Use all functions as a single region.  
12766 This typically results in the smallest code size, and is enabled by default for
12767 @option{-Os} or @option{-O0}.
12769 @end table
12771 @opindex fira-hoist-pressure
12772 @item -fira-hoist-pressure
12773 Use IRA to evaluate register pressure in the code hoisting pass for
12774 decisions to hoist expressions.  This option usually results in smaller
12775 code, but it can slow the compiler down.
12777 This option is enabled at level @option{-Os} for all targets.
12779 @opindex fira-loop-pressure
12780 @item -fira-loop-pressure
12781 Use IRA to evaluate register pressure in loops for decisions to move
12782 loop invariants.  This option usually results in generation
12783 of faster and smaller code on machines with large register files (>= 32
12784 registers), but it can slow the compiler down.
12786 This option is enabled at level @option{-O3} for some targets.
12788 @opindex fno-ira-share-save-slots
12789 @opindex fira-share-save-slots
12790 @item -fno-ira-share-save-slots
12791 Disable sharing of stack slots used for saving call-used hard
12792 registers living through a call.  Each hard register gets a
12793 separate stack slot, and as a result function stack frames are
12794 larger.
12796 @opindex fno-ira-share-spill-slots
12797 @opindex fira-share-spill-slots
12798 @item -fno-ira-share-spill-slots
12799 Disable sharing of stack slots allocated for pseudo-registers.  Each
12800 pseudo-register that does not get a hard register gets a separate
12801 stack slot, and as a result function stack frames are larger.
12803 @opindex flra-remat
12804 @item -flra-remat
12805 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12806 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12807 values if it is profitable.
12809 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12811 @opindex fdelayed-branch
12812 @item -fdelayed-branch
12813 If supported for the target machine, attempt to reorder instructions
12814 to exploit instruction slots available after delayed branch
12815 instructions.
12817 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12818 but not at @option{-Og}.
12820 @opindex fschedule-insns
12821 @item -fschedule-insns
12822 If supported for the target machine, attempt to reorder instructions to
12823 eliminate execution stalls due to required data being unavailable.  This
12824 helps machines that have slow floating point or memory load instructions
12825 by allowing other instructions to be issued until the result of the load
12826 or floating-point instruction is required.
12828 Enabled at levels @option{-O2}, @option{-O3}.
12830 @opindex fschedule-insns2
12831 @item -fschedule-insns2
12832 Similar to @option{-fschedule-insns}, but requests an additional pass of
12833 instruction scheduling after register allocation has been done.  This is
12834 especially useful on machines with a relatively small number of
12835 registers and where memory load instructions take more than one cycle.
12837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12839 @opindex fno-sched-interblock
12840 @opindex fsched-interblock
12841 @item -fno-sched-interblock
12842 Disable instruction scheduling across basic blocks, which
12843 is normally enabled when scheduling before register allocation, i.e.@:
12844 with @option{-fschedule-insns} or at @option{-O2} or higher.
12846 @opindex fno-sched-spec
12847 @opindex fsched-spec
12848 @item -fno-sched-spec
12849 Disable speculative motion of non-load instructions, which
12850 is normally enabled when scheduling before register allocation, i.e.@:
12851 with @option{-fschedule-insns} or at @option{-O2} or higher.
12853 @opindex fsched-pressure
12854 @item -fsched-pressure
12855 Enable register pressure sensitive insn scheduling before register
12856 allocation.  This only makes sense when scheduling before register
12857 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12858 @option{-O2} or higher.  Usage of this option can improve the
12859 generated code and decrease its size by preventing register pressure
12860 increase above the number of available hard registers and subsequent
12861 spills in register allocation.
12863 @opindex fsched-spec-load
12864 @item -fsched-spec-load
12865 Allow speculative motion of some load instructions.  This only makes
12866 sense when scheduling before register allocation, i.e.@: with
12867 @option{-fschedule-insns} or at @option{-O2} or higher.
12869 @opindex fsched-spec-load-dangerous
12870 @item -fsched-spec-load-dangerous
12871 Allow speculative motion of more load instructions.  This only makes
12872 sense when scheduling before register allocation, i.e.@: with
12873 @option{-fschedule-insns} or at @option{-O2} or higher.
12875 @opindex fsched-stalled-insns
12876 @item -fsched-stalled-insns
12877 @itemx -fsched-stalled-insns=@var{n}
12878 Define how many insns (if any) can be moved prematurely from the queue
12879 of stalled insns into the ready list during the second scheduling pass.
12880 @option{-fno-sched-stalled-insns} means that no insns are moved
12881 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12882 on how many queued insns can be moved prematurely.
12883 @option{-fsched-stalled-insns} without a value is equivalent to
12884 @option{-fsched-stalled-insns=1}.
12886 @opindex fsched-stalled-insns-dep
12887 @item -fsched-stalled-insns-dep
12888 @itemx -fsched-stalled-insns-dep=@var{n}
12889 Define how many insn groups (cycles) are examined for a dependency
12890 on a stalled insn that is a candidate for premature removal from the queue
12891 of stalled insns.  This has an effect only during the second scheduling pass,
12892 and only if @option{-fsched-stalled-insns} is used.
12893 @option{-fno-sched-stalled-insns-dep} is equivalent to
12894 @option{-fsched-stalled-insns-dep=0}.
12895 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12896 @option{-fsched-stalled-insns-dep=1}.
12898 @opindex fsched2-use-superblocks
12899 @item -fsched2-use-superblocks
12900 When scheduling after register allocation, use superblock scheduling.
12901 This allows motion across basic block boundaries,
12902 resulting in faster schedules.  This option is experimental, as not all machine
12903 descriptions used by GCC model the CPU closely enough to avoid unreliable
12904 results from the algorithm.
12906 This only makes sense when scheduling after register allocation, i.e.@: with
12907 @option{-fschedule-insns2} or at @option{-O2} or higher.
12909 @opindex fsched-group-heuristic
12910 @item -fsched-group-heuristic
12911 Enable the group heuristic in the scheduler.  This heuristic favors
12912 the instruction that belongs to a schedule group.  This is enabled
12913 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12914 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12916 @opindex fsched-critical-path-heuristic
12917 @item -fsched-critical-path-heuristic
12918 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12919 instructions on the critical path.  This is enabled by default when
12920 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12921 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12923 @opindex fsched-spec-insn-heuristic
12924 @item -fsched-spec-insn-heuristic
12925 Enable the speculative instruction heuristic in the scheduler.  This
12926 heuristic favors speculative instructions with greater dependency weakness.
12927 This is enabled by default when scheduling is enabled, i.e.@:
12928 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12929 or at @option{-O2} or higher.
12931 @opindex fsched-rank-heuristic
12932 @item -fsched-rank-heuristic
12933 Enable the rank heuristic in the scheduler.  This heuristic favors
12934 the instruction belonging to a basic block with greater size or frequency.
12935 This is enabled by default when scheduling is enabled, i.e.@:
12936 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12937 at @option{-O2} or higher.
12939 @opindex fsched-last-insn-heuristic
12940 @item -fsched-last-insn-heuristic
12941 Enable the last-instruction heuristic in the scheduler.  This heuristic
12942 favors the instruction that is less dependent on the last instruction
12943 scheduled.  This is enabled by default when scheduling is enabled,
12944 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12945 at @option{-O2} or higher.
12947 @opindex fsched-dep-count-heuristic
12948 @item -fsched-dep-count-heuristic
12949 Enable the dependent-count heuristic in the scheduler.  This heuristic
12950 favors the instruction that has more instructions depending on it.
12951 This is enabled by default when scheduling is enabled, i.e.@:
12952 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12953 at @option{-O2} or higher.
12955 @opindex freschedule-modulo-scheduled-loops
12956 @item -freschedule-modulo-scheduled-loops
12957 Modulo scheduling is performed before traditional scheduling.  If a loop
12958 is modulo scheduled, later scheduling passes may change its schedule.  
12959 Use this option to control that behavior.
12961 @opindex fselective-scheduling
12962 @item -fselective-scheduling
12963 Schedule instructions using selective scheduling algorithm.  Selective
12964 scheduling runs instead of the first scheduler pass.
12966 @opindex fselective-scheduling2
12967 @item -fselective-scheduling2
12968 Schedule instructions using selective scheduling algorithm.  Selective
12969 scheduling runs instead of the second scheduler pass.
12971 @opindex fsel-sched-pipelining
12972 @item -fsel-sched-pipelining
12973 Enable software pipelining of innermost loops during selective scheduling.
12974 This option has no effect unless one of @option{-fselective-scheduling} or
12975 @option{-fselective-scheduling2} is turned on.
12977 @opindex fsel-sched-pipelining-outer-loops
12978 @item -fsel-sched-pipelining-outer-loops
12979 When pipelining loops during selective scheduling, also pipeline outer loops.
12980 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12982 @opindex fsemantic-interposition
12983 @item -fsemantic-interposition
12984 Some object formats, like ELF, allow interposing of symbols by the 
12985 dynamic linker.
12986 This means that for symbols exported from the DSO, the compiler cannot perform
12987 interprocedural propagation, inlining and other optimizations in anticipation
12988 that the function or variable in question may change. While this feature is
12989 useful, for example, to rewrite memory allocation functions by a debugging
12990 implementation, it is expensive in the terms of code quality.
12991 With @option{-fno-semantic-interposition} the compiler assumes that 
12992 if interposition happens for functions the overwriting function will have 
12993 precisely the same semantics (and side effects). 
12994 Similarly if interposition happens
12995 for variables, the constructor of the variable will be the same. The flag
12996 has no effect for functions explicitly declared inline 
12997 (where it is never allowed for interposition to change semantics) 
12998 and for symbols explicitly declared weak.
13000 @opindex fshrink-wrap
13001 @item -fshrink-wrap
13002 Emit function prologues only before parts of the function that need it,
13003 rather than at the top of the function.  This flag is enabled by default at
13004 @option{-O} and higher.
13006 @opindex fshrink-wrap-separate
13007 @item -fshrink-wrap-separate
13008 Shrink-wrap separate parts of the prologue and epilogue separately, so that
13009 those parts are only executed when needed.
13010 This option is on by default, but has no effect unless @option{-fshrink-wrap}
13011 is also turned on and the target supports this.
13013 @opindex fcaller-saves
13014 @item -fcaller-saves
13015 Enable allocation of values to registers that are clobbered by
13016 function calls, by emitting extra instructions to save and restore the
13017 registers around such calls.  Such allocation is done only when it
13018 seems to result in better code.
13020 This option is always enabled by default on certain machines, usually
13021 those which have no call-preserved registers to use instead.
13023 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13025 @opindex fcombine-stack-adjustments
13026 @item -fcombine-stack-adjustments
13027 Tracks stack adjustments (pushes and pops) and stack memory references
13028 and then tries to find ways to combine them.
13030 Enabled by default at @option{-O1} and higher.
13032 @opindex fipa-ra
13033 @item -fipa-ra
13034 Use caller save registers for allocation if those registers are not used by
13035 any called function.  In that case it is not necessary to save and restore
13036 them around calls.  This is only possible if called functions are part of
13037 same compilation unit as current function and they are compiled before it.
13039 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13040 is disabled if generated code will be instrumented for profiling
13041 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13042 exactly (this happens on targets that do not expose prologues
13043 and epilogues in RTL).
13045 @opindex fconserve-stack
13046 @item -fconserve-stack
13047 Attempt to minimize stack usage.  The compiler attempts to use less
13048 stack space, even if that makes the program slower.  This option
13049 implies setting the @option{large-stack-frame} parameter to 100
13050 and the @option{large-stack-frame-growth} parameter to 400.
13052 @opindex ftree-reassoc
13053 @item -ftree-reassoc
13054 Perform reassociation on trees.  This flag is enabled by default
13055 at @option{-O1} and higher.
13057 @opindex fcode-hoisting
13058 @item -fcode-hoisting
13059 Perform code hoisting.  Code hoisting tries to move the
13060 evaluation of expressions executed on all paths to the function exit
13061 as early as possible.  This is especially useful as a code size
13062 optimization, but it often helps for code speed as well.
13063 This flag is enabled by default at @option{-O2} and higher.
13065 @opindex ftree-pre
13066 @item -ftree-pre
13067 Perform partial redundancy elimination (PRE) on trees.  This flag is
13068 enabled by default at @option{-O2} and @option{-O3}.
13070 @opindex ftree-partial-pre
13071 @item -ftree-partial-pre
13072 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13073 enabled by default at @option{-O3}.
13075 @opindex ftree-forwprop
13076 @item -ftree-forwprop
13077 Perform forward propagation on trees.  This flag is enabled by default
13078 at @option{-O1} and higher.
13080 @opindex ftree-fre
13081 @item -ftree-fre
13082 Perform full redundancy elimination (FRE) on trees.  The difference
13083 between FRE and PRE is that FRE only considers expressions
13084 that are computed on all paths leading to the redundant computation.
13085 This analysis is faster than PRE, though it exposes fewer redundancies.
13086 This flag is enabled by default at @option{-O1} and higher.
13088 @opindex ftree-phiprop
13089 @item -ftree-phiprop
13090 Perform hoisting of loads from conditional pointers on trees.  This
13091 pass is enabled by default at @option{-O1} and higher.
13093 @opindex fhoist-adjacent-loads
13094 @item -fhoist-adjacent-loads
13095 Speculatively hoist loads from both branches of an if-then-else if the
13096 loads are from adjacent locations in the same structure and the target
13097 architecture has a conditional move instruction.  This flag is enabled
13098 by default at @option{-O2} and higher.
13100 @opindex ftree-copy-prop
13101 @item -ftree-copy-prop
13102 Perform copy propagation on trees.  This pass eliminates unnecessary
13103 copy operations.  This flag is enabled by default at @option{-O1} and
13104 higher.
13106 @opindex fipa-pure-const
13107 @item -fipa-pure-const
13108 Discover which functions are pure or constant.
13109 Enabled by default at @option{-O1} and higher.
13111 @opindex fipa-reference
13112 @item -fipa-reference
13113 Discover which static variables do not escape the
13114 compilation unit.
13115 Enabled by default at @option{-O1} and higher.
13117 @opindex fipa-reference-addressable
13118 @item -fipa-reference-addressable
13119 Discover read-only, write-only and non-addressable static variables.
13120 Enabled by default at @option{-O1} and higher.
13122 @opindex fipa-stack-alignment
13123 @item -fipa-stack-alignment
13124 Reduce stack alignment on call sites if possible.
13125 Enabled by default.
13127 @opindex fipa-pta
13128 @item -fipa-pta
13129 Perform interprocedural pointer analysis and interprocedural modification
13130 and reference analysis.  This option can cause excessive memory and
13131 compile-time usage on large compilation units.  It is not enabled by
13132 default at any optimization level.
13134 @opindex fipa-profile
13135 @item -fipa-profile
13136 Perform interprocedural profile propagation.  The functions called only from
13137 cold functions are marked as cold. Also functions executed once (such as
13138 @code{cold}, @code{noreturn}, static constructors or destructors) are
13139 identified. Cold functions and loop less parts of functions executed once are
13140 then optimized for size.
13141 Enabled by default at @option{-O1} and higher.
13143 @opindex fipa-modref
13144 @item -fipa-modref
13145 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13146 effects of functions (memory locations that are modified or referenced) and
13147 enables better optimization across the function call boundary.  This flag is
13148 enabled by default at @option{-O1} and higher.
13150 @opindex fipa-cp
13151 @item -fipa-cp
13152 Perform interprocedural constant propagation.
13153 This optimization analyzes the program to determine when values passed
13154 to functions are constants and then optimizes accordingly.
13155 This optimization can substantially increase performance
13156 if the application has constants passed to functions.
13157 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13158 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13160 @opindex fipa-cp-clone
13161 @item -fipa-cp-clone
13162 Perform function cloning to make interprocedural constant propagation stronger.
13163 When enabled, interprocedural constant propagation performs function cloning
13164 when externally visible function can be called with constant arguments.
13165 Because this optimization can create multiple copies of functions,
13166 it may significantly increase code size
13167 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13168 This flag is enabled by default at @option{-O3}.
13169 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13171 @opindex fipa-bit-cp
13172 @item -fipa-bit-cp
13173 When enabled, perform interprocedural bitwise constant
13174 propagation. This flag is enabled by default at @option{-O2} and
13175 by @option{-fprofile-use} and @option{-fauto-profile}.
13176 It requires that @option{-fipa-cp} is enabled.  
13178 @opindex fipa-vrp
13179 @item -fipa-vrp
13180 When enabled, perform interprocedural propagation of value
13181 ranges. This flag is enabled by default at @option{-O2}. It requires
13182 that @option{-fipa-cp} is enabled.
13184 @opindex fipa-icf
13185 @item -fipa-icf
13186 Perform Identical Code Folding for functions and read-only variables.
13187 The optimization reduces code size and may disturb unwind stacks by replacing
13188 a function by equivalent one with a different name. The optimization works
13189 more effectively with link-time optimization enabled.
13191 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13192 works on different levels and thus the optimizations are not same - there are
13193 equivalences that are found only by GCC and equivalences found only by Gold.
13195 This flag is enabled by default at @option{-O2} and @option{-Os}.
13197 @opindex flive-patching
13198 @item -flive-patching=@var{level}
13199 Control GCC's optimizations to produce output suitable for live-patching.
13201 If the compiler's optimization uses a function's body or information extracted
13202 from its body to optimize/change another function, the latter is called an
13203 impacted function of the former.  If a function is patched, its impacted
13204 functions should be patched too.
13206 The impacted functions are determined by the compiler's interprocedural
13207 optimizations.  For example, a caller is impacted when inlining a function
13208 into its caller,
13209 cloning a function and changing its caller to call this new clone,
13210 or extracting a function's pureness/constness information to optimize
13211 its direct or indirect callers, etc.
13213 Usually, the more IPA optimizations enabled, the larger the number of
13214 impacted functions for each function.  In order to control the number of
13215 impacted functions and more easily compute the list of impacted function,
13216 IPA optimizations can be partially enabled at two different levels.
13218 The @var{level} argument should be one of the following:
13220 @table @samp
13222 @item inline-clone
13224 Only enable inlining and cloning optimizations, which includes inlining,
13225 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13226 As a result, when patching a function, all its callers and its clones'
13227 callers are impacted, therefore need to be patched as well.
13229 @option{-flive-patching=inline-clone} disables the following optimization flags:
13230 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13231 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13232 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13233 -fipa-reference-addressable
13234 -fipa-stack-alignment -fipa-modref}
13236 @item inline-only-static
13238 Only enable inlining of static functions.
13239 As a result, when patching a static function, all its callers are impacted
13240 and so need to be patched as well.
13242 In addition to all the flags that @option{-flive-patching=inline-clone}
13243 disables,
13244 @option{-flive-patching=inline-only-static} disables the following additional
13245 optimization flags:
13246 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13248 @end table
13250 When @option{-flive-patching} is specified without any value, the default value
13251 is @var{inline-clone}.
13253 This flag is disabled by default.
13255 Note that @option{-flive-patching} is not supported with link-time optimization
13256 (@option{-flto}).
13258 @opindex fisolate-erroneous-paths-dereference
13259 @item -fisolate-erroneous-paths-dereference
13260 Detect paths that trigger erroneous or undefined behavior due to
13261 dereferencing a null pointer.  Isolate those paths from the main control
13262 flow and turn the statement with erroneous or undefined behavior into a trap.
13263 This flag is enabled by default at @option{-O2} and higher and depends on
13264 @option{-fdelete-null-pointer-checks} also being enabled.
13266 @opindex fisolate-erroneous-paths-attribute
13267 @item -fisolate-erroneous-paths-attribute
13268 Detect paths that trigger erroneous or undefined behavior due to a null value
13269 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13270 attribute.  Isolate those paths from the main control flow and turn the
13271 statement with erroneous or undefined behavior into a trap.  This is not
13272 currently enabled, but may be enabled by @option{-O2} in the future.
13274 @opindex ftree-sink
13275 @item -ftree-sink
13276 Perform forward store motion on trees.  This flag is
13277 enabled by default at @option{-O1} and higher.
13279 @opindex ftree-bit-ccp
13280 @item -ftree-bit-ccp
13281 Perform sparse conditional bit constant propagation on trees and propagate
13282 pointer alignment information.
13283 This pass only operates on local scalar variables and is enabled by default
13284 at @option{-O1} and higher, except for @option{-Og}.
13285 It requires that @option{-ftree-ccp} is enabled.
13287 @opindex ftree-ccp
13288 @item -ftree-ccp
13289 Perform sparse conditional constant propagation (CCP) on trees.  This
13290 pass only operates on local scalar variables and is enabled by default
13291 at @option{-O1} and higher.
13293 @opindex fssa-backprop
13294 @item -fssa-backprop
13295 Propagate information about uses of a value up the definition chain
13296 in order to simplify the definitions.  For example, this pass strips
13297 sign operations if the sign of a value never matters.  The flag is
13298 enabled by default at @option{-O1} and higher.
13300 @opindex fssa-phiopt
13301 @item -fssa-phiopt
13302 Perform pattern matching on SSA PHI nodes to optimize conditional
13303 code.  This pass is enabled by default at @option{-O1} and higher,
13304 except for @option{-Og}.
13306 @opindex ftree-switch-conversion
13307 @item -ftree-switch-conversion
13308 Perform conversion of simple initializations in a switch to
13309 initializations from a scalar array.  This flag is enabled by default
13310 at @option{-O2} and higher.
13312 @opindex ftree-tail-merge
13313 @item -ftree-tail-merge
13314 Look for identical code sequences.  When found, replace one with a jump to the
13315 other.  This optimization is known as tail merging or cross jumping.  This flag
13316 is enabled by default at @option{-O2} and higher.  The compilation time
13317 in this pass can
13318 be limited using @option{max-tail-merge-comparisons} parameter and
13319 @option{max-tail-merge-iterations} parameter.
13321 @opindex ftree-dce
13322 @item -ftree-dce
13323 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13324 default at @option{-O1} and higher.
13326 @opindex ftree-builtin-call-dce
13327 @item -ftree-builtin-call-dce
13328 Perform conditional dead code elimination (DCE) for calls to built-in functions
13329 that may set @code{errno} but are otherwise free of side effects.  This flag is
13330 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13331 specified.
13333 @opindex ffinite-loops
13334 @opindex fno-finite-loops
13335 @item -ffinite-loops
13336 Assume that a loop with an exit will eventually take the exit and not loop
13337 indefinitely.  This allows the compiler to remove loops that otherwise have
13338 no side-effects, not considering eventual endless looping as such.
13340 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13341 or higher.
13343 @opindex ftree-dominator-opts
13344 @item -ftree-dominator-opts
13345 Perform a variety of simple scalar cleanups (constant/copy
13346 propagation, redundancy elimination, range propagation and expression
13347 simplification) based on a dominator tree traversal.  This also
13348 performs jump threading (to reduce jumps to jumps). This flag is
13349 enabled by default at @option{-O1} and higher.
13351 @opindex ftree-dse
13352 @item -ftree-dse
13353 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13354 a memory location that is later overwritten by another store without
13355 any intervening loads.  In this case the earlier store can be deleted.  This
13356 flag is enabled by default at @option{-O1} and higher.
13358 @opindex ftree-ch
13359 @item -ftree-ch
13360 Perform loop header copying on trees.  This is beneficial since it increases
13361 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13362 is enabled by default at @option{-O1} and higher.  It is not enabled
13363 for @option{-Os}, since it usually increases code size.
13365 @opindex ftree-loop-optimize
13366 @item -ftree-loop-optimize
13367 Perform loop optimizations on trees.  This flag is enabled by default
13368 at @option{-O1} and higher.
13370 @opindex ftree-loop-linear
13371 @opindex floop-strip-mine
13372 @opindex floop-block
13373 @item -ftree-loop-linear
13374 @itemx -floop-strip-mine
13375 @itemx -floop-block
13376 Perform loop nest optimizations.  Same as
13377 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13378 to be configured with @option{--with-isl} to enable the Graphite loop
13379 transformation infrastructure.
13381 @opindex fgraphite-identity
13382 @item -fgraphite-identity
13383 Enable the identity transformation for graphite.  For every SCoP we generate
13384 the polyhedral representation and transform it back to gimple.  Using
13385 @option{-fgraphite-identity} we can check the costs or benefits of the
13386 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13387 are also performed by the code generator isl, like index splitting and
13388 dead code elimination in loops.
13390 @opindex floop-nest-optimize
13391 @item -floop-nest-optimize
13392 Enable the isl based loop nest optimizer.  This is a generic loop nest
13393 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13394 structure optimized for data-locality and parallelism.  This option
13395 is experimental.
13397 @opindex floop-parallelize-all
13398 @item -floop-parallelize-all
13399 Use the Graphite data dependence analysis to identify loops that can
13400 be parallelized.  Parallelize all the loops that can be analyzed to
13401 not contain loop carried dependences without checking that it is
13402 profitable to parallelize the loops.
13404 @opindex ftree-coalesce-vars
13405 @item -ftree-coalesce-vars
13406 While transforming the program out of the SSA representation, attempt to
13407 reduce copying by coalescing versions of different user-defined
13408 variables, instead of just compiler temporaries.  This may severely
13409 limit the ability to debug an optimized program compiled with
13410 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13411 prevents SSA coalescing of user variables.  This option is enabled by
13412 default if optimization is enabled, and it does very little otherwise.
13414 @opindex ftree-loop-if-convert
13415 @item -ftree-loop-if-convert
13416 Attempt to transform conditional jumps in the innermost loops to
13417 branch-less equivalents.  The intent is to remove control-flow from
13418 the innermost loops in order to improve the ability of the
13419 vectorization pass to handle these loops.  This is enabled by default
13420 if vectorization is enabled.
13422 @opindex ftree-loop-distribution
13423 @item -ftree-loop-distribution
13424 Perform loop distribution.  This flag can improve cache performance on
13425 big loop bodies and allow further loop optimizations, like
13426 parallelization or vectorization, to take place.  For example, the loop
13427 @smallexample
13428 DO I = 1, N
13429   A(I) = B(I) + C
13430   D(I) = E(I) * F
13431 ENDDO
13432 @end smallexample
13433 is transformed to
13434 @smallexample
13435 DO I = 1, N
13436    A(I) = B(I) + C
13437 ENDDO
13438 DO I = 1, N
13439    D(I) = E(I) * F
13440 ENDDO
13441 @end smallexample
13442 This flag is enabled by default at @option{-O3}.
13443 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13445 @opindex ftree-loop-distribute-patterns
13446 @item -ftree-loop-distribute-patterns
13447 Perform loop distribution of patterns that can be code generated with
13448 calls to a library.  This flag is enabled by default at @option{-O2} and
13449 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13451 This pass distributes the initialization loops and generates a call to
13452 memset zero.  For example, the loop
13453 @smallexample
13454 DO I = 1, N
13455   A(I) = 0
13456   B(I) = A(I) + I
13457 ENDDO
13458 @end smallexample
13459 is transformed to
13460 @smallexample
13461 DO I = 1, N
13462    A(I) = 0
13463 ENDDO
13464 DO I = 1, N
13465    B(I) = A(I) + I
13466 ENDDO
13467 @end smallexample
13468 and the initialization loop is transformed into a call to memset zero.
13469 This flag is enabled by default at @option{-O3}.
13470 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13472 @opindex floop-interchange
13473 @item -floop-interchange
13474 Perform loop interchange outside of graphite.  This flag can improve cache
13475 performance on loop nest and allow further loop optimizations, like
13476 vectorization, to take place.  For example, the loop
13477 @smallexample
13478 for (int i = 0; i < N; i++)
13479   for (int j = 0; j < N; j++)
13480     for (int k = 0; k < N; k++)
13481       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13482 @end smallexample
13483 is transformed to
13484 @smallexample
13485 for (int i = 0; i < N; i++)
13486   for (int k = 0; k < N; k++)
13487     for (int j = 0; j < N; j++)
13488       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13489 @end smallexample
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 floop-unroll-and-jam
13494 @item -floop-unroll-and-jam
13495 Apply unroll and jam transformations on feasible loops.  In a loop
13496 nest this unrolls the outer loop by some factor and fuses the resulting
13497 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13498 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13500 @opindex ftree-loop-im
13501 @item -ftree-loop-im
13502 Perform loop invariant motion on trees.  This pass moves only invariants that
13503 are hard to handle at RTL level (function calls, operations that expand to
13504 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13505 operands of conditions that are invariant out of the loop, so that we can use
13506 just trivial invariantness analysis in loop unswitching.  The pass also includes
13507 store motion.
13509 @opindex ftree-loop-ivcanon
13510 @item -ftree-loop-ivcanon
13511 Create a canonical counter for number of iterations in loops for which
13512 determining number of iterations requires complicated analysis.  Later
13513 optimizations then may determine the number easily.  Useful especially
13514 in connection with unrolling.
13516 @opindex ftree-scev-cprop
13517 @item -ftree-scev-cprop
13518 Perform final value replacement.  If a variable is modified in a loop
13519 in such a way that its value when exiting the loop can be determined using
13520 only its initial value and the number of loop iterations, replace uses of
13521 the final value by such a computation, provided it is sufficiently cheap.
13522 This reduces data dependencies and may allow further simplifications.
13523 Enabled by default at @option{-O1} and higher.
13525 @opindex fivopts
13526 @item -fivopts
13527 Perform induction variable optimizations (strength reduction, induction
13528 variable merging and induction variable elimination) on trees.
13530 @opindex ftree-parallelize-loops
13531 @item -ftree-parallelize-loops=n
13532 Parallelize loops, i.e., split their iteration space to run in n threads.
13533 This is only possible for loops whose iterations are independent
13534 and can be arbitrarily reordered.  The optimization is only
13535 profitable on multiprocessor machines, for loops that are CPU-intensive,
13536 rather than constrained e.g.@: by memory bandwidth.  This option
13537 implies @option{-pthread}, and thus is only supported on targets
13538 that have support for @option{-pthread}.
13540 @opindex ftree-pta
13541 @item -ftree-pta
13542 Perform function-local points-to analysis on trees.  This flag is
13543 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13545 @opindex ftree-sra
13546 @item -ftree-sra
13547 Perform scalar replacement of aggregates.  This pass replaces structure
13548 references with scalars to prevent committing structures to memory too
13549 early.  This flag is enabled by default at @option{-O1} and higher,
13550 except for @option{-Og}.
13552 @opindex fstore-merging
13553 @item -fstore-merging
13554 Perform merging of narrow stores to consecutive memory addresses.  This pass
13555 merges contiguous stores of immediate values narrower than a word into fewer
13556 wider stores to reduce the number of instructions.  This is enabled by default
13557 at @option{-O2} and higher as well as @option{-Os}.
13559 @opindex ftree-ter
13560 @item -ftree-ter
13561 Perform temporary expression replacement during the SSA->normal phase.  Single
13562 use/single def temporaries are replaced at their use location with their
13563 defining expression.  This results in non-GIMPLE code, but gives the expanders
13564 much more complex trees to work on resulting in better RTL generation.  This is
13565 enabled by default at @option{-O1} and higher.
13567 @opindex ftree-slsr
13568 @item -ftree-slsr
13569 Perform straight-line strength reduction on trees.  This recognizes related
13570 expressions involving multiplications and replaces them by less expensive
13571 calculations when possible.  This is enabled by default at @option{-O1} and
13572 higher.
13574 @opindex ftree-vectorize
13575 @item -ftree-vectorize
13576 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13577 and @option{-ftree-slp-vectorize} if not explicitly specified.
13579 @opindex ftree-loop-vectorize
13580 @item -ftree-loop-vectorize
13581 Perform loop vectorization on trees. This flag is enabled by default at
13582 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13583 and @option{-fauto-profile}.
13585 @opindex ftree-slp-vectorize
13586 @item -ftree-slp-vectorize
13587 Perform basic block vectorization on trees. This flag is enabled by default at
13588 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13589 and @option{-fauto-profile}.
13591 @opindex ftrivial-auto-var-init
13592 @item -ftrivial-auto-var-init=@var{choice}
13593 Initialize automatic variables with either a pattern or with zeroes to increase
13594 the security and predictability of a program by preventing uninitialized memory
13595 disclosure and use.
13596 GCC still considers an automatic variable that doesn't have an explicit
13597 initializer as uninitialized, @option{-Wuninitialized} and
13598 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13599 warning messages on such automatic variables and the compiler will
13600 perform optimization as if the variable were uninitialized.
13601 With this option, GCC will also initialize any padding of automatic variables
13602 that have structure or union types to zeroes.
13603 However, the current implementation cannot initialize automatic variables that
13604 are declared between the controlling expression and the first case of a
13605 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13606 such cases.
13608 The three values of @var{choice} are:
13610 @itemize @bullet
13611 @item
13612 @samp{uninitialized} doesn't initialize any automatic variables.
13613 This is C and C++'s default.
13615 @item
13616 @samp{pattern} Initialize automatic variables with values which will likely
13617 transform logic bugs into crashes down the line, are easily recognized in a
13618 crash dump and without being values that programmers can rely on for useful
13619 program semantics.
13620 The current value is byte-repeatable pattern with byte "0xFE".
13621 The values used for pattern initialization might be changed in the future.
13623 @item
13624 @samp{zero} Initialize automatic variables with zeroes.
13625 @end itemize
13627 The default is @samp{uninitialized}.
13629 You can control this behavior for a specific variable by using the variable
13630 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13632 @opindex fvect-cost-model
13633 @item -fvect-cost-model=@var{model}
13634 Alter the cost model used for vectorization.  The @var{model} argument
13635 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13636 @samp{very-cheap}.
13637 With the @samp{unlimited} model the vectorized code-path is assumed
13638 to be profitable while with the @samp{dynamic} model a runtime check
13639 guards the vectorized code-path to enable it only for iteration
13640 counts that will likely execute faster than when executing the original
13641 scalar loop.  The @samp{cheap} model disables vectorization of
13642 loops where doing so would be cost prohibitive for example due to
13643 required runtime checks for data dependence or alignment but otherwise
13644 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13645 allows vectorization if the vector code would entirely replace the
13646 scalar code that is being vectorized.  For example, if each iteration
13647 of a vectorized loop would only be able to handle exactly four iterations
13648 of the scalar loop, the @samp{very-cheap} model would only allow
13649 vectorization if the scalar iteration count is known to be a multiple
13650 of four.
13652 The default cost model depends on other optimization flags and is
13653 either @samp{dynamic} or @samp{cheap}.
13655 @opindex fsimd-cost-model
13656 @item -fsimd-cost-model=@var{model}
13657 Alter the cost model used for vectorization of loops marked with the OpenMP
13658 simd directive.  The @var{model} argument should be one of
13659 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
13660 have the same meaning as described in @option{-fvect-cost-model} and by
13661 default a cost model defined with @option{-fvect-cost-model} is used.
13663 @opindex ftree-vrp
13664 @item -ftree-vrp
13665 Perform Value Range Propagation on trees.  This is similar to the
13666 constant propagation pass, but instead of values, ranges of values are
13667 propagated.  This allows the optimizers to remove unnecessary range
13668 checks like array bound checks and null pointer checks.  This is
13669 enabled by default at @option{-O2} and higher.  Null pointer check
13670 elimination is only done if @option{-fdelete-null-pointer-checks} is
13671 enabled.
13673 @opindex fsplit-paths
13674 @item -fsplit-paths
13675 Split paths leading to loop backedges.  This can improve dead code
13676 elimination and common subexpression elimination.  This is enabled by
13677 default at @option{-O3} and above.
13679 @opindex fsplit-ivs-in-unroller
13680 @item -fsplit-ivs-in-unroller
13681 Enables expression of values of induction variables in later iterations
13682 of the unrolled loop using the value in the first iteration.  This breaks
13683 long dependency chains, thus improving efficiency of the scheduling passes.
13685 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13686 same effect.  However, that is not reliable in cases where the loop body
13687 is more complicated than a single basic block.  It also does not work at all
13688 on some architectures due to restrictions in the CSE pass.
13690 This optimization is enabled by default.
13692 @opindex fvariable-expansion-in-unroller
13693 @item -fvariable-expansion-in-unroller
13694 With this option, the compiler creates multiple copies of some
13695 local variables when unrolling a loop, which can result in superior code.
13697 This optimization is enabled by default for PowerPC targets, but disabled
13698 by default otherwise.
13700 @opindex fpartial-inlining
13701 @item -fpartial-inlining
13702 Inline parts of functions.  This option has any effect only
13703 when inlining itself is turned on by the @option{-finline-functions}
13704 or @option{-finline-small-functions} options.
13706 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13708 @opindex fpredictive-commoning
13709 @item -fpredictive-commoning
13710 Perform predictive commoning optimization, i.e., reusing computations
13711 (especially memory loads and stores) performed in previous
13712 iterations of loops.
13714 This option is enabled at level @option{-O3}.
13715 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13717 @opindex fprefetch-loop-arrays
13718 @item -fprefetch-loop-arrays
13719 If supported by the target machine, generate instructions to prefetch
13720 memory to improve the performance of loops that access large arrays.
13722 This option may generate better or worse code; results are highly
13723 dependent on the structure of loops within the source code.
13725 Disabled at level @option{-Os}.
13727 @opindex fno-printf-return-value
13728 @opindex fprintf-return-value
13729 @item -fno-printf-return-value
13730 Do not substitute constants for known return value of formatted output
13731 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13732 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13733 transformation allows GCC to optimize or even eliminate branches based
13734 on the known return value of these functions called with arguments that
13735 are either constant, or whose values are known to be in a range that
13736 makes determining the exact return value possible.  For example, when
13737 @option{-fprintf-return-value} is in effect, both the branch and the
13738 body of the @code{if} statement (but not the call to @code{snprint})
13739 can be optimized away when @code{i} is a 32-bit or smaller integer
13740 because the return value is guaranteed to be at most 8.
13742 @smallexample
13743 char buf[9];
13744 if (snprintf (buf, "%08x", i) >= sizeof buf)
13745   @dots{}
13746 @end smallexample
13748 The @option{-fprintf-return-value} option relies on other optimizations
13749 and yields best results with @option{-O2} and above.  It works in tandem
13750 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13751 options.  The @option{-fprintf-return-value} option is enabled by default.
13753 @opindex fno-peephole
13754 @opindex fpeephole
13755 @opindex fno-peephole2
13756 @opindex fpeephole2
13757 @item -fno-peephole
13758 @itemx -fno-peephole2
13759 Disable any machine-specific peephole optimizations.  The difference
13760 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13761 are implemented in the compiler; some targets use one, some use the
13762 other, a few use both.
13764 @option{-fpeephole} is enabled by default.
13765 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13767 @opindex fno-guess-branch-probability
13768 @opindex fguess-branch-probability
13769 @item -fno-guess-branch-probability
13770 Do not guess branch probabilities using heuristics.
13772 GCC uses heuristics to guess branch probabilities if they are
13773 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13774 heuristics are based on the control flow graph.  If some branch probabilities
13775 are specified by @code{__builtin_expect}, then the heuristics are
13776 used to guess branch probabilities for the rest of the control flow graph,
13777 taking the @code{__builtin_expect} info into account.  The interactions
13778 between the heuristics and @code{__builtin_expect} can be complex, and in
13779 some cases, it may be useful to disable the heuristics so that the effects
13780 of @code{__builtin_expect} are easier to understand.
13782 It is also possible to specify expected probability of the expression
13783 with @code{__builtin_expect_with_probability} built-in function.
13785 The default is @option{-fguess-branch-probability} at levels
13786 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13788 @opindex freorder-blocks
13789 @item -freorder-blocks
13790 Reorder basic blocks in the compiled function in order to reduce number of
13791 taken branches and improve code locality.
13793 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13795 @opindex freorder-blocks-algorithm
13796 @item -freorder-blocks-algorithm=@var{algorithm}
13797 Use the specified algorithm for basic block reordering.  The
13798 @var{algorithm} argument can be @samp{simple}, which does not increase
13799 code size (except sometimes due to secondary effects like alignment),
13800 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13801 put all often executed code together, minimizing the number of branches
13802 executed by making extra copies of code.
13804 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13805 @samp{stc} at levels @option{-O2}, @option{-O3}.
13807 @opindex freorder-blocks-and-partition
13808 @item -freorder-blocks-and-partition
13809 In addition to reordering basic blocks in the compiled function, in order
13810 to reduce number of taken branches, partitions hot and cold basic blocks
13811 into separate sections of the assembly and @file{.o} files, to improve
13812 paging and cache locality performance.
13814 This optimization is automatically turned off in the presence of
13815 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13816 section attribute and on any architecture that does not support named
13817 sections.  When @option{-fsplit-stack} is used this option is not
13818 enabled by default (to avoid linker errors), but may be enabled
13819 explicitly (if using a working linker).
13821 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13823 @opindex freorder-functions
13824 @item -freorder-functions
13825 Reorder functions in the object file in order to
13826 improve code locality.  This is implemented by using special
13827 subsections @code{.text.hot} for most frequently executed functions and
13828 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13829 the linker so object file format must support named sections and linker must
13830 place them in a reasonable way.
13832 This option isn't effective unless you either provide profile feedback
13833 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13834 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13836 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13838 @opindex fstrict-aliasing
13839 @item -fstrict-aliasing
13840 Allow the compiler to assume the strictest aliasing rules applicable to
13841 the language being compiled.  For C (and C++), this activates
13842 optimizations based on the type of expressions.  In particular, an
13843 object of one type is assumed never to reside at the same address as an
13844 object of a different type, unless the types are almost the same.  For
13845 example, an @code{unsigned int} can alias an @code{int}, but not a
13846 @code{void*} or a @code{double}.  A character type may alias any other
13847 type.
13849 @anchor{Type-punning}Pay special attention to code like this:
13850 @smallexample
13851 union a_union @{
13852   int i;
13853   double d;
13856 int f() @{
13857   union a_union t;
13858   t.d = 3.0;
13859   return t.i;
13861 @end smallexample
13862 The practice of reading from a different union member than the one most
13863 recently written to (called ``type-punning'') is common.  Even with
13864 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13865 is accessed through the union type.  So, the code above works as
13866 expected.  @xref{Structures unions enumerations and bit-fields
13867 implementation}.  However, this code might not:
13868 @smallexample
13869 int f() @{
13870   union a_union t;
13871   int* ip;
13872   t.d = 3.0;
13873   ip = &t.i;
13874   return *ip;
13876 @end smallexample
13878 Similarly, access by taking the address, casting the resulting pointer
13879 and dereferencing the result has undefined behavior, even if the cast
13880 uses a union type, e.g.:
13881 @smallexample
13882 int f() @{
13883   double d = 3.0;
13884   return ((union a_union *) &d)->i;
13886 @end smallexample
13888 The @option{-fstrict-aliasing} option is enabled at levels
13889 @option{-O2}, @option{-O3}, @option{-Os}.
13891 @opindex fipa-strict-aliasing
13892 @item -fipa-strict-aliasing
13893 Controls whether rules of @option{-fstrict-aliasing} are applied across
13894 function boundaries.  Note that if multiple functions gets inlined into a
13895 single function the memory accesses are no longer considered to be crossing a
13896 function boundary.
13898 The @option{-fipa-strict-aliasing} option is enabled by default and is
13899 effective only in combination with @option{-fstrict-aliasing}.
13901 @opindex falign-functions
13902 @item -falign-functions
13903 @itemx -falign-functions=@var{n}
13904 @itemx -falign-functions=@var{n}:@var{m}
13905 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13906 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13907 Align the start of functions to the next power-of-two greater than or
13908 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13909 least the first @var{m} bytes of the function can be fetched by the CPU
13910 without crossing an @var{n}-byte alignment boundary.
13912 If @var{m} is not specified, it defaults to @var{n}.
13914 Examples: @option{-falign-functions=32} aligns functions to the next
13915 32-byte boundary, @option{-falign-functions=24} aligns to the next
13916 32-byte boundary only if this can be done by skipping 23 bytes or less,
13917 @option{-falign-functions=32:7} aligns to the next
13918 32-byte boundary only if this can be done by skipping 6 bytes or less.
13920 The second pair of @var{n2}:@var{m2} values allows you to specify
13921 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13922 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13923 otherwise aligns to the next 32-byte boundary if this can be done
13924 by skipping 2 bytes or less.
13925 If @var{m2} is not specified, it defaults to @var{n2}.
13927 Some assemblers only support this flag when @var{n} is a power of two;
13928 in that case, it is rounded up.
13930 @option{-fno-align-functions} and @option{-falign-functions=1} are
13931 equivalent and mean that functions are not aligned.
13933 If @var{n} is not specified or is zero, use a machine-dependent default.
13934 The maximum allowed @var{n} option value is 65536.
13936 Enabled at levels @option{-O2}, @option{-O3}.
13938 @item -flimit-function-alignment
13939 If this option is enabled, the compiler tries to avoid unnecessarily
13940 overaligning functions. It attempts to instruct the assembler to align
13941 by the amount specified by @option{-falign-functions}, but not to
13942 skip more bytes than the size of the function.
13944 @opindex falign-labels
13945 @item -falign-labels
13946 @itemx -falign-labels=@var{n}
13947 @itemx -falign-labels=@var{n}:@var{m}
13948 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13949 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13950 Align all branch targets to a power-of-two boundary.
13952 Parameters of this option are analogous to the @option{-falign-functions} option.
13953 @option{-fno-align-labels} and @option{-falign-labels=1} are
13954 equivalent and mean that labels are not aligned.
13956 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13957 are greater than this value, then their values are used instead.
13959 If @var{n} is not specified or is zero, use a machine-dependent default
13960 which is very likely to be @samp{1}, meaning no alignment.
13961 The maximum allowed @var{n} option value is 65536.
13963 Enabled at levels @option{-O2}, @option{-O3}.
13965 @opindex falign-loops
13966 @item -falign-loops
13967 @itemx -falign-loops=@var{n}
13968 @itemx -falign-loops=@var{n}:@var{m}
13969 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13970 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13971 Align loops to a power-of-two boundary.  If the loops are executed
13972 many times, this makes up for any execution of the dummy padding
13973 instructions.
13975 If @option{-falign-labels} is greater than this value, then its value
13976 is used instead.
13978 Parameters of this option are analogous to the @option{-falign-functions} option.
13979 @option{-fno-align-loops} and @option{-falign-loops=1} are
13980 equivalent and mean that loops are not aligned.
13981 The maximum allowed @var{n} option value is 65536.
13983 If @var{n} is not specified or is zero, use a machine-dependent default.
13985 Enabled at levels @option{-O2}, @option{-O3}.
13987 @opindex falign-jumps
13988 @item -falign-jumps
13989 @itemx -falign-jumps=@var{n}
13990 @itemx -falign-jumps=@var{n}:@var{m}
13991 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13992 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13993 Align branch targets to a power-of-two boundary, for branch targets
13994 where the targets can only be reached by jumping.  In this case,
13995 no dummy operations need be executed.
13997 If @option{-falign-labels} is greater than this value, then its value
13998 is used instead.
14000 Parameters of this option are analogous to the @option{-falign-functions} option.
14001 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
14002 equivalent and mean that loops are not aligned.
14004 If @var{n} is not specified or is zero, use a machine-dependent default.
14005 The maximum allowed @var{n} option value is 65536.
14007 Enabled at levels @option{-O2}, @option{-O3}.
14009 @opindex fno-allocation-dce
14010 @item -fno-allocation-dce
14011 Do not remove unused C++ allocations in dead code elimination.
14013 @opindex fallow-store-data-races
14014 @item -fallow-store-data-races
14015 Allow the compiler to perform optimizations that may introduce new data races
14016 on stores, without proving that the variable cannot be concurrently accessed
14017 by other threads.  Does not affect optimization of local data.  It is safe to
14018 use this option if it is known that global data will not be accessed by
14019 multiple threads.
14021 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14022 hoisting or if-conversions that may cause a value that was already in memory
14023 to be re-written with that same value.  Such re-writing is safe in a single
14024 threaded context but may be unsafe in a multi-threaded context.  Note that on
14025 some processors, if-conversions may be required in order to enable
14026 vectorization.
14028 Enabled at level @option{-Ofast}.
14030 @opindex funit-at-a-time
14031 @item -funit-at-a-time
14032 This option is left for compatibility reasons. @option{-funit-at-a-time}
14033 has no effect, while @option{-fno-unit-at-a-time} implies
14034 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14036 Enabled by default.
14038 @opindex fno-toplevel-reorder
14039 @opindex ftoplevel-reorder
14040 @item -fno-toplevel-reorder
14041 Do not reorder top-level functions, variables, and @code{asm}
14042 statements.  Output them in the same order that they appear in the
14043 input file.  When this option is used, unreferenced static variables
14044 are not removed.  This option is intended to support existing code
14045 that relies on a particular ordering.  For new code, it is better to
14046 use attributes when possible.
14048 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14049 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14050 Additionally @option{-fno-toplevel-reorder} implies
14051 @option{-fno-section-anchors}.
14053 @opindex funreachable-traps
14054 @item -funreachable-traps
14055 With this option, the compiler turns calls to
14056 @code{__builtin_unreachable} into traps, instead of using them for
14057 optimization.  This also affects any such calls implicitly generated
14058 by the compiler.
14060 This option has the same effect as @option{-fsanitize=unreachable
14061 -fsanitize-trap=unreachable}, but does not affect the values of those
14062 options.  If @option{-fsanitize=unreachable} is enabled, that option
14063 takes priority over this one.
14065 This option is enabled by default at @option{-O0} and @option{-Og}.
14067 @opindex fweb
14068 @item -fweb
14069 Constructs webs as commonly used for register allocation purposes and assign
14070 each web individual pseudo register.  This allows the register allocation pass
14071 to operate on pseudos directly, but also strengthens several other optimization
14072 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14073 however, make debugging impossible, since variables no longer stay in a
14074 ``home register''.
14076 Enabled by default with @option{-funroll-loops}.
14078 @opindex fwhole-program
14079 @item -fwhole-program
14080 Assume that the current compilation unit represents the whole program being
14081 compiled.  All public functions and variables with the exception of @code{main}
14082 and those merged by attribute @code{externally_visible} become static functions
14083 and in effect are optimized more aggressively by interprocedural optimizers.
14085 With @option{-flto} this option has a limited use.  In most cases the
14086 precise list of symbols used or exported from the binary is known the
14087 resolution info passed to the link-time optimizer by the linker plugin.  It is
14088 still useful if no linker plugin is used or during incremental link step when
14089 final code is produced (with @option{-flto}
14090 @option{-flinker-output=nolto-rel}).
14092 @opindex flto
14093 @item -flto[=@var{n}]
14094 This option runs the standard link-time optimizer.  When invoked
14095 with source code, it generates GIMPLE (one of GCC's internal
14096 representations) and writes it to special ELF sections in the object
14097 file.  When the object files are linked together, all the function
14098 bodies are read from these ELF sections and instantiated as if they
14099 had been part of the same translation unit.
14101 To use the link-time optimizer, @option{-flto} and optimization
14102 options should be specified at compile time and during the final link.
14103 It is recommended that you compile all the files participating in the
14104 same link with the same options and also specify those options at
14105 link time.  
14106 For example:
14108 @smallexample
14109 gcc -c -O2 -flto foo.c
14110 gcc -c -O2 -flto bar.c
14111 gcc -o myprog -flto -O2 foo.o bar.o
14112 @end smallexample
14114 The first two invocations to GCC save a bytecode representation
14115 of GIMPLE into special ELF sections inside @file{foo.o} and
14116 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14117 @file{foo.o} and @file{bar.o}, merges the two files into a single
14118 internal image, and compiles the result as usual.  Since both
14119 @file{foo.o} and @file{bar.o} are merged into a single image, this
14120 causes all the interprocedural analyses and optimizations in GCC to
14121 work across the two files as if they were a single one.  This means,
14122 for example, that the inliner is able to inline functions in
14123 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14125 Another (simpler) way to enable link-time optimization is:
14127 @smallexample
14128 gcc -o myprog -flto -O2 foo.c bar.c
14129 @end smallexample
14131 The above generates bytecode for @file{foo.c} and @file{bar.c},
14132 merges them together into a single GIMPLE representation and optimizes
14133 them as usual to produce @file{myprog}.
14135 The important thing to keep in mind is that to enable link-time
14136 optimizations you need to use the GCC driver to perform the link step.
14137 GCC automatically performs link-time optimization if any of the
14138 objects involved were compiled with the @option{-flto} command-line option.  
14139 You can always override
14140 the automatic decision to do link-time optimization
14141 by passing @option{-fno-lto} to the link command.
14143 To make whole program optimization effective, it is necessary to make
14144 certain whole program assumptions.  The compiler needs to know
14145 what functions and variables can be accessed by libraries and runtime
14146 outside of the link-time optimized unit.  When supported by the linker,
14147 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14148 to the compiler about used and externally visible symbols.  When
14149 the linker plugin is not available, @option{-fwhole-program} should be
14150 used to allow the compiler to make these assumptions, which leads
14151 to more aggressive optimization decisions.
14153 When a file is compiled with @option{-flto} without
14154 @option{-fuse-linker-plugin}, the generated object file is larger than
14155 a regular object file because it contains GIMPLE bytecodes and the usual
14156 final code (see @option{-ffat-lto-objects}).  This means that
14157 object files with LTO information can be linked as normal object
14158 files; if @option{-fno-lto} is passed to the linker, no
14159 interprocedural optimizations are applied.  Note that when
14160 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14161 but you cannot perform a regular, non-LTO link on them.
14163 When producing the final binary, GCC only
14164 applies link-time optimizations to those files that contain bytecode.
14165 Therefore, you can mix and match object files and libraries with
14166 GIMPLE bytecodes and final object code.  GCC automatically selects
14167 which files to optimize in LTO mode and which files to link without
14168 further processing.
14170 Generally, options specified at link time override those
14171 specified at compile time, although in some cases GCC attempts to infer
14172 link-time options from the settings used to compile the input files.
14174 If you do not specify an optimization level option @option{-O} at
14175 link time, then GCC uses the highest optimization level 
14176 used when compiling the object files.  Note that it is generally 
14177 ineffective to specify an optimization level option only at link time and 
14178 not at compile time, for two reasons.  First, compiling without 
14179 optimization suppresses compiler passes that gather information 
14180 needed for effective optimization at link time.  Second, some early
14181 optimization passes can be performed only at compile time and 
14182 not at link time.
14184 There are some code generation flags preserved by GCC when
14185 generating bytecodes, as they need to be used during the final link.
14186 Currently, the following options and their settings are taken from
14187 the first object file that explicitly specifies them: 
14188 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14189 @option{-fgnu-tm} and all the @option{-m} target flags.
14191 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14192 @option{-fPIE} are combined based on the following scheme:
14194 @smallexample
14195 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14196 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14197 @option{-fpic/-fPIC} + (no option) = (no option)
14198 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14199 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14200 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14201 @end smallexample
14203 Certain ABI-changing flags are required to match in all compilation units,
14204 and trying to override this at link time with a conflicting value
14205 is ignored.  This includes options such as @option{-freg-struct-return}
14206 and @option{-fpcc-struct-return}. 
14208 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14209 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14210 are passed through to the link stage and merged conservatively for
14211 conflicting translation units.  Specifically
14212 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14213 precedence; and for example @option{-ffp-contract=off} takes precedence
14214 over @option{-ffp-contract=fast}.  You can override them at link time.
14216 Diagnostic options such as @option{-Wstringop-overflow} are passed
14217 through to the link stage and their setting matches that of the
14218 compile-step at function granularity.  Note that this matters only
14219 for diagnostics emitted during optimization.  Note that code
14220 transforms such as inlining can lead to warnings being enabled
14221 or disabled for regions if code not consistent with the setting
14222 at compile time.
14224 When you need to pass options to the assembler via @option{-Wa} or
14225 @option{-Xassembler} make sure to either compile such translation
14226 units with @option{-fno-lto} or consistently use the same assembler
14227 options on all translation units.  You can alternatively also
14228 specify assembler options at LTO link time.
14230 To enable debug info generation you need to supply @option{-g} at
14231 compile time.  If any of the input files at link time were built
14232 with debug info generation enabled the link will enable debug info
14233 generation as well.  Any elaborate debug info settings
14234 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14235 at the linker command line and mixing different settings in different
14236 translation units is discouraged.
14238 If LTO encounters objects with C linkage declared with incompatible
14239 types in separate translation units to be linked together (undefined
14240 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14241 issued.  The behavior is still undefined at run time.  Similar
14242 diagnostics may be raised for other languages.
14244 Another feature of LTO is that it is possible to apply interprocedural
14245 optimizations on files written in different languages:
14247 @smallexample
14248 gcc -c -flto foo.c
14249 g++ -c -flto bar.cc
14250 gfortran -c -flto baz.f90
14251 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14252 @end smallexample
14254 Notice that the final link is done with @command{g++} to get the C++
14255 runtime libraries and @option{-lgfortran} is added to get the Fortran
14256 runtime libraries.  In general, when mixing languages in LTO mode, you
14257 should use the same link command options as when mixing languages in a
14258 regular (non-LTO) compilation.
14260 If object files containing GIMPLE bytecode are stored in a library archive, say
14261 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14262 are using a linker with plugin support.  To create static libraries suitable
14263 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14264 and @command{ranlib}; 
14265 to show the symbols of object files with GIMPLE bytecode, use
14266 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14267 and @command{nm} have been compiled with plugin support.  At link time, use the
14268 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14269 the LTO optimization process:
14271 @smallexample
14272 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14273 @end smallexample
14275 With the linker plugin enabled, the linker extracts the needed
14276 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14277 to make them part of the aggregated GIMPLE image to be optimized.
14279 If you are not using a linker with plugin support and/or do not
14280 enable the linker plugin, then the objects inside @file{libfoo.a}
14281 are extracted and linked as usual, but they do not participate
14282 in the LTO optimization process.  In order to make a static library suitable
14283 for both LTO optimization and usual linkage, compile its object files with
14284 @option{-flto} @option{-ffat-lto-objects}.
14286 Link-time optimizations do not require the presence of the whole program to
14287 operate.  If the program does not require any symbols to be exported, it is
14288 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14289 the interprocedural optimizers to use more aggressive assumptions which may
14290 lead to improved optimization opportunities.
14291 Use of @option{-fwhole-program} is not needed when linker plugin is
14292 active (see @option{-fuse-linker-plugin}).
14294 The current implementation of LTO makes no
14295 attempt to generate bytecode that is portable between different
14296 types of hosts.  The bytecode files are versioned and there is a
14297 strict version check, so bytecode files generated in one version of
14298 GCC do not work with an older or newer version of GCC.
14300 Link-time optimization does not work well with generation of debugging
14301 information on systems other than those using a combination of ELF and
14302 DWARF.
14304 If you specify the optional @var{n}, the optimization and code
14305 generation done at link time is executed in parallel using @var{n}
14306 parallel jobs by utilizing an installed @command{make} program.  The
14307 environment variable @env{MAKE} may be used to override the program
14308 used.
14310 You can also specify @option{-flto=jobserver} to use GNU make's
14311 job server mode to determine the number of parallel jobs. This
14312 is useful when the Makefile calling GCC is already executing in parallel.
14313 You must prepend a @samp{+} to the command recipe in the parent Makefile
14314 for this to work.  This option likely only works if @env{MAKE} is
14315 GNU make.  Even without the option value, GCC tries to automatically
14316 detect a running GNU make's job server.
14318 Use @option{-flto=auto} to use GNU make's job server, if available,
14319 or otherwise fall back to autodetection of the number of CPU threads
14320 present in your system.
14322 @opindex flto-partition
14323 @item -flto-partition=@var{alg}
14324 Specify the partitioning algorithm used by the link-time optimizer.
14325 The value is either @samp{1to1} to specify a partitioning mirroring
14326 the original source files or @samp{balanced} to specify partitioning
14327 into equally sized chunks (whenever possible) or @samp{max} to create
14328 new partition for every symbol where possible.  Specifying @samp{none}
14329 as an algorithm disables partitioning and streaming completely. 
14330 The default value is @samp{balanced}. While @samp{1to1} can be used
14331 as an workaround for various code ordering issues, the @samp{max}
14332 partitioning is intended for internal testing only.
14333 The value @samp{one} specifies that exactly one partition should be
14334 used while the value @samp{none} bypasses partitioning and executes
14335 the link-time optimization step directly from the WPA phase.
14337 @opindex flto-compression-level
14338 @item -flto-compression-level=@var{n}
14339 This option specifies the level of compression used for intermediate
14340 language written to LTO object files, and is only meaningful in
14341 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14342 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14343 to 19 (maximum compression), while zlib supports values from 0 to 9.
14344 Values outside this range are clamped to either minimum or maximum
14345 of the supported values.  If the option is not given,
14346 a default balanced compression setting is used.
14348 @opindex fuse-linker-plugin
14349 @item -fuse-linker-plugin
14350 Enables the use of a linker plugin during link-time optimization.  This
14351 option relies on plugin support in the linker, which is available in gold
14352 or in GNU ld 2.21 or newer.
14354 This option enables the extraction of object files with GIMPLE bytecode out
14355 of library archives. This improves the quality of optimization by exposing
14356 more code to the link-time optimizer.  This information specifies what
14357 symbols can be accessed externally (by non-LTO object or during dynamic
14358 linking).  Resulting code quality improvements on binaries (and shared
14359 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14360 See @option{-flto} for a description of the effect of this flag and how to
14361 use it.
14363 This option is enabled by default when LTO support in GCC is enabled
14364 and GCC was configured for use with
14365 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14367 @opindex ffat-lto-objects
14368 @item -ffat-lto-objects
14369 Fat LTO objects are object files that contain both the intermediate language
14370 and the object code. This makes them usable for both LTO linking and normal
14371 linking. This option is effective only when compiling with @option{-flto}
14372 and is ignored at link time.
14374 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14375 requires the complete toolchain to be aware of LTO. It requires a linker with
14376 linker plugin support for basic functionality.  Additionally,
14377 @command{nm}, @command{ar} and @command{ranlib}
14378 need to support linker plugins to allow a full-featured build environment
14379 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14380 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14381 to these tools. With non fat LTO makefiles need to be modified to use them.
14383 Note that modern binutils provide plugin auto-load mechanism.
14384 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14385 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14386 @command{gcc-ranlib}).
14388 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14389 support.
14391 @opindex fcompare-elim
14392 @item -fcompare-elim
14393 After register allocation and post-register allocation instruction splitting,
14394 identify arithmetic instructions that compute processor flags similar to a
14395 comparison operation based on that arithmetic.  If possible, eliminate the
14396 explicit comparison operation.
14398 This pass only applies to certain targets that cannot explicitly represent
14399 the comparison operation before register allocation is complete.
14401 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14403 @opindex ffold-mem-offsets
14404 @item -ffold-mem-offsets
14405 @itemx -fno-fold-mem-offsets
14406 Try to eliminate add instructions by folding them in memory loads/stores.
14408 Enabled at levels @option{-O2}, @option{-O3}.
14410 @opindex fcprop-registers
14411 @item -fcprop-registers
14412 After register allocation and post-register allocation instruction splitting,
14413 perform a copy-propagation pass to try to reduce scheduling dependencies
14414 and occasionally eliminate the copy.
14416 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14418 @opindex fprofile-correction
14419 @item -fprofile-correction
14420 Profiles collected using an instrumented binary for multi-threaded programs may
14421 be inconsistent due to missed counter updates. When this option is specified,
14422 GCC uses heuristics to correct or smooth out such inconsistencies. By
14423 default, GCC emits an error message when an inconsistent profile is detected.
14425 This option is enabled by @option{-fauto-profile}.
14427 @opindex fprofile-partial-training
14428 @item -fprofile-partial-training
14429 With @code{-fprofile-use} all portions of programs not executed during train
14430 run are optimized agressively for size rather than speed.  In some cases it is
14431 not practical to train all possible hot paths in the program. (For
14432 example, program may contain functions specific for a given hardware and
14433 trianing may not cover all hardware configurations program is run on.)  With
14434 @code{-fprofile-partial-training} profile feedback will be ignored for all
14435 functions not executed during the train run leading them to be optimized as if
14436 they were compiled without profile feedback. This leads to better performance
14437 when train run is not representative but also leads to significantly bigger
14438 code.
14440 @opindex fprofile-use
14441 @item -fprofile-use
14442 @itemx -fprofile-use=@var{path}
14443 Enable profile feedback-directed optimizations, 
14444 and the following optimizations, many of which
14445 are generally profitable only with profile feedback available:
14447 @gccoptlist{-fbranch-probabilities  -fprofile-values
14448 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14449 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14450 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14451 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14452 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14453 -fprofile-reorder-functions}
14455 Before you can use this option, you must first generate profiling information.
14456 @xref{Instrumentation Options}, for information about the
14457 @option{-fprofile-generate} option.
14459 By default, GCC emits an error message if the feedback profiles do not
14460 match the source code.  This error can be turned into a warning by using
14461 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14462 optimized code.  Additionally, by default, GCC also emits a warning message if
14463 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14465 If @var{path} is specified, GCC looks at the @var{path} to find
14466 the profile feedback data files. See @option{-fprofile-dir}.
14468 @opindex fauto-profile
14469 @item -fauto-profile
14470 @itemx -fauto-profile=@var{path}
14471 Enable sampling-based feedback-directed optimizations, 
14472 and the following optimizations,
14473 many of which are generally profitable only with profile feedback available:
14475 @gccoptlist{-fbranch-probabilities  -fprofile-values
14476 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14477 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14478 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14479 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14480 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14481 -fprofile-correction}
14483 @var{path} is the name of a file containing AutoFDO profile information.
14484 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14486 Producing an AutoFDO profile data file requires running your program
14487 with the @command{perf} utility on a supported GNU/Linux target system.
14488 For more information, see @uref{https://perf.wiki.kernel.org/}.
14490 E.g.
14491 @smallexample
14492 perf record -e br_inst_retired:near_taken -b -o perf.data \
14493     -- your_program
14494 @end smallexample
14496 Then use the @command{create_gcov} tool to convert the raw profile data
14497 to a format that can be used by GCC.@  You must also supply the 
14498 unstripped binary for your program to this tool.  
14499 See @uref{https://github.com/google/autofdo}.
14501 E.g.
14502 @smallexample
14503 create_gcov --binary=your_program.unstripped --profile=perf.data \
14504     --gcov=profile.afdo
14505 @end smallexample
14506 @end table
14508 The following options control compiler behavior regarding floating-point 
14509 arithmetic.  These options trade off between speed and
14510 correctness.  All must be specifically enabled.
14512 @table @gcctabopt
14513 @opindex ffloat-store
14514 @item -ffloat-store
14515 Do not store floating-point variables in registers, and inhibit other
14516 options that might change whether a floating-point value is taken from a
14517 register or memory.
14519 @cindex floating-point precision
14520 This option prevents undesirable excess precision on machines such as
14521 the 68000 where the floating registers (of the 68881) keep more
14522 precision than a @code{double} is supposed to have.  Similarly for the
14523 x86 architecture.  For most programs, the excess precision does only
14524 good, but a few programs rely on the precise definition of IEEE floating
14525 point.  Use @option{-ffloat-store} for such programs, after modifying
14526 them to store all pertinent intermediate computations into variables.
14528 @opindex fexcess-precision
14529 @item -fexcess-precision=@var{style}
14530 This option allows further control over excess precision on machines
14531 where floating-point operations occur in a format with more precision or
14532 range than the IEEE standard and interchange floating-point types.  By
14533 default, @option{-fexcess-precision=fast} is in effect; this means that
14534 operations may be carried out in a wider precision than the types specified
14535 in the source if that would result in faster code, and it is unpredictable
14536 when rounding to the types specified in the source code takes place.
14537 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14538 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14539 both casts and assignments cause values to be rounded to their
14540 semantic types (whereas @option{-ffloat-store} only affects
14541 assignments).  This option is enabled by default for C or C++ if a strict
14542 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14543 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14544 regardless of whether a strict conformance option is used.
14546 @opindex mfpmath
14547 @option{-fexcess-precision=standard} is not implemented for languages
14548 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14549 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14550 semantics apply without excess precision, and in the latter, rounding
14551 is unpredictable.
14553 @opindex ffast-math
14554 @item -ffast-math
14555 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14556 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14557 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14558 @option{-fexcess-precision=fast}.
14560 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14562 This option is not turned on by any @option{-O} option besides
14563 @option{-Ofast} since it can result in incorrect output for programs
14564 that depend on an exact implementation of IEEE or ISO rules/specifications
14565 for math functions. It may, however, yield faster code for programs
14566 that do not require the guarantees of these specifications.
14568 @opindex fno-math-errno
14569 @opindex fmath-errno
14570 @item -fno-math-errno
14571 Do not set @code{errno} after calling math functions that are executed
14572 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14573 IEEE exceptions for math error handling may want to use this flag
14574 for speed while maintaining IEEE arithmetic compatibility.
14576 This option is not turned on by any @option{-O} option since
14577 it can result in incorrect output for programs that depend on
14578 an exact implementation of IEEE or ISO rules/specifications for
14579 math functions. It may, however, yield faster code for programs
14580 that do not require the guarantees of these specifications.
14582 The default is @option{-fmath-errno}.
14584 On Darwin systems, the math library never sets @code{errno}.  There is
14585 therefore no reason for the compiler to consider the possibility that
14586 it might, and @option{-fno-math-errno} is the default.
14588 @opindex funsafe-math-optimizations
14589 @item -funsafe-math-optimizations
14591 Allow optimizations for floating-point arithmetic that (a) assume
14592 that arguments and results are valid and (b) may violate IEEE or
14593 ANSI standards.  When used at link time, it may include libraries
14594 or startup files that change the default FPU control word or other
14595 similar optimizations.
14597 This option is not turned on by any @option{-O} option since
14598 it can result in incorrect output for programs that depend on
14599 an exact implementation of IEEE or ISO rules/specifications for
14600 math functions. It may, however, yield faster code for programs
14601 that do not require the guarantees of these specifications.
14602 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14603 @option{-fassociative-math} and @option{-freciprocal-math}.
14605 The default is @option{-fno-unsafe-math-optimizations}.
14607 @opindex fassociative-math
14608 @item -fassociative-math
14610 Allow re-association of operands in series of floating-point operations.
14611 This violates the ISO C and C++ language standard by possibly changing
14612 computation result.  NOTE: re-ordering may change the sign of zero as
14613 well as ignore NaNs and inhibit or create underflow or overflow (and
14614 thus cannot be used on code that relies on rounding behavior like
14615 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14616 and thus may not be used when ordered comparisons are required.
14617 This option requires that both @option{-fno-signed-zeros} and
14618 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14619 much sense with @option{-frounding-math}. For Fortran the option
14620 is automatically enabled when both @option{-fno-signed-zeros} and
14621 @option{-fno-trapping-math} are in effect.
14623 The default is @option{-fno-associative-math}.
14625 @opindex freciprocal-math
14626 @item -freciprocal-math
14628 Allow the reciprocal of a value to be used instead of dividing by
14629 the value if this enables optimizations.  For example @code{x / y}
14630 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14631 is subject to common subexpression elimination.  Note that this loses
14632 precision and increases the number of flops operating on the value.
14634 The default is @option{-fno-reciprocal-math}.
14636 @opindex ffinite-math-only
14637 @item -ffinite-math-only
14638 Allow optimizations for floating-point arithmetic that assume
14639 that arguments and results are not NaNs or +-Infs.
14641 This option is not turned on by any @option{-O} option since
14642 it can result in incorrect output for programs that depend on
14643 an exact implementation of IEEE or ISO rules/specifications for
14644 math functions. It may, however, yield faster code for programs
14645 that do not require the guarantees of these specifications.
14647 The default is @option{-fno-finite-math-only}.
14649 @opindex fno-signed-zeros
14650 @opindex fsigned-zeros
14651 @item -fno-signed-zeros
14652 Allow optimizations for floating-point arithmetic that ignore the
14653 signedness of zero.  IEEE arithmetic specifies the behavior of
14654 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14655 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14656 This option implies that the sign of a zero result isn't significant.
14658 The default is @option{-fsigned-zeros}.
14660 @opindex fno-trapping-math
14661 @opindex ftrapping-math
14662 @item -fno-trapping-math
14663 Compile code assuming that floating-point operations cannot generate
14664 user-visible traps.  These traps include division by zero, overflow,
14665 underflow, inexact result and invalid operation.  This option requires
14666 that @option{-fno-signaling-nans} be in effect.  Setting this option may
14667 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14669 This option should never be turned on by any @option{-O} option since
14670 it can result in incorrect output for programs that depend on
14671 an exact implementation of IEEE or ISO rules/specifications for
14672 math functions.
14674 The default is @option{-ftrapping-math}.
14676 Future versions of GCC may provide finer control of this setting
14677 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14678 will be used along with @option{-frounding-math} to specify the
14679 default state for @code{FENV_ACCESS}.
14681 @opindex frounding-math
14682 @item -frounding-math
14683 Disable transformations and optimizations that assume default floating-point
14684 rounding behavior.  This is round-to-zero for all floating point
14685 to integer conversions, and round-to-nearest for all other arithmetic
14686 truncations.  This option should be specified for programs that change
14687 the FP rounding mode dynamically, or that may be executed with a
14688 non-default rounding mode.  This option disables constant folding of
14689 floating-point expressions at compile time (which may be affected by
14690 rounding mode) and arithmetic transformations that are unsafe in the
14691 presence of sign-dependent rounding modes.
14693 The default is @option{-fno-rounding-math}.
14695 This option is experimental and does not currently guarantee to
14696 disable all GCC optimizations that are affected by rounding mode.
14697 Future versions of GCC may provide finer control of this setting
14698 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14699 will be used along with @option{-ftrapping-math} to specify the
14700 default state for @code{FENV_ACCESS}.
14702 @opindex fsignaling-nans
14703 @item -fsignaling-nans
14704 Compile code assuming that IEEE signaling NaNs may generate user-visible
14705 traps during floating-point operations.  Setting this option disables
14706 optimizations that may change the number of exceptions visible with
14707 signaling NaNs.  This option implies @option{-ftrapping-math}.
14709 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14710 be defined.
14712 The default is @option{-fno-signaling-nans}.
14714 This option is experimental and does not currently guarantee to
14715 disable all GCC optimizations that affect signaling NaN behavior.
14717 @opindex fno-fp-int-builtin-inexact
14718 @opindex ffp-int-builtin-inexact
14719 @item -fno-fp-int-builtin-inexact
14720 Do not allow the built-in functions @code{ceil}, @code{floor},
14721 @code{round} and @code{trunc}, and their @code{float} and @code{long
14722 double} variants, to generate code that raises the ``inexact''
14723 floating-point exception for noninteger arguments.  ISO C99 and C11
14724 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14725 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14726 ISO C23, does not allow these functions to do so.
14728 The default is @option{-ffp-int-builtin-inexact}, allowing the
14729 exception to be raised, unless C23 or a later C standard is selected.
14730 This option does nothing unless @option{-ftrapping-math} is in effect.
14732 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14733 generate a call to a library function then the ``inexact'' exception
14734 may be raised if the library implementation does not follow TS 18661.
14736 @opindex fsingle-precision-constant
14737 @item -fsingle-precision-constant
14738 Treat floating-point constants as single precision instead of
14739 implicitly converting them to double-precision constants.
14741 @opindex fcx-limited-range
14742 @item -fcx-limited-range
14743 When enabled, this option states that a range reduction step is not
14744 needed when performing complex division.  Also, there is no checking
14745 whether the result of a complex multiplication or division is @code{NaN
14746 + I*NaN}, with an attempt to rescue the situation in that case.  The
14747 default is @option{-fno-cx-limited-range}, but is enabled by
14748 @option{-ffast-math}.
14750 This option controls the default setting of the ISO C99
14751 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14752 all languages.
14754 @opindex fcx-fortran-rules
14755 @item -fcx-fortran-rules
14756 Complex multiplication and division follow Fortran rules.  Range
14757 reduction is done as part of complex division, but there is no checking
14758 whether the result of a complex multiplication or division is @code{NaN
14759 + I*NaN}, with an attempt to rescue the situation in that case.
14761 The default is @option{-fno-cx-fortran-rules}.
14763 @end table
14765 The following options control optimizations that may improve
14766 performance, but are not enabled by any @option{-O} options.  This
14767 section includes experimental options that may produce broken code.
14769 @table @gcctabopt
14770 @opindex fbranch-probabilities
14771 @item -fbranch-probabilities
14772 After running a program compiled with @option{-fprofile-arcs}
14773 (@pxref{Instrumentation Options}),
14774 you can compile it a second time using
14775 @option{-fbranch-probabilities}, to improve optimizations based on
14776 the number of times each branch was taken.  When a program
14777 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14778 counts to a file called @file{@var{sourcename}.gcda} for each source
14779 file.  The information in this data file is very dependent on the
14780 structure of the generated code, so you must use the same source code
14781 and the same optimization options for both compilations.
14782 See details about the file naming in @option{-fprofile-arcs}.
14784 With @option{-fbranch-probabilities}, GCC puts a
14785 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14786 These can be used to improve optimization.  Currently, they are only
14787 used in one place: in @file{reorg.cc}, instead of guessing which path a
14788 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14789 exactly determine which path is taken more often.
14791 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14793 @opindex fprofile-values
14794 @item -fprofile-values
14795 If combined with @option{-fprofile-arcs}, it adds code so that some
14796 data about values of expressions in the program is gathered.
14798 With @option{-fbranch-probabilities}, it reads back the data gathered
14799 from profiling values of expressions for usage in optimizations.
14801 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14802 @option{-fauto-profile}.
14804 @opindex fprofile-reorder-functions
14805 @item -fprofile-reorder-functions
14806 Function reordering based on profile instrumentation collects
14807 first time of execution of a function and orders these functions
14808 in ascending order.
14810 Enabled with @option{-fprofile-use}.
14812 @opindex fvpt
14813 @item -fvpt
14814 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14815 to add code to gather information about values of expressions.
14817 With @option{-fbranch-probabilities}, it reads back the data gathered
14818 and actually performs the optimizations based on them.
14819 Currently the optimizations include specialization of division operations
14820 using the knowledge about the value of the denominator.
14822 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14824 @opindex frename-registers
14825 @item -frename-registers
14826 Attempt to avoid false dependencies in scheduled code by making use
14827 of registers left over after register allocation.  This optimization
14828 most benefits processors with lots of registers.  Depending on the
14829 debug information format adopted by the target, however, it can
14830 make debugging impossible, since variables no longer stay in
14831 a ``home register''.
14833 Enabled by default with @option{-funroll-loops}.
14835 @opindex fschedule-fusion
14836 @item -fschedule-fusion
14837 Performs a target dependent pass over the instruction stream to schedule
14838 instructions of same type together because target machine can execute them
14839 more efficiently if they are adjacent to each other in the instruction flow.
14841 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14843 @opindex ftracer
14844 @item -ftracer
14845 Perform tail duplication to enlarge superblock size.  This transformation
14846 simplifies the control flow of the function allowing other optimizations to do
14847 a better job.
14849 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14851 @opindex funroll-loops
14852 @item -funroll-loops
14853 Unroll loops whose number of iterations can be determined at compile time or
14854 upon entry to the loop.  @option{-funroll-loops} implies
14855 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14856 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14857 a small constant number of iterations).  This option makes code larger, and may
14858 or may not make it run faster.
14860 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14862 @opindex funroll-all-loops
14863 @item -funroll-all-loops
14864 Unroll all loops, even if their number of iterations is uncertain when
14865 the loop is entered.  This usually makes programs run more slowly.
14866 @option{-funroll-all-loops} implies the same options as
14867 @option{-funroll-loops}.
14869 @opindex fpeel-loops
14870 @item -fpeel-loops
14871 Peels loops for which there is enough information that they do not
14872 roll much (from profile feedback or static analysis).  It also turns on
14873 complete loop peeling (i.e.@: complete removal of loops with small constant
14874 number of iterations).
14876 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14878 @opindex fmove-loop-invariants
14879 @item -fmove-loop-invariants
14880 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14881 at level @option{-O1} and higher, except for @option{-Og}.
14883 @opindex fmove-loop-stores
14884 @item -fmove-loop-stores
14885 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14886 moves invariant stores to after the end of the loop in exchange for
14887 carrying the stored value in a register across the iteration.
14888 Note for this option to have an effect @option{-ftree-loop-im} has to
14889 be enabled as well.  Enabled at level @option{-O1} and higher, except
14890 for @option{-Og}.
14892 @opindex fsplit-loops
14893 @item -fsplit-loops
14894 Split a loop into two if it contains a condition that's always true
14895 for one side of the iteration space and false for the other.
14897 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14899 @opindex funswitch-loops
14900 @item -funswitch-loops
14901 Move branches with loop invariant conditions out of the loop, with duplicates
14902 of the loop on both branches (modified according to result of the condition).
14904 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14906 @opindex fversion-loops-for-strides
14907 @item -fversion-loops-for-strides
14908 If a loop iterates over an array with a variable stride, create another
14909 version of the loop that assumes the stride is always one.  For example:
14911 @smallexample
14912 for (int i = 0; i < n; ++i)
14913   x[i * stride] = @dots{};
14914 @end smallexample
14916 becomes:
14918 @smallexample
14919 if (stride == 1)
14920   for (int i = 0; i < n; ++i)
14921     x[i] = @dots{};
14922 else
14923   for (int i = 0; i < n; ++i)
14924     x[i * stride] = @dots{};
14925 @end smallexample
14927 This is particularly useful for assumed-shape arrays in Fortran where
14928 (for example) it allows better vectorization assuming contiguous accesses.
14929 This flag is enabled by default at @option{-O3}.
14930 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14932 @opindex ffunction-sections
14933 @opindex fdata-sections
14934 @item -ffunction-sections
14935 @itemx -fdata-sections
14936 Place each function or data item into its own section in the output
14937 file if the target supports arbitrary sections.  The name of the
14938 function or the name of the data item determines the section's name
14939 in the output file.
14941 Use these options on systems where the linker can perform optimizations to
14942 improve locality of reference in the instruction space.  Most systems using the
14943 ELF object format have linkers with such optimizations.  On AIX, the linker
14944 rearranges sections (CSECTs) based on the call graph.  The performance impact
14945 varies.
14947 Together with a linker garbage collection (linker @option{--gc-sections}
14948 option) these options may lead to smaller statically-linked executables (after
14949 stripping).
14951 On ELF/DWARF systems these options do not degenerate the quality of the debug
14952 information.  There could be issues with other object files/debug info formats.
14954 Only use these options when there are significant benefits from doing so.  When
14955 you specify these options, the assembler and linker create larger object and
14956 executable files and are also slower.  These options affect code generation.
14957 They prevent optimizations by the compiler and assembler using relative
14958 locations inside a translation unit since the locations are unknown until
14959 link time.  An example of such an optimization is relaxing calls to short call
14960 instructions.
14962 @opindex fstdarg-opt
14963 @item -fstdarg-opt
14964 Optimize the prologue of variadic argument functions with respect to usage of
14965 those arguments.
14967 @opindex fsection-anchors
14968 @item -fsection-anchors
14969 Try to reduce the number of symbolic address calculations by using
14970 shared ``anchor'' symbols to address nearby objects.  This transformation
14971 can help to reduce the number of GOT entries and GOT accesses on some
14972 targets.
14974 For example, the implementation of the following function @code{foo}:
14976 @smallexample
14977 static int a, b, c;
14978 int foo (void) @{ return a + b + c; @}
14979 @end smallexample
14981 @noindent
14982 usually calculates the addresses of all three variables, but if you
14983 compile it with @option{-fsection-anchors}, it accesses the variables
14984 from a common anchor point instead.  The effect is similar to the
14985 following pseudocode (which isn't valid C):
14987 @smallexample
14988 int foo (void)
14990   register int *xr = &x;
14991   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14993 @end smallexample
14995 Not all targets support this option.
14997 @opindex fzero-call-used-regs
14998 @item -fzero-call-used-regs=@var{choice}
14999 Zero call-used registers at function return to increase program
15000 security by either mitigating Return-Oriented Programming (ROP)
15001 attacks or preventing information leakage through registers.
15003 The possible values of @var{choice} are the same as for the
15004 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
15005 The default is @samp{skip}.
15007 You can control this behavior for a specific function by using the function
15008 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
15010 @opindex param
15011 @item --param @var{name}=@var{value}
15012 In some places, GCC uses various constants to control the amount of
15013 optimization that is done.  For example, GCC does not inline functions
15014 that contain more than a certain number of instructions.  You can
15015 control some of these constants on the command line using the
15016 @option{--param} option.
15018 The names of specific parameters, and the meaning of the values, are
15019 tied to the internals of the compiler, and are subject to change
15020 without notice in future releases.
15022 In order to get the minimal, maximal and default values of a parameter,
15023 use the @option{--help=param -Q} options.
15025 In each case, the @var{value} is an integer.  The following choices
15026 of @var{name} are recognized for all targets:
15028 @table @gcctabopt
15029 @item predictable-branch-outcome
15030 When branch is predicted to be taken with probability lower than this threshold
15031 (in percent), then it is considered well predictable.
15033 @item max-rtl-if-conversion-insns
15034 RTL if-conversion tries to remove conditional branches around a block and
15035 replace them with conditionally executed instructions.  This parameter
15036 gives the maximum number of instructions in a block which should be
15037 considered for if-conversion.  The compiler will
15038 also use other heuristics to decide whether if-conversion is likely to be
15039 profitable.
15041 @item max-rtl-if-conversion-predictable-cost
15042 RTL if-conversion will try to remove conditional branches around a block
15043 and replace them with conditionally executed instructions.  These parameters
15044 give the maximum permissible cost for the sequence that would be generated
15045 by if-conversion depending on whether the branch is statically determined
15046 to be predictable or not.  The units for this parameter are the same as
15047 those for the GCC internal seq_cost metric.  The compiler will try to
15048 provide a reasonable default for this parameter using the BRANCH_COST
15049 target macro.
15051 @item max-crossjump-edges
15052 The maximum number of incoming edges to consider for cross-jumping.
15053 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15054 the number of edges incoming to each block.  Increasing values mean
15055 more aggressive optimization, making the compilation time increase with
15056 probably small improvement in executable size.
15058 @item min-crossjump-insns
15059 The minimum number of instructions that must be matched at the end
15060 of two blocks before cross-jumping is performed on them.  This
15061 value is ignored in the case where all instructions in the block being
15062 cross-jumped from are matched.
15064 @item max-grow-copy-bb-insns
15065 The maximum code size expansion factor when copying basic blocks
15066 instead of jumping.  The expansion is relative to a jump instruction.
15068 @item max-goto-duplication-insns
15069 The maximum number of instructions to duplicate to a block that jumps
15070 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15071 passes, GCC factors computed gotos early in the compilation process,
15072 and unfactors them as late as possible.  Only computed jumps at the
15073 end of a basic blocks with no more than max-goto-duplication-insns are
15074 unfactored.
15076 @item max-delay-slot-insn-search
15077 The maximum number of instructions to consider when looking for an
15078 instruction to fill a delay slot.  If more than this arbitrary number of
15079 instructions are searched, the time savings from filling the delay slot
15080 are minimal, so stop searching.  Increasing values mean more
15081 aggressive optimization, making the compilation time increase with probably
15082 small improvement in execution time.
15084 @item max-delay-slot-live-search
15085 When trying to fill delay slots, the maximum number of instructions to
15086 consider when searching for a block with valid live register
15087 information.  Increasing this arbitrarily chosen value means more
15088 aggressive optimization, increasing the compilation time.  This parameter
15089 should be removed when the delay slot code is rewritten to maintain the
15090 control-flow graph.
15092 @item max-gcse-memory
15093 The approximate maximum amount of memory in @code{kB} that can be allocated in
15094 order to perform the global common subexpression elimination
15095 optimization.  If more memory than specified is required, the
15096 optimization is not done.
15098 @item max-gcse-insertion-ratio
15099 If the ratio of expression insertions to deletions is larger than this value
15100 for any expression, then RTL PRE inserts or removes the expression and thus
15101 leaves partially redundant computations in the instruction stream.
15103 @item max-pending-list-length
15104 The maximum number of pending dependencies scheduling allows
15105 before flushing the current state and starting over.  Large functions
15106 with few branches or calls can create excessively large lists which
15107 needlessly consume memory and resources.
15109 @item max-modulo-backtrack-attempts
15110 The maximum number of backtrack attempts the scheduler should make
15111 when modulo scheduling a loop.  Larger values can exponentially increase
15112 compilation time.
15114 @item max-inline-functions-called-once-loop-depth
15115 Maximal loop depth of a call considered by inline heuristics that tries to
15116 inline all functions called once.
15118 @item max-inline-functions-called-once-insns
15119 Maximal estimated size of functions produced while inlining functions called
15120 once.
15122 @item max-inline-insns-single
15123 Several parameters control the tree inliner used in GCC@.  This number sets the
15124 maximum number of instructions (counted in GCC's internal representation) in a
15125 single function that the tree inliner considers for inlining.  This only
15126 affects functions declared inline and methods implemented in a class
15127 declaration (C++). 
15130 @item max-inline-insns-auto
15131 When you use @option{-finline-functions} (included in @option{-O3}),
15132 a lot of functions that would otherwise not be considered for inlining
15133 by the compiler are investigated.  To those functions, a different
15134 (more restrictive) limit compared to functions declared inline can
15135 be applied (@option{--param max-inline-insns-auto}).
15137 @item max-inline-insns-small
15138 This is bound applied to calls which are considered relevant with
15139 @option{-finline-small-functions}.
15141 @item max-inline-insns-size
15142 This is bound applied to calls which are optimized for size. Small growth
15143 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15145 @item uninlined-function-insns
15146 Number of instructions accounted by inliner for function overhead such as
15147 function prologue and epilogue.
15149 @item uninlined-function-time
15150 Extra time accounted by inliner for function overhead such as time needed to
15151 execute function prologue and epilogue.
15153 @item inline-heuristics-hint-percent
15154 The scale (in percents) applied to @option{inline-insns-single},
15155 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15156 when inline heuristics hints that inlining is
15157 very profitable (will enable later optimizations).
15159 @item uninlined-thunk-insns
15160 @item uninlined-thunk-time
15161 Same as @option{--param uninlined-function-insns} and
15162 @option{--param uninlined-function-time} but applied to function thunks.
15164 @item inline-min-speedup
15165 When estimated performance improvement of caller + callee runtime exceeds this
15166 threshold (in percent), the function can be inlined regardless of the limit on
15167 @option{--param max-inline-insns-single} and @option{--param
15168 max-inline-insns-auto}.
15170 @item large-function-insns
15171 The limit specifying really large functions.  For functions larger than this
15172 limit after inlining, inlining is constrained by
15173 @option{--param large-function-growth}.  This parameter is useful primarily
15174 to avoid extreme compilation time caused by non-linear algorithms used by the
15175 back end.
15177 @item large-function-growth
15178 Specifies maximal growth of large function caused by inlining in percents.
15179 For example, parameter value 100 limits large function growth to 2.0 times
15180 the original size.
15182 @item large-unit-insns
15183 The limit specifying large translation unit.  Growth caused by inlining of
15184 units larger than this limit is limited by @option{--param inline-unit-growth}.
15185 For small units this might be too tight.
15186 For example, consider a unit consisting of function A
15187 that is inline and B that just calls A three times.  If B is small relative to
15188 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15189 large units consisting of small inlineable functions, however, the overall unit
15190 growth limit is needed to avoid exponential explosion of code size.  Thus for
15191 smaller units, the size is increased to @option{--param large-unit-insns}
15192 before applying @option{--param inline-unit-growth}.
15194 @item lazy-modules
15195 Maximum number of concurrently open C++ module files when lazy loading.
15197 @item inline-unit-growth
15198 Specifies maximal overall growth of the compilation unit caused by inlining.
15199 For example, parameter value 20 limits unit growth to 1.2 times the original
15200 size. Cold functions (either marked cold via an attribute or by profile
15201 feedback) are not accounted into the unit size.
15203 @item ipa-cp-unit-growth
15204 Specifies maximal overall growth of the compilation unit caused by
15205 interprocedural constant propagation.  For example, parameter value 10 limits
15206 unit growth to 1.1 times the original size.
15208 @item ipa-cp-large-unit-insns
15209 The size of translation unit that IPA-CP pass considers large.
15211 @item large-stack-frame
15212 The limit specifying large stack frames.  While inlining the algorithm is trying
15213 to not grow past this limit too much.
15215 @item large-stack-frame-growth
15216 Specifies maximal growth of large stack frames caused by inlining in percents.
15217 For example, parameter value 1000 limits large stack frame growth to 11 times
15218 the original size.
15220 @item max-inline-insns-recursive
15221 @itemx max-inline-insns-recursive-auto
15222 Specifies the maximum number of instructions an out-of-line copy of a
15223 self-recursive inline
15224 function can grow into by performing recursive inlining.
15226 @option{--param max-inline-insns-recursive} applies to functions
15227 declared inline.
15228 For functions not declared inline, recursive inlining
15229 happens only when @option{-finline-functions} (included in @option{-O3}) is
15230 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15232 @item max-inline-recursive-depth
15233 @itemx max-inline-recursive-depth-auto
15234 Specifies the maximum recursion depth used for recursive inlining.
15236 @option{--param max-inline-recursive-depth} applies to functions
15237 declared inline.  For functions not declared inline, recursive inlining
15238 happens only when @option{-finline-functions} (included in @option{-O3}) is
15239 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15241 @item min-inline-recursive-probability
15242 Recursive inlining is profitable only for function having deep recursion
15243 in average and can hurt for function having little recursion depth by
15244 increasing the prologue size or complexity of function body to other
15245 optimizers.
15247 When profile feedback is available (see @option{-fprofile-generate}) the actual
15248 recursion depth can be guessed from the probability that function recurses
15249 via a given call expression.  This parameter limits inlining only to call
15250 expressions whose probability exceeds the given threshold (in percents).
15252 @item early-inlining-insns
15253 Specify growth that the early inliner can make.  In effect it increases
15254 the amount of inlining for code having a large abstraction penalty.
15256 @item max-early-inliner-iterations
15257 Limit of iterations of the early inliner.  This basically bounds
15258 the number of nested indirect calls the early inliner can resolve.
15259 Deeper chains are still handled by late inlining.
15261 @item comdat-sharing-probability
15262 Probability (in percent) that C++ inline function with comdat visibility
15263 are shared across multiple compilation units.
15265 @item modref-max-bases
15266 @item modref-max-refs
15267 @item modref-max-accesses
15268 Specifies the maximal number of base pointers, references and accesses stored
15269 for a single function by mod/ref analysis.
15271 @item modref-max-tests
15272 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15273 memory locations using the mod/ref information.  This parameter ought to be
15274 bigger than @option{--param modref-max-bases} and @option{--param
15275 modref-max-refs}.
15277 @item modref-max-depth
15278 Specifies the maximum depth of DFS walk used by modref escape analysis.
15279 Setting to 0 disables the analysis completely.
15281 @item modref-max-escape-points
15282 Specifies the maximum number of escape points tracked by modref per SSA-name.
15284 @item modref-max-adjustments
15285 Specifies the maximum number the access range is enlarged during modref dataflow
15286 analysis.
15288 @item profile-func-internal-id
15289 A parameter to control whether to use function internal id in profile
15290 database lookup. If the value is 0, the compiler uses an id that
15291 is based on function assembler name and filename, which makes old profile
15292 data more tolerant to source changes such as function reordering etc.
15294 @item min-vect-loop-bound
15295 The minimum number of iterations under which loops are not vectorized
15296 when @option{-ftree-vectorize} is used.  The number of iterations after
15297 vectorization needs to be greater than the value specified by this option
15298 to allow vectorization.
15300 @item gcse-cost-distance-ratio
15301 Scaling factor in calculation of maximum distance an expression
15302 can be moved by GCSE optimizations.  This is currently supported only in the
15303 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15304 is with simple expressions, i.e., the expressions that have cost
15305 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15306 hoisting of simple expressions.
15308 @item gcse-unrestricted-cost
15309 Cost, roughly measured as the cost of a single typical machine
15310 instruction, at which GCSE optimizations do not constrain
15311 the distance an expression can travel.  This is currently
15312 supported only in the code hoisting pass.  The lesser the cost,
15313 the more aggressive code hoisting is.  Specifying 0 
15314 allows all expressions to travel unrestricted distances.
15316 @item max-hoist-depth
15317 The depth of search in the dominator tree for expressions to hoist.
15318 This is used to avoid quadratic behavior in hoisting algorithm.
15319 The value of 0 does not limit on the search, but may slow down compilation
15320 of huge functions.
15322 @item max-tail-merge-comparisons
15323 The maximum amount of similar bbs to compare a bb with.  This is used to
15324 avoid quadratic behavior in tree tail merging.
15326 @item max-tail-merge-iterations
15327 The maximum amount of iterations of the pass over the function.  This is used to
15328 limit compilation time in tree tail merging.
15330 @item store-merging-allow-unaligned
15331 Allow the store merging pass to introduce unaligned stores if it is legal to
15332 do so.
15334 @item max-stores-to-merge
15335 The maximum number of stores to attempt to merge into wider stores in the store
15336 merging pass.
15338 @item max-store-chains-to-track
15339 The maximum number of store chains to track at the same time in the attempt
15340 to merge them into wider stores in the store merging pass.
15342 @item max-stores-to-track
15343 The maximum number of stores to track at the same time in the attemt to
15344 to merge them into wider stores in the store merging pass.
15346 @item max-unrolled-insns
15347 The maximum number of instructions that a loop may have to be unrolled.
15348 If a loop is unrolled, this parameter also determines how many times
15349 the loop code is unrolled.
15351 @item max-average-unrolled-insns
15352 The maximum number of instructions biased by probabilities of their execution
15353 that a loop may have to be unrolled.  If a loop is unrolled,
15354 this parameter also determines how many times the loop code is unrolled.
15356 @item max-unroll-times
15357 The maximum number of unrollings of a single loop.
15359 @item max-peeled-insns
15360 The maximum number of instructions that a loop may have to be peeled.
15361 If a loop is peeled, this parameter also determines how many times
15362 the loop code is peeled.
15364 @item max-peel-times
15365 The maximum number of peelings of a single loop.
15367 @item max-peel-branches
15368 The maximum number of branches on the hot path through the peeled sequence.
15370 @item max-completely-peeled-insns
15371 The maximum number of insns of a completely peeled loop.
15373 @item max-completely-peel-times
15374 The maximum number of iterations of a loop to be suitable for complete peeling.
15376 @item max-completely-peel-loop-nest-depth
15377 The maximum depth of a loop nest suitable for complete peeling.
15379 @item max-unswitch-insns
15380 The maximum number of insns of an unswitched loop.
15382 @item max-unswitch-depth
15383 The maximum depth of a loop nest to be unswitched.
15385 @item lim-expensive
15386 The minimum cost of an expensive expression in the loop invariant motion.
15388 @item min-loop-cond-split-prob
15389 When FDO profile information is available, @option{min-loop-cond-split-prob}
15390 specifies minimum threshold for probability of semi-invariant condition
15391 statement to trigger loop split.
15393 @item iv-consider-all-candidates-bound
15394 Bound on number of candidates for induction variables, below which
15395 all candidates are considered for each use in induction variable
15396 optimizations.  If there are more candidates than this,
15397 only the most relevant ones are considered to avoid quadratic time complexity.
15399 @item iv-max-considered-uses
15400 The induction variable optimizations give up on loops that contain more
15401 induction variable uses.
15403 @item iv-always-prune-cand-set-bound
15404 If the number of candidates in the set is smaller than this value,
15405 always try to remove unnecessary ivs from the set
15406 when adding a new one.
15408 @item avg-loop-niter
15409 Average number of iterations of a loop.
15411 @item dse-max-object-size
15412 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15413 Larger values may result in larger compilation times.
15415 @item dse-max-alias-queries-per-store
15416 Maximum number of queries into the alias oracle per store.
15417 Larger values result in larger compilation times and may result in more
15418 removed dead stores.
15420 @item scev-max-expr-size
15421 Bound on size of expressions used in the scalar evolutions analyzer.
15422 Large expressions slow the analyzer.
15424 @item scev-max-expr-complexity
15425 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15426 Complex expressions slow the analyzer.
15428 @item max-tree-if-conversion-phi-args
15429 Maximum number of arguments in a PHI supported by TREE if conversion
15430 unless the loop is marked with simd pragma.
15432 @item vect-max-layout-candidates
15433 The maximum number of possible vector layouts (such as permutations)
15434 to consider when optimizing to-be-vectorized code.
15436 @item vect-max-version-for-alignment-checks
15437 The maximum number of run-time checks that can be performed when
15438 doing loop versioning for alignment in the vectorizer.
15440 @item vect-max-version-for-alias-checks
15441 The maximum number of run-time checks that can be performed when
15442 doing loop versioning for alias in the vectorizer.
15444 @item vect-max-peeling-for-alignment
15445 The maximum number of loop peels to enhance access alignment
15446 for vectorizer. Value -1 means no limit.
15448 @item max-iterations-to-track
15449 The maximum number of iterations of a loop the brute-force algorithm
15450 for analysis of the number of iterations of the loop tries to evaluate.
15452 @item hot-bb-count-fraction
15453 The denominator n of fraction 1/n of the maximal execution count of a
15454 basic block in the entire program that a basic block needs to at least
15455 have in order to be considered hot.  The default is 10000, which means
15456 that a basic block is considered hot if its execution count is greater
15457 than 1/10000 of the maximal execution count.  0 means that it is never
15458 considered hot.  Used in non-LTO mode.
15460 @item hot-bb-count-ws-permille
15461 The number of most executed permilles, ranging from 0 to 1000, of the
15462 profiled execution of the entire program to which the execution count
15463 of a basic block must be part of in order to be considered hot.  The
15464 default is 990, which means that a basic block is considered hot if
15465 its execution count contributes to the upper 990 permilles, or 99.0%,
15466 of the profiled execution of the entire program.  0 means that it is
15467 never considered hot.  Used in LTO mode.
15469 @item hot-bb-frequency-fraction
15470 The denominator n of fraction 1/n of the execution frequency of the
15471 entry block of a function that a basic block of this function needs
15472 to at least have in order to be considered hot.  The default is 1000,
15473 which means that a basic block is considered hot in a function if it
15474 is executed more frequently than 1/1000 of the frequency of the entry
15475 block of the function.  0 means that it is never considered hot.
15477 @item unlikely-bb-count-fraction
15478 The denominator n of fraction 1/n of the number of profiled runs of
15479 the entire program below which the execution count of a basic block
15480 must be in order for the basic block to be considered unlikely executed.
15481 The default is 20, which means that a basic block is considered unlikely
15482 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15483 the program.  0 means that it is always considered unlikely executed.
15485 @item max-predicted-iterations
15486 The maximum number of loop iterations we predict statically.  This is useful
15487 in cases where a function contains a single loop with known bound and
15488 another loop with unknown bound.
15489 The known number of iterations is predicted correctly, while
15490 the unknown number of iterations average to roughly 10.  This means that the
15491 loop without bounds appears artificially cold relative to the other one.
15493 @item builtin-expect-probability
15494 Control the probability of the expression having the specified value. This
15495 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15497 @item builtin-string-cmp-inline-length
15498 The maximum length of a constant string for a builtin string cmp call 
15499 eligible for inlining.
15501 @item align-threshold
15503 Select fraction of the maximal frequency of executions of a basic block in
15504 a function to align the basic block.
15506 @item align-loop-iterations
15508 A loop expected to iterate at least the selected number of iterations is
15509 aligned.
15511 @item tracer-dynamic-coverage
15512 @itemx tracer-dynamic-coverage-feedback
15514 This value is used to limit superblock formation once the given percentage of
15515 executed instructions is covered.  This limits unnecessary code size
15516 expansion.
15518 The @option{tracer-dynamic-coverage-feedback} parameter
15519 is used only when profile
15520 feedback is available.  The real profiles (as opposed to statically estimated
15521 ones) are much less balanced allowing the threshold to be larger value.
15523 @item tracer-max-code-growth
15524 Stop tail duplication once code growth has reached given percentage.  This is
15525 a rather artificial limit, as most of the duplicates are eliminated later in
15526 cross jumping, so it may be set to much higher values than is the desired code
15527 growth.
15529 @item tracer-min-branch-ratio
15531 Stop reverse growth when the reverse probability of best edge is less than this
15532 threshold (in percent).
15534 @item tracer-min-branch-probability
15535 @itemx tracer-min-branch-probability-feedback
15537 Stop forward growth if the best edge has probability lower than this
15538 threshold.
15540 Similarly to @option{tracer-dynamic-coverage} two parameters are
15541 provided.  @option{tracer-min-branch-probability-feedback} is used for
15542 compilation with profile feedback and @option{tracer-min-branch-probability}
15543 compilation without.  The value for compilation with profile feedback
15544 needs to be more conservative (higher) in order to make tracer
15545 effective.
15547 @item stack-clash-protection-guard-size
15548 Specify the size of the operating system provided stack guard as
15549 2 raised to @var{num} bytes.  Higher values may reduce the
15550 number of explicit probes, but a value larger than the operating system
15551 provided guard will leave code vulnerable to stack clash style attacks.
15553 @item stack-clash-protection-probe-interval
15554 Stack clash protection involves probing stack space as it is allocated.  This
15555 param controls the maximum distance between probes into the stack as 2 raised
15556 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15557 larger than the operating system provided guard will leave code vulnerable to
15558 stack clash style attacks.
15560 @item max-cse-path-length
15562 The maximum number of basic blocks on path that CSE considers.
15564 @item max-cse-insns
15565 The maximum number of instructions CSE processes before flushing.
15567 @item ggc-min-expand
15569 GCC uses a garbage collector to manage its own memory allocation.  This
15570 parameter specifies the minimum percentage by which the garbage
15571 collector's heap should be allowed to expand between collections.
15572 Tuning this may improve compilation speed; it has no effect on code
15573 generation.
15575 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15576 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15577 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15578 GCC is not able to calculate RAM on a particular platform, the lower
15579 bound of 30% is used.  Setting this parameter and
15580 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15581 every opportunity.  This is extremely slow, but can be useful for
15582 debugging.
15584 @item ggc-min-heapsize
15586 Minimum size of the garbage collector's heap before it begins bothering
15587 to collect garbage.  The first collection occurs after the heap expands
15588 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15589 tuning this may improve compilation speed, and has no effect on code
15590 generation.
15592 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15593 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15594 with a lower bound of 4096 (four megabytes) and an upper bound of
15595 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15596 particular platform, the lower bound is used.  Setting this parameter
15597 very large effectively disables garbage collection.  Setting this
15598 parameter and @option{ggc-min-expand} to zero causes a full collection
15599 to occur at every opportunity.
15601 @item max-reload-search-insns
15602 The maximum number of instruction reload should look backward for equivalent
15603 register.  Increasing values mean more aggressive optimization, making the
15604 compilation time increase with probably slightly better performance.
15606 @item max-cselib-memory-locations
15607 The maximum number of memory locations cselib should take into account.
15608 Increasing values mean more aggressive optimization, making the compilation time
15609 increase with probably slightly better performance.
15611 @item max-sched-ready-insns
15612 The maximum number of instructions ready to be issued the scheduler should
15613 consider at any given time during the first scheduling pass.  Increasing
15614 values mean more thorough searches, making the compilation time increase
15615 with probably little benefit.
15617 @item max-sched-region-blocks
15618 The maximum number of blocks in a region to be considered for
15619 interblock scheduling.
15621 @item max-pipeline-region-blocks
15622 The maximum number of blocks in a region to be considered for
15623 pipelining in the selective scheduler.
15625 @item max-sched-region-insns
15626 The maximum number of insns in a region to be considered for
15627 interblock scheduling.
15629 @item max-pipeline-region-insns
15630 The maximum number of insns in a region to be considered for
15631 pipelining in the selective scheduler.
15633 @item min-spec-prob
15634 The minimum probability (in percents) of reaching a source block
15635 for interblock speculative scheduling.
15637 @item max-sched-extend-regions-iters
15638 The maximum number of iterations through CFG to extend regions.
15639 A value of 0 disables region extensions.
15641 @item max-sched-insn-conflict-delay
15642 The maximum conflict delay for an insn to be considered for speculative motion.
15644 @item sched-spec-prob-cutoff
15645 The minimal probability of speculation success (in percents), so that
15646 speculative insns are scheduled.
15648 @item sched-state-edge-prob-cutoff
15649 The minimum probability an edge must have for the scheduler to save its
15650 state across it.
15652 @item sched-mem-true-dep-cost
15653 Minimal distance (in CPU cycles) between store and load targeting same
15654 memory locations.
15656 @item selsched-max-lookahead
15657 The maximum size of the lookahead window of selective scheduling.  It is a
15658 depth of search for available instructions.
15660 @item selsched-max-sched-times
15661 The maximum number of times that an instruction is scheduled during
15662 selective scheduling.  This is the limit on the number of iterations
15663 through which the instruction may be pipelined.
15665 @item selsched-insns-to-rename
15666 The maximum number of best instructions in the ready list that are considered
15667 for renaming in the selective scheduler.
15669 @item sms-min-sc
15670 The minimum value of stage count that swing modulo scheduler
15671 generates.
15673 @item max-last-value-rtl
15674 The maximum size measured as number of RTLs that can be recorded in an expression
15675 in combiner for a pseudo register as last known value of that register.
15677 @item max-combine-insns
15678 The maximum number of instructions the RTL combiner tries to combine.
15680 @item integer-share-limit
15681 Small integer constants can use a shared data structure, reducing the
15682 compiler's memory usage and increasing its speed.  This sets the maximum
15683 value of a shared integer constant.
15685 @item ssp-buffer-size
15686 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15687 protection when @option{-fstack-protector} is used.
15689 @item min-size-for-stack-sharing
15690 The minimum size of variables taking part in stack slot sharing when not
15691 optimizing.
15693 @item max-jump-thread-duplication-stmts
15694 Maximum number of statements allowed in a block that needs to be
15695 duplicated when threading jumps.
15697 @item max-jump-thread-paths
15698 The maximum number of paths to consider when searching for jump threading
15699 opportunities.  When arriving at a block, incoming edges are only considered
15700 if the number of paths to be searched so far multiplied by the number of
15701 incoming edges does not exhaust the specified maximum number of paths to
15702 consider.
15704 @item max-fields-for-field-sensitive
15705 Maximum number of fields in a structure treated in
15706 a field sensitive manner during pointer analysis.
15708 @item prefetch-latency
15709 Estimate on average number of instructions that are executed before
15710 prefetch finishes.  The distance prefetched ahead is proportional
15711 to this constant.  Increasing this number may also lead to less
15712 streams being prefetched (see @option{simultaneous-prefetches}).
15714 @item simultaneous-prefetches
15715 Maximum number of prefetches that can run at the same time.
15717 @item l1-cache-line-size
15718 The size of cache line in L1 data cache, in bytes.
15720 @item l1-cache-size
15721 The size of L1 data cache, in kilobytes.
15723 @item l2-cache-size
15724 The size of L2 data cache, in kilobytes.
15726 @item prefetch-dynamic-strides
15727 Whether the loop array prefetch pass should issue software prefetch hints
15728 for strides that are non-constant.  In some cases this may be
15729 beneficial, though the fact the stride is non-constant may make it
15730 hard to predict when there is clear benefit to issuing these hints.
15732 Set to 1 if the prefetch hints should be issued for non-constant
15733 strides.  Set to 0 if prefetch hints should be issued only for strides that
15734 are known to be constant and below @option{prefetch-minimum-stride}.
15736 @item prefetch-minimum-stride
15737 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15738 the stride is less than this threshold, prefetch hints will not be issued.
15740 This setting is useful for processors that have hardware prefetchers, in
15741 which case there may be conflicts between the hardware prefetchers and
15742 the software prefetchers.  If the hardware prefetchers have a maximum
15743 stride they can handle, it should be used here to improve the use of
15744 software prefetchers.
15746 A value of -1 means we don't have a threshold and therefore
15747 prefetch hints can be issued for any constant stride.
15749 This setting is only useful for strides that are known and constant.
15751 @item destructive-interference-size
15752 @item constructive-interference-size
15753 The values for the C++17 variables
15754 @code{std::hardware_destructive_interference_size} and
15755 @code{std::hardware_constructive_interference_size}.  The destructive
15756 interference size is the minimum recommended offset between two
15757 independent concurrently-accessed objects; the constructive
15758 interference size is the maximum recommended size of contiguous memory
15759 accessed together.  Typically both will be the size of an L1 cache
15760 line for the target, in bytes.  For a generic target covering a range of L1
15761 cache line sizes, typically the constructive interference size will be
15762 the small end of the range and the destructive size will be the large
15763 end.
15765 The destructive interference size is intended to be used for layout,
15766 and thus has ABI impact.  The default value is not expected to be
15767 stable, and on some targets varies with @option{-mtune}, so use of
15768 this variable in a context where ABI stability is important, such as
15769 the public interface of a library, is strongly discouraged; if it is
15770 used in that context, users can stabilize the value using this
15771 option.
15773 The constructive interference size is less sensitive, as it is
15774 typically only used in a @samp{static_assert} to make sure that a type
15775 fits within a cache line.
15777 See also @option{-Winterference-size}.
15779 @item loop-interchange-max-num-stmts
15780 The maximum number of stmts in a loop to be interchanged.
15782 @item loop-interchange-stride-ratio
15783 The minimum ratio between stride of two loops for interchange to be profitable.
15785 @item min-insn-to-prefetch-ratio
15786 The minimum ratio between the number of instructions and the
15787 number of prefetches to enable prefetching in a loop.
15789 @item prefetch-min-insn-to-mem-ratio
15790 The minimum ratio between the number of instructions and the
15791 number of memory references to enable prefetching in a loop.
15793 @item use-canonical-types
15794 Whether the compiler should use the ``canonical'' type system.
15795 Should always be 1, which uses a more efficient internal
15796 mechanism for comparing types in C++ and Objective-C++.  However, if
15797 bugs in the canonical type system are causing compilation failures,
15798 set this value to 0 to disable canonical types.
15800 @item switch-conversion-max-branch-ratio
15801 Switch initialization conversion refuses to create arrays that are
15802 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15803 branches in the switch.
15805 @item max-partial-antic-length
15806 Maximum length of the partial antic set computed during the tree
15807 partial redundancy elimination optimization (@option{-ftree-pre}) when
15808 optimizing at @option{-O3} and above.  For some sorts of source code
15809 the enhanced partial redundancy elimination optimization can run away,
15810 consuming all of the memory available on the host machine.  This
15811 parameter sets a limit on the length of the sets that are computed,
15812 which prevents the runaway behavior.  Setting a value of 0 for
15813 this parameter allows an unlimited set length.
15815 @item rpo-vn-max-loop-depth
15816 Maximum loop depth that is value-numbered optimistically.
15817 When the limit hits the innermost
15818 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15819 loop nest are value-numbered optimistically and the remaining ones not.
15821 @item sccvn-max-alias-queries-per-access
15822 Maximum number of alias-oracle queries we perform when looking for
15823 redundancies for loads and stores.  If this limit is hit the search
15824 is aborted and the load or store is not considered redundant.  The
15825 number of queries is algorithmically limited to the number of
15826 stores on all paths from the load to the function entry.
15828 @item ira-max-loops-num
15829 IRA uses regional register allocation by default.  If a function
15830 contains more loops than the number given by this parameter, only at most
15831 the given number of the most frequently-executed loops form regions
15832 for regional register allocation.
15834 @item ira-max-conflict-table-size 
15835 Although IRA uses a sophisticated algorithm to compress the conflict
15836 table, the table can still require excessive amounts of memory for
15837 huge functions.  If the conflict table for a function could be more
15838 than the size in MB given by this parameter, the register allocator
15839 instead uses a faster, simpler, and lower-quality
15840 algorithm that does not require building a pseudo-register conflict table.  
15842 @item ira-loop-reserved-regs
15843 IRA can be used to evaluate more accurate register pressure in loops
15844 for decisions to move loop invariants (see @option{-O3}).  The number
15845 of available registers reserved for some other purposes is given
15846 by this parameter.  Default of the parameter
15847 is the best found from numerous experiments.
15849 @item ira-consider-dup-in-all-alts
15850 Make IRA to consider matching constraint (duplicated operand number)
15851 heavily in all available alternatives for preferred register class.
15852 If it is set as zero, it means IRA only respects the matching
15853 constraint when it's in the only available alternative with an
15854 appropriate register class.  Otherwise, it means IRA will check all
15855 available alternatives for preferred register class even if it has
15856 found some choice with an appropriate register class and respect the
15857 found qualified matching constraint.
15859 @item ira-simple-lra-insn-threshold
15860 Approximate function insn number in 1K units triggering simple local RA.
15862 @item lra-inheritance-ebb-probability-cutoff
15863 LRA tries to reuse values reloaded in registers in subsequent insns.
15864 This optimization is called inheritance.  EBB is used as a region to
15865 do this optimization.  The parameter defines a minimal fall-through
15866 edge probability in percentage used to add BB to inheritance EBB in
15867 LRA.  The default value was chosen
15868 from numerous runs of SPEC2000 on x86-64.
15870 @item loop-invariant-max-bbs-in-loop
15871 Loop invariant motion can be very expensive, both in compilation time and
15872 in amount of needed compile-time memory, with very large loops.  Loops
15873 with more basic blocks than this parameter won't have loop invariant
15874 motion optimization performed on them.
15876 @item loop-max-datarefs-for-datadeps
15877 Building data dependencies is expensive for very large loops.  This
15878 parameter limits the number of data references in loops that are
15879 considered for data dependence analysis.  These large loops are no
15880 handled by the optimizations using loop data dependencies.
15882 @item max-vartrack-size
15883 Sets a maximum number of hash table slots to use during variable
15884 tracking dataflow analysis of any function.  If this limit is exceeded
15885 with variable tracking at assignments enabled, analysis for that
15886 function is retried without it, after removing all debug insns from
15887 the function.  If the limit is exceeded even without debug insns, var
15888 tracking analysis is completely disabled for the function.  Setting
15889 the parameter to zero makes it unlimited.
15891 @item max-vartrack-expr-depth
15892 Sets a maximum number of recursion levels when attempting to map
15893 variable names or debug temporaries to value expressions.  This trades
15894 compilation time for more complete debug information.  If this is set too
15895 low, value expressions that are available and could be represented in
15896 debug information may end up not being used; setting this higher may
15897 enable the compiler to find more complex debug expressions, but compile
15898 time and memory use may grow.
15900 @item max-debug-marker-count
15901 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15902 markers) to avoid complexity explosion at inlining or expanding to RTL.
15903 If a function has more such gimple stmts than the set limit, such stmts
15904 will be dropped from the inlined copy of a function, and from its RTL
15905 expansion.
15907 @item min-nondebug-insn-uid
15908 Use uids starting at this parameter for nondebug insns.  The range below
15909 the parameter is reserved exclusively for debug insns created by
15910 @option{-fvar-tracking-assignments}, but debug insns may get
15911 (non-overlapping) uids above it if the reserved range is exhausted.
15913 @item ipa-sra-deref-prob-threshold
15914 IPA-SRA replaces a pointer which is known not be NULL with one or more
15915 new parameters only when the probability (in percent, relative to
15916 function entry) of it being dereferenced is higher than this parameter.
15918 @item ipa-sra-ptr-growth-factor
15919 IPA-SRA replaces a pointer to an aggregate with one or more new
15920 parameters only when their cumulative size is less or equal to
15921 @option{ipa-sra-ptr-growth-factor} times the size of the original
15922 pointer parameter.
15924 @item ipa-sra-ptrwrap-growth-factor
15925 Additional maximum allowed growth of total size of new parameters
15926 that ipa-sra replaces a pointer to an aggregate with,
15927 if it points to a local variable that the caller only writes to and
15928 passes it as an argument to other functions.
15930 @item ipa-sra-max-replacements
15931 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15932 consequence, it is also the maximum number of replacements of a formal
15933 parameter.
15935 @item sra-max-scalarization-size-Ospeed
15936 @itemx sra-max-scalarization-size-Osize
15937 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15938 replace scalar parts of aggregates with uses of independent scalar
15939 variables.  These parameters control the maximum size, in storage units,
15940 of aggregate which is considered for replacement when compiling for
15941 speed
15942 (@option{sra-max-scalarization-size-Ospeed}) or size
15943 (@option{sra-max-scalarization-size-Osize}) respectively.
15945 @item sra-max-propagations
15946 The maximum number of artificial accesses that Scalar Replacement of
15947 Aggregates (SRA) will track, per one local variable, in order to
15948 facilitate copy propagation.
15950 @item tm-max-aggregate-size
15951 When making copies of thread-local variables in a transaction, this
15952 parameter specifies the size in bytes after which variables are
15953 saved with the logging functions as opposed to save/restore code
15954 sequence pairs.  This option only applies when using
15955 @option{-fgnu-tm}.
15957 @item graphite-max-nb-scop-params
15958 To avoid exponential effects in the Graphite loop transforms, the
15959 number of parameters in a Static Control Part (SCoP) is bounded.
15960 A value of zero can be used to lift
15961 the bound.  A variable whose value is unknown at compilation time and
15962 defined outside a SCoP is a parameter of the SCoP.
15964 @item hardcfr-max-blocks
15965 Disable @option{-fharden-control-flow-redundancy} for functions with a
15966 larger number of blocks than the specified value.  Zero removes any
15967 limit.
15969 @item hardcfr-max-inline-blocks
15970 Force @option{-fharden-control-flow-redundancy} to use out-of-line
15971 checking for functions with a larger number of basic blocks than the
15972 specified value.
15974 @item loop-block-tile-size
15975 Loop blocking or strip mining transforms, enabled with
15976 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15977 loop in the loop nest by a given number of iterations.  The strip
15978 length can be changed using the @option{loop-block-tile-size}
15979 parameter.
15981 @item ipa-jump-function-lookups
15982 Specifies number of statements visited during jump function offset discovery.
15984 @item ipa-cp-value-list-size
15985 IPA-CP attempts to track all possible values and types passed to a function's
15986 parameter in order to propagate them and perform devirtualization.
15987 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15988 stores per one formal parameter of a function.
15990 @item ipa-cp-eval-threshold
15991 IPA-CP calculates its own score of cloning profitability heuristics
15992 and performs those cloning opportunities with scores that exceed
15993 @option{ipa-cp-eval-threshold}.
15995 @item ipa-cp-max-recursive-depth
15996 Maximum depth of recursive cloning for self-recursive function.
15998 @item ipa-cp-min-recursive-probability
15999 Recursive cloning only when the probability of call being executed exceeds
16000 the parameter.
16002 @item ipa-cp-profile-count-base
16003 When using @option{-fprofile-use} option, IPA-CP will consider the measured
16004 execution count of a call graph edge at this percentage position in their
16005 histogram as the basis for its heuristics calculation.
16007 @item ipa-cp-recursive-freq-factor
16008 The number of times interprocedural copy propagation expects recursive
16009 functions to call themselves.
16011 @item ipa-cp-recursion-penalty
16012 Percentage penalty the recursive functions will receive when they
16013 are evaluated for cloning.
16015 @item ipa-cp-single-call-penalty
16016 Percentage penalty functions containing a single call to another
16017 function will receive when they are evaluated for cloning.
16019 @item ipa-max-agg-items
16020 IPA-CP is also capable to propagate a number of scalar values passed
16021 in an aggregate. @option{ipa-max-agg-items} controls the maximum
16022 number of such values per one parameter.
16024 @item ipa-cp-loop-hint-bonus
16025 When IPA-CP determines that a cloning candidate would make the number
16026 of iterations of a loop known, it adds a bonus of
16027 @option{ipa-cp-loop-hint-bonus} to the profitability score of
16028 the candidate.
16030 @item ipa-max-loop-predicates
16031 The maximum number of different predicates IPA will use to describe when
16032 loops in a function have known properties.
16034 @item ipa-max-aa-steps
16035 During its analysis of function bodies, IPA-CP employs alias analysis
16036 in order to track values pointed to by function parameters.  In order
16037 not spend too much time analyzing huge functions, it gives up and
16038 consider all memory clobbered after examining
16039 @option{ipa-max-aa-steps} statements modifying memory.
16041 @item ipa-max-switch-predicate-bounds
16042 Maximal number of boundary endpoints of case ranges of switch statement.
16043 For switch exceeding this limit, IPA-CP will not construct cloning cost
16044 predicate, which is used to estimate cloning benefit, for default case
16045 of the switch statement.
16047 @item ipa-max-param-expr-ops
16048 IPA-CP will analyze conditional statement that references some function
16049 parameter to estimate benefit for cloning upon certain constant value.
16050 But if number of operations in a parameter expression exceeds
16051 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16052 one, and is not handled by IPA analysis.
16054 @item lto-partitions
16055 Specify desired number of partitions produced during WHOPR compilation.
16056 The number of partitions should exceed the number of CPUs used for compilation.
16058 @item lto-min-partition
16059 Size of minimal partition for WHOPR (in estimated instructions).
16060 This prevents expenses of splitting very small programs into too many
16061 partitions.
16063 @item lto-max-partition
16064 Size of max partition for WHOPR (in estimated instructions).
16065 to provide an upper bound for individual size of partition.
16066 Meant to be used only with balanced partitioning.
16068 @item lto-max-streaming-parallelism
16069 Maximal number of parallel processes used for LTO streaming.
16071 @item cxx-max-namespaces-for-diagnostic-help
16072 The maximum number of namespaces to consult for suggestions when C++
16073 name lookup fails for an identifier.
16075 @item sink-frequency-threshold
16076 The maximum relative execution frequency (in percents) of the target block
16077 relative to a statement's original block to allow statement sinking of a
16078 statement.  Larger numbers result in more aggressive statement sinking.
16079 A small positive adjustment is applied for
16080 statements with memory operands as those are even more profitable so sink.
16082 @item max-stores-to-sink
16083 The maximum number of conditional store pairs that can be sunk.  Set to 0
16084 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16085 (@option{-ftree-loop-if-convert}) is disabled.
16087 @item case-values-threshold
16088 The smallest number of different values for which it is best to use a
16089 jump-table instead of a tree of conditional branches.  If the value is
16090 0, use the default for the machine.
16092 @item jump-table-max-growth-ratio-for-size
16093 The maximum code size growth ratio when expanding
16094 into a jump table (in percent).  The parameter is used when
16095 optimizing for size.
16097 @item jump-table-max-growth-ratio-for-speed
16098 The maximum code size growth ratio when expanding
16099 into a jump table (in percent).  The parameter is used when
16100 optimizing for speed.
16102 @item tree-reassoc-width
16103 Set the maximum number of instructions executed in parallel in
16104 reassociated tree. This parameter overrides target dependent
16105 heuristics used by default if has non zero value.
16107 @item sched-pressure-algorithm
16108 Choose between the two available implementations of
16109 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16110 and is the more likely to prevent instructions from being reordered.
16111 Algorithm 2 was designed to be a compromise between the relatively
16112 conservative approach taken by algorithm 1 and the rather aggressive
16113 approach taken by the default scheduler.  It relies more heavily on
16114 having a regular register file and accurate register pressure classes.
16115 See @file{haifa-sched.cc} in the GCC sources for more details.
16117 The default choice depends on the target.
16119 @item max-slsr-cand-scan
16120 Set the maximum number of existing candidates that are considered when
16121 seeking a basis for a new straight-line strength reduction candidate.
16123 @item asan-globals
16124 Enable buffer overflow detection for global objects.  This kind
16125 of protection is enabled by default if you are using
16126 @option{-fsanitize=address} option.
16127 To disable global objects protection use @option{--param asan-globals=0}.
16129 @item asan-stack
16130 Enable buffer overflow detection for stack objects.  This kind of
16131 protection is enabled by default when using @option{-fsanitize=address}.
16132 To disable stack protection use @option{--param asan-stack=0} option.
16134 @item asan-instrument-reads
16135 Enable buffer overflow detection for memory reads.  This kind of
16136 protection is enabled by default when using @option{-fsanitize=address}.
16137 To disable memory reads protection use
16138 @option{--param asan-instrument-reads=0}.
16140 @item asan-instrument-writes
16141 Enable buffer overflow detection for memory writes.  This kind of
16142 protection is enabled by default when using @option{-fsanitize=address}.
16143 To disable memory writes protection use
16144 @option{--param asan-instrument-writes=0} option.
16146 @item asan-memintrin
16147 Enable detection for built-in functions.  This kind of protection
16148 is enabled by default when using @option{-fsanitize=address}.
16149 To disable built-in functions protection use
16150 @option{--param asan-memintrin=0}.
16152 @item asan-use-after-return
16153 Enable detection of use-after-return.  This kind of protection
16154 is enabled by default when using the @option{-fsanitize=address} option.
16155 To disable it use @option{--param asan-use-after-return=0}.
16157 Note: By default the check is disabled at run time.  To enable it,
16158 add @code{detect_stack_use_after_return=1} to the environment variable
16159 @env{ASAN_OPTIONS}.
16161 @item asan-instrumentation-with-call-threshold
16162 If number of memory accesses in function being instrumented
16163 is greater or equal to this number, use callbacks instead of inline checks.
16164 E.g. to disable inline code use
16165 @option{--param asan-instrumentation-with-call-threshold=0}.
16167 @item asan-kernel-mem-intrinsic-prefix
16168 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16169 with @samp{__asan_} or @samp{__hwasan_}
16170 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16171 respectively.
16173 @item hwasan-instrument-stack
16174 Enable hwasan instrumentation of statically sized stack-allocated variables.
16175 This kind of instrumentation is enabled by default when using
16176 @option{-fsanitize=hwaddress} and disabled by default when using
16177 @option{-fsanitize=kernel-hwaddress}.
16178 To disable stack instrumentation use
16179 @option{--param hwasan-instrument-stack=0}, and to enable it use
16180 @option{--param hwasan-instrument-stack=1}.
16182 @item hwasan-random-frame-tag
16183 When using stack instrumentation, decide tags for stack variables using a
16184 deterministic sequence beginning at a random tag for each frame.  With this
16185 parameter unset tags are chosen using the same sequence but beginning from 1.
16186 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16187 for @option{-fsanitize=kernel-hwaddress}.
16188 To disable it use @option{--param hwasan-random-frame-tag=0}.
16190 @item hwasan-instrument-allocas
16191 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16192 This kind of instrumentation is enabled by default when using
16193 @option{-fsanitize=hwaddress} and disabled by default when using
16194 @option{-fsanitize=kernel-hwaddress}.
16195 To disable instrumentation of such variables use
16196 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16197 @option{--param hwasan-instrument-allocas=1}.
16199 @item hwasan-instrument-reads
16200 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16201 default for both @option{-fsanitize=hwaddress} and
16202 @option{-fsanitize=kernel-hwaddress}.
16203 To disable checking memory reads use
16204 @option{--param hwasan-instrument-reads=0}.
16206 @item hwasan-instrument-writes
16207 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16208 default for both @option{-fsanitize=hwaddress} and
16209 @option{-fsanitize=kernel-hwaddress}.
16210 To disable checking memory writes use
16211 @option{--param hwasan-instrument-writes=0}.
16213 @item hwasan-instrument-mem-intrinsics
16214 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16215 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16216 and @option{-fsanitize=kernel-hwaddress}.
16217 To disable instrumentation of builtin functions use
16218 @option{--param hwasan-instrument-mem-intrinsics=0}.
16220 @item use-after-scope-direct-emission-threshold
16221 If the size of a local variable in bytes is smaller or equal to this
16222 number, directly poison (or unpoison) shadow memory instead of using
16223 run-time callbacks.
16225 @item tsan-distinguish-volatile
16226 Emit special instrumentation for accesses to volatiles.
16228 @item tsan-instrument-func-entry-exit
16229 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16231 @item max-fsm-thread-path-insns
16232 Maximum number of instructions to copy when duplicating blocks on a
16233 finite state automaton jump thread path.
16235 @item threader-debug
16236 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16238 @item parloops-chunk-size
16239 Chunk size of omp schedule for loops parallelized by parloops.
16241 @item parloops-schedule
16242 Schedule type of omp schedule for loops parallelized by parloops (static,
16243 dynamic, guided, auto, runtime).
16245 @item parloops-min-per-thread
16246 The minimum number of iterations per thread of an innermost parallelized
16247 loop for which the parallelized variant is preferred over the single threaded
16248 one.  Note that for a parallelized loop nest the
16249 minimum number of iterations of the outermost loop per thread is two.
16251 @item max-ssa-name-query-depth
16252 Maximum depth of recursion when querying properties of SSA names in things
16253 like fold routines.  One level of recursion corresponds to following a
16254 use-def chain.
16256 @item max-speculative-devirt-maydefs
16257 The maximum number of may-defs we analyze when looking for a must-def
16258 specifying the dynamic type of an object that invokes a virtual call
16259 we may be able to devirtualize speculatively.
16261 @item ranger-debug
16262 Specifies the type of debug output to be issued for ranges.
16264 @item unroll-jam-min-percent
16265 The minimum percentage of memory references that must be optimized
16266 away for the unroll-and-jam transformation to be considered profitable.
16268 @item unroll-jam-max-unroll
16269 The maximum number of times the outer loop should be unrolled by
16270 the unroll-and-jam transformation.
16272 @item max-rtl-if-conversion-unpredictable-cost
16273 Maximum permissible cost for the sequence that would be generated
16274 by the RTL if-conversion pass for a branch that is considered unpredictable.
16276 @item max-variable-expansions-in-unroller
16277 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16278 of times that an individual variable will be expanded during loop unrolling.
16280 @item partial-inlining-entry-probability
16281 Maximum probability of the entry BB of split region
16282 (in percent relative to entry BB of the function)
16283 to make partial inlining happen.
16285 @item max-tracked-strlens
16286 Maximum number of strings for which strlen optimization pass will
16287 track string lengths.
16289 @item gcse-after-reload-partial-fraction
16290 The threshold ratio for performing partial redundancy
16291 elimination after reload.
16293 @item gcse-after-reload-critical-fraction
16294 The threshold ratio of critical edges execution count that
16295 permit performing redundancy elimination after reload.
16297 @item max-loop-header-insns
16298 The maximum number of insns in loop header duplicated
16299 by the copy loop headers pass.
16301 @item vect-epilogues-nomask
16302 Enable loop epilogue vectorization using smaller vector size.
16304 @item vect-partial-vector-usage
16305 Controls when the loop vectorizer considers using partial vector loads
16306 and stores as an alternative to falling back to scalar code.  0 stops
16307 the vectorizer from ever using partial vector loads and stores.  1 allows
16308 partial vector loads and stores if vectorization removes the need for the
16309 code to iterate.  2 allows partial vector loads and stores in all loops.
16310 The parameter only has an effect on targets that support partial
16311 vector loads and stores.
16313 @item vect-inner-loop-cost-factor
16314 The maximum factor which the loop vectorizer applies to the cost of statements
16315 in an inner loop relative to the loop being vectorized.  The factor applied
16316 is the maximum of the estimated number of iterations of the inner loop and
16317 this parameter.  The default value of this parameter is 50.
16319 @item vect-induction-float
16320 Enable loop vectorization of floating point inductions.
16322 @item vrp-sparse-threshold
16323 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16325 @item vrp-switch-limit
16326 Maximum number of outgoing edges in a switch before VRP will not process it.
16328 @item vrp-vector-threshold
16329 Maximum number of basic blocks for VRP to use a basic cache vector.
16331 @item avoid-fma-max-bits
16332 Maximum number of bits for which we avoid creating FMAs.
16334 @item sms-loop-average-count-threshold
16335 A threshold on the average loop count considered by the swing modulo scheduler.
16337 @item sms-dfa-history
16338 The number of cycles the swing modulo scheduler considers when checking
16339 conflicts using DFA.
16341 @item graphite-allow-codegen-errors
16342 Whether codegen errors should be ICEs when @option{-fchecking}.
16344 @item sms-max-ii-factor
16345 A factor for tuning the upper bound that swing modulo scheduler
16346 uses for scheduling a loop.
16348 @item lra-max-considered-reload-pseudos
16349 The max number of reload pseudos which are considered during
16350 spilling a non-reload pseudo.
16352 @item max-pow-sqrt-depth
16353 Maximum depth of sqrt chains to use when synthesizing exponentiation
16354 by a real constant.
16356 @item max-dse-active-local-stores
16357 Maximum number of active local stores in RTL dead store elimination.
16359 @item asan-instrument-allocas
16360 Enable asan allocas/VLAs protection.
16362 @item max-iterations-computation-cost
16363 Bound on the cost of an expression to compute the number of iterations.
16365 @item max-isl-operations
16366 Maximum number of isl operations, 0 means unlimited.
16368 @item graphite-max-arrays-per-scop
16369 Maximum number of arrays per scop.
16371 @item max-vartrack-reverse-op-size
16372 Max. size of loc list for which reverse ops should be added.
16374 @item fsm-scale-path-stmts
16375 Scale factor to apply to the number of statements in a threading path
16376 crossing a loop backedge when comparing to
16377 @option{--param=max-jump-thread-duplication-stmts}.
16379 @item uninit-control-dep-attempts
16380 Maximum number of nested calls to search for control dependencies
16381 during uninitialized variable analysis.
16383 @item uninit-max-chain-len
16384 Maximum number of predicates anded for each predicate ored in the normalized
16385 predicate chain.
16387 @item uninit-max-num-chains
16388 Maximum number of predicates ored in the normalized predicate chain.
16390 @item sched-autopref-queue-depth
16391 Hardware autoprefetcher scheduler model control flag.
16392 Number of lookahead cycles the model looks into; at '
16393 ' only enable instruction sorting heuristic.
16395 @item loop-versioning-max-inner-insns
16396 The maximum number of instructions that an inner loop can have
16397 before the loop versioning pass considers it too big to copy.
16399 @item loop-versioning-max-outer-insns
16400 The maximum number of instructions that an outer loop can have
16401 before the loop versioning pass considers it too big to copy,
16402 discounting any instructions in inner loops that directly benefit
16403 from versioning.
16405 @item ssa-name-def-chain-limit
16406 The maximum number of SSA_NAME assignments to follow in determining
16407 a property of a variable such as its value.  This limits the number
16408 of iterations or recursive calls GCC performs when optimizing certain
16409 statements or when determining their validity prior to issuing
16410 diagnostics.
16412 @item store-merging-max-size
16413 Maximum size of a single store merging region in bytes.
16415 @item hash-table-verification-limit
16416 The number of elements for which hash table verification is done
16417 for each searched element.
16419 @item max-find-base-term-values
16420 Maximum number of VALUEs handled during a single find_base_term call.
16422 @item analyzer-max-enodes-per-program-point
16423 The maximum number of exploded nodes per program point within
16424 the analyzer, before terminating analysis of that point.
16426 @item analyzer-max-constraints
16427 The maximum number of constraints per state.
16429 @item analyzer-min-snodes-for-call-summary
16430 The minimum number of supernodes within a function for the
16431 analyzer to consider summarizing its effects at call sites.
16433 @item analyzer-max-enodes-for-full-dump
16434 The maximum depth of exploded nodes that should appear in a dot dump
16435 before switching to a less verbose format.
16437 @item analyzer-max-recursion-depth
16438 The maximum number of times a callsite can appear in a call stack
16439 within the analyzer, before terminating analysis of a call that would
16440 recurse deeper.
16442 @item analyzer-max-svalue-depth
16443 The maximum depth of a symbolic value, before approximating
16444 the value as unknown.
16446 @item analyzer-max-infeasible-edges
16447 The maximum number of infeasible edges to reject before declaring
16448 a diagnostic as infeasible.
16450 @item gimple-fe-computed-hot-bb-threshold
16451 The number of executions of a basic block which is considered hot.
16452 The parameter is used only in GIMPLE FE.
16454 @item analyzer-bb-explosion-factor
16455 The maximum number of 'after supernode' exploded nodes within the analyzer
16456 per supernode, before terminating analysis.
16458 @item analyzer-text-art-string-ellipsis-threshold
16459 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16461 @item analyzer-text-art-ideal-canvas-width
16462 The ideal width in characters of text art diagrams generated by the analyzer.
16464 @item analyzer-text-art-string-ellipsis-head-len
16465 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16467 @item analyzer-text-art-string-ellipsis-tail-len
16468 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16470 @item ranger-logical-depth
16471 Maximum depth of logical expression evaluation ranger will look through
16472 when evaluating outgoing edge ranges.
16474 @item ranger-recompute-depth
16475 Maximum depth of instruction chains to consider for recomputation
16476 in the outgoing range calculator.
16478 @item relation-block-limit
16479 Maximum number of relations the oracle will register in a basic block.
16481 @item min-pagesize
16482 Minimum page size for warning purposes.
16484 @item openacc-kernels
16485 Specify mode of OpenACC `kernels' constructs handling.
16486 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16487 constructs are decomposed into parts, a sequence of compute
16488 constructs, each then handled individually.
16489 This is work in progress.
16490 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16491 constructs are handled by the @samp{parloops} pass, en bloc.
16492 This is the current default.
16494 @item openacc-privatization
16495 Control whether the @option{-fopt-info-omp-note} and applicable
16496 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16497 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16498 This is the current default.
16499 With @option{--param=openacc-privatization=noisy}, do diagnose.
16501 @end table
16503 The following choices of @var{name} are available on AArch64 targets:
16505 @table @gcctabopt
16506 @item aarch64-sve-compare-costs
16507 When vectorizing for SVE, consider using ``unpacked'' vectors for
16508 smaller elements and use the cost model to pick the cheapest approach.
16509 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16511 Using unpacked vectors includes storing smaller elements in larger
16512 containers and accessing elements with extending loads and truncating
16513 stores.
16515 @item aarch64-float-recp-precision
16516 The number of Newton iterations for calculating the reciprocal for float type.
16517 The precision of division is proportional to this param when division
16518 approximation is enabled.  The default value is 1.
16520 @item aarch64-double-recp-precision
16521 The number of Newton iterations for calculating the reciprocal for double type.
16522 The precision of division is propotional to this param when division
16523 approximation is enabled.  The default value is 2.
16525 @item aarch64-autovec-preference
16526 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16527 0 to 4, inclusive.
16528 @table @samp
16529 @item 0
16530 Use the default heuristics.
16531 @item 1
16532 Use only Advanced SIMD for auto-vectorization.
16533 @item 2
16534 Use only SVE for auto-vectorization.
16535 @item 3
16536 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16537 deemed equal.
16538 @item 4
16539 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16540 @end table
16541 The default value is 0.
16543 @item aarch64-ldp-policy
16544 Fine-grained policy for load pairs.
16545 With @option{--param=aarch64-ldp-policy=default}, use the policy of the
16546 tuning structure.  This is the current default.
16547 With @option{--param=aarch64-ldp-policy=always}, emit ldp regardless
16548 of alignment.
16549 With @option{--param=aarch64-ldp-policy=never}, do not emit ldp.
16550 With @option{--param=aarch64-ldp-policy=aligned}, emit ldp only if the
16551 source pointer is aligned to at least double the alignment of the type.
16553 @item aarch64-stp-policy
16554 Fine-grained policy for store pairs.
16555 With @option{--param=aarch64-stp-policy=default}, use the policy of the
16556 tuning structure.  This is the current default.
16557 With @option{--param=aarch64-stp-policy=always}, emit stp regardless
16558 of alignment.
16559 With @option{--param=aarch64-stp-policy=never}, do not emit stp.
16560 With @option{--param=aarch64-stp-policy=aligned}, emit stp only if the
16561 source pointer is aligned to at least double the alignment of the type.
16563 @item aarch64-loop-vect-issue-rate-niters
16564 The tuning for some AArch64 CPUs tries to take both latencies and issue
16565 rates into account when deciding whether a loop should be vectorized
16566 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16567 If this parameter is set to @var{n}, GCC will not use this heuristic
16568 for loops that are known to execute in fewer than @var{n} Advanced
16569 SIMD iterations.
16571 @item aarch64-vect-unroll-limit
16572 The vectorizer will use available tuning information to determine whether it
16573 would be beneficial to unroll the main vectorized loop and by how much.  This
16574 parameter set's the upper bound of how much the vectorizer will unroll the main
16575 loop.  The default value is four.
16577 @end table
16579 The following choices of @var{name} are available on i386 and x86_64 targets:
16581 @table @gcctabopt
16582 @item x86-stlf-window-ninsns
16583 Instructions number above which STFL stall penalty can be compensated.
16585 @item x86-stv-max-visits
16586 The maximum number of use and def visits when discovering a STV chain before
16587 the discovery is aborted.
16589 @end table
16591 @end table
16593 @node Instrumentation Options
16594 @section Program Instrumentation Options
16595 @cindex instrumentation options
16596 @cindex program instrumentation options
16597 @cindex run-time error checking options
16598 @cindex profiling options
16599 @cindex options, program instrumentation
16600 @cindex options, run-time error checking
16601 @cindex options, profiling
16603 GCC supports a number of command-line options that control adding
16604 run-time instrumentation to the code it normally generates.  
16605 For example, one purpose of instrumentation is collect profiling
16606 statistics for use in finding program hot spots, code coverage
16607 analysis, or profile-guided optimizations.
16608 Another class of program instrumentation is adding run-time checking 
16609 to detect programming errors like invalid pointer
16610 dereferences or out-of-bounds array accesses, as well as deliberately
16611 hostile attacks such as stack smashing or C++ vtable hijacking.
16612 There is also a general hook which can be used to implement other
16613 forms of tracing or function-level instrumentation for debug or
16614 program analysis purposes.
16616 @table @gcctabopt
16617 @cindex @command{prof}
16618 @cindex @command{gprof}
16619 @opindex p
16620 @opindex pg
16621 @item -p
16622 @itemx -pg
16623 Generate extra code to write profile information suitable for the
16624 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16625 (for @option{-pg}).  You must use this option when compiling
16626 the source files you want data about, and you must also use it when
16627 linking.
16629 You can use the function attribute @code{no_instrument_function} to
16630 suppress profiling of individual functions when compiling with these options.
16631 @xref{Common Function Attributes}.
16633 @opindex fprofile-arcs
16634 @item -fprofile-arcs
16635 Add code so that program flow @dfn{arcs} are instrumented.  During
16636 execution the program records how many times each branch and call is
16637 executed and how many times it is taken or returns.  On targets that support
16638 constructors with priority support, profiling properly handles constructors,
16639 destructors and C++ constructors (and destructors) of classes which are used
16640 as a type of a global variable.
16642 When the compiled
16643 program exits it saves this data to a file called
16644 @file{@var{auxname}.gcda} for each source file.  The data may be used for
16645 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16646 test coverage analysis (@option{-ftest-coverage}).  Each object file's
16647 @var{auxname} is generated from the name of the output file, if
16648 explicitly specified and it is not the final executable, otherwise it is
16649 the basename of the source file.  In both cases any suffix is removed
16650 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16651 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16653 Note that if a command line directly links source files, the corresponding
16654 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16655 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16656 @file{binary-b.gcda} files.
16658 @xref{Cross-profiling}.
16660 @cindex @command{gcov}
16661 @opindex coverage
16662 @item --coverage
16664 This option is used to compile and link code instrumented for coverage
16665 analysis.  The option is a synonym for @option{-fprofile-arcs}
16666 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16667 linking).  See the documentation for those options for more details.
16669 @itemize
16671 @item
16672 Compile the source files with @option{-fprofile-arcs} plus optimization
16673 and code generation options.  For test coverage analysis, use the
16674 additional @option{-ftest-coverage} option.  You do not need to profile
16675 every source file in a program.
16677 @item
16678 Compile the source files additionally with @option{-fprofile-abs-path}
16679 to create absolute path names in the @file{.gcno} files.  This allows
16680 @command{gcov} to find the correct sources in projects where compilations
16681 occur with different working directories.
16683 @item
16684 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16685 (the latter implies the former).
16687 @item
16688 Run the program on a representative workload to generate the arc profile
16689 information.  This may be repeated any number of times.  You can run
16690 concurrent instances of your program, and provided that the file system
16691 supports locking, the data files will be correctly updated.  Unless
16692 a strict ISO C dialect option is in effect, @code{fork} calls are
16693 detected and correctly handled without double counting.
16695 Moreover, an object file can be recompiled multiple times
16696 and the corresponding @file{.gcda} file merges as long as
16697 the source file and the compiler options are unchanged.
16699 @item
16700 For profile-directed optimizations, compile the source files again with
16701 the same optimization and code generation options plus
16702 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16703 Control Optimization}).
16705 @item
16706 For test coverage analysis, use @command{gcov} to produce human readable
16707 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
16708 @command{gcov} documentation for further information.
16710 @end itemize
16712 With @option{-fprofile-arcs}, for each function of your program GCC
16713 creates a program flow graph, then finds a spanning tree for the graph.
16714 Only arcs that are not on the spanning tree have to be instrumented: the
16715 compiler adds code to count the number of times that these arcs are
16716 executed.  When an arc is the only exit or only entrance to a block, the
16717 instrumentation code can be added to the block; otherwise, a new basic
16718 block must be created to hold the instrumentation code.
16720 @need 2000
16721 @opindex ftest-coverage
16722 @item -ftest-coverage
16723 Produce a notes file that the @command{gcov} code-coverage utility
16724 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16725 show program coverage.  Each source file's note file is called
16726 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
16727 above for a description of @var{auxname} and instructions on how to
16728 generate test coverage data.  Coverage data matches the source files
16729 more closely if you do not optimize.
16731 @opindex fprofile-abs-path
16732 @item -fprofile-abs-path
16733 Automatically convert relative source file names to absolute path names
16734 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
16735 sources in projects where compilations occur with different working
16736 directories.
16738 @opindex fprofile-dir
16739 @item -fprofile-dir=@var{path}
16741 Set the directory to search for the profile data files in to @var{path}.
16742 This option affects only the profile data generated by
16743 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16744 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16745 and its related options.  Both absolute and relative paths can be used.
16746 By default, GCC uses the current directory as @var{path}, thus the
16747 profile data file appears in the same directory as the object file.
16748 In order to prevent the file name clashing, if the object file name is
16749 not an absolute path, we mangle the absolute path of the
16750 @file{@var{sourcename}.gcda} file and use it as the file name of a
16751 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
16752 See similar option @option{-fprofile-note}.
16754 When an executable is run in a massive parallel environment, it is recommended
16755 to save profile to different folders.  That can be done with variables
16756 in @var{path} that are exported during run-time:
16758 @table @gcctabopt
16760 @item %p
16761 process ID.
16763 @item %q@{VAR@}
16764 value of environment variable @var{VAR}
16766 @end table
16768 @opindex fprofile-generate
16769 @item -fprofile-generate
16770 @itemx -fprofile-generate=@var{path}
16772 Enable options usually used for instrumenting application to produce
16773 profile useful for later recompilation with profile feedback based
16774 optimization.  You must use @option{-fprofile-generate} both when
16775 compiling and when linking your program.
16777 The following options are enabled:
16778 @option{-fprofile-arcs}, @option{-fprofile-values},
16779 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16781 If @var{path} is specified, GCC looks at the @var{path} to find
16782 the profile feedback data files. See @option{-fprofile-dir}.
16784 To optimize the program based on the collected profile information, use
16785 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16787 @opindex fprofile-info-section
16788 @item -fprofile-info-section
16789 @itemx -fprofile-info-section=@var{name}
16791 Register the profile information in the specified section instead of using a
16792 constructor/destructor.  The section name is @var{name} if it is specified,
16793 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16794 profile information generated by @option{-fprofile-arcs} is placed in the
16795 specified section for each translation unit.  This option disables the profile
16796 information registration through a constructor and it disables the profile
16797 information processing through a destructor.  This option is not intended to be
16798 used in hosted environments such as GNU/Linux.  It targets freestanding
16799 environments (for example embedded systems) with limited resources which do not
16800 support constructors/destructors or the C library file I/O.
16802 The linker could collect the input sections in a continuous memory block and
16803 define start and end symbols.  A GNU linker script example which defines a
16804 linker output section follows:
16806 @smallexample
16807   .gcov_info      :
16808   @{
16809     PROVIDE (__gcov_info_start = .);
16810     KEEP (*(.gcov_info))
16811     PROVIDE (__gcov_info_end = .);
16812   @}
16813 @end smallexample
16815 The program could dump the profiling information registered in this linker set
16816 for example like this:
16818 @smallexample
16819 #include <gcov.h>
16820 #include <stdio.h>
16821 #include <stdlib.h>
16823 extern const struct gcov_info *const __gcov_info_start[];
16824 extern const struct gcov_info *const __gcov_info_end[];
16826 static void
16827 dump (const void *d, unsigned n, void *arg)
16829   const unsigned char *c = d;
16831   for (unsigned i = 0; i < n; ++i)
16832     printf ("%02x", c[i]);
16835 static void
16836 filename (const char *f, void *arg)
16838   __gcov_filename_to_gcfn (f, dump, arg );
16841 static void *
16842 allocate (unsigned length, void *arg)
16844   return malloc (length);
16847 static void
16848 dump_gcov_info (void)
16850   const struct gcov_info *const *info = __gcov_info_start;
16851   const struct gcov_info *const *end = __gcov_info_end;
16853   /* Obfuscate variable to prevent compiler optimizations.  */
16854   __asm__ ("" : "+r" (info));
16856   while (info != end)
16857   @{
16858     void *arg = NULL;
16859     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16860     putchar ('\n');
16861     ++info;
16862   @}
16866 main (void)
16868   dump_gcov_info ();
16869   return 0;
16871 @end smallexample
16873 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16874 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16875 @code{__gcov_info_to_gcda} functions and merge the profile information into
16876 @file{.gcda} files on the host filesystem.
16878 @opindex fprofile-note
16879 @item -fprofile-note=@var{path}
16881 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16882 location.  If you combine the option with multiple source files,
16883 the @file{.gcno} file will be overwritten.
16885 @opindex fprofile-prefix-path
16886 @item -fprofile-prefix-path=@var{path}
16888 This option can be used in combination with
16889 @option{profile-generate=}@var{profile_dir} and
16890 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16891 directory of built source tree.  By default @var{profile_dir} will contain
16892 files with mangled absolute paths of all object files in the built project.
16893 This is not desirable when directory used to build the instrumented binary
16894 differs from the directory used to build the binary optimized with profile
16895 feedback because the profile data will not be found during the optimized build.
16896 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16897 pointing to the base directory of the build can be used to strip the irrelevant
16898 part of the path and keep all file names relative to the main build directory.
16900 @opindex fprofile-prefix-map
16901 @item -fprofile-prefix-map=@var{old}=@var{new}
16902 When compiling files residing in directory @file{@var{old}}, record
16903 profiling information (with @option{--coverage})
16904 describing them as if the files resided in
16905 directory @file{@var{new}} instead.
16906 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
16908 @opindex fprofile-update
16909 @item -fprofile-update=@var{method}
16911 Alter the update method for an application instrumented for profile
16912 feedback based optimization.  The @var{method} argument should be one of
16913 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16914 The first one is useful for single-threaded applications,
16915 while the second one prevents profile corruption by emitting thread-safe code.
16917 @strong{Warning:} When an application does not properly join all threads
16918 (or creates an detached thread), a profile file can be still corrupted.
16920 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16921 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16922 automatically selects @samp{prefer-atomic} when @option{-pthread}
16923 is present in the command line.
16925 @opindex fprofile-filter-files
16926 @item -fprofile-filter-files=@var{regex}
16928 Instrument only functions from files whose name matches
16929 any of the regular expressions (separated by semi-colons).
16931 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16932 only @file{main.c} and all C files starting with 'module'.
16934 @opindex fprofile-exclude-files
16935 @item -fprofile-exclude-files=@var{regex}
16937 Instrument only functions from files whose name does not match
16938 any of the regular expressions (separated by semi-colons).
16940 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16941 of all files that are located in the @file{/usr/} folder.
16943 @opindex fprofile-reproducible
16944 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16945 Control level of reproducibility of profile gathered by
16946 @code{-fprofile-generate}.  This makes it possible to rebuild program
16947 with same outcome which is useful, for example, for distribution
16948 packages.
16950 With @option{-fprofile-reproducible=serial} the profile gathered by
16951 @option{-fprofile-generate} is reproducible provided the trained program
16952 behaves the same at each invocation of the train run, it is not
16953 multi-threaded and profile data streaming is always done in the same
16954 order.  Note that profile streaming happens at the end of program run but
16955 also before @code{fork} function is invoked.
16957 Note that it is quite common that execution counts of some part of
16958 programs depends, for example, on length of temporary file names or
16959 memory space randomization (that may affect hash-table collision rate).
16960 Such non-reproducible part of programs may be annotated by
16961 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16962 @option{-l} can be used to dump gathered data and verify that they are
16963 indeed reproducible.
16965 With @option{-fprofile-reproducible=parallel-runs} collected profile
16966 stays reproducible regardless the order of streaming of the data into
16967 gcda files.  This setting makes it possible to run multiple instances of
16968 instrumented program in parallel (such as with @code{make -j}). This
16969 reduces quality of gathered data, in particular of indirect call
16970 profiling.
16972 @opindex fsanitize=address
16973 @item -fsanitize=address
16974 Enable AddressSanitizer, a fast memory error detector.
16975 Memory access instructions are instrumented to detect
16976 out-of-bounds and use-after-free bugs.
16977 The option enables @option{-fsanitize-address-use-after-scope}.
16978 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16979 more details.  The run-time behavior can be influenced using the
16980 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
16981 the available options are shown at startup of the instrumented program.  See
16982 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16983 for a list of supported options.
16984 The option cannot be combined with @option{-fsanitize=thread} or
16985 @option{-fsanitize=hwaddress}.  Note that the only target
16986 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16988 To get more accurate stack traces, it is possible to use options such as
16989 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16990 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16991 optimizing sibling and tail recursive calls; this option is implicit for
16992 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16993 disables Identical Code Folding for functions).  Since multiple runs of the
16994 program may yield backtraces with different addresses due to ASLR (Address
16995 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
16996 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16998 @opindex fsanitize=kernel-address
16999 @item -fsanitize=kernel-address
17000 Enable AddressSanitizer for Linux kernel.
17001 See @uref{https://github.com/google/kernel-sanitizers} for more details.
17003 @opindex fsanitize=hwaddress
17004 @item -fsanitize=hwaddress
17005 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
17006 ignore the top byte of a pointer to allow the detection of memory errors with
17007 a low memory overhead.
17008 Memory access instructions are instrumented to detect out-of-bounds and
17009 use-after-free bugs.
17010 The option enables @option{-fsanitize-address-use-after-scope}.
17012 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
17013 for more details.  The run-time behavior can be influenced using the
17014 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
17015 the available options are shown at startup of the instrumented program.
17016 The option cannot be combined with @option{-fsanitize=thread} or
17017 @option{-fsanitize=address}, and is currently only available on AArch64.
17019 @opindex fsanitize=kernel-hwaddress
17020 @item -fsanitize=kernel-hwaddress
17021 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
17022 Similar to @option{-fsanitize=kernel-address} but using an alternate
17023 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
17024 instrumentation differences necessary for compiling the Linux kernel.
17025 These differences are to avoid hwasan library initialization calls and to
17026 account for the stack pointer having a different value in its top byte.
17028 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
17029 Instrumenting the stack and alloca calls are not on by default but are still
17030 possible by specifying the command-line options
17031 @option{--param hwasan-instrument-stack=1} and
17032 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
17033 tag is not implemented for kernel instrumentation.
17035 @opindex fsanitize=pointer-compare
17036 @item -fsanitize=pointer-compare
17037 Instrument comparison operation (<, <=, >, >=) with pointer operands.
17038 The option must be combined with either @option{-fsanitize=kernel-address} or
17039 @option{-fsanitize=address}
17040 The option cannot be combined with @option{-fsanitize=thread}.
17041 Note: By default the check is disabled at run time.  To enable it,
17042 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17043 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17044 invalid operation only when both pointers are non-null.
17046 @opindex fsanitize=pointer-subtract
17047 @item -fsanitize=pointer-subtract
17048 Instrument subtraction with pointer operands.
17049 The option must be combined with either @option{-fsanitize=kernel-address} or
17050 @option{-fsanitize=address}
17051 The option cannot be combined with @option{-fsanitize=thread}.
17052 Note: By default the check is disabled at run time.  To enable it,
17053 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17054 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17055 invalid operation only when both pointers are non-null.
17057 @opindex fsanitize=shadow-call-stack
17058 @item -fsanitize=shadow-call-stack
17059 Enable ShadowCallStack, a security enhancement mechanism used to protect
17060 programs against return address overwrites (e.g. stack buffer overflows.)
17061 It works by saving a function's return address to a separately allocated
17062 shadow call stack in the function prologue and restoring the return address
17063 from the shadow call stack in the function epilogue.  Instrumentation only
17064 occurs in functions that need to save the return address to the stack.
17066 Currently it only supports the aarch64 platform.  It is specifically
17067 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17068 For the user space programs, runtime support is not currently provided
17069 in libc and libgcc.  Users who want to use this feature in user space need
17070 to provide their own support for the runtime.  It should be noted that
17071 this may cause the ABI rules to be broken.
17073 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17074 This generally means that any code that may run on the same thread as code
17075 compiled with ShadowCallStack must be compiled with the flag
17076 @option{-ffixed-x18}, otherwise functions compiled without
17077 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17078 stack pointer.
17080 Also, because there is no userspace runtime support, code compiled with
17081 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17082 to turn off exceptions.
17084 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17085 details.
17087 @opindex fsanitize=thread
17088 @item -fsanitize=thread
17089 Enable ThreadSanitizer, a fast data race detector.
17090 Memory access instructions are instrumented to detect
17091 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17092 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17093 environment variable; see
17094 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17095 supported options.
17096 The option cannot be combined with @option{-fsanitize=address},
17097 @option{-fsanitize=leak}.
17099 Note that sanitized atomic builtins cannot throw exceptions when
17100 operating on invalid memory addresses with non-call exceptions
17101 (@option{-fnon-call-exceptions}).
17103 @opindex fsanitize=leak
17104 @item -fsanitize=leak
17105 Enable LeakSanitizer, a memory leak detector.
17106 This option only matters for linking of executables.
17107 The executable is linked against a library that overrides @code{malloc}
17108 and other allocator functions.  See
17109 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17110 details.  The run-time behavior can be influenced using the
17111 @env{LSAN_OPTIONS} environment variable.
17112 The option cannot be combined with @option{-fsanitize=thread}.
17114 @opindex fsanitize=undefined
17115 @item -fsanitize=undefined
17116 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17117 Various computations are instrumented to detect undefined behavior
17118 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17119 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17121 @table @gcctabopt
17123 @opindex fsanitize=shift
17124 @item -fsanitize=shift
17125 This option enables checking that the result of a shift operation is
17126 not undefined.  Note that what exactly is considered undefined differs
17127 slightly between C and C++, as well as between ISO C90 and C99, etc.
17128 This option has two suboptions, @option{-fsanitize=shift-base} and
17129 @option{-fsanitize=shift-exponent}.
17131 @opindex fsanitize=shift-exponent
17132 @item -fsanitize=shift-exponent
17133 This option enables checking that the second argument of a shift operation
17134 is not negative and is smaller than the precision of the promoted first
17135 argument.
17137 @opindex fsanitize=shift-base
17138 @item -fsanitize=shift-base
17139 If the second argument of a shift operation is within range, check that the
17140 result of a shift operation is not undefined.  Note that what exactly is
17141 considered undefined differs slightly between C and C++, as well as between
17142 ISO C90 and C99, etc.
17144 @opindex fsanitize=integer-divide-by-zero
17145 @item -fsanitize=integer-divide-by-zero
17146 Detect integer division by zero.
17148 @opindex fsanitize=unreachable
17149 @item -fsanitize=unreachable
17150 With this option, the compiler turns the @code{__builtin_unreachable}
17151 call into a diagnostics message call instead.  When reaching the
17152 @code{__builtin_unreachable} call, the behavior is undefined.
17154 @opindex fsanitize=vla-bound
17155 @item -fsanitize=vla-bound
17156 This option instructs the compiler to check that the size of a variable
17157 length array is positive.
17159 @opindex fsanitize=null
17160 @item -fsanitize=null
17161 This option enables pointer checking.  Particularly, the application
17162 built with this option turned on will issue an error message when it
17163 tries to dereference a NULL pointer, or if a reference (possibly an
17164 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17165 on an object pointed by a NULL pointer.
17167 @opindex fsanitize=return
17168 @item -fsanitize=return
17169 This option enables return statement checking.  Programs
17170 built with this option turned on will issue an error message
17171 when the end of a non-void function is reached without actually
17172 returning a value.  This option works in C++ only.
17174 @opindex fsanitize=signed-integer-overflow
17175 @item -fsanitize=signed-integer-overflow
17176 This option enables signed integer overflow checking.  We check that
17177 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17178 does not overflow in the signed arithmetics.  This also detects
17179 @code{INT_MIN / -1} signed division.  Note, integer promotion
17180 rules must be taken into account.  That is, the following is not an
17181 overflow:
17182 @smallexample
17183 signed char a = SCHAR_MAX;
17184 a++;
17185 @end smallexample
17187 @opindex fsanitize=bounds
17188 @item -fsanitize=bounds
17189 This option enables instrumentation of array bounds.  Various out of bounds
17190 accesses are detected.  Flexible array members, flexible array member-like
17191 arrays, and initializers of variables with static storage are not
17192 instrumented, with the exception of flexible array member-like arrays
17193 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17194 options or @code{strict_flex_array} attributes say they shouldn't be treated
17195 like flexible array member-like arrays.
17197 @opindex fsanitize=bounds-strict
17198 @item -fsanitize=bounds-strict
17199 This option enables strict instrumentation of array bounds.  Most out of bounds
17200 accesses are detected, including flexible array member-like arrays.
17201 Initializers of variables with static storage are not instrumented.
17203 @opindex fsanitize=alignment
17204 @item -fsanitize=alignment
17206 This option enables checking of alignment of pointers when they are
17207 dereferenced, or when a reference is bound to insufficiently aligned target,
17208 or when a method or constructor is invoked on insufficiently aligned object.
17210 @opindex fsanitize=object-size
17211 @item -fsanitize=object-size
17212 This option enables instrumentation of memory references using the
17213 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17214 pointer accesses are detected.
17216 @opindex fsanitize=float-divide-by-zero
17217 @item -fsanitize=float-divide-by-zero
17218 Detect floating-point division by zero.  Unlike other similar options,
17219 @option{-fsanitize=float-divide-by-zero} is not enabled by
17220 @option{-fsanitize=undefined}, since floating-point division by zero can
17221 be a legitimate way of obtaining infinities and NaNs.
17223 @opindex fsanitize=float-cast-overflow
17224 @item -fsanitize=float-cast-overflow
17225 This option enables floating-point type to integer conversion checking.
17226 We check that the result of the conversion does not overflow.
17227 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17228 not enabled by @option{-fsanitize=undefined}.
17229 This option does not work well with @code{FE_INVALID} exceptions enabled.
17231 @opindex fsanitize=nonnull-attribute
17232 @item -fsanitize=nonnull-attribute
17234 This option enables instrumentation of calls, checking whether null values
17235 are not passed to arguments marked as requiring a non-null value by the
17236 @code{nonnull} function attribute.
17238 @opindex fsanitize=returns-nonnull-attribute
17239 @item -fsanitize=returns-nonnull-attribute
17241 This option enables instrumentation of return statements in functions
17242 marked with @code{returns_nonnull} function attribute, to detect returning
17243 of null values from such functions.
17245 @opindex fsanitize=bool
17246 @item -fsanitize=bool
17248 This option enables instrumentation of loads from bool.  If a value other
17249 than 0/1 is loaded, a run-time error is issued.
17251 @opindex fsanitize=enum
17252 @item -fsanitize=enum
17254 This option enables instrumentation of loads from an enum type.  If
17255 a value outside the range of values for the enum type is loaded,
17256 a run-time error is issued.
17258 @opindex fsanitize=vptr
17259 @item -fsanitize=vptr
17261 This option enables instrumentation of C++ member function calls, member
17262 accesses and some conversions between pointers to base and derived classes,
17263 to verify the referenced object has the correct dynamic type.
17265 @opindex fsanitize=pointer-overflow
17266 @item -fsanitize=pointer-overflow
17268 This option enables instrumentation of pointer arithmetics.  If the pointer
17269 arithmetics overflows, a run-time error is issued.
17271 @opindex fsanitize=builtin
17272 @item -fsanitize=builtin
17274 This option enables instrumentation of arguments to selected builtin
17275 functions.  If an invalid value is passed to such arguments, a run-time
17276 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17277 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17278 by this option.
17280 @end table
17282 Note that sanitizers tend to increase the rate of false positive
17283 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17284 We recommend against combining @option{-Werror} and [the use of]
17285 sanitizers.
17287 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17288 @option{-fsanitize=undefined} gives a diagnostic message.
17289 This currently works only for the C family of languages.
17291 @opindex fno-sanitize=all
17292 @item -fno-sanitize=all
17294 This option disables all previously enabled sanitizers.
17295 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17296 together.
17298 @opindex fasan-shadow-offset
17299 @item -fasan-shadow-offset=@var{number}
17300 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17301 It is useful for experimenting with different shadow memory layouts in
17302 Kernel AddressSanitizer.
17304 @opindex fsanitize-sections
17305 @item -fsanitize-sections=@var{s1},@var{s2},...
17306 Sanitize global variables in selected user-defined sections.  @var{si} may
17307 contain wildcards.
17309 @opindex fsanitize-recover
17310 @opindex fno-sanitize-recover
17311 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17312 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17313 mentioned in comma-separated list of @var{opts}.  Enabling this option
17314 for a sanitizer component causes it to attempt to continue
17315 running the program as if no error happened.  This means multiple
17316 runtime errors can be reported in a single program run, and the exit
17317 code of the program may indicate success even when errors
17318 have been reported.  The @option{-fno-sanitize-recover=} option
17319 can be used to alter
17320 this behavior: only the first detected error is reported
17321 and program then exits with a non-zero exit code.
17323 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17324 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17325 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17326 @option{-fsanitize=bounds-strict},
17327 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17328 For these sanitizers error recovery is turned on by default,
17329 except @option{-fsanitize=address}, for which this feature is experimental.
17330 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17331 accepted, the former enables recovery for all sanitizers that support it,
17332 the latter disables recovery for all sanitizers that support it.
17334 Even if a recovery mode is turned on the compiler side, it needs to be also
17335 enabled on the runtime library side, otherwise the failures are still fatal.
17336 The runtime library defaults to @code{halt_on_error=0} for
17337 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17338 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17339 setting the @code{halt_on_error} flag in the corresponding environment variable.
17341 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17342 equivalent to specifying an @var{opts} list of:
17344 @smallexample
17345 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17346 @end smallexample
17348 @opindex fsanitize-address-use-after-scope
17349 @item -fsanitize-address-use-after-scope
17350 Enable sanitization of local variables to detect use-after-scope bugs.
17351 The option sets @option{-fstack-reuse} to @samp{none}.
17353 @opindex fsanitize-trap
17354 @opindex fno-sanitize-trap
17355 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17356 The @option{-fsanitize-trap=} option instructs the compiler to
17357 report for sanitizers mentioned in comma-separated list of @var{opts}
17358 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17359 library routine.  If this option is enabled for certain sanitizer,
17360 it takes precedence over the @option{-fsanitizer-recover=} for that
17361 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17362 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17364 The advantage of this is that the @code{libubsan} library is not needed
17365 and is not linked in, so this is usable even in freestanding environments.
17367 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17368 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17369 @option{-fsanitize=float-divide-by-zero} and
17370 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17371 specified, which enables it for @code{undefined} suboptions,
17372 @option{-fsanitize=float-cast-overflow},
17373 @option{-fsanitize=float-divide-by-zero} and
17374 @option{-fsanitize=bounds-strict}.
17375 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17376 and @code{-fsanitize=vptr} is enabled on the command line, the
17377 instrumentation is silently ignored as the instrumentation always needs
17378 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17380 @opindex fsanitize-undefined-trap-on-error
17381 @item -fsanitize-undefined-trap-on-error
17382 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17383 equivalent of @option{-fsanitize-trap=all}.
17385 @opindex fsanitize-coverage=trace-pc
17386 @item -fsanitize-coverage=trace-pc
17387 Enable coverage-guided fuzzing code instrumentation.
17388 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17390 @opindex fsanitize-coverage=trace-cmp
17391 @item -fsanitize-coverage=trace-cmp
17392 Enable dataflow guided fuzzing code instrumentation.
17393 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17394 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17395 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17396 variable or @code{__sanitizer_cov_trace_const_cmp1},
17397 @code{__sanitizer_cov_trace_const_cmp2},
17398 @code{__sanitizer_cov_trace_const_cmp4} or
17399 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17400 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17401 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17402 @code{__sanitizer_cov_trace_switch} for switch statements.
17404 @opindex fcf-protection
17405 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17406 Enable code instrumentation of control-flow transfers to increase
17407 program security by checking that target addresses of control-flow
17408 transfer instructions (such as indirect function call, function return,
17409 indirect jump) are valid.  This prevents diverting the flow of control
17410 to an unexpected target.  This is intended to protect against such
17411 threats as Return-oriented Programming (ROP), and similarly
17412 call/jmp-oriented programming (COP/JOP).
17414 The value @code{branch} tells the compiler to implement checking of
17415 validity of control-flow transfer at the point of indirect branch
17416 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17417 implements checking of validity at the point of returning from a
17418 function.  The value @code{full} is an alias for specifying both
17419 @code{branch} and @code{return}. The value @code{none} turns off
17420 instrumentation.
17422 The value @code{check} is used for the final link with link-time
17423 optimization (LTO).  An error is issued if LTO object files are
17424 compiled with different @option{-fcf-protection} values.  The
17425 value @code{check} is ignored at the compile time.
17427 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17428 used.  The first bit of @code{__CET__} is set to 1 for the value
17429 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17430 the @code{return}.
17432 You can also use the @code{nocf_check} attribute to identify
17433 which functions and calls should be skipped from instrumentation
17434 (@pxref{Function Attributes}).
17436 Currently the x86 GNU/Linux target provides an implementation based
17437 on Intel Control-flow Enforcement Technology (CET) which works for
17438 i686 processor or newer.
17440 @opindex fharden-compares
17441 @item -fharden-compares
17442 For every logical test that survives gimple optimizations and is
17443 @emph{not} the condition in a conditional branch (for example,
17444 conditions tested for conditional moves, or to store in boolean
17445 variables), emit extra code to compute and verify the reversed
17446 condition, and to call @code{__builtin_trap} if the results do not
17447 match.  Use with @samp{-fharden-conditional-branches} to cover all
17448 conditionals.
17450 @opindex fharden-conditional-branches
17451 @item -fharden-conditional-branches
17452 For every non-vectorized conditional branch that survives gimple
17453 optimizations, emit extra code to compute and verify the reversed
17454 condition, and to call @code{__builtin_trap} if the result is
17455 unexpected.  Use with @samp{-fharden-compares} to cover all
17456 conditionals.
17458 @opindex fharden-control-flow-redundancy
17459 @item -fharden-control-flow-redundancy
17460 Emit extra code to set booleans when entering basic blocks, and to
17461 verify and trap, at function exits, when the booleans do not form an
17462 execution path that is compatible with the control flow graph.
17464 Verification takes place before returns, before mandatory tail calls
17465 (see below) and, optionally, before escaping exceptions with
17466 @option{-fhardcfr-check-exceptions}, before returning calls with
17467 @option{-fhardcfr-check-returning-calls}, and before noreturn calls with
17468 @option{-fhardcfr-check-noreturn-calls}).  Tuning options
17469 @option{--param hardcfr-max-blocks} and @option{--param
17470 hardcfr-max-inline-blocks} are available.
17472 Tail call optimization takes place too late to affect control flow
17473 redundancy, but calls annotated as mandatory tail calls by language
17474 front-ends, and any calls marked early enough as potential tail calls
17475 would also have verification issued before the call, but these
17476 possibilities are merely theoretical, as these conditions can only be
17477 met when using custom compiler plugins.
17479 @opindex fhardcfr-skip-leaf
17480 @item -fhardcfr-skip-leaf
17481 Disable @option{-fharden-control-flow-redundancy} in leaf functions.
17483 @opindex fhardcfr-check-exceptions
17484 @opindex fno-hardcfr-check-exceptions
17485 @item -fhardcfr-check-exceptions
17486 When @option{-fharden-control-flow-redundancy} is active, check the
17487 recorded execution path against the control flow graph at exception
17488 escape points, as if the function body was wrapped with a cleanup
17489 handler that performed the check and reraised.  This option is enabled
17490 by default; use @option{-fno-hardcfr-check-exceptions} to disable it.
17492 @opindex fhardcfr-check-returning-calls
17493 @opindex fno-hardcfr-check-returning-calls
17494 @item -fhardcfr-check-returning-calls
17495 When @option{-fharden-control-flow-redundancy} is active, check the
17496 recorded execution path against the control flow graph before any
17497 function call immediately followed by a return of its result, if any, so
17498 as to not prevent tail-call optimization, whether or not it is
17499 ultimately optimized to a tail call.
17501 This option is enabled by default whenever sibling call optimizations
17502 are enabled (see @option{-foptimize-sibling-calls}), but it can be
17503 enabled (or disabled, using its negated form) explicitly, regardless of
17504 the optimizations.
17506 @opindex fhardcfr-check-noreturn-calls
17507 @item -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
17508 When @option{-fharden-control-flow-redundancy} is active, check the
17509 recorded execution path against the control flow graph before
17510 @code{noreturn} calls, either all of them (@option{always}), those that
17511 aren't expected to return control to the caller through an exception
17512 (@option{no-xthrow}, the default), those that may not return control to
17513 the caller through an exception either (@option{nothrow}), or none of
17514 them (@option{never}).
17516 Checking before a @code{noreturn} function that may return control to
17517 the caller through an exception may cause checking to be performed more
17518 than once, if the exception is caught in the caller, whether by a
17519 handler or a cleanup.  When @option{-fhardcfr-check-exceptions} is also
17520 enabled, the compiler will avoid associating a @code{noreturn} call with
17521 the implicitly-added cleanup handler, since it would be redundant with
17522 the check performed before the call, but other handlers or cleanups in
17523 the function, if activated, will modify the recorded execution path and
17524 check it again when another checkpoint is hit.  The checkpoint may even
17525 be another @code{noreturn} call, so checking may end up performed
17526 multiple times.
17528 Various optimizers may cause calls to be marked as @code{noreturn}
17529 and/or @code{nothrow}, even in the absence of the corresponding
17530 attributes, which may affect the placement of checks before calls, as
17531 well as the addition of implicit cleanup handlers for them.  This
17532 unpredictability, and the fact that raising and reraising exceptions
17533 frequently amounts to implicitly calling @code{noreturn} functions, have
17534 made @option{no-xthrow} the default setting for this option: it excludes
17535 from the @code{noreturn} treatment only internal functions used to
17536 (re)raise exceptions, that are not affected by these optimizations.
17538 @opindex fstack-protector
17539 @item -fstack-protector
17540 Emit extra code to check for buffer overflows, such as stack smashing
17541 attacks.  This is done by adding a guard variable to functions with
17542 vulnerable objects.  This includes functions that call @code{alloca}, and
17543 functions with buffers larger than or equal to 8 bytes.  The guards are
17544 initialized when a function is entered and then checked when the function
17545 exits.  If a guard check fails, an error message is printed and the program
17546 exits.  Only variables that are actually allocated on the stack are
17547 considered, optimized away variables or variables allocated in registers
17548 don't count.
17550 @opindex fstack-protector-all
17551 @item -fstack-protector-all
17552 Like @option{-fstack-protector} except that all functions are protected.
17554 @opindex fstack-protector-strong
17555 @item -fstack-protector-strong
17556 Like @option{-fstack-protector} but includes additional functions to
17557 be protected --- those that have local array definitions, or have
17558 references to local frame addresses.  Only variables that are actually
17559 allocated on the stack are considered, optimized away variables or variables
17560 allocated in registers don't count.
17562 @opindex fstack-protector-explicit
17563 @item -fstack-protector-explicit
17564 Like @option{-fstack-protector} but only protects those functions which
17565 have the @code{stack_protect} attribute.
17567 @opindex fstack-check
17568 @item -fstack-check
17569 Generate code to verify that you do not go beyond the boundary of the
17570 stack.  You should specify this flag if you are running in an
17571 environment with multiple threads, but you only rarely need to specify it in
17572 a single-threaded environment since stack overflow is automatically
17573 detected on nearly all systems if there is only one stack.
17575 Note that this switch does not actually cause checking to be done; the
17576 operating system or the language runtime must do that.  The switch causes
17577 generation of code to ensure that they see the stack being extended.
17579 You can additionally specify a string parameter: @samp{no} means no
17580 checking, @samp{generic} means force the use of old-style checking,
17581 @samp{specific} means use the best checking method and is equivalent
17582 to bare @option{-fstack-check}.
17584 Old-style checking is a generic mechanism that requires no specific
17585 target support in the compiler but comes with the following drawbacks:
17587 @enumerate
17588 @item
17589 Modified allocation strategy for large objects: they are always
17590 allocated dynamically if their size exceeds a fixed threshold.  Note this
17591 may change the semantics of some code.
17593 @item
17594 Fixed limit on the size of the static frame of functions: when it is
17595 topped by a particular function, stack checking is not reliable and
17596 a warning is issued by the compiler.
17598 @item
17599 Inefficiency: because of both the modified allocation strategy and the
17600 generic implementation, code performance is hampered.
17601 @end enumerate
17603 Note that old-style stack checking is also the fallback method for
17604 @samp{specific} if no target support has been added in the compiler.
17606 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17607 and stack overflows.  @samp{specific} is an excellent choice when compiling
17608 Ada code.  It is not generally sufficient to protect against stack-clash
17609 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
17611 @opindex fstack-clash-protection
17612 @item -fstack-clash-protection
17613 Generate code to prevent stack clash style attacks.  When this option is
17614 enabled, the compiler will only allocate one page of stack space at a time
17615 and each page is accessed immediately after allocation.  Thus, it prevents
17616 allocations from jumping over any stack guard page provided by the
17617 operating system.
17619 Most targets do not fully support stack clash protection.  However, on
17620 those targets @option{-fstack-clash-protection} will protect dynamic stack
17621 allocations.  @option{-fstack-clash-protection} may also provide limited
17622 protection for static stack allocations if the target supports
17623 @option{-fstack-check=specific}.
17625 @opindex fstack-limit-register
17626 @opindex fstack-limit-symbol
17627 @opindex fno-stack-limit
17628 @item -fstack-limit-register=@var{reg}
17629 @itemx -fstack-limit-symbol=@var{sym}
17630 @itemx -fno-stack-limit
17631 Generate code to ensure that the stack does not grow beyond a certain value,
17632 either the value of a register or the address of a symbol.  If a larger
17633 stack is required, a signal is raised at run time.  For most targets,
17634 the signal is raised before the stack overruns the boundary, so
17635 it is possible to catch the signal without taking special precautions.
17637 For instance, if the stack starts at absolute address @samp{0x80000000}
17638 and grows downwards, you can use the flags
17639 @option{-fstack-limit-symbol=__stack_limit} and
17640 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17641 of 128KB@.  Note that this may only work with the GNU linker.
17643 You can locally override stack limit checking by using the
17644 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17646 @opindex fsplit-stack
17647 @item -fsplit-stack
17648 Generate code to automatically split the stack before it overflows.
17649 The resulting program has a discontiguous stack which can only
17650 overflow if the program is unable to allocate any more memory.  This
17651 is most useful when running threaded programs, as it is no longer
17652 necessary to calculate a good stack size to use for each thread.  This
17653 is currently only implemented for the x86 targets running
17654 GNU/Linux.
17656 When code compiled with @option{-fsplit-stack} calls code compiled
17657 without @option{-fsplit-stack}, there may not be much stack space
17658 available for the latter code to run.  If compiling all code,
17659 including library code, with @option{-fsplit-stack} is not an option,
17660 then the linker can fix up these calls so that the code compiled
17661 without @option{-fsplit-stack} always has a large stack.  Support for
17662 this is implemented in the gold linker in GNU binutils release 2.21
17663 and later.
17665 @opindex fvtable-verify
17666 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17667 This option is only available when compiling C++ code.
17668 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17669 feature that verifies at run time, for every virtual call, that
17670 the vtable pointer through which the call is made is valid for the type of
17671 the object, and has not been corrupted or overwritten.  If an invalid vtable
17672 pointer is detected at run time, an error is reported and execution of the
17673 program is immediately halted.
17675 This option causes run-time data structures to be built at program startup,
17676 which are used for verifying the vtable pointers.  
17677 The options @samp{std} and @samp{preinit}
17678 control the timing of when these data structures are built.  In both cases the
17679 data structures are built before execution reaches @code{main}.  Using
17680 @option{-fvtable-verify=std} causes the data structures to be built after
17681 shared libraries have been loaded and initialized.
17682 @option{-fvtable-verify=preinit} causes them to be built before shared
17683 libraries have been loaded and initialized.
17685 If this option appears multiple times in the command line with different
17686 values specified, @samp{none} takes highest priority over both @samp{std} and
17687 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17689 @opindex fvtv-debug
17690 @item -fvtv-debug
17691 When used in conjunction with @option{-fvtable-verify=std} or 
17692 @option{-fvtable-verify=preinit}, causes debug versions of the 
17693 runtime functions for the vtable verification feature to be called.  
17694 This flag also causes the compiler to log information about which 
17695 vtable pointers it finds for each class.
17696 This information is written to a file named @file{vtv_set_ptr_data.log} 
17697 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
17698 if that is defined or the current working directory otherwise.
17700 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
17701 file, be sure to delete any existing one.
17703 @opindex fvtv-counts
17704 @item -fvtv-counts
17705 This is a debugging flag.  When used in conjunction with
17706 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17707 causes the compiler to keep track of the total number of virtual calls
17708 it encounters and the number of verifications it inserts.  It also
17709 counts the number of calls to certain run-time library functions
17710 that it inserts and logs this information for each compilation unit.
17711 The compiler writes this information to a file named
17712 @file{vtv_count_data.log} in the directory named by the environment
17713 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17714 directory otherwise.  It also counts the size of the vtable pointer sets
17715 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17716 in the same directory.
17718 Note:  This feature @emph{appends} data to the log files.  To get fresh log
17719 files, be sure to delete any existing ones.
17721 @opindex finstrument-functions
17722 @item -finstrument-functions
17723 Generate instrumentation calls for entry and exit to functions.  Just
17724 after function entry and just before function exit, the following
17725 profiling functions are called with the address of the current
17726 function and its call site.  (On some platforms,
17727 @code{__builtin_return_address} does not work beyond the current
17728 function, so the call site information may not be available to the
17729 profiling functions otherwise.)
17731 @smallexample
17732 void __cyg_profile_func_enter (void *this_fn,
17733                                void *call_site);
17734 void __cyg_profile_func_exit  (void *this_fn,
17735                                void *call_site);
17736 @end smallexample
17738 The first argument is the address of the start of the current function,
17739 which may be looked up exactly in the symbol table.
17741 This instrumentation is also done for functions expanded inline in other
17742 functions.  The profiling calls indicate where, conceptually, the
17743 inline function is entered and exited.  This means that addressable
17744 versions of such functions must be available.  If all your uses of a
17745 function are expanded inline, this may mean an additional expansion of
17746 code size.  If you use @code{extern inline} in your C code, an
17747 addressable version of such functions must be provided.  (This is
17748 normally the case anyway, but if you get lucky and the optimizer always
17749 expands the functions inline, you might have gotten away without
17750 providing static copies.)
17752 A function may be given the attribute @code{no_instrument_function}, in
17753 which case this instrumentation is not done.  This can be used, for
17754 example, for the profiling functions listed above, high-priority
17755 interrupt routines, and any functions from which the profiling functions
17756 cannot safely be called (perhaps signal handlers, if the profiling
17757 routines generate output or allocate memory).
17758 @xref{Common Function Attributes}.
17760 @opindex finstrument-functions-once
17761 @item -finstrument-functions-once
17762 This is similar to @option{-finstrument-functions}, but the profiling
17763 functions are called only once per instrumented function, i.e. the first
17764 profiling function is called after the first entry into the instrumented
17765 function and the second profiling function is called before the exit
17766 corresponding to this first entry.
17768 The definition of @code{once} for the purpose of this option is a little
17769 vague because the implementation is not protected against data races.
17770 As a result, the implementation only guarantees that the profiling
17771 functions are called at @emph{least} once per process and at @emph{most}
17772 once per thread, but the calls are always paired, that is to say, if a
17773 thread calls the first function, then it will call the second function,
17774 unless it never reaches the exit of the instrumented function.
17776 @opindex finstrument-functions-exclude-file-list
17777 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17779 Set the list of functions that are excluded from instrumentation (see
17780 the description of @option{-finstrument-functions}).  If the file that
17781 contains a function definition matches with one of @var{file}, then
17782 that function is not instrumented.  The match is done on substrings:
17783 if the @var{file} parameter is a substring of the file name, it is
17784 considered to be a match.
17786 For example:
17788 @smallexample
17789 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17790 @end smallexample
17792 @noindent
17793 excludes any inline function defined in files whose pathnames
17794 contain @file{/bits/stl} or @file{include/sys}.
17796 If, for some reason, you want to include letter @samp{,} in one of
17797 @var{sym}, write @samp{\,}. For example,
17798 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17799 (note the single quote surrounding the option).
17801 @opindex finstrument-functions-exclude-function-list
17802 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17804 This is similar to @option{-finstrument-functions-exclude-file-list},
17805 but this option sets the list of function names to be excluded from
17806 instrumentation.  The function name to be matched is its user-visible
17807 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17808 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17809 match is done on substrings: if the @var{sym} parameter is a substring
17810 of the function name, it is considered to be a match.  For C99 and C++
17811 extended identifiers, the function name must be given in UTF-8, not
17812 using universal character names.
17814 @opindex fpatchable-function-entry
17815 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17816 Generate @var{N} NOPs right at the beginning
17817 of each function, with the function entry point before the @var{M}th NOP.
17818 If @var{M} is omitted, it defaults to @code{0} so the
17819 function entry points to the address just at the first NOP.
17820 The NOP instructions reserve extra space which can be used to patch in
17821 any desired instrumentation at run time, provided that the code segment
17822 is writable.  The amount of space is controllable indirectly via
17823 the number of NOPs; the NOP instruction used corresponds to the instruction
17824 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
17825 is target-specific and may also depend on the architecture variant and/or
17826 other compilation options.
17828 For run-time identification, the starting addresses of these areas,
17829 which correspond to their respective function entries minus @var{M},
17830 are additionally collected in the @code{__patchable_function_entries}
17831 section of the resulting binary.
17833 Note that the value of @code{__attribute__ ((patchable_function_entry
17834 (N,M)))} takes precedence over command-line option
17835 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
17836 the area size or to remove it completely on a single function.
17837 If @code{N=0}, no pad location is recorded.
17839 The NOP instructions are inserted at---and maybe before, depending on
17840 @var{M}---the function entry address, even before the prologue.  On
17841 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17842 the local entry point is this function entry address.
17844 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
17845 ELFv2 ABI, for a function with dual entry points, the supported values
17846 for @var{M} are 0, 2, 6 and 14.
17847 @end table
17850 @node Preprocessor Options
17851 @section Options Controlling the Preprocessor
17852 @cindex preprocessor options
17853 @cindex options, preprocessor
17855 These options control the C preprocessor, which is run on each C source
17856 file before actual compilation.
17858 If you use the @option{-E} option, nothing is done except preprocessing.
17859 Some of these options make sense only together with @option{-E} because
17860 they cause the preprocessor output to be unsuitable for actual
17861 compilation.
17863 In addition to the options listed here, there are a number of options 
17864 to control search paths for include files documented in 
17865 @ref{Directory Options}.  
17866 Options to control preprocessor diagnostics are listed in 
17867 @ref{Warning Options}.
17869 @table @gcctabopt
17870 @include cppopts.texi
17872 @opindex Wp
17873 @item -Wp,@var{option}
17874 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17875 and pass @var{option} directly through to the preprocessor.  If
17876 @var{option} contains commas, it is split into multiple options at the
17877 commas.  However, many options are modified, translated or interpreted
17878 by the compiler driver before being passed to the preprocessor, and
17879 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17880 interface is undocumented and subject to change, so whenever possible
17881 you should avoid using @option{-Wp} and let the driver handle the
17882 options instead.
17884 @opindex Xpreprocessor
17885 @item -Xpreprocessor @var{option}
17886 Pass @var{option} as an option to the preprocessor.  You can use this to
17887 supply system-specific preprocessor options that GCC does not 
17888 recognize.
17890 If you want to pass an option that takes an argument, you must use
17891 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17893 @opindex no-integrated-cpp
17894 @item -no-integrated-cpp
17895 Perform preprocessing as a separate pass before compilation.
17896 By default, GCC performs preprocessing as an integrated part of
17897 input tokenization and parsing.
17898 If this option is provided, the appropriate language front end
17899 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17900 and Objective-C, respectively) is instead invoked twice,
17901 once for preprocessing only and once for actual compilation
17902 of the preprocessed input.
17903 This option may be useful in conjunction with the @option{-B} or
17904 @option{-wrapper} options to specify an alternate preprocessor or
17905 perform additional processing of the program source between
17906 normal preprocessing and compilation.
17908 @opindex flarge-source-files
17909 @item -flarge-source-files
17910 Adjust GCC to expect large source files, at the expense of slower
17911 compilation and higher memory usage.
17913 Specifically, GCC normally tracks both column numbers and line numbers
17914 within source files and it normally prints both of these numbers in
17915 diagnostics.  However, once it has processed a certain number of source
17916 lines, it stops tracking column numbers and only tracks line numbers.
17917 This means that diagnostics for later lines do not include column numbers.
17918 It also means that options like @option{-Wmisleading-indentation} cease to work
17919 at that point, although the compiler prints a note if this happens.
17920 Passing @option{-flarge-source-files} significantly increases the number
17921 of source lines that GCC can process before it stops tracking columns.
17923 @end table
17925 @node Assembler Options
17926 @section Passing Options to the Assembler
17928 @c prevent bad page break with this line
17929 You can pass options to the assembler.
17931 @table @gcctabopt
17932 @opindex Wa
17933 @item -Wa,@var{option}
17934 Pass @var{option} as an option to the assembler.  If @var{option}
17935 contains commas, it is split into multiple options at the commas.
17937 @opindex Xassembler
17938 @item -Xassembler @var{option}
17939 Pass @var{option} as an option to the assembler.  You can use this to
17940 supply system-specific assembler options that GCC does not
17941 recognize.
17943 If you want to pass an option that takes an argument, you must use
17944 @option{-Xassembler} twice, once for the option and once for the argument.
17946 @end table
17948 @node Link Options
17949 @section Options for Linking
17950 @cindex link options
17951 @cindex options, linking
17953 These options come into play when the compiler links object files into
17954 an executable output file.  They are meaningless if the compiler is
17955 not doing a link step.
17957 @table @gcctabopt
17958 @cindex file names
17959 @item @var{object-file-name}
17960 A file name that does not end in a special recognized suffix is
17961 considered to name an object file or library.  (Object files are
17962 distinguished from libraries by the linker according to the file
17963 contents.)  If linking is done, these object files are used as input
17964 to the linker.
17966 @opindex c
17967 @opindex S
17968 @opindex E
17969 @item -c
17970 @itemx -S
17971 @itemx -E
17972 If any of these options is used, then the linker is not run, and
17973 object file names should not be used as arguments.  @xref{Overall
17974 Options}.
17976 @opindex flinker-output
17977 @item -flinker-output=@var{type}
17978 This option controls code generation of the link-time optimizer.  By
17979 default the linker output is automatically determined by the linker
17980 plugin.  For debugging the compiler and if incremental linking with a 
17981 non-LTO object file is desired, it may be useful to control the type
17982 manually.
17984 If @var{type} is @samp{exec}, code generation produces a static
17985 binary. In this case @option{-fpic} and @option{-fpie} are both
17986 disabled.
17988 If @var{type} is @samp{dyn}, code generation produces a shared
17989 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
17990 but not enabled automatically.  This allows to build shared libraries
17991 without position-independent code on architectures where this is
17992 possible, i.e.@: on x86.
17994 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17995 executable. This results in similar optimizations as @samp{exec}
17996 except that @option{-fpie} is not disabled if specified at compilation
17997 time.
17999 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
18000 done.  The sections containing intermediate code for link-time optimization are
18001 merged, pre-optimized, and output to the resulting object file. In addition, if
18002 @option{-ffat-lto-objects} is specified, binary code is produced for future
18003 non-LTO linking. The object file produced by incremental linking is smaller
18004 than a static library produced from the same object files.  At link time the
18005 result of incremental linking also loads faster than a static
18006 library assuming that the majority of objects in the library are used.
18008 Finally @samp{nolto-rel} configures the compiler for incremental linking where
18009 code generation is forced, a final binary is produced, and the intermediate
18010 code for later link-time optimization is stripped. When multiple object files
18011 are linked together the resulting code is better optimized than with
18012 link-time optimizations disabled (for example, cross-module inlining 
18013 happens), but most of benefits of whole program optimizations are lost. 
18015 During the incremental link (by @option{-r}) the linker plugin defaults to
18016 @option{rel}. With current interfaces to GNU Binutils it is however not
18017 possible to incrementally link LTO objects and non-LTO objects into a single
18018 mixed object file.  If any of object files in incremental link cannot
18019 be used for link-time optimization, the linker plugin issues a warning and
18020 uses @samp{nolto-rel}. To maintain whole program optimization, it is
18021 recommended to link such objects into static library instead. Alternatively it
18022 is possible to use H.J. Lu's binutils with support for mixed objects.
18024 @opindex fuse-ld=bfd
18025 @item -fuse-ld=bfd
18026 Use the @command{bfd} linker instead of the default linker.
18028 @opindex fuse-ld=gold
18029 @item -fuse-ld=gold
18030 Use the @command{gold} linker instead of the default linker.
18032 @opindex fuse-ld=lld
18033 @item -fuse-ld=lld
18034 Use the LLVM @command{lld} linker instead of the default linker.
18036 @opindex fuse-ld=mold
18037 @item -fuse-ld=mold
18038 Use the Modern Linker (@command{mold}) instead of the default linker.
18040 @cindex Libraries
18041 @opindex l
18042 @item -l@var{library}
18043 @itemx -l @var{library}
18044 Search the library named @var{library} when linking.  (The second
18045 alternative with the library as a separate argument is only for
18046 POSIX compliance and is not recommended.)
18048 The @option{-l} option is passed directly to the linker by GCC.  Refer
18049 to your linker documentation for exact details.  The general
18050 description below applies to the GNU linker.  
18052 The linker searches a standard list of directories for the library.
18053 The directories searched include several standard system directories
18054 plus any that you specify with @option{-L}.
18056 Static libraries are archives of object files, and have file names
18057 like @file{lib@var{library}.a}.  Some targets also support shared
18058 libraries, which typically have names like @file{lib@var{library}.so}.
18059 If both static and shared libraries are found, the linker gives
18060 preference to linking with the shared library unless the
18061 @option{-static} option is used.
18063 It makes a difference where in the command you write this option; the
18064 linker searches and processes libraries and object files in the order they
18065 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
18066 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
18067 to functions in @samp{z}, those functions may not be loaded.
18069 @opindex lobjc
18070 @item -lobjc
18071 You need this special case of the @option{-l} option in order to
18072 link an Objective-C or Objective-C++ program.
18074 @opindex nostartfiles
18075 @item -nostartfiles
18076 Do not use the standard system startup files when linking.
18077 The standard system libraries are used normally, unless @option{-nostdlib},
18078 @option{-nolibc}, or @option{-nodefaultlibs} is used.
18080 @opindex nodefaultlibs
18081 @item -nodefaultlibs
18082 Do not use the standard system libraries when linking.
18083 Only the libraries you specify are passed to the linker, and options
18084 specifying linkage of the system libraries, such as @option{-static-libgcc}
18085 or @option{-shared-libgcc}, are ignored.  
18086 The standard startup files are used normally, unless @option{-nostartfiles}
18087 is used.  
18089 The compiler may generate calls to @code{memcmp},
18090 @code{memset}, @code{memcpy} and @code{memmove}.
18091 These entries are usually resolved by entries in
18092 libc.  These entry points should be supplied through some other
18093 mechanism when this option is specified.
18095 @opindex nolibc
18096 @item -nolibc
18097 Do not use the C library or system libraries tightly coupled with it when
18098 linking.  Still link with the startup files, @file{libgcc} or toolchain
18099 provided language support libraries such as @file{libgnat}, @file{libgfortran}
18100 or @file{libstdc++} unless options preventing their inclusion are used as
18101 well.  This typically removes @option{-lc} from the link command line, as well
18102 as system libraries that normally go with it and become meaningless when
18103 absence of a C library is assumed, for example @option{-lpthread} or
18104 @option{-lm} in some configurations.  This is intended for bare-board
18105 targets when there is indeed no C library available.
18107 @opindex nostdlib
18108 @item -nostdlib
18109 Do not use the standard system startup files or libraries when linking.
18110 No startup files and only the libraries you specify are passed to
18111 the linker, and options specifying linkage of the system libraries, such as
18112 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
18114 The compiler may generate calls to @code{memcmp}, @code{memset},
18115 @code{memcpy} and @code{memmove}.
18116 These entries are usually resolved by entries in
18117 libc.  These entry points should be supplied through some other
18118 mechanism when this option is specified.
18120 @cindex @option{-lgcc}, use with @option{-nostdlib}
18121 @cindex @option{-nostdlib} and unresolved references
18122 @cindex unresolved references and @option{-nostdlib}
18123 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
18124 @cindex @option{-nodefaultlibs} and unresolved references
18125 @cindex unresolved references and @option{-nodefaultlibs}
18126 One of the standard libraries bypassed by @option{-nostdlib} and
18127 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
18128 which GCC uses to overcome shortcomings of particular machines, or special
18129 needs for some languages.
18130 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
18131 Collection (GCC) Internals},
18132 for more discussion of @file{libgcc.a}.)
18133 In most cases, you need @file{libgcc.a} even when you want to avoid
18134 other standard libraries.  In other words, when you specify @option{-nostdlib}
18135 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
18136 This ensures that you have no unresolved references to internal GCC
18137 library subroutines.
18138 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18139 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18140 GNU Compiler Collection (GCC) Internals}.)
18142 @opindex nostdlib++
18143 @item -nostdlib++
18144 Do not implicitly link with standard C++ libraries.
18146 @opindex e
18147 @opindex entry
18148 @item -e @var{entry}
18149 @itemx --entry=@var{entry}
18151 Specify that the program entry point is @var{entry}.  The argument is
18152 interpreted by the linker; the GNU linker accepts either a symbol name
18153 or an address.
18155 @opindex pie
18156 @item -pie
18157 Produce a dynamically linked position independent executable on targets
18158 that support it.  For predictable results, you must also specify the same
18159 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18160 or model suboptions) when you specify this linker option.
18162 @opindex no-pie
18163 @item -no-pie
18164 Don't produce a dynamically linked position independent executable.
18166 @opindex static-pie
18167 @item -static-pie
18168 Produce a static position independent executable on targets that support
18169 it.  A static position independent executable is similar to a static
18170 executable, but can be loaded at any address without a dynamic linker.
18171 For predictable results, you must also specify the same set of options
18172 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18173 suboptions) when you specify this linker option.
18175 @opindex pthread
18176 @item -pthread
18177 Link with the POSIX threads library.  This option is supported on 
18178 GNU/Linux targets, most other Unix derivatives, and also on 
18179 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18180 flags for the preprocessor, so it should be used consistently for both
18181 compilation and linking.
18183 @opindex r
18184 @item -r
18185 Produce a relocatable object as output.  This is also known as partial
18186 linking.
18188 @opindex rdynamic
18189 @item -rdynamic
18190 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18191 that support it. This instructs the linker to add all symbols, not
18192 only used ones, to the dynamic symbol table. This option is needed
18193 for some uses of @code{dlopen} or to allow obtaining backtraces
18194 from within a program.
18196 @opindex s
18197 @item -s
18198 Remove all symbol table and relocation information from the executable.
18200 @opindex static
18201 @item -static
18202 On systems that support dynamic linking, this overrides @option{-pie}
18203 and prevents linking with the shared libraries.  On other systems, this
18204 option has no effect.
18206 @opindex shared
18207 @item -shared
18208 Produce a shared object which can then be linked with other objects to
18209 form an executable.  Not all systems support this option.  For predictable
18210 results, you must also specify the same set of options used for compilation
18211 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18212 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18213 needs to build supplementary stub code for constructors to work.  On
18214 multi-libbed systems, @samp{gcc -shared} must select the correct support
18215 libraries to link against.  Failing to supply the correct flags may lead
18216 to subtle defects.  Supplying them in cases where they are not necessary
18217 is innocuous.  @option{-shared} suppresses the addition of startup code
18218 to alter the floating-point environment as done with @option{-ffast-math},
18219 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18221 @opindex shared-libgcc
18222 @opindex static-libgcc
18223 @item -shared-libgcc
18224 @itemx -static-libgcc
18225 On systems that provide @file{libgcc} as a shared library, these options
18226 force the use of either the shared or static version, respectively.
18227 If no shared version of @file{libgcc} was built when the compiler was
18228 configured, these options have no effect.
18230 There are several situations in which an application should use the
18231 shared @file{libgcc} instead of the static version.  The most common
18232 of these is when the application wishes to throw and catch exceptions
18233 across different shared libraries.  In that case, each of the libraries
18234 as well as the application itself should use the shared @file{libgcc}.
18236 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18237 whenever you build a shared library or a main executable, because C++
18238 programs typically use exceptions, so this is the right thing to do.
18240 If, instead, you use the GCC driver to create shared libraries, you may
18241 find that they are not always linked with the shared @file{libgcc}.
18242 If GCC finds, at its configuration time, that you have a non-GNU linker
18243 or a GNU linker that does not support option @option{--eh-frame-hdr},
18244 it links the shared version of @file{libgcc} into shared libraries
18245 by default.  Otherwise, it takes advantage of the linker and optimizes
18246 away the linking with the shared version of @file{libgcc}, linking with
18247 the static version of libgcc by default.  This allows exceptions to
18248 propagate through such shared libraries, without incurring relocation
18249 costs at library load time.
18251 However, if a library or main executable is supposed to throw or catch
18252 exceptions, you must link it using the G++ driver, or using the option
18253 @option{-shared-libgcc}, such that it is linked with the shared
18254 @file{libgcc}.
18256 @opindex static-libasan
18257 @item -static-libasan
18258 When the @option{-fsanitize=address} option is used to link a program,
18259 the GCC driver automatically links against @option{libasan}.  If
18260 @file{libasan} is available as a shared library, and the @option{-static}
18261 option is not used, then this links against the shared version of
18262 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18263 driver to link @file{libasan} statically, without necessarily linking
18264 other libraries statically.
18266 @opindex static-libtsan
18267 @item -static-libtsan
18268 When the @option{-fsanitize=thread} option is used to link a program,
18269 the GCC driver automatically links against @option{libtsan}.  If
18270 @file{libtsan} is available as a shared library, and the @option{-static}
18271 option is not used, then this links against the shared version of
18272 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18273 driver to link @file{libtsan} statically, without necessarily linking
18274 other libraries statically.
18276 @opindex static-liblsan
18277 @item -static-liblsan
18278 When the @option{-fsanitize=leak} option is used to link a program,
18279 the GCC driver automatically links against @option{liblsan}.  If
18280 @file{liblsan} is available as a shared library, and the @option{-static}
18281 option is not used, then this links against the shared version of
18282 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18283 driver to link @file{liblsan} statically, without necessarily linking
18284 other libraries statically.
18286 @opindex static-libubsan
18287 @item -static-libubsan
18288 When the @option{-fsanitize=undefined} option is used to link a program,
18289 the GCC driver automatically links against @option{libubsan}.  If
18290 @file{libubsan} is available as a shared library, and the @option{-static}
18291 option is not used, then this links against the shared version of
18292 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18293 driver to link @file{libubsan} statically, without necessarily linking
18294 other libraries statically.
18296 @opindex static-libstdc++
18297 @item -static-libstdc++
18298 When the @command{g++} program is used to link a C++ program, it
18299 normally automatically links against @option{libstdc++}.  If
18300 @file{libstdc++} is available as a shared library, and the
18301 @option{-static} option is not used, then this links against the
18302 shared version of @file{libstdc++}.  That is normally fine.  However, it
18303 is sometimes useful to freeze the version of @file{libstdc++} used by
18304 the program without going all the way to a fully static link.  The
18305 @option{-static-libstdc++} option directs the @command{g++} driver to
18306 link @file{libstdc++} statically, without necessarily linking other
18307 libraries statically.
18309 @opindex symbolic
18310 @item -symbolic
18311 Bind references to global symbols when building a shared object.  Warn
18312 about any unresolved references (unless overridden by the link editor
18313 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18314 this option.
18316 @opindex T
18317 @cindex linker script
18318 @item -T @var{script}
18319 Use @var{script} as the linker script.  This option is supported by most
18320 systems using the GNU linker.  On some targets, such as bare-board
18321 targets without an operating system, the @option{-T} option may be required
18322 when linking to avoid references to undefined symbols.
18324 @opindex Xlinker
18325 @item -Xlinker @var{option}
18326 Pass @var{option} as an option to the linker.  You can use this to
18327 supply system-specific linker options that GCC does not recognize.
18329 If you want to pass an option that takes a separate argument, you must use
18330 @option{-Xlinker} twice, once for the option and once for the argument.
18331 For example, to pass @option{-assert definitions}, you must write
18332 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18333 @option{-Xlinker "-assert definitions"}, because this passes the entire
18334 string as a single argument, which is not what the linker expects.
18336 When using the GNU linker, it is usually more convenient to pass
18337 arguments to linker options using the @option{@var{option}=@var{value}}
18338 syntax than as separate arguments.  For example, you can specify
18339 @option{-Xlinker -Map=output.map} rather than
18340 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18341 this syntax for command-line options.
18343 @opindex Wl
18344 @item -Wl,@var{option}
18345 Pass @var{option} as an option to the linker.  If @var{option} contains
18346 commas, it is split into multiple options at the commas.  You can use this
18347 syntax to pass an argument to the option.
18348 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18349 linker.  When using the GNU linker, you can also get the same effect with
18350 @option{-Wl,-Map=output.map}.
18352 @opindex u
18353 @item -u @var{symbol}
18354 Pretend the symbol @var{symbol} is undefined, to force linking of
18355 library modules to define it.  You can use @option{-u} multiple times with
18356 different symbols to force loading of additional library modules.
18358 @opindex z
18359 @item -z @var{keyword}
18360 @option{-z} is passed directly on to the linker along with the keyword
18361 @var{keyword}. See the section in the documentation of your linker for
18362 permitted values and their meanings.
18363 @end table
18365 @node Directory Options
18366 @section Options for Directory Search
18367 @cindex directory options
18368 @cindex options, directory search
18369 @cindex search path
18371 These options specify directories to search for header files, for
18372 libraries and for parts of the compiler:
18374 @table @gcctabopt
18375 @include cppdiropts.texi
18377 @opindex iplugindir=
18378 @item -iplugindir=@var{dir}
18379 Set the directory to search for plugins that are passed
18380 by @option{-fplugin=@var{name}} instead of
18381 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18382 to be used by the user, but only passed by the driver.
18384 @opindex L
18385 @item -L@var{dir}
18386 Add directory @var{dir} to the list of directories to be searched
18387 for @option{-l}.
18389 @opindex B
18390 @item -B@var{prefix}
18391 This option specifies where to find the executables, libraries,
18392 include files, and data files of the compiler itself.
18394 The compiler driver program runs one or more of the subprograms
18395 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18396 @var{prefix} as a prefix for each program it tries to run, both with and
18397 without @samp{@var{machine}/@var{version}/} for the corresponding target
18398 machine and compiler version.
18400 For each subprogram to be run, the compiler driver first tries the
18401 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18402 is not specified, the driver tries two standard prefixes, 
18403 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18404 those results in a file name that is found, the unmodified program
18405 name is searched for using the directories specified in your
18406 @env{PATH} environment variable.
18408 The compiler checks to see if the path provided by @option{-B}
18409 refers to a directory, and if necessary it adds a directory
18410 separator character at the end of the path.
18412 @option{-B} prefixes that effectively specify directory names also apply
18413 to libraries in the linker, because the compiler translates these
18414 options into @option{-L} options for the linker.  They also apply to
18415 include files in the preprocessor, because the compiler translates these
18416 options into @option{-isystem} options for the preprocessor.  In this case,
18417 the compiler appends @samp{include} to the prefix.
18419 The runtime support file @file{libgcc.a} can also be searched for using
18420 the @option{-B} prefix, if needed.  If it is not found there, the two
18421 standard prefixes above are tried, and that is all.  The file is left
18422 out of the link if it is not found by those means.
18424 Another way to specify a prefix much like the @option{-B} prefix is to use
18425 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18426 Variables}.
18428 As a special kludge, if the path provided by @option{-B} is
18429 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18430 9, then it is replaced by @file{[dir/]include}.  This is to help
18431 with boot-strapping the compiler.
18433 @opindex no-canonical-prefixes
18434 @item -no-canonical-prefixes
18435 Do not expand any symbolic links, resolve references to @samp{/../}
18436 or @samp{/./}, or make the path absolute when generating a relative
18437 prefix.
18439 @opindex sysroot
18440 @item --sysroot=@var{dir}
18441 Use @var{dir} as the logical root directory for headers and libraries.
18442 For example, if the compiler normally searches for headers in
18443 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18444 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18446 If you use both this option and the @option{-isysroot} option, then
18447 the @option{--sysroot} option applies to libraries, but the
18448 @option{-isysroot} option applies to header files.
18450 The GNU linker (beginning with version 2.16) has the necessary support
18451 for this option.  If your linker does not support this option, the
18452 header file aspect of @option{--sysroot} still works, but the
18453 library aspect does not.
18455 @opindex no-sysroot-suffix
18456 @item --no-sysroot-suffix
18457 For some targets, a suffix is added to the root directory specified
18458 with @option{--sysroot}, depending on the other options used, so that
18459 headers may for example be found in
18460 @file{@var{dir}/@var{suffix}/usr/include} instead of
18461 @file{@var{dir}/usr/include}.  This option disables the addition of
18462 such a suffix.
18464 @end table
18466 @node Code Gen Options
18467 @section Options for Code Generation Conventions
18468 @cindex code generation conventions
18469 @cindex options, code generation
18470 @cindex run-time options
18472 These machine-independent options control the interface conventions
18473 used in code generation.
18475 Most of them have both positive and negative forms; the negative form
18476 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
18477 one of the forms is listed---the one that is not the default.  You
18478 can figure out the other form by either removing @samp{no-} or adding
18481 @table @gcctabopt
18482 @opindex fstack_reuse
18483 @item -fstack-reuse=@var{reuse-level}
18484 This option controls stack space reuse for user declared local/auto variables
18485 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
18486 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18487 local variables and temporaries, @samp{named_vars} enables the reuse only for
18488 user defined local variables with names, and @samp{none} disables stack reuse
18489 completely. The default value is @samp{all}. The option is needed when the
18490 program extends the lifetime of a scoped local variable or a compiler generated
18491 temporary beyond the end point defined by the language.  When a lifetime of
18492 a variable ends, and if the variable lives in memory, the optimizing compiler
18493 has the freedom to reuse its stack space with other temporaries or scoped
18494 local variables whose live range does not overlap with it. Legacy code extending
18495 local lifetime is likely to break with the stack reuse optimization.
18497 For example,
18499 @smallexample
18500    int *p;
18501    @{
18502      int local1;
18504      p = &local1;
18505      local1 = 10;
18506      ....
18507    @}
18508    @{
18509       int local2;
18510       local2 = 20;
18511       ...
18512    @}
18514    if (*p == 10)  // out of scope use of local1
18515      @{
18517      @}
18518 @end smallexample
18520 Another example:
18521 @smallexample
18523    struct A
18524    @{
18525        A(int k) : i(k), j(k) @{ @}
18526        int i;
18527        int j;
18528    @};
18530    A *ap;
18532    void foo(const A& ar)
18533    @{
18534       ap = &ar;
18535    @}
18537    void bar()
18538    @{
18539       foo(A(10)); // temp object's lifetime ends when foo returns
18541       @{
18542         A a(20);
18543         ....
18544       @}
18545       ap->i+= 10;  // ap references out of scope temp whose space
18546                    // is reused with a. What is the value of ap->i?
18547    @}
18549 @end smallexample
18551 The lifetime of a compiler generated temporary is well defined by the C++
18552 standard. When a lifetime of a temporary ends, and if the temporary lives
18553 in memory, the optimizing compiler has the freedom to reuse its stack
18554 space with other temporaries or scoped local variables whose live range
18555 does not overlap with it. However some of the legacy code relies on
18556 the behavior of older compilers in which temporaries' stack space is
18557 not reused, the aggressive stack reuse can lead to runtime errors. This
18558 option is used to control the temporary stack reuse optimization.
18560 @opindex ftrapv
18561 @item -ftrapv
18562 This option generates traps for signed overflow on addition, subtraction,
18563 multiplication operations.
18564 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18565 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18566 @option{-fwrapv} being effective.  Note that only active options override, so
18567 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18568 results in @option{-ftrapv} being effective.
18570 @opindex fwrapv
18571 @item -fwrapv
18572 This option instructs the compiler to assume that signed arithmetic
18573 overflow of addition, subtraction and multiplication wraps around
18574 using twos-complement representation.  This flag enables some optimizations
18575 and disables others.
18576 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18577 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18578 @option{-fwrapv} being effective.  Note that only active options override, so
18579 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18580 results in @option{-ftrapv} being effective.
18582 @opindex fwrapv-pointer
18583 @item -fwrapv-pointer
18584 This option instructs the compiler to assume that pointer arithmetic
18585 overflow on addition and subtraction wraps around using twos-complement
18586 representation.  This flag disables some optimizations which assume
18587 pointer overflow is invalid.
18589 @opindex fstrict-overflow
18590 @item -fstrict-overflow
18591 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18592 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18594 @opindex fexceptions
18595 @item -fexceptions
18596 Enable exception handling.  Generates extra code needed to propagate
18597 exceptions.  For some targets, this implies GCC generates frame
18598 unwind information for all functions, which can produce significant data
18599 size overhead, although it does not affect execution.  If you do not
18600 specify this option, GCC enables it by default for languages like
18601 C++ that normally require exception handling, and disables it for
18602 languages like C that do not normally require it.  However, you may need
18603 to enable this option when compiling C code that needs to interoperate
18604 properly with exception handlers written in C++.  You may also wish to
18605 disable this option if you are compiling older C++ programs that don't
18606 use exception handling.
18608 @opindex fnon-call-exceptions
18609 @item -fnon-call-exceptions
18610 Generate code that allows trapping instructions to throw exceptions.
18611 Note that this requires platform-specific runtime support that does
18612 not exist everywhere.  Moreover, it only allows @emph{trapping}
18613 instructions to throw exceptions, i.e.@: memory references or floating-point
18614 instructions.  It does not allow exceptions to be thrown from
18615 arbitrary signal handlers such as @code{SIGALRM}.  This enables
18616 @option{-fexceptions}.
18618 @opindex fdelete-dead-exceptions
18619 @item -fdelete-dead-exceptions
18620 Consider that instructions that may throw exceptions but don't otherwise
18621 contribute to the execution of the program can be optimized away.
18622 This does not affect calls to functions except those with the
18623 @code{pure} or @code{const} attributes.
18624 This option is enabled by default for the Ada and C++ compilers, as permitted by
18625 the language specifications.
18626 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18628 @opindex funwind-tables
18629 @item -funwind-tables
18630 Similar to @option{-fexceptions}, except that it just generates any needed
18631 static data, but does not affect the generated code in any other way.
18632 You normally do not need to enable this option; instead, a language processor
18633 that needs this handling enables it on your behalf.
18635 @opindex fasynchronous-unwind-tables
18636 @item -fasynchronous-unwind-tables
18637 Generate unwind table in DWARF format, if supported by target machine.  The
18638 table is exact at each instruction boundary, so it can be used for stack
18639 unwinding from asynchronous events (such as debugger or garbage collector).
18641 @opindex fno-gnu-unique
18642 @opindex fgnu-unique
18643 @item -fno-gnu-unique
18644 On systems with recent GNU assembler and C library, the C++ compiler
18645 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18646 of template static data members and static local variables in inline
18647 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18648 is necessary to avoid problems with a library used by two different
18649 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18650 therefore disagreeing with the other one about the binding of the
18651 symbol.  But this causes @code{dlclose} to be ignored for affected
18652 DSOs; if your program relies on reinitialization of a DSO via
18653 @code{dlclose} and @code{dlopen}, you can use
18654 @option{-fno-gnu-unique}.
18656 @opindex fpcc-struct-return
18657 @item -fpcc-struct-return
18658 Return ``short'' @code{struct} and @code{union} values in memory like
18659 longer ones, rather than in registers.  This convention is less
18660 efficient, but it has the advantage of allowing intercallability between
18661 GCC-compiled files and files compiled with other compilers, particularly
18662 the Portable C Compiler (pcc).
18664 The precise convention for returning structures in memory depends
18665 on the target configuration macros.
18667 Short structures and unions are those whose size and alignment match
18668 that of some integer type.
18670 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18671 switch is not binary compatible with code compiled with the
18672 @option{-freg-struct-return} switch.
18673 Use it to conform to a non-default application binary interface.
18675 @opindex freg-struct-return
18676 @item -freg-struct-return
18677 Return @code{struct} and @code{union} values in registers when possible.
18678 This is more efficient for small structures than
18679 @option{-fpcc-struct-return}.
18681 If you specify neither @option{-fpcc-struct-return} nor
18682 @option{-freg-struct-return}, GCC defaults to whichever convention is
18683 standard for the target.  If there is no standard convention, GCC
18684 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18685 the principal compiler.  In those cases, we can choose the standard, and
18686 we chose the more efficient register return alternative.
18688 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18689 switch is not binary compatible with code compiled with the
18690 @option{-fpcc-struct-return} switch.
18691 Use it to conform to a non-default application binary interface.
18693 @opindex fshort-enums
18694 @item -fshort-enums
18695 Allocate to an @code{enum} type only as many bytes as it needs for the
18696 declared range of possible values.  Specifically, the @code{enum} type
18697 is equivalent to the smallest integer type that has enough room.
18698 This option has no effect for an enumeration type with a fixed underlying
18699 type.
18701 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18702 code that is not binary compatible with code generated without that switch.
18703 Use it to conform to a non-default application binary interface.
18705 @opindex fshort-wchar
18706 @item -fshort-wchar
18707 Override the underlying type for @code{wchar_t} to be @code{short
18708 unsigned int} instead of the default for the target.  This option is
18709 useful for building programs to run under WINE@.
18711 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18712 code that is not binary compatible with code generated without that switch.
18713 Use it to conform to a non-default application binary interface.
18715 @opindex fcommon
18716 @opindex fno-common
18717 @cindex tentative definitions
18718 @item -fcommon
18719 In C code, this option controls the placement of global variables
18720 defined without an initializer, known as @dfn{tentative definitions}
18721 in the C standard.  Tentative definitions are distinct from declarations
18722 of a variable with the @code{extern} keyword, which do not allocate storage.
18724 The default is @option{-fno-common}, which specifies that the compiler places
18725 uninitialized global variables in the BSS section of the object file.
18726 This inhibits the merging of tentative definitions by the linker so you get a
18727 multiple-definition error if the same variable is accidentally defined in more
18728 than one compilation unit.
18730 The @option{-fcommon} places uninitialized global variables in a common block.
18731 This allows the linker to resolve all tentative definitions of the same variable
18732 in different compilation units to the same object, or to a non-tentative
18733 definition.  This behavior is inconsistent with C++, and on many targets implies
18734 a speed and code size penalty on global variable references.  It is mainly
18735 useful to enable legacy code to link without errors.
18737 @opindex fno-ident
18738 @opindex fident
18739 @item -fno-ident
18740 Ignore the @code{#ident} directive.
18742 @opindex finhibit-size-directive
18743 @item -finhibit-size-directive
18744 Don't output a @code{.size} assembler directive, or anything else that
18745 would cause trouble if the function is split in the middle, and the
18746 two halves are placed at locations far apart in memory.  This option is
18747 used when compiling @file{crtstuff.c}; you should not need to use it
18748 for anything else.
18750 @opindex fverbose-asm
18751 @item -fverbose-asm
18752 Put extra commentary information in the generated assembly code to
18753 make it more readable.  This option is generally only of use to those
18754 who actually need to read the generated assembly code (perhaps while
18755 debugging the compiler itself).
18757 @option{-fno-verbose-asm}, the default, causes the
18758 extra information to be omitted and is useful when comparing two assembler
18759 files.
18761 The added comments include:
18763 @itemize @bullet
18765 @item
18766 information on the compiler version and command-line options,
18768 @item
18769 the source code lines associated with the assembly instructions,
18770 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18772 @item
18773 hints on which high-level expressions correspond to
18774 the various assembly instruction operands.
18776 @end itemize
18778 For example, given this C source file:
18780 @smallexample
18781 int test (int n)
18783   int i;
18784   int total = 0;
18786   for (i = 0; i < n; i++)
18787     total += i * i;
18789   return total;
18791 @end smallexample
18793 compiling to (x86_64) assembly via @option{-S} and emitting the result
18794 direct to stdout via @option{-o} @option{-}
18796 @smallexample
18797 gcc -S test.c -fverbose-asm -Os -o -
18798 @end smallexample
18800 gives output similar to this:
18802 @smallexample
18803         .file   "test.c"
18804 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18805   [...snip...]
18806 # options passed:
18807   [...snip...]
18809         .text
18810         .globl  test
18811         .type   test, @@function
18812 test:
18813 .LFB0:
18814         .cfi_startproc
18815 # test.c:4:   int total = 0;
18816         xorl    %eax, %eax      # <retval>
18817 # test.c:6:   for (i = 0; i < n; i++)
18818         xorl    %edx, %edx      # i
18819 .L2:
18820 # test.c:6:   for (i = 0; i < n; i++)
18821         cmpl    %edi, %edx      # n, i
18822         jge     .L5     #,
18823 # test.c:7:     total += i * i;
18824         movl    %edx, %ecx      # i, tmp92
18825         imull   %edx, %ecx      # i, tmp92
18826 # test.c:6:   for (i = 0; i < n; i++)
18827         incl    %edx    # i
18828 # test.c:7:     total += i * i;
18829         addl    %ecx, %eax      # tmp92, <retval>
18830         jmp     .L2     #
18831 .L5:
18832 # test.c:10: @}
18833         ret
18834         .cfi_endproc
18835 .LFE0:
18836         .size   test, .-test
18837         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
18838         .section        .note.GNU-stack,"",@@progbits
18839 @end smallexample
18841 The comments are intended for humans rather than machines and hence the
18842 precise format of the comments is subject to change.
18844 @opindex frecord-gcc-switches
18845 @item -frecord-gcc-switches
18846 This switch causes the command line used to invoke the
18847 compiler to be recorded into the object file that is being created.
18848 This switch is only implemented on some targets and the exact format
18849 of the recording is target and binary file format dependent, but it
18850 usually takes the form of a section containing ASCII text.  This
18851 switch is related to the @option{-fverbose-asm} switch, but that
18852 switch only records information in the assembler output file as
18853 comments, so it never reaches the object file.
18854 See also @option{-grecord-gcc-switches} for another
18855 way of storing compiler options into the object file.
18857 @opindex fpic
18858 @cindex global offset table
18859 @cindex PIC
18860 @item -fpic
18861 Generate position-independent code (PIC) suitable for use in a shared
18862 library, if supported for the target machine.  Such code accesses all
18863 constant addresses through a global offset table (GOT)@.  The dynamic
18864 loader resolves the GOT entries when the program starts (the dynamic
18865 loader is not part of GCC; it is part of the operating system).  If
18866 the GOT size for the linked executable exceeds a machine-specific
18867 maximum size, you get an error message from the linker indicating that
18868 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18869 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18870 on the m68k and RS/6000.  The x86 has no such limit.)
18872 Position-independent code requires special support, and therefore works
18873 only on certain machines.  For the x86, GCC supports PIC for System V
18874 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18875 position-independent.
18877 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18878 are defined to 1.
18880 @opindex fPIC
18881 @item -fPIC
18882 If supported for the target machine, emit position-independent code,
18883 suitable for dynamic linking and avoiding any limit on the size of the
18884 global offset table.  This option makes a difference on AArch64, m68k,
18885 PowerPC and SPARC@.
18887 Position-independent code requires special support, and therefore works
18888 only on certain machines.
18890 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18891 are defined to 2.
18893 @opindex fpie
18894 @opindex fPIE
18895 @item -fpie
18896 @itemx -fPIE
18897 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18898 generated position-independent code can be only linked into executables.
18899 Usually these options are used to compile code that will be linked using
18900 the @option{-pie} GCC option.
18902 @option{-fpie} and @option{-fPIE} both define the macros
18903 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18904 for @option{-fpie} and 2 for @option{-fPIE}.
18906 @opindex fno-plt
18907 @opindex fplt
18908 @item -fno-plt
18909 Do not use the PLT for external function calls in position-independent code.
18910 Instead, load the callee address at call sites from the GOT and branch to it.
18911 This leads to more efficient code by eliminating PLT stubs and exposing
18912 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18913 PLT stubs expect the GOT pointer in a specific register, this gives more
18914 register allocation freedom to the compiler.
18915 Lazy binding requires use of the PLT; 
18916 with @option{-fno-plt} all external symbols are resolved at load time.
18918 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18919 through the PLT for specific external functions.
18921 In position-dependent code, a few targets also convert calls to
18922 functions that are marked to not use the PLT to use the GOT instead.
18924 @opindex fno-jump-tables
18925 @opindex fjump-tables
18926 @item -fno-jump-tables
18927 Do not use jump tables for switch statements even where it would be
18928 more efficient than other code generation strategies.  This option is
18929 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18930 building code that forms part of a dynamic linker and cannot
18931 reference the address of a jump table.  On some targets, jump tables
18932 do not require a GOT and this option is not needed.
18934 @opindex fno-bit-tests
18935 @opindex fbit-tests
18936 @item -fno-bit-tests
18937 Do not use bit tests for switch statements even where it would be
18938 more efficient than other code generation strategies.
18940 @opindex ffixed
18941 @item -ffixed-@var{reg}
18942 Treat the register named @var{reg} as a fixed register; generated code
18943 should never refer to it (except perhaps as a stack pointer, frame
18944 pointer or in some other fixed role).
18946 @var{reg} must be the name of a register.  The register names accepted
18947 are machine-specific and are defined in the @code{REGISTER_NAMES}
18948 macro in the machine description macro file.
18950 This flag does not have a negative form, because it specifies a
18951 three-way choice.
18953 @opindex fcall-used
18954 @item -fcall-used-@var{reg}
18955 Treat the register named @var{reg} as an allocable register that is
18956 clobbered by function calls.  It may be allocated for temporaries or
18957 variables that do not live across a call.  Functions compiled this way
18958 do not save and restore the register @var{reg}.
18960 It is an error to use this flag with the frame pointer or stack pointer.
18961 Use of this flag for other registers that have fixed pervasive roles in
18962 the machine's execution model produces disastrous results.
18964 This flag does not have a negative form, because it specifies a
18965 three-way choice.
18967 @opindex fcall-saved
18968 @item -fcall-saved-@var{reg}
18969 Treat the register named @var{reg} as an allocable register saved by
18970 functions.  It may be allocated even for temporaries or variables that
18971 live across a call.  Functions compiled this way save and restore
18972 the register @var{reg} if they use it.
18974 It is an error to use this flag with the frame pointer or stack pointer.
18975 Use of this flag for other registers that have fixed pervasive roles in
18976 the machine's execution model produces disastrous results.
18978 A different sort of disaster results from the use of this flag for
18979 a register in which function values may be returned.
18981 This flag does not have a negative form, because it specifies a
18982 three-way choice.
18984 @opindex fpack-struct
18985 @item -fpack-struct[=@var{n}]
18986 Without a value specified, pack all structure members together without
18987 holes.  When a value is specified (which must be a small power of two), pack
18988 structure members according to this value, representing the maximum
18989 alignment (that is, objects with default alignment requirements larger than
18990 this are output potentially unaligned at the next fitting location.
18992 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18993 code that is not binary compatible with code generated without that switch.
18994 Additionally, it makes the code suboptimal.
18995 Use it to conform to a non-default application binary interface.
18997 @opindex fleading-underscore
18998 @item -fleading-underscore
18999 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19000 change the way C symbols are represented in the object file.  One use
19001 is to help link with legacy assembly code.
19003 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19004 generate code that is not binary compatible with code generated without that
19005 switch.  Use it to conform to a non-default application binary interface.
19006 Not all targets provide complete support for this switch.
19008 @opindex ftls-model
19009 @item -ftls-model=@var{model}
19010 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19011 The @var{model} argument should be one of @samp{global-dynamic},
19012 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
19013 Note that the choice is subject to optimization: the compiler may use
19014 a more efficient model for symbols not visible outside of the translation
19015 unit, or if @option{-fpic} is not given on the command line.
19017 The default without @option{-fpic} is @samp{initial-exec}; with
19018 @option{-fpic} the default is @samp{global-dynamic}.
19020 @opindex ftrampolines
19021 @item -ftrampolines
19022 For targets that normally need trampolines for nested functions, always
19023 generate them instead of using descriptors.  Otherwise, for targets that
19024 do not need them, like for example HP-PA or IA-64, do nothing.
19026 A trampoline is a small piece of code that is created at run time on the
19027 stack when the address of a nested function is taken, and is used to call
19028 the nested function indirectly.  Therefore, it requires the stack to be
19029 made executable in order for the program to work properly.
19031 @option{-fno-trampolines} is enabled by default on a language by language
19032 basis to let the compiler avoid generating them, if it computes that this
19033 is safe, and replace them with descriptors.  Descriptors are made up of data
19034 only, but the generated code must be prepared to deal with them.  As of this
19035 writing, @option{-fno-trampolines} is enabled by default only for Ada.
19037 Moreover, code compiled with @option{-ftrampolines} and code compiled with
19038 @option{-fno-trampolines} are not binary compatible if nested functions are
19039 present.  This option must therefore be used on a program-wide basis and be
19040 manipulated with extreme care.
19042 For languages other than Ada, the @code{-ftrampolines} and
19043 @code{-fno-trampolines} options currently have no effect, and
19044 trampolines are always generated on platforms that need them
19045 for nested functions.
19047 @opindex ftrampoline-impl
19048 @item -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
19049 By default, trampolines are generated on stack.  However, certain platforms
19050 (such as the Apple M1) do not permit an executable stack.  Compiling with
19051 @option{-ftrampoline-impl=heap} generate calls to
19052 @code{__builtin_nested_func_ptr_created} and
19053 @code{__builtin_nested_func_ptr_deleted} in order to allocate and
19054 deallocate trampoline space on the executable heap.  These functions are
19055 implemented in libgcc, and will only be provided on specific targets:
19056 x86_64 Darwin, x86_64 and aarch64 Linux.  @emph{PLEASE NOTE}: Heap
19057 trampolines are @emph{not} guaranteed to be correctly deallocated if you
19058 @code{setjmp}, instantiate nested functions, and then @code{longjmp} back
19059 to a state prior to having allocated those nested functions.
19061 @opindex fvisibility
19062 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
19063 Set the default ELF image symbol visibility to the specified option---all
19064 symbols are marked with this unless overridden within the code.
19065 Using this feature can very substantially improve linking and
19066 load times of shared object libraries, produce more optimized
19067 code, provide near-perfect API export and prevent symbol clashes.
19068 It is @strong{strongly} recommended that you use this in any shared objects
19069 you distribute.
19071 Despite the nomenclature, @samp{default} always means public; i.e.,
19072 available to be linked against from outside the shared object.
19073 @samp{protected} and @samp{internal} are pretty useless in real-world
19074 usage so the only other commonly used option is @samp{hidden}.
19075 The default if @option{-fvisibility} isn't specified is
19076 @samp{default}, i.e., make every symbol public.
19078 A good explanation of the benefits offered by ensuring ELF
19079 symbols have the correct visibility is given by ``How To Write
19080 Shared Libraries'' by Ulrich Drepper (which can be found at
19081 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
19082 solution made possible by this option to marking things hidden when
19083 the default is public is to make the default hidden and mark things
19084 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
19085 and @code{__attribute__ ((visibility("default")))} instead of
19086 @code{__declspec(dllexport)} you get almost identical semantics with
19087 identical syntax.  This is a great boon to those working with
19088 cross-platform projects.
19090 For those adding visibility support to existing code, you may find
19091 @code{#pragma GCC visibility} of use.  This works by you enclosing
19092 the declarations you wish to set visibility for with (for example)
19093 @code{#pragma GCC visibility push(hidden)} and
19094 @code{#pragma GCC visibility pop}.
19095 Bear in mind that symbol visibility should be viewed @strong{as
19096 part of the API interface contract} and thus all new code should
19097 always specify visibility when it is not the default; i.e., declarations
19098 only for use within the local DSO should @strong{always} be marked explicitly
19099 as hidden as so to avoid PLT indirection overheads---making this
19100 abundantly clear also aids readability and self-documentation of the code.
19101 Note that due to ISO C++ specification requirements, @code{operator new} and
19102 @code{operator delete} must always be of default visibility.
19104 Be aware that headers from outside your project, in particular system
19105 headers and headers from any other library you use, may not be
19106 expecting to be compiled with visibility other than the default.  You
19107 may need to explicitly say @code{#pragma GCC visibility push(default)}
19108 before including any such headers.
19110 @code{extern} declarations are not affected by @option{-fvisibility}, so
19111 a lot of code can be recompiled with @option{-fvisibility=hidden} with
19112 no modifications.  However, this means that calls to @code{extern}
19113 functions with no explicit visibility use the PLT, so it is more
19114 effective to use @code{__attribute ((visibility))} and/or
19115 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
19116 declarations should be treated as hidden.
19118 Note that @option{-fvisibility} does affect C++ vague linkage
19119 entities. This means that, for instance, an exception class that is
19120 be thrown between DSOs must be explicitly marked with default
19121 visibility so that the @samp{type_info} nodes are unified between
19122 the DSOs.
19124 An overview of these techniques, their benefits and how to use them
19125 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
19127 @opindex fstrict-volatile-bitfields
19128 @item -fstrict-volatile-bitfields
19129 This option should be used if accesses to volatile bit-fields (or other
19130 structure fields, although the compiler usually honors those types
19131 anyway) should use a single access of the width of the
19132 field's type, aligned to a natural alignment if possible.  For
19133 example, targets with memory-mapped peripheral registers might require
19134 all such accesses to be 16 bits wide; with this flag you can
19135 declare all peripheral bit-fields as @code{unsigned short} (assuming short
19136 is 16 bits on these targets) to force GCC to use 16-bit accesses
19137 instead of, perhaps, a more efficient 32-bit access.
19139 If this option is disabled, the compiler uses the most efficient
19140 instruction.  In the previous example, that might be a 32-bit load
19141 instruction, even though that accesses bytes that do not contain
19142 any portion of the bit-field, or memory-mapped registers unrelated to
19143 the one being updated.
19145 In some cases, such as when the @code{packed} attribute is applied to a 
19146 structure field, it may not be possible to access the field with a single
19147 read or write that is correctly aligned for the target machine.  In this
19148 case GCC falls back to generating multiple accesses rather than code that 
19149 will fault or truncate the result at run time.
19151 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
19152 not allowed to touch non bit-field members.  It is therefore recommended
19153 to define all bits of the field's type as bit-field members.
19155 The default value of this option is determined by the application binary
19156 interface for the target processor.
19158 @opindex fsync-libcalls
19159 @item -fsync-libcalls
19160 This option controls whether any out-of-line instance of the @code{__sync}
19161 family of functions may be used to implement the C++11 @code{__atomic}
19162 family of functions.
19164 The default value of this option is enabled, thus the only useful form
19165 of the option is @option{-fno-sync-libcalls}.  This option is used in
19166 the implementation of the @file{libatomic} runtime library.
19168 @end table
19170 @node Developer Options
19171 @section GCC Developer Options
19172 @cindex developer options
19173 @cindex debugging GCC
19174 @cindex debug dump options
19175 @cindex dump options
19176 @cindex compilation statistics
19178 This section describes command-line options that are primarily of
19179 interest to GCC developers, including options to support compiler
19180 testing and investigation of compiler bugs and compile-time
19181 performance problems.  This includes options that produce debug dumps
19182 at various points in the compilation; that print statistics such as
19183 memory use and execution time; and that print information about GCC's
19184 configuration, such as where it searches for libraries.  You should
19185 rarely need to use any of these options for ordinary compilation and
19186 linking tasks.
19188 Many developer options that cause GCC to dump output to a file take an
19189 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19190 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19191 error.
19193 If @samp{=@var{filename}} is omitted, a default dump file name is
19194 constructed by concatenating the base dump file name, a pass number,
19195 phase letter, and pass name.  The base dump file name is the name of
19196 output file produced by the compiler if explicitly specified and not
19197 an executable; otherwise it is the source file name.
19198 The pass number is determined by the order passes are registered with
19199 the compiler's pass manager. 
19200 This is generally the same as the order of execution, but passes
19201 registered by plugins, target-specific passes, or passes that are
19202 otherwise registered late are numbered higher than the pass named
19203 @samp{final}, even if they are executed earlier.  The phase letter is
19204 one of @samp{i} (inter-procedural analysis), @samp{l}
19205 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19206 The files are created in the directory of the output file. 
19208 @table @gcctabopt
19210 @opindex fcallgraph-info
19211 @item -fcallgraph-info
19212 @itemx -fcallgraph-info=@var{MARKERS}
19213 Makes the compiler output callgraph information for the program, on a
19214 per-object-file basis.  The information is generated in the common VCG
19215 format.  It can be decorated with additional, per-node and/or per-edge
19216 information, if a list of comma-separated markers is additionally
19217 specified.  When the @code{su} marker is specified, the callgraph is
19218 decorated with stack usage information; it is equivalent to
19219 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19220 callgraph is decorated with information about dynamically allocated
19221 objects.
19223 When compiling with @option{-flto}, no callgraph information is output
19224 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19225 may generate multiple callgraph information files next to intermediate
19226 LTO output files.
19228 @opindex d
19229 @opindex fdump-rtl-@var{pass}
19230 @item -d@var{letters}
19231 @itemx -fdump-rtl-@var{pass}
19232 @itemx -fdump-rtl-@var{pass}=@var{filename}
19233 Says to make debugging dumps during compilation at times specified by
19234 @var{letters}.  This is used for debugging the RTL-based passes of the
19235 compiler.
19237 Some @option{-d@var{letters}} switches have different meaning when
19238 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19239 for information about preprocessor-specific dump options.
19241 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19242 @option{-d} option @var{letters}.  Here are the possible
19243 letters for use in @var{pass} and @var{letters}, and their meanings:
19245 @table @gcctabopt
19247 @opindex fdump-rtl-alignments
19248 @item -fdump-rtl-alignments
19249 Dump after branch alignments have been computed.
19251 @opindex fdump-rtl-asmcons
19252 @item -fdump-rtl-asmcons
19253 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19255 @opindex fdump-rtl-auto_inc_dec
19256 @item -fdump-rtl-auto_inc_dec
19257 Dump after auto-inc-dec discovery.  This pass is only run on
19258 architectures that have auto inc or auto dec instructions.
19260 @opindex fdump-rtl-barriers
19261 @item -fdump-rtl-barriers
19262 Dump after cleaning up the barrier instructions.
19264 @opindex fdump-rtl-bbpart
19265 @item -fdump-rtl-bbpart
19266 Dump after partitioning hot and cold basic blocks.
19268 @opindex fdump-rtl-bbro
19269 @item -fdump-rtl-bbro
19270 Dump after block reordering.
19272 @opindex fdump-rtl-btl2
19273 @opindex fdump-rtl-btl2
19274 @item -fdump-rtl-btl1
19275 @itemx -fdump-rtl-btl2
19276 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19277 after the two branch
19278 target load optimization passes.
19280 @opindex fdump-rtl-bypass
19281 @item -fdump-rtl-bypass
19282 Dump after jump bypassing and control flow optimizations.
19284 @opindex fdump-rtl-combine
19285 @item -fdump-rtl-combine
19286 Dump after the RTL instruction combination pass.
19288 @opindex fdump-rtl-compgotos
19289 @item -fdump-rtl-compgotos
19290 Dump after duplicating the computed gotos.
19292 @opindex fdump-rtl-ce1
19293 @opindex fdump-rtl-ce2
19294 @opindex fdump-rtl-ce3
19295 @item -fdump-rtl-ce1
19296 @itemx -fdump-rtl-ce2
19297 @itemx -fdump-rtl-ce3
19298 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19299 @option{-fdump-rtl-ce3} enable dumping after the three
19300 if conversion passes.
19302 @opindex fdump-rtl-cprop_hardreg
19303 @item -fdump-rtl-cprop_hardreg
19304 Dump after hard register copy propagation.
19306 @opindex fdump-rtl-csa
19307 @item -fdump-rtl-csa
19308 Dump after combining stack adjustments.
19310 @opindex fdump-rtl-cse1
19311 @opindex fdump-rtl-cse2
19312 @item -fdump-rtl-cse1
19313 @itemx -fdump-rtl-cse2
19314 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19315 the two common subexpression elimination passes.
19317 @opindex fdump-rtl-dce
19318 @item -fdump-rtl-dce
19319 Dump after the standalone dead code elimination passes.
19321 @opindex fdump-rtl-dbr
19322 @item -fdump-rtl-dbr
19323 Dump after delayed branch scheduling.
19325 @opindex fdump-rtl-dce1
19326 @opindex fdump-rtl-dce2
19327 @item -fdump-rtl-dce1
19328 @itemx -fdump-rtl-dce2
19329 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19330 the two dead store elimination passes.
19332 @opindex fdump-rtl-eh
19333 @item -fdump-rtl-eh
19334 Dump after finalization of EH handling code.
19336 @opindex fdump-rtl-eh_ranges
19337 @item -fdump-rtl-eh_ranges
19338 Dump after conversion of EH handling range regions.
19340 @opindex fdump-rtl-expand
19341 @item -fdump-rtl-expand
19342 Dump after RTL generation.
19344 @opindex fdump-rtl-fwprop1
19345 @opindex fdump-rtl-fwprop2
19346 @item -fdump-rtl-fwprop1
19347 @itemx -fdump-rtl-fwprop2
19348 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19349 dumping after the two forward propagation passes.
19351 @opindex fdump-rtl-gcse1
19352 @opindex fdump-rtl-gcse2
19353 @item -fdump-rtl-gcse1
19354 @itemx -fdump-rtl-gcse2
19355 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19356 after global common subexpression elimination.
19358 @opindex fdump-rtl-init-regs
19359 @item -fdump-rtl-init-regs
19360 Dump after the initialization of the registers.
19362 @opindex fdump-rtl-initvals
19363 @item -fdump-rtl-initvals
19364 Dump after the computation of the initial value sets.
19366 @opindex fdump-rtl-into_cfglayout
19367 @item -fdump-rtl-into_cfglayout
19368 Dump after converting to cfglayout mode.
19370 @opindex fdump-rtl-ira
19371 @item -fdump-rtl-ira
19372 Dump after iterated register allocation.
19374 @opindex fdump-rtl-jump
19375 @item -fdump-rtl-jump
19376 Dump after the second jump optimization.
19378 @opindex fdump-rtl-loop2
19379 @item -fdump-rtl-loop2
19380 @option{-fdump-rtl-loop2} enables dumping after the rtl
19381 loop optimization passes.
19383 @opindex fdump-rtl-mach
19384 @item -fdump-rtl-mach
19385 Dump after performing the machine dependent reorganization pass, if that
19386 pass exists.
19388 @opindex fdump-rtl-mode_sw
19389 @item -fdump-rtl-mode_sw
19390 Dump after removing redundant mode switches.
19392 @opindex fdump-rtl-rnreg
19393 @item -fdump-rtl-rnreg
19394 Dump after register renumbering.
19396 @opindex fdump-rtl-outof_cfglayout
19397 @item -fdump-rtl-outof_cfglayout
19398 Dump after converting from cfglayout mode.
19400 @opindex fdump-rtl-peephole2
19401 @item -fdump-rtl-peephole2
19402 Dump after the peephole pass.
19404 @opindex fdump-rtl-postreload
19405 @item -fdump-rtl-postreload
19406 Dump after post-reload optimizations.
19408 @opindex fdump-rtl-pro_and_epilogue
19409 @item -fdump-rtl-pro_and_epilogue
19410 Dump after generating the function prologues and epilogues.
19412 @opindex fdump-rtl-sched1
19413 @opindex fdump-rtl-sched2
19414 @item -fdump-rtl-sched1
19415 @itemx -fdump-rtl-sched2
19416 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19417 after the basic block scheduling passes.
19419 @opindex fdump-rtl-ree
19420 @item -fdump-rtl-ree
19421 Dump after sign/zero extension elimination.
19423 @opindex fdump-rtl-seqabstr
19424 @item -fdump-rtl-seqabstr
19425 Dump after common sequence discovery.
19427 @opindex fdump-rtl-shorten
19428 @item -fdump-rtl-shorten
19429 Dump after shortening branches.
19431 @opindex fdump-rtl-sibling
19432 @item -fdump-rtl-sibling
19433 Dump after sibling call optimizations.
19435 @opindex fdump-rtl-split1
19436 @opindex fdump-rtl-split2
19437 @opindex fdump-rtl-split3
19438 @opindex fdump-rtl-split4
19439 @opindex fdump-rtl-split5
19440 @item -fdump-rtl-split1
19441 @itemx -fdump-rtl-split2
19442 @itemx -fdump-rtl-split3
19443 @itemx -fdump-rtl-split4
19444 @itemx -fdump-rtl-split5
19445 These options enable dumping after five rounds of
19446 instruction splitting.
19448 @opindex fdump-rtl-sms
19449 @item -fdump-rtl-sms
19450 Dump after modulo scheduling.  This pass is only run on some
19451 architectures.
19453 @opindex fdump-rtl-stack
19454 @item -fdump-rtl-stack
19455 Dump after conversion from GCC's ``flat register file'' registers to the
19456 x87's stack-like registers.  This pass is only run on x86 variants.
19458 @opindex fdump-rtl-subreg1
19459 @opindex fdump-rtl-subreg2
19460 @item -fdump-rtl-subreg1
19461 @itemx -fdump-rtl-subreg2
19462 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19463 the two subreg expansion passes.
19465 @opindex fdump-rtl-unshare
19466 @item -fdump-rtl-unshare
19467 Dump after all rtl has been unshared.
19469 @opindex fdump-rtl-vartrack
19470 @item -fdump-rtl-vartrack
19471 Dump after variable tracking.
19473 @opindex fdump-rtl-vregs
19474 @item -fdump-rtl-vregs
19475 Dump after converting virtual registers to hard registers.
19477 @opindex fdump-rtl-web
19478 @item -fdump-rtl-web
19479 Dump after live range splitting.
19481 @opindex fdump-rtl-regclass
19482 @opindex fdump-rtl-subregs_of_mode_init
19483 @opindex fdump-rtl-subregs_of_mode_finish
19484 @opindex fdump-rtl-dfinit
19485 @opindex fdump-rtl-dfinish
19486 @item -fdump-rtl-regclass
19487 @itemx -fdump-rtl-subregs_of_mode_init
19488 @itemx -fdump-rtl-subregs_of_mode_finish
19489 @itemx -fdump-rtl-dfinit
19490 @itemx -fdump-rtl-dfinish
19491 These dumps are defined but always produce empty files.
19493 @opindex da
19494 @opindex fdump-rtl-all
19495 @item -da
19496 @itemx -fdump-rtl-all
19497 Produce all the dumps listed above.
19499 @opindex dA
19500 @item -dA
19501 Annotate the assembler output with miscellaneous debugging information.
19503 @opindex dD
19504 @item -dD
19505 Dump all macro definitions, at the end of preprocessing, in addition to
19506 normal output.
19508 @opindex dH
19509 @item -dH
19510 Produce a core dump whenever an error occurs.
19512 @opindex dp
19513 @item -dp
19514 Annotate the assembler output with a comment indicating which
19515 pattern and alternative is used.  The length and cost of each instruction are
19516 also printed.
19518 @opindex dP
19519 @item -dP
19520 Dump the RTL in the assembler output as a comment before each instruction.
19521 Also turns on @option{-dp} annotation.
19523 @opindex dx
19524 @item -dx
19525 Just generate RTL for a function instead of compiling it.  Usually used
19526 with @option{-fdump-rtl-expand}.
19527 @end table
19529 @opindex fdump-debug
19530 @item -fdump-debug
19531 Dump debugging information generated during the debug
19532 generation phase.
19534 @opindex fdump-earlydebug
19535 @item -fdump-earlydebug
19536 Dump debugging information generated during the early debug
19537 generation phase.
19539 @opindex fdump-noaddr
19540 @item -fdump-noaddr
19541 When doing debugging dumps, suppress address output.  This makes it more
19542 feasible to use diff on debugging dumps for compiler invocations with
19543 different compiler binaries and/or different
19544 text / bss / data / heap / stack / dso start locations.
19546 @opindex freport-bug
19547 @item -freport-bug
19548 Collect and dump debug information into a temporary file if an
19549 internal compiler error (ICE) occurs.
19551 @opindex fdump-unnumbered
19552 @item -fdump-unnumbered
19553 When doing debugging dumps, suppress instruction numbers and address output.
19554 This makes it more feasible to use diff on debugging dumps for compiler
19555 invocations with different options, in particular with and without
19556 @option{-g}.
19558 @opindex fdump-unnumbered-links
19559 @item -fdump-unnumbered-links
19560 When doing debugging dumps (see @option{-d} option above), suppress
19561 instruction numbers for the links to the previous and next instructions
19562 in a sequence.
19564 @opindex fdump-ipa
19565 @item -fdump-ipa-@var{switch}
19566 @itemx -fdump-ipa-@var{switch}-@var{options}
19567 Control the dumping at various stages of inter-procedural analysis
19568 language tree to a file.  The file name is generated by appending a
19569 switch specific suffix to the source file name, and the file is created
19570 in the same directory as the output file.  The following dumps are
19571 possible:
19573 @table @samp
19574 @item all
19575 Enables all inter-procedural analysis dumps.
19577 @item cgraph
19578 Dumps information about call-graph optimization, unused function removal,
19579 and inlining decisions.
19581 @item inline
19582 Dump after function inlining.
19584 @end table
19586 Additionally, the options @option{-optimized}, @option{-missed},
19587 @option{-note}, and @option{-all} can be provided, with the same meaning
19588 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19590 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19591 information on callsites that were inlined, along with callsites
19592 that were not inlined.
19594 By default, the dump will contain messages about successful
19595 optimizations (equivalent to @option{-optimized}) together with
19596 low-level details about the analysis.
19598 @opindex fdump-lang
19599 @item -fdump-lang
19600 Dump language-specific information.  The file name is made by appending
19601 @file{.lang} to the source file name.
19603 @opindex fdump-lang-all
19604 @opindex fdump-lang
19605 @item -fdump-lang-all
19606 @itemx -fdump-lang-@var{switch}
19607 @itemx -fdump-lang-@var{switch}-@var{options}
19608 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19609 Control the dumping of language-specific information.  The @var{options}
19610 and @var{filename} portions behave as described in the
19611 @option{-fdump-tree} option.  The following @var{switch} values are
19612 accepted:
19614 @table @samp
19615 @item all
19617 Enable all language-specific dumps.
19619 @item class
19620 Dump class hierarchy information.  Virtual table information is emitted
19621 unless '@option{slim}' is specified.  This option is applicable to C++ only.
19623 @item module
19624 Dump module information.  Options @option{lineno} (locations),
19625 @option{graph} (reachability), @option{blocks} (clusters),
19626 @option{uid} (serialization), @option{alias} (mergeable),
19627 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19628 (macros) may provide additional information.  This option is
19629 applicable to C++ only.
19631 @item raw
19632 Dump the raw internal tree data.  This option is applicable to C++ only.
19634 @end table
19636 @opindex fdump-passes
19637 @item -fdump-passes
19638 Print on @file{stderr} the list of optimization passes that are turned
19639 on and off by the current command-line options.
19641 @opindex fdump-statistics
19642 @item -fdump-statistics-@var{option}
19643 Enable and control dumping of pass statistics in a separate file.  The
19644 file name is generated by appending a suffix ending in
19645 @samp{.statistics} to the source file name, and the file is created in
19646 the same directory as the output file.  If the @samp{-@var{option}}
19647 form is used, @samp{-stats} causes counters to be summed over the
19648 whole compilation unit while @samp{-details} dumps every event as
19649 the passes generate them.  The default with no option is to sum
19650 counters for each function compiled.
19652 @opindex fdump-tree-all
19653 @opindex fdump-tree
19654 @item -fdump-tree-all
19655 @itemx -fdump-tree-@var{switch}
19656 @itemx -fdump-tree-@var{switch}-@var{options}
19657 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19658 Control the dumping at various stages of processing the intermediate
19659 language tree to a file.  If the @samp{-@var{options}}
19660 form is used, @var{options} is a list of @samp{-} separated options
19661 which control the details of the dump.  Not all options are applicable
19662 to all dumps; those that are not meaningful are ignored.  The
19663 following options are available
19665 @table @samp
19666 @item address
19667 Print the address of each node.  Usually this is not meaningful as it
19668 changes according to the environment and source file.  Its primary use
19669 is for tying up a dump file with a debug environment.
19670 @item asmname
19671 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19672 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
19673 use working backward from mangled names in the assembly file.
19674 @item slim
19675 When dumping front-end intermediate representations, inhibit dumping
19676 of members of a scope or body of a function merely because that scope
19677 has been reached.  Only dump such items when they are directly reachable
19678 by some other path.
19680 When dumping pretty-printed trees, this option inhibits dumping the
19681 bodies of control structures.
19683 When dumping RTL, print the RTL in slim (condensed) form instead of
19684 the default LISP-like representation.
19685 @item raw
19686 Print a raw representation of the tree.  By default, trees are
19687 pretty-printed into a C-like representation.
19688 @item details
19689 Enable more detailed dumps (not honored by every dump option). Also
19690 include information from the optimization passes.
19691 @item stats
19692 Enable dumping various statistics about the pass (not honored by every dump
19693 option).
19694 @item blocks
19695 Enable showing basic block boundaries (disabled in raw dumps).
19696 @item graph
19697 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19698 dump a representation of the control flow graph suitable for viewing with
19699 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
19700 the file is pretty-printed as a subgraph, so that GraphViz can render them
19701 all in a single plot.
19703 This option currently only works for RTL dumps, and the RTL is always
19704 dumped in slim form.
19705 @item vops
19706 Enable showing virtual operands for every statement.
19707 @item lineno
19708 Enable showing line numbers for statements.
19709 @item uid
19710 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19711 @item verbose
19712 Enable showing the tree dump for each statement.
19713 @item eh
19714 Enable showing the EH region number holding each statement.
19715 @item scev
19716 Enable showing scalar evolution analysis details.
19717 @item optimized
19718 Enable showing optimization information (only available in certain
19719 passes).
19720 @item missed
19721 Enable showing missed optimization information (only available in certain
19722 passes).
19723 @item note
19724 Enable other detailed optimization information (only available in
19725 certain passes).
19726 @item all
19727 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19728 and @option{lineno}.
19729 @item optall
19730 Turn on all optimization options, i.e., @option{optimized},
19731 @option{missed}, and @option{note}.
19732 @end table
19734 To determine what tree dumps are available or find the dump for a pass
19735 of interest follow the steps below.
19737 @enumerate
19738 @item
19739 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19740 look for a code that corresponds to the pass you are interested in.
19741 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19742 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19743 The number at the end distinguishes distinct invocations of the same pass.
19744 @item
19745 To enable the creation of the dump file, append the pass code to
19746 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
19747 to enable the dump from the Early Value Range Propagation pass, invoke
19748 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
19749 specify the name of the dump file.  If you don't specify one, GCC
19750 creates as described below.
19751 @item
19752 Find the pass dump in a file whose name is composed of three components
19753 separated by a period: the name of the source file GCC was invoked to
19754 compile, a numeric suffix indicating the pass number followed by the
19755 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19756 and finally the pass code.  For example, the Early VRP pass dump might
19757 be in a file named @file{myfile.c.038t.evrp} in the current working
19758 directory.  Note that the numeric codes are not stable and may change
19759 from one version of GCC to another.
19760 @end enumerate
19762 @opindex fopt-info
19763 @item -fopt-info
19764 @itemx -fopt-info-@var{options}
19765 @itemx -fopt-info-@var{options}=@var{filename}
19766 Controls optimization dumps from various optimization passes. If the
19767 @samp{-@var{options}} form is used, @var{options} is a list of
19768 @samp{-} separated option keywords to select the dump details and
19769 optimizations.  
19771 The @var{options} can be divided into three groups:
19772 @enumerate
19773 @item
19774 options describing what kinds of messages should be emitted,
19775 @item
19776 options describing the verbosity of the dump, and
19777 @item
19778 options describing which optimizations should be included.
19779 @end enumerate
19780 The options from each group can be freely mixed as they are
19781 non-overlapping. However, in case of any conflicts,
19782 the later options override the earlier options on the command
19783 line. 
19785 The following options control which kinds of messages should be emitted:
19787 @table @samp
19788 @item optimized
19789 Print information when an optimization is successfully applied. It is
19790 up to a pass to decide which information is relevant. For example, the
19791 vectorizer passes print the source location of loops which are
19792 successfully vectorized.
19793 @item missed
19794 Print information about missed optimizations. Individual passes
19795 control which information to include in the output. 
19796 @item note
19797 Print verbose information about optimizations, such as certain
19798 transformations, more detailed messages about decisions etc.
19799 @item all
19800 Print detailed optimization information. This includes
19801 @samp{optimized}, @samp{missed}, and @samp{note}.
19802 @end table
19804 The following option controls the dump verbosity:
19806 @table @samp
19807 @item internals
19808 By default, only ``high-level'' messages are emitted. This option enables
19809 additional, more detailed, messages, which are likely to only be of interest
19810 to GCC developers.
19811 @end table
19813 One or more of the following option keywords can be used to describe a
19814 group of optimizations:
19816 @table @samp
19817 @item ipa
19818 Enable dumps from all interprocedural optimizations.
19819 @item loop
19820 Enable dumps from all loop optimizations.
19821 @item inline
19822 Enable dumps from all inlining optimizations.
19823 @item omp
19824 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19825 @item vec
19826 Enable dumps from all vectorization optimizations.
19827 @item optall
19828 Enable dumps from all optimizations. This is a superset of
19829 the optimization groups listed above.
19830 @end table
19832 If @var{options} is
19833 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19834 about successful optimizations from all the passes, omitting messages
19835 that are treated as ``internals''.
19837 If the @var{filename} is provided, then the dumps from all the
19838 applicable optimizations are concatenated into the @var{filename}.
19839 Otherwise the dump is output onto @file{stderr}. Though multiple
19840 @option{-fopt-info} options are accepted, only one of them can include
19841 a @var{filename}. If other filenames are provided then all but the
19842 first such option are ignored.
19844 Note that the output @var{filename} is overwritten
19845 in case of multiple translation units. If a combined output from
19846 multiple translation units is desired, @file{stderr} should be used
19847 instead.
19849 In the following example, the optimization info is output to
19850 @file{stderr}:
19852 @smallexample
19853 gcc -O3 -fopt-info
19854 @end smallexample
19856 This example:
19857 @smallexample
19858 gcc -O3 -fopt-info-missed=missed.all
19859 @end smallexample
19861 @noindent
19862 outputs missed optimization report from all the passes into
19863 @file{missed.all}, and this one:
19865 @smallexample
19866 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19867 @end smallexample
19869 @noindent
19870 prints information about missed optimization opportunities from
19871 vectorization passes on @file{stderr}.  
19872 Note that @option{-fopt-info-vec-missed} is equivalent to 
19873 @option{-fopt-info-missed-vec}.  The order of the optimization group
19874 names and message types listed after @option{-fopt-info} does not matter.
19876 As another example,
19877 @smallexample
19878 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19879 @end smallexample
19881 @noindent
19882 outputs information about missed optimizations as well as
19883 optimized locations from all the inlining passes into
19884 @file{inline.txt}.
19886 Finally, consider:
19888 @smallexample
19889 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19890 @end smallexample
19892 @noindent
19893 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19894 in conflict since only one output file is allowed. In this case, only
19895 the first option takes effect and the subsequent options are
19896 ignored. Thus only @file{vec.miss} is produced which contains
19897 dumps from the vectorizer about missed opportunities.
19899 @opindex fsave-optimization-record
19900 @item -fsave-optimization-record
19901 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19902 were performed, for those optimizations that support @option{-fopt-info}.
19904 This option is experimental and the format of the data within the
19905 compressed JSON file is subject to change.
19907 It is roughly equivalent to a machine-readable version of
19908 @option{-fopt-info-all}, as a collection of messages with source file,
19909 line number and column number, with the following additional data for
19910 each message:
19912 @itemize @bullet
19914 @item
19915 the execution count of the code being optimized, along with metadata about
19916 whether this was from actual profile data, or just an estimate, allowing
19917 consumers to prioritize messages by code hotness,
19919 @item
19920 the function name of the code being optimized, where applicable,
19922 @item
19923 the ``inlining chain'' for the code being optimized, so that when
19924 a function is inlined into several different places (which might
19925 themselves be inlined), the reader can distinguish between the copies,
19927 @item
19928 objects identifying those parts of the message that refer to expressions,
19929 statements or symbol-table nodes, which of these categories they are, and,
19930 when available, their source code location,
19932 @item
19933 the GCC pass that emitted the message, and
19935 @item
19936 the location in GCC's own code from which the message was emitted
19938 @end itemize
19940 Additionally, some messages are logically nested within other
19941 messages, reflecting implementation details of the optimization
19942 passes.
19944 @opindex fsched-verbose
19945 @item -fsched-verbose=@var{n}
19946 On targets that use instruction scheduling, this option controls the
19947 amount of debugging output the scheduler prints to the dump files.
19949 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19950 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19951 For @var{n} greater than one, it also output basic block probabilities,
19952 detailed ready list information and unit/insn info.  For @var{n} greater
19953 than two, it includes RTL at abort point, control-flow and regions info.
19954 And for @var{n} over four, @option{-fsched-verbose} also includes
19955 dependence info.
19959 @opindex fdisable-
19960 @opindex fenable-
19961 @item -fenable-@var{kind}-@var{pass}
19962 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19964 This is a set of options that are used to explicitly disable/enable
19965 optimization passes.  These options are intended for use for debugging GCC.
19966 Compiler users should use regular options for enabling/disabling
19967 passes instead.
19969 @table @gcctabopt
19971 @item -fdisable-ipa-@var{pass}
19972 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
19973 statically invoked in the compiler multiple times, the pass name should be
19974 appended with a sequential number starting from 1.
19976 @item -fdisable-rtl-@var{pass}
19977 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19978 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19979 statically invoked in the compiler multiple times, the pass name should be
19980 appended with a sequential number starting from 1.  @var{range-list} is a 
19981 comma-separated list of function ranges or assembler names.  Each range is a number
19982 pair separated by a colon.  The range is inclusive in both ends.  If the range
19983 is trivial, the number pair can be simplified as a single number.  If the
19984 function's call graph node's @var{uid} falls within one of the specified ranges,
19985 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
19986 function header of a dump file, and the pass names can be dumped by using
19987 option @option{-fdump-passes}.
19989 @item -fdisable-tree-@var{pass}
19990 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19991 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
19992 option arguments.
19994 @item -fenable-ipa-@var{pass}
19995 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19996 statically invoked in the compiler multiple times, the pass name should be
19997 appended with a sequential number starting from 1.
19999 @item -fenable-rtl-@var{pass}
20000 @itemx -fenable-rtl-@var{pass}=@var{range-list}
20001 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
20002 description and examples.
20004 @item -fenable-tree-@var{pass}
20005 @itemx -fenable-tree-@var{pass}=@var{range-list}
20006 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
20007 of option arguments.
20009 @end table
20011 Here are some examples showing uses of these options.
20013 @smallexample
20015 # disable ccp1 for all functions
20016    -fdisable-tree-ccp1
20017 # disable complete unroll for function whose cgraph node uid is 1
20018    -fenable-tree-cunroll=1
20019 # disable gcse2 for functions at the following ranges [1,1],
20020 # [300,400], and [400,1000]
20021 # disable gcse2 for functions foo and foo2
20022    -fdisable-rtl-gcse2=foo,foo2
20023 # disable early inlining
20024    -fdisable-tree-einline
20025 # disable ipa inlining
20026    -fdisable-ipa-inline
20027 # enable tree full unroll
20028    -fenable-tree-unroll
20030 @end smallexample
20032 @opindex fchecking
20033 @opindex fno-checking
20034 @item -fchecking
20035 @itemx -fchecking=@var{n}
20036 Enable internal consistency checking.  The default depends on
20037 the compiler configuration.  @option{-fchecking=2} enables further
20038 internal consistency checking that might affect code generation.
20040 @opindex frandom-seed
20041 @item -frandom-seed=@var{string}
20042 This option provides a seed that GCC uses in place of
20043 random numbers in generating certain symbol names
20044 that have to be different in every compiled file.  It is also used to
20045 place unique stamps in coverage data files and the object files that
20046 produce them.  You can use the @option{-frandom-seed} option to produce
20047 reproducibly identical object files.
20049 The @var{string} can either be a number (decimal, octal or hex) or an
20050 arbitrary string (in which case it's converted to a number by
20051 computing CRC32).
20053 The @var{string} should be different for every file you compile.
20055 @opindex save-temps
20056 @item -save-temps
20057 Store the usual ``temporary'' intermediate files permanently; name them
20058 as auxiliary output files, as specified described under
20059 @option{-dumpbase} and @option{-dumpdir}.
20061 When used in combination with the @option{-x} command-line option,
20062 @option{-save-temps} is sensible enough to avoid overwriting an
20063 input source file with the same extension as an intermediate file.
20064 The corresponding intermediate file may be obtained by renaming the
20065 source file before using @option{-save-temps}.
20067 @opindex save-temps=cwd
20068 @item -save-temps=cwd
20069 Equivalent to @option{-save-temps -dumpdir ./}.
20071 @opindex save-temps=obj
20072 @item -save-temps=obj
20073 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
20074 @file{outdir/} is the directory of the output file specified after the
20075 @option{-o} option, including any directory separators.  If the
20076 @option{-o} option is not used, the @option{-save-temps=obj} switch
20077 behaves like @option{-save-temps=cwd}.
20079 @opindex time
20080 @item -time@r{[}=@var{file}@r{]}
20081 Report the CPU time taken by each subprocess in the compilation
20082 sequence.  For C source files, this is the compiler proper and assembler
20083 (plus the linker if linking is done).
20085 Without the specification of an output file, the output looks like this:
20087 @smallexample
20088 # cc1 0.12 0.01
20089 # as 0.00 0.01
20090 @end smallexample
20092 The first number on each line is the ``user time'', that is time spent
20093 executing the program itself.  The second number is ``system time'',
20094 time spent executing operating system routines on behalf of the program.
20095 Both numbers are in seconds.
20097 With the specification of an output file, the output is appended to the
20098 named file, and it looks like this:
20100 @smallexample
20101 0.12 0.01 cc1 @var{options}
20102 0.00 0.01 as @var{options}
20103 @end smallexample
20105 The ``user time'' and the ``system time'' are moved before the program
20106 name, and the options passed to the program are displayed, so that one
20107 can later tell what file was being compiled, and with which options.
20109 @opindex fdump-final-insns
20110 @item -fdump-final-insns@r{[}=@var{file}@r{]}
20111 Dump the final internal representation (RTL) to @var{file}.  If the
20112 optional argument is omitted (or if @var{file} is @code{.}), the name
20113 of the dump file is determined by appending @code{.gkd} to the
20114 dump base name, see @option{-dumpbase}.
20116 @opindex fcompare-debug
20117 @opindex fno-compare-debug
20118 @item -fcompare-debug@r{[}=@var{opts}@r{]}
20119 If no error occurs during compilation, run the compiler a second time,
20120 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
20121 passed to the second compilation.  Dump the final internal
20122 representation in both compilations, and print an error if they differ.
20124 If the equal sign is omitted, the default @option{-gtoggle} is used.
20126 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
20127 and nonzero, implicitly enables @option{-fcompare-debug}.  If
20128 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
20129 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
20130 is used.
20132 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
20133 is equivalent to @option{-fno-compare-debug}, which disables the dumping
20134 of the final representation and the second compilation, preventing even
20135 @env{GCC_COMPARE_DEBUG} from taking effect.
20137 To verify full coverage during @option{-fcompare-debug} testing, set
20138 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
20139 which GCC rejects as an invalid option in any actual compilation
20140 (rather than preprocessing, assembly or linking).  To get just a
20141 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
20142 not overridden} will do.
20144 @opindex fcompare-debug-second
20145 @item -fcompare-debug-second
20146 This option is implicitly passed to the compiler for the second
20147 compilation requested by @option{-fcompare-debug}, along with options to
20148 silence warnings, and omitting other options that would cause the compiler
20149 to produce output to files or to standard output as a side effect.  Dump
20150 files and preserved temporary files are renamed so as to contain the
20151 @code{.gk} additional extension during the second compilation, to avoid
20152 overwriting those generated by the first.
20154 When this option is passed to the compiler driver, it causes the
20155 @emph{first} compilation to be skipped, which makes it useful for little
20156 other than debugging the compiler proper.
20158 @opindex gtoggle
20159 @item -gtoggle
20160 Turn off generation of debug info, if leaving out this option
20161 generates it, or turn it on at level 2 otherwise.  The position of this
20162 argument in the command line does not matter; it takes effect after all
20163 other options are processed, and it does so only once, no matter how
20164 many times it is given.  This is mainly intended to be used with
20165 @option{-fcompare-debug}.
20167 @opindex fvar-tracking-assignments-toggle
20168 @opindex fno-var-tracking-assignments-toggle
20169 @item -fvar-tracking-assignments-toggle
20170 Toggle @option{-fvar-tracking-assignments}, in the same way that
20171 @option{-gtoggle} toggles @option{-g}.
20173 @opindex Q
20174 @item -Q
20175 Makes the compiler print out each function name as it is compiled, and
20176 print some statistics about each pass when it finishes.
20178 @opindex ftime-report
20179 @item -ftime-report
20180 Makes the compiler print some statistics to stderr about the time consumed
20181 by each pass when it finishes.
20183 If SARIF output of diagnostics was requested via
20184 @option{-fdiagnostics-format=sarif-file} or
20185 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20186 information is instead emitted in JSON form as part of SARIF output.  The
20187 precise format of this JSON data is subject to change, and the values may
20188 not exactly match those emitted to stderr due to being written out at a
20189 slightly different place within the compiler.
20191 @opindex ftime-report-details
20192 @item -ftime-report-details
20193 Record the time consumed by infrastructure parts separately for each pass.
20195 @opindex fira-verbose
20196 @item -fira-verbose=@var{n}
20197 Control the verbosity of the dump file for the integrated register allocator.
20198 The default value is 5.  If the value @var{n} is greater or equal to 10,
20199 the dump output is sent to stderr using the same format as @var{n} minus 10.
20201 @opindex flto-report
20202 @item -flto-report
20203 Prints a report with internal details on the workings of the link-time
20204 optimizer.  The contents of this report vary from version to version.
20205 It is meant to be useful to GCC developers when processing object
20206 files in LTO mode (via @option{-flto}).
20208 Disabled by default.
20210 @opindex flto-report-wpa
20211 @item -flto-report-wpa
20212 Like @option{-flto-report}, but only print for the WPA phase of link-time
20213 optimization.
20215 @opindex fmem-report
20216 @item -fmem-report
20217 Makes the compiler print some statistics about permanent memory
20218 allocation when it finishes.
20220 @opindex fmem-report-wpa
20221 @item -fmem-report-wpa
20222 Makes the compiler print some statistics about permanent memory
20223 allocation for the WPA phase only.
20225 @opindex fpre-ipa-mem-report
20226 @opindex fpost-ipa-mem-report
20227 @item -fpre-ipa-mem-report
20228 @item -fpost-ipa-mem-report
20229 Makes the compiler print some statistics about permanent memory
20230 allocation before or after interprocedural optimization.
20232 @opindex fmultiflags
20233 @item -fmultiflags
20234 This option enables multilib-aware @code{TFLAGS} to be used to build
20235 target libraries with options different from those the compiler is
20236 configured to use by default, through the use of specs (@xref{Spec
20237 Files}) set up by compiler internals, by the target, or by builders at
20238 configure time.
20240 Like @code{TFLAGS}, this allows the target libraries to be built for
20241 portable baseline environments, while the compiler defaults to more
20242 demanding ones.  That's useful because users can easily override the
20243 defaults the compiler is configured to use to build their own programs,
20244 if the defaults are not ideal for their target environment, whereas
20245 rebuilding the runtime libraries is usually not as easy or desirable.
20247 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20248 selected for different multilibs.  The way to accomplish that is to
20249 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20250 @samp{--with-specs=%@{fmultiflags:...@}}.
20252 This option is discarded by the driver once it's done processing driver
20253 self spec.
20255 It is also useful to check that @code{TFLAGS} are being used to build
20256 all target libraries, by configuring a non-bootstrap compiler
20257 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20258 the compiler and target libraries.
20260 @opindex fprofile-report
20261 @item -fprofile-report
20262 Makes the compiler print some statistics about consistency of the
20263 (estimated) profile and effect of individual passes.
20265 @opindex fstack-usage
20266 @item -fstack-usage
20267 Makes the compiler output stack usage information for the program, on a
20268 per-function basis.  The filename for the dump is made by appending
20269 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20270 the output file, if explicitly specified and it is not an executable,
20271 otherwise it is the basename of the source file.  An entry is made up
20272 of three fields:
20274 @itemize
20275 @item
20276 The name of the function.
20277 @item
20278 A number of bytes.
20279 @item
20280 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20281 @end itemize
20283 The qualifier @code{static} means that the function manipulates the stack
20284 statically: a fixed number of bytes are allocated for the frame on function
20285 entry and released on function exit; no stack adjustments are otherwise made
20286 in the function.  The second field is this fixed number of bytes.
20288 The qualifier @code{dynamic} means that the function manipulates the stack
20289 dynamically: in addition to the static allocation described above, stack
20290 adjustments are made in the body of the function, for example to push/pop
20291 arguments around function calls.  If the qualifier @code{bounded} is also
20292 present, the amount of these adjustments is bounded at compile time and
20293 the second field is an upper bound of the total amount of stack used by
20294 the function.  If it is not present, the amount of these adjustments is
20295 not bounded at compile time and the second field only represents the
20296 bounded part.
20298 @opindex fstats
20299 @item -fstats
20300 Emit statistics about front-end processing at the end of the compilation.
20301 This option is supported only by the C++ front end, and
20302 the information is generally only useful to the G++ development team.
20304 @opindex fdbg-cnt-list
20305 @item -fdbg-cnt-list
20306 Print the name and the counter upper bound for all debug counters.
20309 @opindex fdbg-cnt
20310 @item -fdbg-cnt=@var{counter-value-list}
20311 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20312 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20313 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20314 the name of the counter and list of closed intervals.
20315 The @var{lower_bound} is optional and is zero
20316 initialized if not set.
20317 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20318 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20319 eleventh invocation.
20320 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20322 @opindex print-file-name
20323 @item -print-file-name=@var{library}
20324 Print the full absolute name of the library file @var{library} that
20325 would be used when linking---and don't do anything else.  With this
20326 option, GCC does not compile or link anything; it just prints the
20327 file name.
20329 @opindex print-multi-directory
20330 @item -print-multi-directory
20331 Print the directory name corresponding to the multilib selected by any
20332 other switches present in the command line.  This directory is supposed
20333 to exist in @env{GCC_EXEC_PREFIX}.
20335 @opindex print-multi-lib
20336 @item -print-multi-lib
20337 Print the mapping from multilib directory names to compiler switches
20338 that enable them.  The directory name is separated from the switches by
20339 @samp{;}, and each switch starts with an @samp{@@} instead of the
20340 @samp{-}, without spaces between multiple switches.  This is supposed to
20341 ease shell processing.
20343 @opindex print-multi-os-directory
20344 @item -print-multi-os-directory
20345 Print the path to OS libraries for the selected
20346 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20347 present in the @file{lib} subdirectory and no multilibs are used, this is
20348 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20349 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20350 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20351 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20353 @opindex print-multiarch
20354 @item -print-multiarch
20355 Print the path to OS libraries for the selected multiarch,
20356 relative to some @file{lib} subdirectory.
20358 @opindex print-prog-name
20359 @item -print-prog-name=@var{program}
20360 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20362 @opindex print-libgcc-file-name
20363 @item -print-libgcc-file-name
20364 Same as @option{-print-file-name=libgcc.a}.
20366 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20367 but you do want to link with @file{libgcc.a}.  You can do:
20369 @smallexample
20370 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20371 @end smallexample
20373 @opindex print-search-dirs
20374 @item -print-search-dirs
20375 Print the name of the configured installation directory and a list of
20376 program and library directories @command{gcc} searches---and don't do anything else.
20378 This is useful when @command{gcc} prints the error message
20379 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20380 To resolve this you either need to put @file{cpp0} and the other compiler
20381 components where @command{gcc} expects to find them, or you can set the environment
20382 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20383 Don't forget the trailing @samp{/}.
20384 @xref{Environment Variables}.
20386 @opindex print-sysroot
20387 @item -print-sysroot
20388 Print the target sysroot directory that is used during
20389 compilation.  This is the target sysroot specified either at configure
20390 time or using the @option{--sysroot} option, possibly with an extra
20391 suffix that depends on compilation options.  If no target sysroot is
20392 specified, the option prints nothing.
20394 @opindex print-sysroot-headers-suffix
20395 @item -print-sysroot-headers-suffix
20396 Print the suffix added to the target sysroot when searching for
20397 headers, or give an error if the compiler is not configured with such
20398 a suffix---and don't do anything else.
20400 @opindex dumpmachine
20401 @item -dumpmachine
20402 Print the compiler's target machine (for example,
20403 @samp{i686-pc-linux-gnu})---and don't do anything else.
20405 @opindex dumpversion
20406 @item -dumpversion
20407 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20408 anything else.  This is the compiler version used in filesystem paths and
20409 specs. Depending on how the compiler has been configured it can be just
20410 a single number (major version), two numbers separated by a dot (major and
20411 minor version) or three numbers separated by dots (major, minor and patchlevel
20412 version).
20414 @opindex dumpfullversion
20415 @item -dumpfullversion
20416 Print the full compiler version---and don't do anything else. The output is
20417 always three numbers separated by dots, major, minor and patchlevel version.
20419 @opindex dumpspecs
20420 @item -dumpspecs
20421 Print the compiler's built-in specs---and don't do anything else.  (This
20422 is used when GCC itself is being built.)  @xref{Spec Files}.
20423 @end table
20425 @node Submodel Options
20426 @section Machine-Dependent Options
20427 @cindex submodel options
20428 @cindex specifying hardware config
20429 @cindex hardware models and configurations, specifying
20430 @cindex target-dependent options
20431 @cindex machine-dependent options
20433 Each target machine supported by GCC can have its own options---for
20434 example, to allow you to compile for a particular processor variant or
20435 ABI, or to control optimizations specific to that machine.  By
20436 convention, the names of machine-specific options start with
20437 @samp{-m}.
20439 Some configurations of the compiler also support additional target-specific
20440 options, usually for compatibility with other compilers on the same
20441 platform.
20443 @c This list is ordered alphanumerically by subsection name.
20444 @c It should be the same order and spelling as these options are listed
20445 @c in Machine Dependent Options
20447 @menu
20448 * AArch64 Options::
20449 * Adapteva Epiphany Options::
20450 * AMD GCN Options::
20451 * ARC Options::
20452 * ARM Options::
20453 * AVR Options::
20454 * Blackfin Options::
20455 * C6X Options::
20456 * CRIS Options::
20457 * C-SKY Options::
20458 * Darwin Options::
20459 * DEC Alpha Options::
20460 * eBPF Options::
20461 * FR30 Options::
20462 * FT32 Options::
20463 * FRV Options::
20464 * GNU/Linux Options::
20465 * H8/300 Options::
20466 * HPPA Options::
20467 * IA-64 Options::
20468 * LM32 Options::
20469 * LoongArch Options::
20470 * M32C Options::
20471 * M32R/D Options::
20472 * M680x0 Options::
20473 * MCore Options::
20474 * MicroBlaze Options::
20475 * MIPS Options::
20476 * MMIX Options::
20477 * MN10300 Options::
20478 * Moxie Options::
20479 * MSP430 Options::
20480 * NDS32 Options::
20481 * Nios II Options::
20482 * Nvidia PTX Options::
20483 * OpenRISC Options::
20484 * PDP-11 Options::
20485 * PowerPC Options::
20486 * PRU Options::
20487 * RISC-V Options::
20488 * RL78 Options::
20489 * RS/6000 and PowerPC Options::
20490 * RX Options::
20491 * S/390 and zSeries Options::
20492 * SH Options::
20493 * Solaris 2 Options::
20494 * SPARC Options::
20495 * System V Options::
20496 * V850 Options::
20497 * VAX Options::
20498 * Visium Options::
20499 * VMS Options::
20500 * VxWorks Options::
20501 * x86 Options::
20502 * x86 Windows Options::
20503 * Xstormy16 Options::
20504 * Xtensa Options::
20505 * zSeries Options::
20506 @end menu
20508 @node AArch64 Options
20509 @subsection AArch64 Options
20510 @cindex AArch64 Options
20512 These options are defined for AArch64 implementations:
20514 @table @gcctabopt
20516 @opindex mabi
20517 @item -mabi=@var{name}
20518 Generate code for the specified data model.  Permissible values
20519 are @samp{ilp32} for SysV-like data model where int, long int and pointers
20520 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
20521 but long int and pointers are 64 bits.
20523 The default depends on the specific target configuration.  Note that
20524 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
20525 entire program with the same ABI, and link with a compatible set of libraries.
20527 @opindex mbig-endian
20528 @item -mbig-endian
20529 Generate big-endian code.  This is the default when GCC is configured for an
20530 @samp{aarch64_be-*-*} target.
20532 @opindex mgeneral-regs-only
20533 @item -mgeneral-regs-only
20534 Generate code which uses only the general-purpose registers.  This will prevent
20535 the compiler from using floating-point and Advanced SIMD registers but will not
20536 impose any restrictions on the assembler.
20538 @opindex mlittle-endian
20539 @item -mlittle-endian
20540 Generate little-endian code.  This is the default when GCC is configured for an
20541 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
20543 @opindex mcmodel=tiny
20544 @item -mcmodel=tiny
20545 Generate code for the tiny code model.  The program and its statically defined
20546 symbols must be within 1MB of each other.  Programs can be statically or
20547 dynamically linked.
20549 @opindex mcmodel=small
20550 @item -mcmodel=small
20551 Generate code for the small code model.  The program and its statically defined
20552 symbols must be within 4GB of each other.  Programs can be statically or
20553 dynamically linked.  This is the default code model.
20555 @opindex mcmodel=large
20556 @item -mcmodel=large
20557 Generate code for the large code model.  This makes no assumptions about
20558 addresses and sizes of sections.  Programs can be statically linked only.  The
20559 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20560 @option{-fpic} and @option{-fPIC}.
20562 @item -mtp=@var{name}
20563 @opindex mtp
20564 Specify the system register to use as a thread pointer.  The valid values
20565 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
20566 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
20567 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
20568 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
20569 code intended to interoperate with the same value of this option to avoid
20570 accessing a different thread pointer from the wrong exception level.
20572 @opindex mstrict-align
20573 @opindex mno-strict-align
20574 @item -mstrict-align
20575 @itemx -mno-strict-align
20576 Avoid or allow generating memory accesses that may not be aligned on a natural
20577 object boundary as described in the architecture specification.
20579 @opindex momit-leaf-frame-pointer
20580 @opindex mno-omit-leaf-frame-pointer
20581 @item -momit-leaf-frame-pointer
20582 @itemx -mno-omit-leaf-frame-pointer
20583 Omit or keep the frame pointer in leaf functions.  The former behavior is the
20584 default.
20586 @opindex mstack-protector-guard
20587 @opindex mstack-protector-guard-reg
20588 @opindex mstack-protector-guard-offset
20589 @item -mstack-protector-guard=@var{guard}
20590 @itemx -mstack-protector-guard-reg=@var{reg}
20591 @itemx -mstack-protector-guard-offset=@var{offset}
20592 Generate stack protection code using canary at @var{guard}.  Supported
20593 locations are @samp{global} for a global canary or @samp{sysreg} for a
20594 canary in an appropriate system register.
20596 With the latter choice the options
20597 @option{-mstack-protector-guard-reg=@var{reg}} and
20598 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20599 which system register to use as base register for reading the canary,
20600 and from what offset from that base register. There is no default
20601 register or offset as this is entirely for use within the Linux
20602 kernel.
20604 @opindex mtls-dialect=desc
20605 @item -mtls-dialect=desc
20606 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20607 of TLS variables.  This is the default.
20609 @opindex mtls-dialect=traditional
20610 @item -mtls-dialect=traditional
20611 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20612 of TLS variables.
20614 @opindex mtls-size
20615 @item -mtls-size=@var{size}
20616 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
20617 This option requires binutils 2.26 or newer.
20619 @opindex mfix-cortex-a53-835769
20620 @opindex mno-fix-cortex-a53-835769
20621 @item -mfix-cortex-a53-835769
20622 @itemx -mno-fix-cortex-a53-835769
20623 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20624 This involves inserting a NOP instruction between memory instructions and
20625 64-bit integer multiply-accumulate instructions.
20627 @opindex mfix-cortex-a53-843419
20628 @opindex mno-fix-cortex-a53-843419
20629 @item -mfix-cortex-a53-843419
20630 @itemx -mno-fix-cortex-a53-843419
20631 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20632 This erratum workaround is made at link time and this will only pass the
20633 corresponding flag to the linker.
20635 @opindex mlow-precision-recip-sqrt
20636 @opindex mno-low-precision-recip-sqrt
20637 @item -mlow-precision-recip-sqrt
20638 @itemx -mno-low-precision-recip-sqrt
20639 Enable or disable the reciprocal square root approximation.
20640 This option only has an effect if @option{-ffast-math} or
20641 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20642 precision of reciprocal square root results to about 16 bits for
20643 single precision and to 32 bits for double precision.
20645 @opindex mlow-precision-sqrt
20646 @opindex mno-low-precision-sqrt
20647 @item -mlow-precision-sqrt
20648 @itemx -mno-low-precision-sqrt
20649 Enable or disable the square root approximation.
20650 This option only has an effect if @option{-ffast-math} or
20651 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20652 precision of square root results to about 16 bits for
20653 single precision and to 32 bits for double precision.
20654 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20656 @opindex mlow-precision-div
20657 @opindex mno-low-precision-div
20658 @item -mlow-precision-div
20659 @itemx -mno-low-precision-div
20660 Enable or disable the division approximation.
20661 This option only has an effect if @option{-ffast-math} or
20662 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20663 precision of division results to about 16 bits for
20664 single precision and to 32 bits for double precision.
20666 @item -mtrack-speculation
20667 @itemx -mno-track-speculation
20668 Enable or disable generation of additional code to track speculative
20669 execution through conditional branches.  The tracking state can then
20670 be used by the compiler when expanding calls to
20671 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20672 sequence to be generated.
20674 @item -moutline-atomics
20675 @itemx -mno-outline-atomics
20676 Enable or disable calls to out-of-line helpers to implement atomic operations.
20677 These helpers will, at runtime, determine if the LSE instructions from
20678 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20679 instructions that are present in the base ARMv8.0 ISA.
20681 This option is only applicable when compiling for the base ARMv8.0
20682 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
20683 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20684 used directly.  The same applies when using @option{-mcpu=} when the
20685 selected cpu supports the @samp{lse} feature.
20686 This option is on by default.
20688 @opindex march
20689 @item -march=@var{name}
20690 Specify the name of the target architecture and, optionally, one or
20691 more feature modifiers.  This option has the form
20692 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20694 The table below summarizes the permissible values for @var{arch}
20695 and the features that they enable by default:
20697 @multitable @columnfractions 0.20 0.20 0.60
20698 @headitem @var{arch} value @tab Architecture @tab Includes by default
20699 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20700 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20701 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20702 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20703 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20704 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20705 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20706 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20707 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20708 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20709 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20710 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20711 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20712 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20713 @end multitable
20715 The value @samp{native} is available on native AArch64 GNU/Linux and
20716 causes the compiler to pick the architecture of the host system.  This
20717 option has no effect if the compiler is unable to recognize the
20718 architecture of the host system,
20720 The permissible values for @var{feature} are listed in the sub-section
20721 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20722 Feature Modifiers}.  Where conflicting feature modifiers are
20723 specified, the right-most feature is used.
20725 GCC uses @var{name} to determine what kind of instructions it can emit
20726 when generating assembly code.  If @option{-march} is specified
20727 without either of @option{-mtune} or @option{-mcpu} also being
20728 specified, the code is tuned to perform well across a range of target
20729 processors implementing the target architecture.
20731 @opindex mtune
20732 @item -mtune=@var{name}
20733 Specify the name of the target processor for which GCC should tune the
20734 performance of the code.  Permissible values for this option are:
20735 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20736 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20737 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20738 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20739 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20740 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20741 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20742 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20743 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20744 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
20745 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20746 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20747 @samp{octeontx2f95mm},
20748 @samp{a64fx},
20749 @samp{thunderx}, @samp{thunderxt88},
20750 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20751 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20752 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20753 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20754 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20755 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20756 @samp{cortex-x3}, @samp{cortex-x4}, @samp{cortex-a510}, @samp{cortex-a520},
20757 @samp{cortex-a710}, @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1},
20758 @samp{ampere1a}, and @samp{native}.
20760 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20761 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20762 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20763 should tune for a big.LITTLE system.
20765 The value @samp{neoverse-512tvb} specifies that GCC should tune
20766 for Neoverse cores that (a) implement SVE and (b) have a total vector
20767 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
20768 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20769 instructions a cycle and that can execute an equivalent number of SVE
20770 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20771 This is more general than tuning for a specific core like Neoverse V1
20772 but is more specific than the default tuning described below.
20774 Additionally on native AArch64 GNU/Linux systems the value
20775 @samp{native} tunes performance to the host system.  This option has no effect
20776 if the compiler is unable to recognize the processor of the host system.
20778 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20779 are specified, the code is tuned to perform well across a range
20780 of target processors.
20782 This option cannot be suffixed by feature modifiers.
20784 @opindex mcpu
20785 @item -mcpu=@var{name}
20786 Specify the name of the target processor, optionally suffixed by one
20787 or more feature modifiers.  This option has the form
20788 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20789 the permissible values for @var{cpu} are the same as those available
20790 for @option{-mtune}.  The permissible values for @var{feature} are
20791 documented in the sub-section on
20792 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20793 Feature Modifiers}.  Where conflicting feature modifiers are
20794 specified, the right-most feature is used.
20796 GCC uses @var{name} to determine what kind of instructions it can emit when
20797 generating assembly code (as if by @option{-march}) and to determine
20798 the target processor for which to tune for performance (as if
20799 by @option{-mtune}).  Where this option is used in conjunction
20800 with @option{-march} or @option{-mtune}, those options take precedence
20801 over the appropriate part of this option.
20803 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20804 to a specific core, but instead refers to all Neoverse cores that
20805 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20806 a cycle.  Unless overridden by @option{-march},
20807 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20808 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20809 these properties.  Unless overridden by @option{-mtune},
20810 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20811 @option{-mtune=neoverse-512tvb}.
20813 @opindex moverride
20814 @item -moverride=@var{string}
20815 Override tuning decisions made by the back-end in response to a
20816 @option{-mtune=} switch.  The syntax, semantics, and accepted values
20817 for @var{string} in this option are not guaranteed to be consistent
20818 across releases.
20820 This option is only intended to be useful when developing GCC.
20822 @opindex mverbose-cost-dump
20823 @item -mverbose-cost-dump
20824 Enable verbose cost model dumping in the debug dump files.  This option is
20825 provided for use in debugging the compiler.
20827 @opindex mpc-relative-literal-loads
20828 @opindex mno-pc-relative-literal-loads
20829 @item -mpc-relative-literal-loads
20830 @itemx -mno-pc-relative-literal-loads
20831 Enable or disable PC-relative literal loads.  With this option literal pools are
20832 accessed using a single instruction and emitted after each function.  This
20833 limits the maximum size of functions to 1MB.  This is enabled by default for
20834 @option{-mcmodel=tiny}.
20836 @opindex msign-return-address
20837 @item -msign-return-address=@var{scope}
20838 Select the function scope on which return address signing will be applied.
20839 Permissible values are @samp{none}, which disables return address signing,
20840 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20841 functions, and @samp{all}, which enables pointer signing for all functions.  The
20842 default value is @samp{none}. This option has been deprecated by
20843 -mbranch-protection.
20845 @opindex mbranch-protection
20846 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20847 Select the branch protection features to use.
20848 @samp{none} is the default and turns off all types of branch protection.
20849 @samp{standard} turns on all types of branch protection features.  If a feature
20850 has additional tuning options, then @samp{standard} sets it to its standard
20851 level.
20852 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20853 level: signing functions that save the return address to memory (non-leaf
20854 functions will practically always do this) using the a-key.  The optional
20855 argument @samp{leaf} can be used to extend the signing to include leaf
20856 functions.  The optional argument @samp{b-key} can be used to sign the functions
20857 with the B-key instead of the A-key.
20858 @samp{bti} turns on branch target identification mechanism.
20860 @opindex mharden-sls
20861 @item -mharden-sls=@var{opts}
20862 Enable compiler hardening against straight line speculation (SLS).
20863 @var{opts} is a comma-separated list of the following options:
20864 @table @samp
20865 @item retbr
20866 @item blr
20867 @end table
20868 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20869 @samp{-mharden-sls=none} disables all SLS hardening.
20871 @opindex msve-vector-bits
20872 @item -msve-vector-bits=@var{bits}
20873 Specify the number of bits in an SVE vector register.  This option only has
20874 an effect when SVE is enabled.
20876 GCC supports two forms of SVE code generation: ``vector-length
20877 agnostic'' output that works with any size of vector register and
20878 ``vector-length specific'' output that allows GCC to make assumptions
20879 about the vector length when it is useful for optimization reasons.
20880 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20881 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20882 Specifying @samp{scalable} selects vector-length agnostic
20883 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
20884 agnostic output for big-endian targets.  All other values generate
20885 vector-length specific code.  The behavior of these values may change
20886 in future releases and no value except @samp{scalable} should be
20887 relied on for producing code that is portable across different
20888 hardware SVE vector lengths.
20890 The default is @samp{-msve-vector-bits=scalable}, which produces
20891 vector-length agnostic code.
20892 @end table
20894 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20895 @anchor{aarch64-feature-modifiers}
20896 @cindex @option{-march} feature modifiers
20897 @cindex @option{-mcpu} feature modifiers
20898 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20899 the following and their inverses @option{no@var{feature}}:
20901 @table @samp
20902 @item crc
20903 Enable CRC extension.  This is on by default for
20904 @option{-march=armv8.1-a}.
20905 @item crypto
20906 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
20907 instructions.
20908 @item fp
20909 Enable floating-point instructions.  This is on by default for all possible
20910 values for options @option{-march} and @option{-mcpu}.
20911 @item simd
20912 Enable Advanced SIMD instructions.  This also enables floating-point
20913 instructions.  This is on by default for all possible values for options
20914 @option{-march} and @option{-mcpu}.
20915 @item sve
20916 Enable Scalable Vector Extension instructions.  This also enables Advanced
20917 SIMD and floating-point instructions.
20918 @item lse
20919 Enable Large System Extension instructions.  This is on by default for
20920 @option{-march=armv8.1-a}.
20921 @item rdma
20922 Enable Round Double Multiply Accumulate instructions.  This is on by default
20923 for @option{-march=armv8.1-a}.
20924 @item fp16
20925 Enable FP16 extension.  This also enables floating-point instructions.
20926 @item fp16fml
20927 Enable FP16 fmla extension.  This also enables FP16 extensions and
20928 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.
20930 @item rcpc
20931 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
20932 load-acquire atomic semantics, and passes it on to the assembler, enabling
20933 inline asm statements to use instructions from the RCpc extension.
20934 @item dotprod
20935 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
20936 @item aes
20937 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
20938 SIMD instructions.
20939 @item sha2
20940 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
20941 @item sha3
20942 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
20943 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20944 @item sm4
20945 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
20946 Use of this option with architectures prior to Armv8.2-A is not supported.
20947 @item profile
20948 Enable the Statistical Profiling extension.  This option is only to enable the
20949 extension at the assembler level and does not affect code generation.
20950 @item rng
20951 Enable the Armv8.5-a Random Number instructions.  This option is only to
20952 enable the extension at the assembler level and does not affect code
20953 generation.
20954 @item memtag
20955 Enable the Armv8.5-a Memory Tagging Extensions.
20956 Use of this option with architectures prior to Armv8.5-A is not supported.
20957 @item sb
20958 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
20959 enable the extension at the assembler level and does not affect code
20960 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20961 @item ssbs
20962 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
20963 is only to enable the extension at the assembler level and does not affect code
20964 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20965 @item predres
20966 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20967 This option is only to enable the extension at the assembler level and does
20968 not affect code generation.  This option is enabled by default for
20969 @option{-march=armv8.5-a}.
20970 @item sve2
20971 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
20972 instructions.
20973 @item sve2-bitperm
20974 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
20975 @item sve2-sm4
20976 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
20977 @item sve2-aes
20978 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
20979 @item sve2-sha3
20980 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
20981 @item tme
20982 Enable the Transactional Memory Extension.
20983 @item i8mm
20984 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
20985 Advanced SIMD and floating-point instructions.  This option is enabled by
20986 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20987 prior to Armv8.2-A is not supported.
20988 @item f32mm
20989 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
20990 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20991 not supported.
20992 @item f64mm
20993 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
20994 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20995 not supported.
20996 @item bf16
20997 Enable brain half-precision floating-point instructions.  This also enables
20998 Advanced SIMD and floating-point instructions.  This option is enabled by
20999 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21000 prior to Armv8.2-A is not supported.
21001 @item ls64
21002 Enable the 64-byte atomic load and store instructions for accelerators.
21003 This option is enabled by default for @option{-march=armv8.7-a}.
21004 @item mops
21005 Enable the instructions to accelerate memory operations like @code{memcpy},
21006 @code{memmove}, @code{memset}.  This option is enabled by default for
21007 @option{-march=armv8.8-a}
21008 @item flagm
21009 Enable the Flag Manipulation instructions Extension.
21010 @item pauth
21011 Enable the Pointer Authentication Extension.
21012 @item cssc
21013 Enable the Common Short Sequence Compression instructions.
21015 @end table
21017 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
21018 which implies @option{fp}.
21019 Conversely, @option{nofp} implies @option{nosimd}, which implies
21020 @option{nocrypto}, @option{noaes} and @option{nosha2}.
21022 @node Adapteva Epiphany Options
21023 @subsection Adapteva Epiphany Options
21025 These @samp{-m} options are defined for Adapteva Epiphany:
21027 @table @gcctabopt
21028 @opindex mhalf-reg-file
21029 @item -mhalf-reg-file
21030 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
21031 That allows code to run on hardware variants that lack these registers.
21033 @opindex mprefer-short-insn-regs
21034 @item -mprefer-short-insn-regs
21035 Preferentially allocate registers that allow short instruction generation.
21036 This can result in increased instruction count, so this may either reduce or
21037 increase overall code size.
21039 @opindex mbranch-cost
21040 @item -mbranch-cost=@var{num}
21041 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21042 This cost is only a heuristic and is not guaranteed to produce
21043 consistent results across releases.
21045 @opindex mcmove
21046 @item -mcmove
21047 Enable the generation of conditional moves.
21049 @opindex mnops
21050 @item -mnops=@var{num}
21051 Emit @var{num} NOPs before every other generated instruction.
21053 @opindex mno-soft-cmpsf
21054 @opindex msoft-cmpsf
21055 @item -mno-soft-cmpsf
21056 For single-precision floating-point comparisons, emit an @code{fsub} instruction
21057 and test the flags.  This is faster than a software comparison, but can
21058 get incorrect results in the presence of NaNs, or when two different small
21059 numbers are compared such that their difference is calculated as zero.
21060 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
21061 software comparisons.
21063 @opindex mstack-offset
21064 @item -mstack-offset=@var{num}
21065 Set the offset between the top of the stack and the stack pointer.
21066 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
21067 can be used by leaf functions without stack allocation.
21068 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
21069 Note also that this option changes the ABI; compiling a program with a
21070 different stack offset than the libraries have been compiled with
21071 generally does not work.
21072 This option can be useful if you want to evaluate if a different stack
21073 offset would give you better code, but to actually use a different stack
21074 offset to build working programs, it is recommended to configure the
21075 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
21077 @opindex mno-round-nearest
21078 @opindex mround-nearest
21079 @item -mno-round-nearest
21080 Make the scheduler assume that the rounding mode has been set to
21081 truncating.  The default is @option{-mround-nearest}.
21083 @opindex mlong-calls
21084 @item -mlong-calls
21085 If not otherwise specified by an attribute, assume all calls might be beyond
21086 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
21087 function address into a register before performing a (otherwise direct) call.
21088 This is the default.
21090 @opindex short-calls
21091 @item -mshort-calls
21092 If not otherwise specified by an attribute, assume all direct calls are
21093 in the range of the @code{b} / @code{bl} instructions, so use these instructions
21094 for direct calls.  The default is @option{-mlong-calls}.
21096 @opindex msmall16
21097 @item -msmall16
21098 Assume addresses can be loaded as 16-bit unsigned values.  This does not
21099 apply to function addresses for which @option{-mlong-calls} semantics
21100 are in effect.
21102 @opindex mfp-mode
21103 @item -mfp-mode=@var{mode}
21104 Set the prevailing mode of the floating-point unit.
21105 This determines the floating-point mode that is provided and expected
21106 at function call and return time.  Making this mode match the mode you
21107 predominantly need at function start can make your programs smaller and
21108 faster by avoiding unnecessary mode switches.
21110 @var{mode} can be set to one the following values:
21112 @table @samp
21113 @item caller
21114 Any mode at function entry is valid, and retained or restored when
21115 the function returns, and when it calls other functions.
21116 This mode is useful for compiling libraries or other compilation units
21117 you might want to incorporate into different programs with different
21118 prevailing FPU modes, and the convenience of being able to use a single
21119 object file outweighs the size and speed overhead for any extra
21120 mode switching that might be needed, compared with what would be needed
21121 with a more specific choice of prevailing FPU mode.
21123 @item truncate
21124 This is the mode used for floating-point calculations with
21125 truncating (i.e.@: round towards zero) rounding mode.  That includes
21126 conversion from floating point to integer.
21128 @item round-nearest
21129 This is the mode used for floating-point calculations with
21130 round-to-nearest-or-even rounding mode.
21132 @item int
21133 This is the mode used to perform integer calculations in the FPU, e.g.@:
21134 integer multiply, or integer multiply-and-accumulate.
21135 @end table
21137 The default is @option{-mfp-mode=caller}
21139 @opindex mno-split-lohi
21140 @opindex msplit-lohi
21141 @opindex mno-postinc
21142 @opindex mpostinc
21143 @opindex mno-postmodify
21144 @opindex mpostmodify
21145 @item -mno-split-lohi
21146 @itemx -mno-postinc
21147 @itemx -mno-postmodify
21148 Code generation tweaks that disable, respectively, splitting of 32-bit
21149 loads, generation of post-increment addresses, and generation of
21150 post-modify addresses.  The defaults are @option{msplit-lohi},
21151 @option{-mpost-inc}, and @option{-mpost-modify}.
21153 @opindex mno-vect-double
21154 @opindex mvect-double
21155 @item -mnovect-double
21156 Change the preferred SIMD mode to SImode.  The default is
21157 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21159 @opindex max-vect-align
21160 @item -max-vect-align=@var{num}
21161 The maximum alignment for SIMD vector mode types.
21162 @var{num} may be 4 or 8.  The default is 8.
21163 Note that this is an ABI change, even though many library function
21164 interfaces are unaffected if they don't use SIMD vector modes
21165 in places that affect size and/or alignment of relevant types.
21167 @opindex msplit-vecmove-early
21168 @item -msplit-vecmove-early
21169 Split vector moves into single word moves before reload.  In theory this
21170 can give better register allocation, but so far the reverse seems to be
21171 generally the case.
21173 @opindex m1reg-
21174 @item -m1reg-@var{reg}
21175 Specify a register to hold the constant @minus{}1, which makes loading small negative
21176 constants and certain bitmasks faster.
21177 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21178 which specify use of that register as a fixed register,
21179 and @samp{none}, which means that no register is used for this
21180 purpose.  The default is @option{-m1reg-none}.
21182 @end table
21184 @node AMD GCN Options
21185 @subsection AMD GCN Options
21186 @cindex AMD GCN Options
21188 These options are defined specifically for the AMD GCN port.
21190 @table @gcctabopt
21192 @opindex march
21193 @opindex mtune
21194 @item -march=@var{gpu}
21195 @itemx -mtune=@var{gpu}
21196 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21199 @table @samp
21200 @item fiji
21201 Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
21202 depends on how GCC has been configured, see @option{--with-arch} and
21203 @option{--with-multilib-list}.
21205 @item gfx900
21206 Compile for GCN5 Vega 10 devices (gfx900).
21208 @item gfx906
21209 Compile for GCN5 Vega 20 devices (gfx906).
21211 @item gfx908
21212 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21214 @item gfx90a
21215 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21217 @end table
21219 @opindex msram-ecc
21220 @item -msram-ecc=on
21221 @itemx -msram-ecc=off
21222 @itemx -msram-ecc=any
21223 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21224 disabled, or either mode.  This feature can be enabled per-process on some
21225 devices.  The compiled code must match the device mode. The default is
21226 @samp{any}, for devices that support it.
21228 @opindex mstack-size
21229 @item -mstack-size=@var{bytes}
21230 Specify how many @var{bytes} of stack space will be requested for each GPU
21231 thread (wave-front).  Beware that there may be many threads and limited memory
21232 available.  The size of the stack allocation may also have an impact on
21233 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21234 1MB otherwise.
21236 @opindex mxnack
21237 @item -mxnack=on
21238 @itemx -mxnack=off
21239 @itemx -mxnack=any
21240 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21241 or either mode.  Some devices always require XNACK and some allow the user to
21242 configure XNACK.  The compiled code must match the device mode.
21243 @c The default is @samp{-mxnack=any}.
21244 At present this option is a placeholder for support that is not yet implemented.
21246 @end table
21248 @node ARC Options
21249 @subsection ARC Options
21250 @cindex ARC options
21252 The following options control the architecture variant for which code
21253 is being compiled:
21255 @c architecture variants
21256 @table @gcctabopt
21258 @opindex mbarrel-shifter
21259 @item -mbarrel-shifter
21260 Generate instructions supported by barrel shifter.  This is the default
21261 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21263 @opindex mjli-always
21264 @item -mjli-always
21265 Force to call a function using jli_s instruction.  This option is
21266 valid only for ARCv2 architecture.
21268 @opindex mcpu
21269 @item -mcpu=@var{cpu}
21270 Set architecture type, register usage, and instruction scheduling
21271 parameters for @var{cpu}.  There are also shortcut alias options
21272 available for backward compatibility and convenience.  Supported
21273 values for @var{cpu} are
21275 @table @samp
21276 @opindex mA6
21277 @opindex mARC600
21278 @item arc600
21279 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21281 @opindex mARC601
21282 @item arc601
21283 Compile for ARC601.  Alias: @option{-mARC601}.
21285 @opindex mA7
21286 @opindex mARC700
21287 @item arc700
21288 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21289 This is the default when configured with @option{--with-cpu=arc700}@.
21291 @item arcem
21292 Compile for ARC EM.
21294 @item archs
21295 Compile for ARC HS.
21297 @item em
21298 Compile for ARC EM CPU with no hardware extensions.
21300 @item em4
21301 Compile for ARC EM4 CPU.
21303 @item em4_dmips
21304 Compile for ARC EM4 DMIPS CPU.
21306 @item em4_fpus
21307 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21308 extension.
21310 @item em4_fpuda
21311 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21312 double assist instructions.
21314 @item hs
21315 Compile for ARC HS CPU with no hardware extensions except the atomic
21316 instructions.
21318 @item hs34
21319 Compile for ARC HS34 CPU.
21321 @item hs38
21322 Compile for ARC HS38 CPU.
21324 @item hs38_linux
21325 Compile for ARC HS38 CPU with all hardware extensions on.
21327 @item hs4x
21328 Compile for ARC HS4x CPU.
21330 @item hs4xd
21331 Compile for ARC HS4xD CPU.
21333 @item hs4x_rel31
21334 Compile for ARC HS4x CPU release 3.10a.
21336 @item arc600_norm
21337 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21339 @item arc600_mul32x16
21340 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21341 instructions enabled.
21343 @item arc600_mul64
21344 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21345 instructions enabled.
21347 @item arc601_norm
21348 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21350 @item arc601_mul32x16
21351 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21352 instructions enabled.
21354 @item arc601_mul64
21355 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21356 instructions enabled.
21358 @item nps400
21359 Compile for ARC 700 on NPS400 chip.
21361 @item em_mini
21362 Compile for ARC EM minimalist configuration featuring reduced register
21363 set.
21365 @end table
21367 @opindex mdpfp
21368 @opindex mdpfp-compact
21369 @item -mdpfp
21370 @itemx -mdpfp-compact
21371 Generate double-precision FPX instructions, tuned for the compact
21372 implementation.
21374 @opindex mdpfp-fast
21375 @item -mdpfp-fast
21376 Generate double-precision FPX instructions, tuned for the fast
21377 implementation.
21379 @opindex mno-dpfp-lrsr
21380 @item -mno-dpfp-lrsr
21381 Disable @code{lr} and @code{sr} instructions from using FPX extension
21382 aux registers.
21384 @opindex mea
21385 @item -mea
21386 Generate extended arithmetic instructions.  Currently only
21387 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
21388 supported.  Only valid for @option{-mcpu=ARC700}.
21390 @opindex mno-mpy
21391 @opindex mmpy
21392 @item -mno-mpy
21393 Do not generate @code{mpy}-family instructions for ARC700.  This option is
21394 deprecated.
21396 @opindex mmul32x16
21397 @item -mmul32x16
21398 Generate 32x16-bit multiply and multiply-accumulate instructions.
21400 @opindex mmul64
21401 @item -mmul64
21402 Generate @code{mul64} and @code{mulu64} instructions.  
21403 Only valid for @option{-mcpu=ARC600}.
21405 @opindex mnorm
21406 @item -mnorm
21407 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
21408 is in effect.
21410 @opindex mspfp
21411 @opindex mspfp-compact
21412 @item -mspfp
21413 @itemx -mspfp-compact
21414 Generate single-precision FPX instructions, tuned for the compact
21415 implementation.
21417 @opindex mspfp-fast
21418 @item -mspfp-fast
21419 Generate single-precision FPX instructions, tuned for the fast
21420 implementation.
21422 @opindex msimd
21423 @item -msimd
21424 Enable generation of ARC SIMD instructions via target-specific
21425 builtins.  Only valid for @option{-mcpu=ARC700}.
21427 @opindex msoft-float
21428 @item -msoft-float
21429 This option ignored; it is provided for compatibility purposes only.
21430 Software floating-point code is emitted by default, and this default
21431 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21432 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21433 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21435 @opindex mswap
21436 @item -mswap
21437 Generate @code{swap} instructions.
21439 @opindex matomic
21440 @item -matomic
21441 This enables use of the locked load/store conditional extension to implement
21442 atomic memory built-in functions.  Not available for ARC 6xx or ARC
21443 EM cores.
21445 @opindex mdiv-rem
21446 @item -mdiv-rem
21447 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21449 @opindex mcode-density
21450 @item -mcode-density
21451 Enable code density instructions for ARC EM.  
21452 This option is on by default for ARC HS.
21454 @opindex mll64
21455 @item -mll64
21456 Enable double load/store operations for ARC HS cores.
21458 @opindex mtp-regno
21459 @item -mtp-regno=@var{regno}
21460 Specify thread pointer register number.
21462 @opindex mmpy-option
21463 @item -mmpy-option=@var{multo}
21464 Compile ARCv2 code with a multiplier design option.  You can specify 
21465 the option using either a string or numeric value for @var{multo}.  
21466 @samp{wlh1} is the default value.  The recognized values are:
21468 @table @samp
21469 @item 0
21470 @itemx none
21471 No multiplier available.
21473 @item 1
21474 @itemx w
21475 16x16 multiplier, fully pipelined.
21476 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
21478 @item 2
21479 @itemx wlh1
21480 32x32 multiplier, fully
21481 pipelined (1 stage).  The following instructions are additionally
21482 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21484 @item 3
21485 @itemx wlh2
21486 32x32 multiplier, fully pipelined
21487 (2 stages).  The following instructions are additionally enabled: @code{mpy},
21488 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21490 @item 4
21491 @itemx wlh3
21492 Two 16x16 multipliers, blocking,
21493 sequential.  The following instructions are additionally enabled: @code{mpy},
21494 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21496 @item 5
21497 @itemx wlh4
21498 One 16x16 multiplier, blocking,
21499 sequential.  The following instructions are additionally enabled: @code{mpy},
21500 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21502 @item 6
21503 @itemx wlh5
21504 One 32x4 multiplier, blocking,
21505 sequential.  The following instructions are additionally enabled: @code{mpy},
21506 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21508 @item 7
21509 @itemx plus_dmpy
21510 ARC HS SIMD support.
21512 @item 8
21513 @itemx plus_macd
21514 ARC HS SIMD support.
21516 @item 9
21517 @itemx plus_qmacw
21518 ARC HS SIMD support.
21520 @end table
21522 This option is only available for ARCv2 cores@.
21524 @opindex mfpu
21525 @item -mfpu=@var{fpu}
21526 Enables support for specific floating-point hardware extensions for ARCv2
21527 cores.  Supported values for @var{fpu} are:
21529 @table @samp
21531 @item fpus
21532 Enables support for single-precision floating-point hardware
21533 extensions@.
21535 @item fpud
21536 Enables support for double-precision floating-point hardware
21537 extensions.  The single-precision floating-point extension is also
21538 enabled.  Not available for ARC EM@.
21540 @item fpuda
21541 Enables support for double-precision floating-point hardware
21542 extensions using double-precision assist instructions.  The single-precision
21543 floating-point extension is also enabled.  This option is
21544 only available for ARC EM@.
21546 @item fpuda_div
21547 Enables support for double-precision floating-point hardware
21548 extensions using double-precision assist instructions.
21549 The single-precision floating-point, square-root, and divide 
21550 extensions are also enabled.  This option is
21551 only available for ARC EM@.
21553 @item fpuda_fma
21554 Enables support for double-precision floating-point hardware
21555 extensions using double-precision assist instructions.
21556 The single-precision floating-point and fused multiply and add 
21557 hardware extensions are also enabled.  This option is
21558 only available for ARC EM@.
21560 @item fpuda_all
21561 Enables support for double-precision floating-point hardware
21562 extensions using double-precision assist instructions.
21563 All single-precision floating-point hardware extensions are also
21564 enabled.  This option is only available for ARC EM@.
21566 @item fpus_div
21567 Enables support for single-precision floating-point, square-root and divide 
21568 hardware extensions@.
21570 @item fpud_div
21571 Enables support for double-precision floating-point, square-root and divide 
21572 hardware extensions.  This option
21573 includes option @samp{fpus_div}. Not available for ARC EM@.
21575 @item fpus_fma
21576 Enables support for single-precision floating-point and 
21577 fused multiply and add hardware extensions@.
21579 @item fpud_fma
21580 Enables support for double-precision floating-point and 
21581 fused multiply and add hardware extensions.  This option
21582 includes option @samp{fpus_fma}.  Not available for ARC EM@.
21584 @item fpus_all
21585 Enables support for all single-precision floating-point hardware
21586 extensions@.
21588 @item fpud_all
21589 Enables support for all single- and double-precision floating-point
21590 hardware extensions.  Not available for ARC EM@.
21592 @end table
21594 @opindex mirq-ctrl-saved
21595 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21596 Specifies general-purposes registers that the processor automatically
21597 saves/restores on interrupt entry and exit.  @var{register-range} is
21598 specified as two registers separated by a dash.  The register range
21599 always starts with @code{r0}, the upper limit is @code{fp} register.
21600 @var{blink} and @var{lp_count} are optional.  This option is only
21601 valid for ARC EM and ARC HS cores.
21603 @opindex mrgf-banked-regs
21604 @item -mrgf-banked-regs=@var{number}
21605 Specifies the number of registers replicated in second register bank
21606 on entry to fast interrupt.  Fast interrupts are interrupts with the
21607 highest priority level P0.  These interrupts save only PC and STATUS32
21608 registers to avoid memory transactions during interrupt entry and exit
21609 sequences.  Use this option when you are using fast interrupts in an
21610 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
21612 @opindex mlpc-width
21613 @item -mlpc-width=@var{width}
21614 Specify the width of the @code{lp_count} register.  Valid values for
21615 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
21616 fixed to 32 bits.  If the width is less than 32, the compiler does not
21617 attempt to transform loops in your program to use the zero-delay loop
21618 mechanism unless it is known that the @code{lp_count} register can
21619 hold the required loop-counter value.  Depending on the width
21620 specified, the compiler and run-time library might continue to use the
21621 loop mechanism for various needs.  This option defines macro
21622 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21624 @opindex mrf16
21625 @item -mrf16
21626 This option instructs the compiler to generate code for a 16-entry
21627 register file.  This option defines the @code{__ARC_RF16__}
21628 preprocessor macro.
21630 @opindex mbranch-index
21631 @item -mbranch-index
21632 Enable use of @code{bi} or @code{bih} instructions to implement jump
21633 tables.
21635 @end table
21637 The following options are passed through to the assembler, and also
21638 define preprocessor macro symbols.
21640 @c Flags used by the assembler, but for which we define preprocessor
21641 @c macro symbols as well.
21642 @table @gcctabopt
21643 @opindex mdsp-packa
21644 @item -mdsp-packa
21645 Passed down to the assembler to enable the DSP Pack A extensions.
21646 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
21647 deprecated.
21649 @opindex mdvbf
21650 @item -mdvbf
21651 Passed down to the assembler to enable the dual Viterbi butterfly
21652 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
21653 option is deprecated.
21655 @c ARC700 4.10 extension instruction
21656 @opindex mlock
21657 @item -mlock
21658 Passed down to the assembler to enable the locked load/store
21659 conditional extension.  Also sets the preprocessor symbol
21660 @code{__Xlock}.
21662 @opindex mmac-d16
21663 @item -mmac-d16
21664 Passed down to the assembler.  Also sets the preprocessor symbol
21665 @code{__Xxmac_d16}.  This option is deprecated.
21667 @opindex mmac-24
21668 @item -mmac-24
21669 Passed down to the assembler.  Also sets the preprocessor symbol
21670 @code{__Xxmac_24}.  This option is deprecated.
21672 @c ARC700 4.10 extension instruction
21673 @opindex mrtsc
21674 @item -mrtsc
21675 Passed down to the assembler to enable the 64-bit time-stamp counter
21676 extension instruction.  Also sets the preprocessor symbol
21677 @code{__Xrtsc}.  This option is deprecated.
21679 @c ARC700 4.10 extension instruction
21680 @opindex mswape
21681 @item -mswape
21682 Passed down to the assembler to enable the swap byte ordering
21683 extension instruction.  Also sets the preprocessor symbol
21684 @code{__Xswape}.
21686 @opindex mtelephony
21687 @item -mtelephony
21688 Passed down to the assembler to enable dual- and single-operand
21689 instructions for telephony.  Also sets the preprocessor symbol
21690 @code{__Xtelephony}.  This option is deprecated.
21692 @opindex mxy
21693 @item -mxy
21694 Passed down to the assembler to enable the XY memory extension.  Also
21695 sets the preprocessor symbol @code{__Xxy}.
21697 @end table
21699 The following options control how the assembly code is annotated:
21701 @c Assembly annotation options
21702 @table @gcctabopt
21703 @opindex misize
21704 @item -misize
21705 Annotate assembler instructions with estimated addresses.
21707 @opindex mannotate-align
21708 @item -mannotate-align
21709 Does nothing.  Preserved for backward compatibility.
21711 @end table
21713 The following options are passed through to the linker:
21715 @c options passed through to the linker
21716 @table @gcctabopt
21717 @opindex marclinux
21718 @item -marclinux
21719 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21720 This option is enabled by default in tool chains built for
21721 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21722 when profiling is not requested.
21724 @opindex marclinux_prof
21725 @item -marclinux_prof
21726 Passed through to the linker, to specify use of the
21727 @code{arclinux_prof} emulation.  This option is enabled by default in
21728 tool chains built for @w{@code{arc-linux-uclibc}} and
21729 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21731 @end table
21733 The following options control the semantics of generated code:
21735 @c semantically relevant code generation options
21736 @table @gcctabopt
21737 @opindex mlong-calls
21738 @item -mlong-calls
21739 Generate calls as register indirect calls, thus providing access
21740 to the full 32-bit address range.
21742 @opindex mmedium-calls
21743 @item -mmedium-calls
21744 Don't use less than 25-bit addressing range for calls, which is the
21745 offset available for an unconditional branch-and-link
21746 instruction.  Conditional execution of function calls is suppressed, to
21747 allow use of the 25-bit range, rather than the 21-bit range with
21748 conditional branch-and-link.  This is the default for tool chains built
21749 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21751 @opindex G
21752 @item -G @var{num}
21753 Put definitions of externally-visible data in a small data section if
21754 that data is no bigger than @var{num} bytes.  The default value of
21755 @var{num} is 4 for any ARC configuration, or 8 when we have double
21756 load/store operations.
21758 @opindex mno-sdata
21759 @opindex msdata
21760 @item -mno-sdata
21761 Do not generate sdata references.  This is the default for tool chains
21762 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21763 targets.
21765 @opindex mvolatile-cache
21766 @item -mvolatile-cache
21767 Use ordinarily cached memory accesses for volatile references.  This is the
21768 default.
21770 @opindex mno-volatile-cache
21771 @opindex mvolatile-cache
21772 @item -mno-volatile-cache
21773 Enable cache bypass for volatile references.
21775 @end table
21777 The following options fine tune code generation:
21778 @c code generation tuning options
21779 @table @gcctabopt
21780 @opindex malign-call
21781 @item -malign-call
21782 Does nothing.  Preserved for backward compatibility.
21784 @opindex mauto-modify-reg
21785 @item -mauto-modify-reg
21786 Enable the use of pre/post modify with register displacement.
21788 @opindex mbbit-peephole
21789 @item -mbbit-peephole
21790 Does nothing.  Preserved for backward compatibility.
21792 @opindex mno-brcc
21793 @item -mno-brcc
21794 This option disables a target-specific pass in @file{arc_reorg} to
21795 generate compare-and-branch (@code{br@var{cc}}) instructions.  
21796 It has no effect on
21797 generation of these instructions driven by the combiner pass.
21799 @opindex mcase-vector-pcrel
21800 @item -mcase-vector-pcrel
21801 Use PC-relative switch case tables to enable case table shortening.
21802 This is the default for @option{-Os}.
21804 @opindex mcompact-casesi
21805 @item -mcompact-casesi
21806 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
21807 and only available for ARCv1 cores.  This option is deprecated.
21809 @opindex mno-cond-exec
21810 @item -mno-cond-exec
21811 Disable the ARCompact-specific pass to generate conditional 
21812 execution instructions.
21814 Due to delay slot scheduling and interactions between operand numbers,
21815 literal sizes, instruction lengths, and the support for conditional execution,
21816 the target-independent pass to generate conditional execution is often lacking,
21817 so the ARC port has kept a special pass around that tries to find more
21818 conditional execution generation opportunities after register allocation,
21819 branch shortening, and delay slot scheduling have been done.  This pass
21820 generally, but not always, improves performance and code size, at the cost of
21821 extra compilation time, which is why there is an option to switch it off.
21822 If you have a problem with call instructions exceeding their allowable
21823 offset range because they are conditionalized, you should consider using
21824 @option{-mmedium-calls} instead.
21826 @opindex mearly-cbranchsi
21827 @item -mearly-cbranchsi
21828 Enable pre-reload use of the @code{cbranchsi} pattern.
21830 @opindex mexpand-adddi
21831 @item -mexpand-adddi
21832 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21833 @code{add.f}, @code{adc} etc.  This option is deprecated.
21835 @opindex mindexed-loads
21836 @item -mindexed-loads
21837 Enable the use of indexed loads.  This can be problematic because some
21838 optimizers then assume that indexed stores exist, which is not
21839 the case.
21841 @opindex mlra
21842 @item -mlra
21843 Enable Local Register Allocation.  This is still experimental for ARC,
21844 so by default the compiler uses standard reload
21845 (i.e.@: @option{-mno-lra}).
21847 @opindex mlra-priority-none
21848 @item -mlra-priority-none
21849 Don't indicate any priority for target registers.
21851 @opindex mlra-priority-compact
21852 @item -mlra-priority-compact
21853 Indicate target register priority for r0..r3 / r12..r15.
21855 @opindex mlra-priority-noncompact
21856 @item -mlra-priority-noncompact
21857 Reduce target register priority for r0..r3 / r12..r15.
21859 @opindex mmillicode
21860 @item -mmillicode
21861 When optimizing for size (using @option{-Os}), prologues and epilogues
21862 that have to save or restore a large number of registers are often
21863 shortened by using call to a special function in libgcc; this is
21864 referred to as a @emph{millicode} call.  As these calls can pose
21865 performance issues, and/or cause linking issues when linking in a
21866 nonstandard way, this option is provided to turn on or off millicode
21867 call generation.
21869 @opindex mcode-density-frame
21870 @item -mcode-density-frame
21871 This option enable the compiler to emit @code{enter} and @code{leave}
21872 instructions.  These instructions are only valid for CPUs with
21873 code-density feature.
21875 @opindex mmixed-code
21876 @item -mmixed-code
21877 Does nothing.  Preserved for backward compatibility.
21879 @opindex mq-class
21880 @item -mq-class
21881 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
21882 This is the default for @option{-Os}.
21884 @opindex mRcq
21885 @item -mRcq
21886 Does nothing.  Preserved for backward compatibility.
21888 @opindex mRcw
21889 @item -mRcw
21890 Does nothing.  Preserved for backward compatibility.
21892 @opindex msize-level
21893 @item -msize-level=@var{level}
21894 Fine-tune size optimization with regards to instruction lengths and alignment.
21895 The recognized values for @var{level} are:
21896 @table @samp
21897 @item 0
21898 No size optimization.  This level is deprecated and treated like @samp{1}.
21900 @item 1
21901 Short instructions are used opportunistically.
21903 @item 2
21904 In addition, alignment of loops and of code after barriers are dropped.
21906 @item 3
21907 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21909 @end table
21911 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
21912 the behavior when this is not set is equivalent to level @samp{1}.
21914 @opindex mtune
21915 @item -mtune=@var{cpu}
21916 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21917 by @option{-mcpu=}.
21919 Supported values for @var{cpu} are
21921 @table @samp
21922 @item ARC600
21923 Tune for ARC600 CPU.
21925 @item ARC601
21926 Tune for ARC601 CPU.
21928 @item ARC700
21929 Tune for ARC700 CPU with standard multiplier block.
21931 @item ARC700-xmac
21932 Tune for ARC700 CPU with XMAC block.
21934 @item ARC725D
21935 Tune for ARC725D CPU.
21937 @item ARC750D
21938 Tune for ARC750D CPU.
21940 @item core3
21941 Tune for ARCv2 core3 type CPU.  This option enable usage of
21942 @code{dbnz} instruction.
21944 @item release31a
21945 Tune for ARC4x release 3.10a.
21947 @end table
21949 @opindex mmultcost
21950 @item -mmultcost=@var{num}
21951 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21952 normal instruction.
21954 @opindex munalign-prob-threshold
21955 @item -munalign-prob-threshold=@var{probability}
21956 Does nothing.  Preserved for backward compatibility.
21958 @end table
21960 The following options are maintained for backward compatibility, but
21961 are now deprecated and will be removed in a future release:
21963 @c Deprecated options
21964 @table @gcctabopt
21966 @opindex margonaut
21967 @item -margonaut
21968 Obsolete FPX.
21970 @opindex mbig-endian
21971 @opindex EB
21972 @item -mbig-endian
21973 @itemx -EB
21974 Compile code for big-endian targets.  Use of these options is now
21975 deprecated.  Big-endian code is supported by configuring GCC to build
21976 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21977 for which big endian is the default.
21979 @opindex mlittle-endian
21980 @opindex EL
21981 @item -mlittle-endian
21982 @itemx -EL
21983 Compile code for little-endian targets.  Use of these options is now
21984 deprecated.  Little-endian code is supported by configuring GCC to build 
21985 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21986 for which little endian is the default.
21988 @opindex mbarrel_shifter
21989 @item -mbarrel_shifter
21990 Replaced by @option{-mbarrel-shifter}.
21992 @opindex mdpfp_compact
21993 @item -mdpfp_compact
21994 Replaced by @option{-mdpfp-compact}.
21996 @opindex mdpfp_fast
21997 @item -mdpfp_fast
21998 Replaced by @option{-mdpfp-fast}.
22000 @opindex mdsp_packa
22001 @item -mdsp_packa
22002 Replaced by @option{-mdsp-packa}.
22004 @opindex mEA
22005 @item -mEA
22006 Replaced by @option{-mea}.
22008 @opindex mmac_24
22009 @item -mmac_24
22010 Replaced by @option{-mmac-24}.
22012 @opindex mmac_d16
22013 @item -mmac_d16
22014 Replaced by @option{-mmac-d16}.
22016 @opindex mspfp_compact
22017 @item -mspfp_compact
22018 Replaced by @option{-mspfp-compact}.
22020 @opindex mspfp_fast
22021 @item -mspfp_fast
22022 Replaced by @option{-mspfp-fast}.
22024 @opindex mtune
22025 @item -mtune=@var{cpu}
22026 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
22027 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
22028 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
22030 @opindex multcost
22031 @item -multcost=@var{num}
22032 Replaced by @option{-mmultcost}.
22034 @end table
22036 @node ARM Options
22037 @subsection ARM Options
22038 @cindex ARM options
22040 These @samp{-m} options are defined for the ARM port:
22042 @table @gcctabopt
22043 @opindex mabi
22044 @item -mabi=@var{name}
22045 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
22046 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
22048 @opindex mapcs-frame
22049 @item -mapcs-frame
22050 Generate a stack frame that is compliant with the ARM Procedure Call
22051 Standard for all functions, even if this is not strictly necessary for
22052 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
22053 with this option causes the stack frames not to be generated for
22054 leaf functions.  The default is @option{-mno-apcs-frame}.
22055 This option is deprecated.
22057 @opindex mapcs
22058 @item -mapcs
22059 This is a synonym for @option{-mapcs-frame} and is deprecated.
22061 @ignore
22062 @c not currently implemented
22063 @opindex mapcs-stack-check
22064 @item -mapcs-stack-check
22065 Generate code to check the amount of stack space available upon entry to
22066 every function (that actually uses some stack space).  If there is
22067 insufficient space available then either the function
22068 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
22069 called, depending upon the amount of stack space required.  The runtime
22070 system is required to provide these functions.  The default is
22071 @option{-mno-apcs-stack-check}, since this produces smaller code.
22073 @c not currently implemented
22074 @opindex mapcs-reentrant
22075 @item -mapcs-reentrant
22076 Generate reentrant, position-independent code.  The default is
22077 @option{-mno-apcs-reentrant}.
22078 @end ignore
22080 @opindex mthumb-interwork
22081 @item -mthumb-interwork
22082 Generate code that supports calling between the ARM and Thumb
22083 instruction sets.  Without this option, on pre-v5 architectures, the
22084 two instruction sets cannot be reliably used inside one program.  The
22085 default is @option{-mno-thumb-interwork}, since slightly larger code
22086 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
22087 configurations this option is meaningless.
22089 @opindex mno-sched-prolog
22090 @opindex msched-prolog
22091 @item -mno-sched-prolog
22092 Prevent the reordering of instructions in the function prologue, or the
22093 merging of those instruction with the instructions in the function's
22094 body.  This means that all functions start with a recognizable set
22095 of instructions (or in fact one of a choice from a small set of
22096 different function prologues), and this information can be used to
22097 locate the start of functions inside an executable piece of code.  The
22098 default is @option{-msched-prolog}.
22100 @opindex mfloat-abi
22101 @item -mfloat-abi=@var{name}
22102 Specifies which floating-point ABI to use.  Permissible values
22103 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22105 Specifying @samp{soft} causes GCC to generate output containing
22106 library calls for floating-point operations.
22107 @samp{softfp} allows the generation of code using hardware floating-point
22108 instructions, but still uses the soft-float calling conventions.
22109 @samp{hard} allows generation of floating-point instructions
22110 and uses FPU-specific calling conventions.
22112 The default depends on the specific target configuration.  Note that
22113 the hard-float and soft-float ABIs are not link-compatible; you must
22114 compile your entire program with the same ABI, and link with a
22115 compatible set of libraries.
22117 @opindex mgeneral-regs-only
22118 @item -mgeneral-regs-only
22119 Generate code which uses only the general-purpose registers.  This will prevent
22120 the compiler from using floating-point and Advanced SIMD registers but will not
22121 impose any restrictions on the assembler.
22123 @opindex mlittle-endian
22124 @item -mlittle-endian
22125 Generate code for a processor running in little-endian mode.  This is
22126 the default for all standard configurations.
22128 @opindex mbig-endian
22129 @item -mbig-endian
22130 Generate code for a processor running in big-endian mode; the default is
22131 to compile code for a little-endian processor.
22133 @opindex mbe8
22134 @item -mbe8
22135 @itemx -mbe32
22136 When linking a big-endian image select between BE8 and BE32 formats.
22137 The option has no effect for little-endian images and is ignored.  The
22138 default is dependent on the selected target architecture.  For ARMv6
22139 and later architectures the default is BE8, for older architectures
22140 the default is BE32.  BE32 format has been deprecated by ARM.
22142 @opindex march
22143 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
22144 This specifies the name of the target ARM architecture.  GCC uses this
22145 name to determine what kind of instructions it can emit when generating
22146 assembly code.  This option can be used in conjunction with or instead
22147 of the @option{-mcpu=} option.
22149 Permissible names are:
22150 @samp{armv4t},
22151 @samp{armv5t}, @samp{armv5te},
22152 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
22153 @samp{armv6z}, @samp{armv6zk},
22154 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22155 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22156 @samp{armv8.4-a},
22157 @samp{armv8.5-a},
22158 @samp{armv8.6-a},
22159 @samp{armv9-a},
22160 @samp{armv7-r},
22161 @samp{armv8-r},
22162 @samp{armv6-m}, @samp{armv6s-m},
22163 @samp{armv7-m}, @samp{armv7e-m},
22164 @samp{armv8-m.base}, @samp{armv8-m.main},
22165 @samp{armv8.1-m.main},
22166 @samp{armv9-a},
22167 @samp{iwmmxt} and @samp{iwmmxt2}.
22169 Additionally, the following architectures, which lack support for the
22170 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22172 Many of the architectures support extensions.  These can be added by
22173 appending @samp{+@var{extension}} to the architecture name.  Extension
22174 options are processed in order and capabilities accumulate.  An extension
22175 will also enable any necessary base extensions
22176 upon which it depends.  For example, the @samp{+crypto} extension
22177 will always enable the @samp{+simd} extension.  The exception to the
22178 additive construction is for extensions that are prefixed with
22179 @samp{+no@dots{}}: these extensions disable the specified option and
22180 any other extensions that may depend on the presence of that
22181 extension.
22183 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22184 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22185 entirely disabled by the @samp{+nofp} option that follows it.
22187 Most extension names are generically named, but have an effect that is
22188 dependent upon the architecture to which it is applied.  For example,
22189 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22190 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22191 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22192 variant for @samp{armv8-a}.
22194 The table below lists the supported extensions for each architecture.
22195 Architectures not mentioned do not support any extensions.
22197 @table @samp
22198 @item armv5te
22199 @itemx armv6
22200 @itemx armv6j
22201 @itemx armv6k
22202 @itemx armv6kz
22203 @itemx armv6t2
22204 @itemx armv6z
22205 @itemx armv6zk
22206 @table @samp
22207 @item +fp
22208 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22209 used as an alias for this extension.
22211 @item +nofp
22212 Disable the floating-point instructions.
22213 @end table
22215 @item armv7
22216 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22217 @table @samp
22218 @item +fp
22219 The VFPv3 floating-point instructions, with 16 double-precision
22220 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22221 for this extension.  Note that floating-point is not supported by the
22222 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22223 ARMv7-R architectures.
22225 @item +nofp
22226 Disable the floating-point instructions.
22227 @end table
22229 @item armv7-a
22230 @table @samp
22231 @item +mp
22232 The multiprocessing extension.
22234 @item +sec
22235 The security extension.
22237 @item +fp
22238 The VFPv3 floating-point instructions, with 16 double-precision
22239 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22240 for this extension.
22242 @item +simd
22243 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22244 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22245 for this extension.
22247 @item +vfpv3
22248 The VFPv3 floating-point instructions, with 32 double-precision
22249 registers.
22251 @item +vfpv3-d16-fp16
22252 The VFPv3 floating-point instructions, with 16 double-precision
22253 registers and the half-precision floating-point conversion operations.
22255 @item +vfpv3-fp16
22256 The VFPv3 floating-point instructions, with 32 double-precision
22257 registers and the half-precision floating-point conversion operations.
22259 @item +vfpv4-d16
22260 The VFPv4 floating-point instructions, with 16 double-precision
22261 registers.
22263 @item +vfpv4
22264 The VFPv4 floating-point instructions, with 32 double-precision
22265 registers.
22267 @item +neon-fp16
22268 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22269 the half-precision floating-point conversion operations.
22271 @item +neon-vfpv4
22272 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22274 @item +nosimd
22275 Disable the Advanced SIMD instructions (does not disable floating point).
22277 @item +nofp
22278 Disable the floating-point and Advanced SIMD instructions.
22279 @end table
22281 @item armv7ve
22282 The extended version of the ARMv7-A architecture with support for
22283 virtualization.
22284 @table @samp
22285 @item +fp
22286 The VFPv4 floating-point instructions, with 16 double-precision registers.
22287 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22289 @item +simd
22290 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22291 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22293 @item +vfpv3-d16
22294 The VFPv3 floating-point instructions, with 16 double-precision
22295 registers.
22297 @item +vfpv3
22298 The VFPv3 floating-point instructions, with 32 double-precision
22299 registers.
22301 @item +vfpv3-d16-fp16
22302 The VFPv3 floating-point instructions, with 16 double-precision
22303 registers and the half-precision floating-point conversion operations.
22305 @item +vfpv3-fp16
22306 The VFPv3 floating-point instructions, with 32 double-precision
22307 registers and the half-precision floating-point conversion operations.
22309 @item +vfpv4-d16
22310 The VFPv4 floating-point instructions, with 16 double-precision
22311 registers.
22313 @item +vfpv4
22314 The VFPv4 floating-point instructions, with 32 double-precision
22315 registers.
22317 @item +neon
22318 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22319 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22321 @item +neon-fp16
22322 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22323 the half-precision floating-point conversion operations.
22325 @item +nosimd
22326 Disable the Advanced SIMD instructions (does not disable floating point).
22328 @item +nofp
22329 Disable the floating-point and Advanced SIMD instructions.
22330 @end table
22332 @item armv8-a
22333 @table @samp
22334 @item +crc
22335 The Cyclic Redundancy Check (CRC) instructions.
22336 @item +simd
22337 The ARMv8-A Advanced SIMD and floating-point instructions.
22338 @item +crypto
22339 The cryptographic instructions.
22340 @item +nocrypto
22341 Disable the cryptographic instructions.
22342 @item +nofp
22343 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22344 @item +sb
22345 Speculation Barrier Instruction.
22346 @item +predres
22347 Execution and Data Prediction Restriction Instructions.
22348 @end table
22350 @item armv8.1-a
22351 @table @samp
22352 @item +simd
22353 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22355 @item +crypto
22356 The cryptographic instructions.  This also enables the Advanced SIMD and
22357 floating-point instructions.
22359 @item +nocrypto
22360 Disable the cryptographic instructions.
22362 @item +nofp
22363 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22365 @item +sb
22366 Speculation Barrier Instruction.
22368 @item +predres
22369 Execution and Data Prediction Restriction Instructions.
22370 @end table
22372 @item armv8.2-a
22373 @itemx armv8.3-a
22374 @table @samp
22375 @item +fp16
22376 The half-precision floating-point data processing instructions.
22377 This also enables the Advanced SIMD and floating-point instructions.
22379 @item +fp16fml
22380 The half-precision floating-point fmla extension.  This also enables
22381 the half-precision floating-point extension and Advanced SIMD and
22382 floating-point instructions.
22384 @item +simd
22385 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22387 @item +crypto
22388 The cryptographic instructions.  This also enables the Advanced SIMD and
22389 floating-point instructions.
22391 @item +dotprod
22392 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
22394 @item +nocrypto
22395 Disable the cryptographic extension.
22397 @item +nofp
22398 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22400 @item +sb
22401 Speculation Barrier Instruction.
22403 @item +predres
22404 Execution and Data Prediction Restriction Instructions.
22406 @item +i8mm
22407 8-bit Integer Matrix Multiply instructions.
22408 This also enables Advanced SIMD and floating-point instructions.
22410 @item +bf16
22411 Brain half-precision floating-point instructions.
22412 This also enables Advanced SIMD and floating-point instructions.
22413 @end table
22415 @item armv8.4-a
22416 @table @samp
22417 @item +fp16
22418 The half-precision floating-point data processing instructions.
22419 This also enables the Advanced SIMD and floating-point instructions as well
22420 as the Dot Product extension and the half-precision floating-point fmla
22421 extension.
22423 @item +simd
22424 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22425 Dot Product extension.
22427 @item +crypto
22428 The cryptographic instructions.  This also enables the Advanced SIMD and
22429 floating-point instructions as well as the Dot Product extension.
22431 @item +nocrypto
22432 Disable the cryptographic extension.
22434 @item +nofp
22435 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22437 @item +sb
22438 Speculation Barrier Instruction.
22440 @item +predres
22441 Execution and Data Prediction Restriction Instructions.
22443 @item +i8mm
22444 8-bit Integer Matrix Multiply instructions.
22445 This also enables Advanced SIMD and floating-point instructions.
22447 @item +bf16
22448 Brain half-precision floating-point instructions.
22449 This also enables Advanced SIMD and floating-point instructions.
22450 @end table
22452 @item armv8.5-a
22453 @table @samp
22454 @item +fp16
22455 The half-precision floating-point data processing instructions.
22456 This also enables the Advanced SIMD and floating-point instructions as well
22457 as the Dot Product extension and the half-precision floating-point fmla
22458 extension.
22460 @item +simd
22461 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22462 Dot Product extension.
22464 @item +crypto
22465 The cryptographic instructions.  This also enables the Advanced SIMD and
22466 floating-point instructions as well as the Dot Product extension.
22468 @item +nocrypto
22469 Disable the cryptographic extension.
22471 @item +nofp
22472 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22474 @item +i8mm
22475 8-bit Integer Matrix Multiply instructions.
22476 This also enables Advanced SIMD and floating-point instructions.
22478 @item +bf16
22479 Brain half-precision floating-point instructions.
22480 This also enables Advanced SIMD and floating-point instructions.
22481 @end table
22483 @item armv8.6-a
22484 @table @samp
22485 @item +fp16
22486 The half-precision floating-point data processing instructions.
22487 This also enables the Advanced SIMD and floating-point instructions as well
22488 as the Dot Product extension and the half-precision floating-point fmla
22489 extension.
22491 @item +simd
22492 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22493 Dot Product extension.
22495 @item +crypto
22496 The cryptographic instructions.  This also enables the Advanced SIMD and
22497 floating-point instructions as well as the Dot Product extension.
22499 @item +nocrypto
22500 Disable the cryptographic extension.
22502 @item +nofp
22503 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22505 @item +i8mm
22506 8-bit Integer Matrix Multiply instructions.
22507 This also enables Advanced SIMD and floating-point instructions.
22509 @item +bf16
22510 Brain half-precision floating-point instructions.
22511 This also enables Advanced SIMD and floating-point instructions.
22512 @end table
22514 @item armv7-r
22515 @table @samp
22516 @item +fp.sp
22517 The single-precision VFPv3 floating-point instructions.  The extension
22518 @samp{+vfpv3xd} can be used as an alias for this extension.
22520 @item +fp
22521 The VFPv3 floating-point instructions with 16 double-precision registers.
22522 The extension +vfpv3-d16 can be used as an alias for this extension.
22524 @item +vfpv3xd-d16-fp16
22525 The single-precision VFPv3 floating-point instructions with 16 double-precision
22526 registers and the half-precision floating-point conversion operations.
22528 @item +vfpv3-d16-fp16
22529 The VFPv3 floating-point instructions with 16 double-precision
22530 registers and the half-precision floating-point conversion operations.
22532 @item +nofp
22533 Disable the floating-point extension.
22535 @item +idiv
22536 The ARM-state integer division instructions.
22538 @item +noidiv
22539 Disable the ARM-state integer division extension.
22540 @end table
22542 @item armv7e-m
22543 @table @samp
22544 @item +fp
22545 The single-precision VFPv4 floating-point instructions.
22547 @item +fpv5
22548 The single-precision FPv5 floating-point instructions.
22550 @item +fp.dp
22551 The single- and double-precision FPv5 floating-point instructions.
22553 @item +nofp
22554 Disable the floating-point extensions.
22555 @end table
22557 @item  armv8.1-m.main
22558 @table @samp
22560 @item +dsp
22561 The DSP instructions.
22563 @item +mve
22564 The M-Profile Vector Extension (MVE) integer instructions.
22566 @item +mve.fp
22567 The M-Profile Vector Extension (MVE) integer and single precision
22568 floating-point instructions.
22570 @item +fp
22571 The single-precision floating-point instructions.
22573 @item +fp.dp
22574 The single- and double-precision floating-point instructions.
22576 @item +nofp
22577 Disable the floating-point extension.
22579 @item +cdecp0, +cdecp1, ... , +cdecp7
22580 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22581 to the numbers given in the options in the range 0 to 7.
22583 @item +pacbti
22584 Enable the Pointer Authentication and Branch Target Identification Extension.
22585 @end table
22587 @item  armv8-m.main
22588 @table @samp
22589 @item +dsp
22590 The DSP instructions.
22592 @item +nodsp
22593 Disable the DSP extension.
22595 @item +fp
22596 The single-precision floating-point instructions.
22598 @item +fp.dp
22599 The single- and double-precision floating-point instructions.
22601 @item +nofp
22602 Disable the floating-point extension.
22604 @item +cdecp0, +cdecp1, ... , +cdecp7
22605 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22606 to the numbers given in the options in the range 0 to 7.
22607 @end table
22609 @item armv8-r
22610 @table @samp
22611 @item +crc
22612 The Cyclic Redundancy Check (CRC) instructions.
22613 @item +fp.sp
22614 The single-precision FPv5 floating-point instructions.
22615 @item +simd
22616 The ARMv8-A Advanced SIMD and floating-point instructions.
22617 @item +crypto
22618 The cryptographic instructions.
22619 @item +nocrypto
22620 Disable the cryptographic instructions.
22621 @item +nofp
22622 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22623 @end table
22625 @end table
22627 @option{-march=native} causes the compiler to auto-detect the architecture
22628 of the build computer.  At present, this feature is only supported on
22629 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22630 is unsuccessful the option has no effect.
22632 @opindex mtune
22633 @item -mtune=@var{name}
22634 This option specifies the name of the target ARM processor for
22635 which GCC should tune the performance of the code.
22636 For some ARM implementations better performance can be obtained by using
22637 this option.
22638 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22639 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22640 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22641 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22642 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22643 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22644 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22645 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22646 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22647 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22648 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22649 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22650 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22651 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22652 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22653 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22654 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22655 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22656 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22657 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
22658 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22659 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22660 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22661 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22662 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22663 @samp{xgene1}.
22665 Additionally, this option can specify that GCC should tune the performance
22666 of the code for a big.LITTLE system.  Permissible names are:
22667 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22668 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22669 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22670 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22672 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22673 performance for a blend of processors within architecture @var{arch}.
22674 The aim is to generate code that run well on the current most popular
22675 processors, balancing between optimizations that benefit some CPUs in the
22676 range, and avoiding performance pitfalls of other CPUs.  The effects of
22677 this option may change in future GCC versions as CPU models come and go.
22679 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22680 the extension options do not affect the tuning of the generated code.
22682 @option{-mtune=native} causes the compiler to auto-detect the CPU
22683 of the build computer.  At present, this feature is only supported on
22684 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
22685 unsuccessful the option has no effect.
22687 @opindex mcpu
22688 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22689 This specifies the name of the target ARM processor.  GCC uses this name
22690 to derive the name of the target ARM architecture (as if specified
22691 by @option{-march}) and the ARM processor type for which to tune for
22692 performance (as if specified by @option{-mtune}).  Where this option
22693 is used in conjunction with @option{-march} or @option{-mtune},
22694 those options take precedence over the appropriate part of this option.
22696 Many of the supported CPUs implement optional architectural
22697 extensions.  Where this is so the architectural extensions are
22698 normally enabled by default.  If implementations that lack the
22699 extension exist, then the extension syntax can be used to disable
22700 those extensions that have been omitted.  For floating-point and
22701 Advanced SIMD (Neon) instructions, the settings of the options
22702 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22703 floating-point and Advanced SIMD instructions will only be used if
22704 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22705 @option{-mfpu} other than @samp{auto} will override the available
22706 floating-point and SIMD extension instructions.
22708 For example, @samp{cortex-a9} can be found in three major
22709 configurations: integer only, with just a floating-point unit or with
22710 floating-point and Advanced SIMD.  The default is to enable all the
22711 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22712 be used to disable just the SIMD or both the SIMD and floating-point
22713 instructions respectively.
22715 Permissible names for this option are the same as those for
22716 @option{-mtune}.
22718 The following extension options are common to the listed CPUs:
22720 @table @samp
22721 @item +nodsp
22722 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
22723 @samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector
22724 Extension (MVE) integer and single precision floating-point instructions on
22725 @samp{cortex-m55} and @samp{cortex-m85}.
22727 @item +nopacbti
22728 Disable the Pointer Authentication and Branch Target Identification Extension
22729 on @samp{cortex-m85}.
22731 @item +nomve
22732 Disable the M-Profile Vector Extension (MVE) integer and single precision
22733 floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22735 @item +nomve.fp
22736 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22737 instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22739 @item +cdecp0, +cdecp1, ... , +cdecp7
22740 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22741 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22743 @item  +nofp
22744 Disables the floating-point instructions on @samp{arm9e},
22745 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22746 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22747 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22748 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22749 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
22750 @samp{cortex-m55} and @samp{cortex-m85}.
22751 Disables the floating-point and SIMD instructions on
22752 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22753 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22754 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22755 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22756 @samp{cortex-a53} and @samp{cortex-a55}.
22758 @item +nofp.dp
22759 Disables the double-precision component of the floating-point instructions
22760 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22761 @samp{cortex-r52plus} and @samp{cortex-m7}.
22763 @item +nosimd
22764 Disables the SIMD (but not floating-point) instructions on
22765 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22766 and @samp{cortex-a9}.
22768 @item +crypto
22769 Enables the cryptographic instructions on @samp{cortex-a32},
22770 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22771 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22772 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22773 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22774 @samp{cortex-a75.cortex-a55}.
22775 @end table
22777 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22778 VFPv3 with 16 double-precision registers.  It supports the following
22779 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22780 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22781 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22782 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
22783 the extensions to @option{-march=armv7-a}.
22785 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22786 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22787 See @option{-mtune} for more information.
22789 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22790 of the build computer.  At present, this feature is only supported on
22791 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22792 is unsuccessful the option has no effect.
22794 @opindex mfpu
22795 @item -mfpu=@var{name}
22796 This specifies what floating-point hardware (or hardware emulation) is
22797 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
22798 @samp{vfpv3},
22799 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22800 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22801 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22802 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22803 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22804 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22805 is an alias for @samp{vfpv2}.
22807 The setting @samp{auto} is the default and is special.  It causes the
22808 compiler to select the floating-point and Advanced SIMD instructions
22809 based on the settings of @option{-mcpu} and @option{-march}.
22811 If the selected floating-point hardware includes the NEON extension
22812 (e.g.@: @option{-mfpu=neon}), note that floating-point
22813 operations are not generated by GCC's auto-vectorization pass unless
22814 @option{-funsafe-math-optimizations} is also specified.  This is
22815 because NEON hardware does not fully implement the IEEE 754 standard for
22816 floating-point arithmetic (in particular denormal values are treated as
22817 zero), so the use of NEON instructions may lead to a loss of precision.
22819 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}).
22821 @opindex mfp16-format
22822 @item -mfp16-format=@var{name}
22823 Specify the format of the @code{__fp16} half-precision floating-point type.
22824 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22825 the default is @samp{none}, in which case the @code{__fp16} type is not
22826 defined.  @xref{Half-Precision}, for more information.
22828 @opindex mstructure-size-boundary
22829 @item -mstructure-size-boundary=@var{n}
22830 The sizes of all structures and unions are rounded up to a multiple
22831 of the number of bits set by this option.  Permissible values are 8, 32
22832 and 64.  The default value varies for different toolchains.  For the COFF
22833 targeted toolchain the default value is 8.  A value of 64 is only allowed
22834 if the underlying ABI supports it.
22836 Specifying a larger number can produce faster, more efficient code, but
22837 can also increase the size of the program.  Different values are potentially
22838 incompatible.  Code compiled with one value cannot necessarily expect to
22839 work with code or libraries compiled with another value, if they exchange
22840 information using structures or unions.
22842 This option is deprecated.
22844 @opindex mabort-on-noreturn
22845 @item -mabort-on-noreturn
22846 Generate a call to the function @code{abort} at the end of a
22847 @code{noreturn} function.  It is executed if the function tries to
22848 return.
22850 @opindex mlong-calls
22851 @opindex mno-long-calls
22852 @item -mlong-calls
22853 @itemx -mno-long-calls
22854 Tells the compiler to perform function calls by first loading the
22855 address of the function into a register and then performing a subroutine
22856 call on this register.  This switch is needed if the target function
22857 lies outside of the 64-megabyte addressing range of the offset-based
22858 version of subroutine call instruction.
22860 Even if this switch is enabled, not all function calls are turned
22861 into long calls.  The heuristic is that static functions, functions
22862 that have the @code{short_call} attribute, functions that are inside
22863 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22864 definitions have already been compiled within the current compilation
22865 unit are not turned into long calls.  The exceptions to this rule are
22866 that weak function definitions, functions with the @code{long_call}
22867 attribute or the @code{section} attribute, and functions that are within
22868 the scope of a @code{#pragma long_calls} directive are always
22869 turned into long calls.
22871 This feature is not enabled by default.  Specifying
22872 @option{-mno-long-calls} restores the default behavior, as does
22873 placing the function calls within the scope of a @code{#pragma
22874 long_calls_off} directive.  Note these switches have no effect on how
22875 the compiler generates code to handle function calls via function
22876 pointers.
22878 @opindex msingle-pic-base
22879 @item -msingle-pic-base
22880 Treat the register used for PIC addressing as read-only, rather than
22881 loading it in the prologue for each function.  The runtime system is
22882 responsible for initializing this register with an appropriate value
22883 before execution begins.
22885 @opindex mpic-register
22886 @item -mpic-register=@var{reg}
22887 Specify the register to be used for PIC addressing.
22888 For standard PIC base case, the default is any suitable register
22889 determined by compiler.  For single PIC base case, the default is
22890 @samp{R9} if target is EABI based or stack-checking is enabled,
22891 otherwise the default is @samp{R10}.
22893 @opindex mpic-data-is-text-relative
22894 @item -mpic-data-is-text-relative
22895 Assume that the displacement between the text and data segments is fixed
22896 at static link time.  This permits using PC-relative addressing
22897 operations to access data known to be in the data segment.  For
22898 non-VxWorks RTP targets, this option is enabled by default.  When
22899 disabled on such targets, it will enable @option{-msingle-pic-base} by
22900 default.
22902 @opindex mpoke-function-name
22903 @item -mpoke-function-name
22904 Write the name of each function into the text section, directly
22905 preceding the function prologue.  The generated code is similar to this:
22907 @smallexample
22908      t0
22909          .ascii "arm_poke_function_name", 0
22910          .align
22911      t1
22912          .word 0xff000000 + (t1 - t0)
22913      arm_poke_function_name
22914          mov     ip, sp
22915          stmfd   sp!, @{fp, ip, lr, pc@}
22916          sub     fp, ip, #4
22917 @end smallexample
22919 When performing a stack backtrace, code can inspect the value of
22920 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
22921 location @code{pc - 12} and the top 8 bits are set, then we know that
22922 there is a function name embedded immediately preceding this location
22923 and has length @code{((pc[-3]) & 0xff000000)}.
22925 @opindex marm
22926 @opindex mthumb
22927 @item -mthumb
22928 @itemx -marm
22930 Select between generating code that executes in ARM and Thumb
22931 states.  The default for most configurations is to generate code
22932 that executes in ARM state, but the default can be changed by
22933 configuring GCC with the @option{--with-mode=}@var{state}
22934 configure option.
22936 You can also override the ARM and Thumb mode for each function
22937 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22938 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22940 @opindex mflip-thumb
22941 @item -mflip-thumb 
22942 Switch ARM/Thumb modes on alternating functions.
22943 This option is provided for regression testing of mixed Thumb/ARM code
22944 generation, and is not intended for ordinary use in compiling code.
22946 @opindex mtpcs-frame
22947 @item -mtpcs-frame
22948 Generate a stack frame that is compliant with the Thumb Procedure Call
22949 Standard for all non-leaf functions.  (A leaf function is one that does
22950 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
22952 @opindex mtpcs-leaf-frame
22953 @item -mtpcs-leaf-frame
22954 Generate a stack frame that is compliant with the Thumb Procedure Call
22955 Standard for all leaf functions.  (A leaf function is one that does
22956 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
22958 @opindex mcallee-super-interworking
22959 @item -mcallee-super-interworking
22960 Gives all externally visible functions in the file being compiled an ARM
22961 instruction set header which switches to Thumb mode before executing the
22962 rest of the function.  This allows these functions to be called from
22963 non-interworking code.  This option is not valid in AAPCS configurations
22964 because interworking is enabled by default.
22966 @opindex mcaller-super-interworking
22967 @item -mcaller-super-interworking
22968 Allows calls via function pointers (including virtual functions) to
22969 execute correctly regardless of whether the target code has been
22970 compiled for interworking or not.  There is a small overhead in the cost
22971 of executing a function pointer if this option is enabled.  This option
22972 is not valid in AAPCS configurations because interworking is enabled
22973 by default.
22975 @opindex mtp
22976 @item -mtp=@var{name}
22977 Specify the access model for the thread local storage pointer.  The model
22978 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
22979 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
22980 the thread pointer from the corresponding system register directly
22981 (supported from the arm6k architecture and later).  These system registers
22982 are accessed through the CP15 co-processor interface and the argument
22983 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
22984 The argument @samp{auto} uses the best available method for the selected
22985 processor.  The default setting is @samp{auto}.
22987 @opindex mtls-dialect
22988 @item -mtls-dialect=@var{dialect}
22989 Specify the dialect to use for accessing thread local storage.  Two
22990 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
22991 @samp{gnu} dialect selects the original GNU scheme for supporting
22992 local and global dynamic TLS models.  The @samp{gnu2} dialect
22993 selects the GNU descriptor scheme, which provides better performance
22994 for shared libraries.  The GNU descriptor scheme is compatible with
22995 the original scheme, but does require new assembler, linker and
22996 library support.  Initial and local exec TLS models are unaffected by
22997 this option and always use the original scheme.
22999 @opindex mword-relocations
23000 @item -mword-relocations
23001 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
23002 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
23003 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
23004 is specified. This option conflicts with @option{-mslow-flash-data}.
23006 @opindex mfix-cortex-m3-ldrd
23007 @item -mfix-cortex-m3-ldrd
23008 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
23009 with overlapping destination and base registers are used.  This option avoids
23010 generating these instructions.  This option is enabled by default when
23011 @option{-mcpu=cortex-m3} is specified.
23013 @item -mfix-cortex-a57-aes-1742098
23014 @itemx -mno-fix-cortex-a57-aes-1742098
23015 @itemx -mfix-cortex-a72-aes-1655431
23016 @itemx -mno-fix-cortex-a72-aes-1655431
23017 Enable (disable) mitigation for an erratum on Cortex-A57 and
23018 Cortex-A72 that affects the AES cryptographic instructions.  This
23019 option is enabled by default when either @option{-mcpu=cortex-a57} or
23020 @option{-mcpu=cortex-a72} is specified.
23022 @opindex munaligned-access
23023 @opindex mno-unaligned-access
23024 @item -munaligned-access
23025 @itemx -mno-unaligned-access
23026 Enables (or disables) reading and writing of 16- and 32- bit values
23027 from addresses that are not 16- or 32- bit aligned.  By default
23028 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
23029 ARMv8-M Baseline architectures, and enabled for all other
23030 architectures.  If unaligned access is not enabled then words in packed
23031 data structures are accessed a byte at a time.
23033 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
23034 generated object file to either true or false, depending upon the
23035 setting of this option.  If unaligned access is enabled then the
23036 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
23037 defined.
23039 @opindex mneon-for-64bits
23040 @item -mneon-for-64bits
23041 This option is deprecated and has no effect.
23043 @opindex mslow-flash-data
23044 @item -mslow-flash-data
23045 Assume loading data from flash is slower than fetching instruction.
23046 Therefore literal load is minimized for better performance.
23047 This option is only supported when compiling for ARMv7 M-profile and
23048 off by default. It conflicts with @option{-mword-relocations}.
23050 @opindex masm-syntax-unified
23051 @item -masm-syntax-unified
23052 Assume inline assembler is using unified asm syntax.  The default is
23053 currently off which implies divided syntax.  This option has no impact
23054 on Thumb2. However, this may change in future releases of GCC.
23055 Divided syntax should be considered deprecated.
23057 @opindex mrestrict-it
23058 @item -mrestrict-it
23059 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
23060 IT blocks can only contain a single 16-bit instruction from a select
23061 set of instructions. This option is on by default for ARMv8-A Thumb mode.
23063 @opindex mprint-tune-info
23064 @item -mprint-tune-info
23065 Print CPU tuning information as comment in assembler file.  This is
23066 an option used only for regression testing of the compiler and not
23067 intended for ordinary use in compiling code.  This option is disabled
23068 by default.
23070 @opindex mverbose-cost-dump
23071 @item -mverbose-cost-dump
23072 Enable verbose cost model dumping in the debug dump files.  This option is
23073 provided for use in debugging the compiler.
23075 @opindex mpure-code
23076 @item -mpure-code
23077 Do not allow constant data to be placed in code sections.
23078 Additionally, when compiling for ELF object format give all text sections the
23079 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
23080 is only available when generating non-pic code for M-profile targets.
23082 @opindex mcmse
23083 @item -mcmse
23084 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
23085 Development Tools Engineering Specification", which can be found on
23086 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
23088 @opindex mfix-cmse-cve-2021-35465
23089 @item -mfix-cmse-cve-2021-35465
23090 Mitigate against a potential security issue with the @code{VLLDM} instruction
23091 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
23092 enabled by default when the option @option{-mcpu=} is used with
23093 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85}
23094 or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used
23095 to disable the mitigation.
23097 @opindex mstack-protector-guard
23098 @opindex mstack-protector-guard-offset
23099 @item -mstack-protector-guard=@var{guard}
23100 @itemx -mstack-protector-guard-offset=@var{offset}
23101 Generate stack protection code using canary at @var{guard}.  Supported
23102 locations are @samp{global} for a global canary or @samp{tls} for a
23103 canary accessible via the TLS register. The option
23104 @option{-mstack-protector-guard-offset=} is for use with
23105 @option{-fstack-protector-guard=tls} and not for use in user-land code.
23107 @opindex mfdpic
23108 @opindex mno-fdpic
23109 @item -mfdpic
23110 @itemx -mno-fdpic
23111 Select the FDPIC ABI, which uses 64-bit function descriptors to
23112 represent pointers to functions.  When the compiler is configured for
23113 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
23114 and implies @option{-fPIE} if none of the PIC/PIE-related options is
23115 provided.  On other targets, it only enables the FDPIC-specific code
23116 generation features, and the user should explicitly provide the
23117 PIC/PIE-related options as needed.
23119 Note that static linking is not supported because it would still
23120 involve the dynamic linker when the program self-relocates.  If such
23121 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
23123 The opposite @option{-mno-fdpic} option is useful (and required) to
23124 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
23125 toolchain as the one used to build the userland programs.
23127 @opindex mbranch-protection
23128 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
23129 Enable branch protection features (armv8.1-m.main only).
23130 @samp{none} generate code without branch protection or return address
23131 signing.
23132 @samp{standard[+@var{leaf}]} generate code with all branch protection
23133 features enabled at their standard level.
23134 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
23135 set to its standard level, which is to sign all functions that save
23136 the return address to memory.
23137 @samp{leaf} When return address signing is enabled, also sign leaf
23138 functions even if they do not write the return address to memory.
23139 +@samp{bti} Add landing-pad instructions at the permitted targets of
23140 indirect branch instructions.
23142 If the @samp{+pacbti} architecture extension is not enabled, then all
23143 branch protection and return address signing operations are
23144 constrained to use only the instructions defined in the
23145 architectural-NOP space. The generated code will remain
23146 backwards-compatible with earlier versions of the architecture, but
23147 the additional security can be enabled at run time on processors that
23148 support the @samp{PACBTI} extension.
23150 Branch target enforcement using BTI can only be enabled at runtime if
23151 all code in the application has been compiled with at least
23152 @samp{-mbranch-protection=bti}.
23154 Any setting other than @samp{none} is supported only on armv8-m.main
23155 or later.
23157 The default is to generate code without branch protection or return
23158 address signing.
23160 @end table
23162 @node AVR Options
23163 @subsection AVR Options
23164 @cindex AVR Options
23166 These options are defined for AVR implementations:
23168 @table @gcctabopt
23169 @opindex mmcu
23170 @item -mmcu=@var{mcu}
23171 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
23173 The default for this option is@tie{}@samp{avr2}.
23175 GCC supports the following AVR devices and ISAs:
23177 @include avr-mmcu.texi
23179 @opindex mabsdata
23180 @item -mabsdata
23182 Assume that all data in static storage can be accessed by LDS / STS
23183 instructions.  This option has only an effect on reduced Tiny devices like
23184 ATtiny40.  See also the @code{absdata}
23185 @ref{AVR Variable Attributes,variable attribute}.
23187 @opindex maccumulate-args
23188 @item -maccumulate-args
23189 Accumulate outgoing function arguments and acquire/release the needed
23190 stack space for outgoing function arguments once in function
23191 prologue/epilogue.  Without this option, outgoing arguments are pushed
23192 before calling a function and popped afterwards.
23194 Popping the arguments after the function call can be expensive on
23195 AVR so that accumulating the stack space might lead to smaller
23196 executables because arguments need not be removed from the
23197 stack after such a function call.
23199 This option can lead to reduced code size for functions that perform
23200 several calls to functions that get their arguments on the stack like
23201 calls to printf-like functions.
23203 @opindex mbranch-cost
23204 @item -mbranch-cost=@var{cost}
23205 Set the branch costs for conditional branch instructions to
23206 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23207 integers. The default branch cost is 0.
23209 @opindex mcall-prologues
23210 @item -mcall-prologues
23211 Functions prologues/epilogues are expanded as calls to appropriate
23212 subroutines.  Code size is smaller.
23214 @opindex mdouble
23215 @opindex mlong-double
23216 @item -mdouble=@var{bits}
23217 @itemx -mlong-double=@var{bits}
23218 Set the size (in bits) of the @code{double} or @code{long double} type,
23219 respectively.  Possible values for @var{bits} are 32 and 64.
23220 Whether or not a specific value for @var{bits} is allowed depends on
23221 the @code{--with-double=} and @code{--with-long-double=}
23222 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23223 and the same applies for the default values of the options.
23225 @opindex mgas-isr-prologues
23226 @item -mgas-isr-prologues
23227 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23228 instruction supported by GNU Binutils.
23229 If this option is on, the feature can still be disabled for individual
23230 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23231 function attribute.  This feature is activated per default
23232 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23233 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23235 @opindex mint8
23236 @item -mint8
23237 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23238 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23239 and @code{long long} is 4 bytes.  Please note that this option does not
23240 conform to the C standards, but it results in smaller code
23241 size.
23243 @opindex mmain-is-OS_task
23244 @item -mmain-is-OS_task
23245 Do not save registers in @code{main}.  The effect is the same like
23246 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23247 to @code{main}. It is activated per default if optimization is on.
23249 @opindex mn-flash
23250 @item -mn-flash=@var{num}
23251 Assume that the flash memory has a size of 
23252 @var{num} times 64@tie{}KiB.
23254 @opindex mno-interrupts
23255 @item -mno-interrupts
23256 Generated code is not compatible with hardware interrupts.
23257 Code size is smaller.
23259 @opindex mrelax
23260 @item -mrelax
23261 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23262 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23263 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23264 the assembler's command line and the @option{--relax} option to the
23265 linker's command line.
23267 Jump relaxing is performed by the linker because jump offsets are not
23268 known before code is located. Therefore, the assembler code generated by the
23269 compiler is the same, but the instructions in the executable may
23270 differ from instructions in the assembler code.
23272 Relaxing must be turned on if linker stubs are needed, see the
23273 section on @code{EIND} and linker stubs below.
23275 @opindex mrmw
23276 @item -mrmw
23277 Assume that the device supports the Read-Modify-Write
23278 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
23280 @opindex mshort-calls
23281 @item -mshort-calls
23283 Assume that @code{RJMP} and @code{RCALL} can target the whole
23284 program memory.
23286 This option is used internally for multilib selection.  It is
23287 not an optimization option, and you don't need to set it by hand.
23289 @opindex msp8
23290 @item -msp8
23291 Treat the stack pointer register as an 8-bit register,
23292 i.e.@: assume the high byte of the stack pointer is zero.
23293 In general, you don't need to set this option by hand.
23295 This option is used internally by the compiler to select and
23296 build multilibs for architectures @code{avr2} and @code{avr25}.
23297 These architectures mix devices with and without @code{SPH}.
23298 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
23299 the compiler driver adds or removes this option from the compiler
23300 proper's command line, because the compiler then knows if the device
23301 or architecture has an 8-bit stack pointer and thus no @code{SPH}
23302 register or not.
23304 @opindex mstrict-X
23305 @item -mstrict-X
23306 Use address register @code{X} in a way proposed by the hardware.  This means
23307 that @code{X} is only used in indirect, post-increment or
23308 pre-decrement addressing.
23310 Without this option, the @code{X} register may be used in the same way
23311 as @code{Y} or @code{Z} which then is emulated by additional
23312 instructions.  
23313 For example, loading a value with @code{X+const} addressing with a
23314 small non-negative @code{const < 64} to a register @var{Rn} is
23315 performed as
23317 @example
23318 adiw r26, const   ; X += const
23319 ld   @var{Rn}, X        ; @var{Rn} = *X
23320 sbiw r26, const   ; X -= const
23321 @end example
23323 @opindex mtiny-stack
23324 @item -mtiny-stack
23325 Only change the lower 8@tie{}bits of the stack pointer.
23327 @opindex mfract-convert-truncate
23328 @item -mfract-convert-truncate
23329 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23331 @opindex nodevicelib
23332 @item -nodevicelib
23333 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23335 @opindex nodevicespecs
23336 @item -nodevicespecs
23337 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23338 command line.  The user takes responsibility for supplying the sub-processes
23339 like compiler proper, assembler and linker with appropriate command line
23340 options.  This means that the user has to supply her private device specs
23341 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23342 more need for option @option{-mmcu=@var{mcu}}.
23344 This option can also serve as a replacement for the older way of
23345 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23346 which contains a folder named @code{device-specs} which contains a specs file named
23347 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23349 @opindex Waddr-space-convert
23350 @opindex Wno-addr-space-convert
23351 @item -Waddr-space-convert
23352 Warn about conversions between address spaces in the case where the
23353 resulting address space is not contained in the incoming address space.
23355 @opindex Wmisspelled-isr
23356 @opindex Wno-misspelled-isr
23357 @item -Wmisspelled-isr
23358 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23359 Enabled by default.
23360 @end table
23362 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23363 @cindex @code{EIND}
23364 Pointers in the implementation are 16@tie{}bits wide.
23365 The address of a function or label is represented as word address so
23366 that indirect jumps and calls can target any code address in the
23367 range of 64@tie{}Ki words.
23369 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23370 bytes of program memory space, there is a special function register called
23371 @code{EIND} that serves as most significant part of the target address
23372 when @code{EICALL} or @code{EIJMP} instructions are used.
23374 Indirect jumps and calls on these devices are handled as follows by
23375 the compiler and are subject to some limitations:
23377 @itemize @bullet
23379 @item
23380 The compiler never sets @code{EIND}.
23382 @item
23383 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
23384 instructions or might read @code{EIND} directly in order to emulate an
23385 indirect call/jump by means of a @code{RET} instruction.
23387 @item
23388 The compiler assumes that @code{EIND} never changes during the startup
23389 code or during the application. In particular, @code{EIND} is not
23390 saved/restored in function or interrupt service routine
23391 prologue/epilogue.
23393 @item
23394 For indirect calls to functions and computed goto, the linker
23395 generates @emph{stubs}. Stubs are jump pads sometimes also called
23396 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
23397 The stub contains a direct jump to the desired address.
23399 @item
23400 Linker relaxation must be turned on so that the linker generates
23401 the stubs correctly in all situations. See the compiler option
23402 @option{-mrelax} and the linker option @option{--relax}.
23403 There are corner cases where the linker is supposed to generate stubs
23404 but aborts without relaxation and without a helpful error message.
23406 @item
23407 The default linker script is arranged for code with @code{EIND = 0}.
23408 If code is supposed to work for a setup with @code{EIND != 0}, a custom
23409 linker script has to be used in order to place the sections whose
23410 name start with @code{.trampolines} into the segment where @code{EIND}
23411 points to.
23413 @item
23414 The startup code from libgcc never sets @code{EIND}.
23415 Notice that startup code is a blend of code from libgcc and AVR-LibC.
23416 For the impact of AVR-LibC on @code{EIND}, see the
23417 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
23419 @item
23420 It is legitimate for user-specific startup code to set up @code{EIND}
23421 early, for example by means of initialization code located in
23422 section @code{.init3}. Such code runs prior to general startup code
23423 that initializes RAM and calls constructors, but after the bit
23424 of startup code from AVR-LibC that sets @code{EIND} to the segment
23425 where the vector table is located.
23426 @example
23427 #include <avr/io.h>
23429 static void
23430 __attribute__((section(".init3"),naked,used,no_instrument_function))
23431 init3_set_eind (void)
23433   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23434                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23436 @end example
23438 @noindent
23439 The @code{__trampolines_start} symbol is defined in the linker script.
23441 @item
23442 Stubs are generated automatically by the linker if
23443 the following two conditions are met:
23444 @itemize @minus
23446 @item The address of a label is taken by means of the @code{gs} modifier
23447 (short for @emph{generate stubs}) like so:
23448 @example
23449 LDI r24, lo8(gs(@var{func}))
23450 LDI r25, hi8(gs(@var{func}))
23451 @end example
23452 @item The final location of that label is in a code segment
23453 @emph{outside} the segment where the stubs are located.
23454 @end itemize
23456 @item
23457 The compiler emits such @code{gs} modifiers for code labels in the
23458 following situations:
23459 @itemize @minus
23460 @item Taking address of a function or code label.
23461 @item Computed goto.
23462 @item If prologue-save function is used, see @option{-mcall-prologues}
23463 command-line option.
23464 @item Switch/case dispatch tables. If you do not want such dispatch
23465 tables you can specify the @option{-fno-jump-tables} command-line option.
23466 @item C and C++ constructors/destructors called during startup/shutdown.
23467 @item If the tools hit a @code{gs()} modifier explained above.
23468 @end itemize
23470 @item
23471 Jumping to non-symbolic addresses like so is @emph{not} supported:
23473 @example
23474 int main (void)
23476     /* Call function at word address 0x2 */
23477     return ((int(*)(void)) 0x2)();
23479 @end example
23481 Instead, a stub has to be set up, i.e.@: the function has to be called
23482 through a symbol (@code{func_4} in the example):
23484 @example
23485 int main (void)
23487     extern int func_4 (void);
23489     /* Call function at byte address 0x4 */
23490     return func_4();
23492 @end example
23494 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
23495 Alternatively, @code{func_4} can be defined in the linker script.
23496 @end itemize
23498 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
23499 @cindex @code{RAMPD}
23500 @cindex @code{RAMPX}
23501 @cindex @code{RAMPY}
23502 @cindex @code{RAMPZ}
23503 Some AVR devices support memories larger than the 64@tie{}KiB range
23504 that can be accessed with 16-bit pointers.  To access memory locations
23505 outside this 64@tie{}KiB range, the content of a @code{RAMP}
23506 register is used as high part of the address:
23507 The @code{X}, @code{Y}, @code{Z} address register is concatenated
23508 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
23509 register, respectively, to get a wide address. Similarly,
23510 @code{RAMPD} is used together with direct addressing.
23512 @itemize
23513 @item
23514 The startup code initializes the @code{RAMP} special function
23515 registers with zero.
23517 @item
23518 If a @ref{AVR Named Address Spaces,named address space} other than
23519 generic or @code{__flash} is used, then @code{RAMPZ} is set
23520 as needed before the operation.
23522 @item
23523 If the device supports RAM larger than 64@tie{}KiB and the compiler
23524 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
23525 is reset to zero after the operation.
23527 @item
23528 If the device comes with a specific @code{RAMP} register, the ISR
23529 prologue/epilogue saves/restores that SFR and initializes it with
23530 zero in case the ISR code might (implicitly) use it.
23532 @item
23533 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
23534 If you use inline assembler to read from locations outside the
23535 16-bit address range and change one of the @code{RAMP} registers,
23536 you must reset it to zero after the access.
23538 @end itemize
23540 @subsubsection AVR Built-in Macros
23542 GCC defines several built-in macros so that the user code can test
23543 for the presence or absence of features.  Almost any of the following
23544 built-in macros are deduced from device capabilities and thus
23545 triggered by the @option{-mmcu=} command-line option.
23547 For even more AVR-specific built-in macros see
23548 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
23550 @table @code
23552 @item __AVR_ARCH__
23553 Build-in macro that resolves to a decimal number that identifies the
23554 architecture and depends on the @option{-mmcu=@var{mcu}} option.
23555 Possible values are:
23557 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
23558 @code{4}, @code{5}, @code{51}, @code{6}
23560 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
23561 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
23563 respectively and
23565 @code{100},
23566 @code{102}, @code{103}, @code{104},
23567 @code{105}, @code{106}, @code{107}
23569 for @var{mcu}=@code{avrtiny},
23570 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
23571 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
23572 If @var{mcu} specifies a device, this built-in macro is set
23573 accordingly. For example, with @option{-mmcu=atmega8} the macro is
23574 defined to @code{4}.
23576 @item __AVR_@var{Device}__
23577 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
23578 the device's name. For example, @option{-mmcu=atmega8} defines the
23579 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
23580 @code{__AVR_ATtiny261A__}, etc.
23582 The built-in macros' names follow
23583 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
23584 the device name as from the AVR user manual. The difference between
23585 @var{Device} in the built-in macro and @var{device} in
23586 @option{-mmcu=@var{device}} is that the latter is always lowercase.
23588 If @var{device} is not a device but only a core architecture like
23589 @samp{avr51}, this macro is not defined.
23591 @item __AVR_DEVICE_NAME__
23592 Setting @option{-mmcu=@var{device}} defines this built-in macro to
23593 the device's name. For example, with @option{-mmcu=atmega8} the macro
23594 is defined to @code{atmega8}.
23596 If @var{device} is not a device but only a core architecture like
23597 @samp{avr51}, this macro is not defined.
23599 @item __AVR_XMEGA__
23600 The device / architecture belongs to the XMEGA family of devices.
23602 @item __AVR_HAVE_ELPM__
23603 The device has the @code{ELPM} instruction.
23605 @item __AVR_HAVE_ELPMX__
23606 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23607 R@var{n},Z+} instructions.
23609 @item __AVR_HAVE_MOVW__
23610 The device has the @code{MOVW} instruction to perform 16-bit
23611 register-register moves.
23613 @item __AVR_HAVE_LPMX__
23614 The device has the @code{LPM R@var{n},Z} and
23615 @code{LPM R@var{n},Z+} instructions.
23617 @item __AVR_HAVE_MUL__
23618 The device has a hardware multiplier. 
23620 @item __AVR_HAVE_JMP_CALL__
23621 The device has the @code{JMP} and @code{CALL} instructions.
23622 This is the case for devices with more than 8@tie{}KiB of program
23623 memory.
23625 @item __AVR_HAVE_EIJMP_EICALL__
23626 @itemx __AVR_3_BYTE_PC__
23627 The device has the @code{EIJMP} and @code{EICALL} instructions.
23628 This is the case for devices with more than 128@tie{}KiB of program memory.
23629 This also means that the program counter
23630 (PC) is 3@tie{}bytes wide.
23632 @item __AVR_2_BYTE_PC__
23633 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23634 with up to 128@tie{}KiB of program memory.
23636 @item __AVR_HAVE_8BIT_SP__
23637 @itemx __AVR_HAVE_16BIT_SP__
23638 The stack pointer (SP) register is treated as 8-bit respectively
23639 16-bit register by the compiler.
23640 The definition of these macros is affected by @option{-mtiny-stack}.
23642 @item __AVR_HAVE_SPH__
23643 @itemx __AVR_SP8__
23644 The device has the SPH (high part of stack pointer) special function
23645 register or has an 8-bit stack pointer, respectively.
23646 The definition of these macros is affected by @option{-mmcu=} and
23647 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23648 by @option{-msp8}.
23650 @item __AVR_HAVE_RAMPD__
23651 @itemx __AVR_HAVE_RAMPX__
23652 @itemx __AVR_HAVE_RAMPY__
23653 @itemx __AVR_HAVE_RAMPZ__
23654 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23655 @code{RAMPZ} special function register, respectively.
23657 @item __NO_INTERRUPTS__
23658 This macro reflects the @option{-mno-interrupts} command-line option.
23660 @item __AVR_ERRATA_SKIP__
23661 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23662 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23663 instructions because of a hardware erratum.  Skip instructions are
23664 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23665 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23666 set.
23668 @item __AVR_ISA_RMW__
23669 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23671 @item __AVR_SFR_OFFSET__=@var{offset}
23672 Instructions that can address I/O special function registers directly
23673 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23674 address as if addressed by an instruction to access RAM like @code{LD}
23675 or @code{STS}. This offset depends on the device architecture and has
23676 to be subtracted from the RAM address in order to get the
23677 respective I/O@tie{}address.
23679 @item __AVR_SHORT_CALLS__
23680 The @option{-mshort-calls} command line option is set.
23682 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23683 Some devices support reading from flash memory by means of @code{LD*}
23684 instructions.  The flash memory is seen in the data address space
23685 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
23686 is not defined, this feature is not available.  If defined,
23687 the address space is linear and there is no need to put
23688 @code{.rodata} into RAM.  This is handled by the default linker
23689 description file, and is currently available for
23690 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
23691 there is no need to use address spaces like @code{__flash} or
23692 features like attribute @code{progmem} and @code{pgm_read_*}.
23694 @item __WITH_AVRLIBC__
23695 The compiler is configured to be used together with AVR-Libc.
23696 See the @option{--with-avrlibc} configure option.
23698 @item __HAVE_DOUBLE_MULTILIB__
23699 Defined if @option{-mdouble=} acts as a multilib option.
23701 @item __HAVE_DOUBLE32__
23702 @itemx __HAVE_DOUBLE64__
23703 Defined if the compiler supports 32-bit double resp. 64-bit double.
23704 The actual layout is specified by option @option{-mdouble=}.
23706 @item __DEFAULT_DOUBLE__
23707 The size in bits of @code{double} if @option{-mdouble=} is not set.
23708 To test the layout of @code{double} in a program, use the built-in
23709 macro @code{__SIZEOF_DOUBLE__}.
23711 @item __HAVE_LONG_DOUBLE32__
23712 @itemx __HAVE_LONG_DOUBLE64__
23713 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23714 @itemx __DEFAULT_LONG_DOUBLE__
23715 Same as above, but for @code{long double} instead of @code{double}.
23717 @item __WITH_DOUBLE_COMPARISON__
23718 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23719 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23720 and is defined to @code{2} or @code{3}.
23722 @item __WITH_LIBF7_LIBGCC__
23723 @itemx __WITH_LIBF7_MATH__
23724 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23725 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23726 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23728 @end table
23730 @node Blackfin Options
23731 @subsection Blackfin Options
23732 @cindex Blackfin Options
23734 @table @gcctabopt
23735 @opindex mcpu=
23736 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23737 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
23738 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23739 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23740 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23741 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23742 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23743 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23744 @samp{bf561}, @samp{bf592}.
23746 The optional @var{sirevision} specifies the silicon revision of the target
23747 Blackfin processor.  Any workarounds available for the targeted silicon revision
23748 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
23749 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23750 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
23751 hexadecimal digits representing the major and minor numbers in the silicon
23752 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23753 is not defined.  If @var{sirevision} is @samp{any}, the
23754 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23755 If this optional @var{sirevision} is not used, GCC assumes the latest known
23756 silicon revision of the targeted Blackfin processor.
23758 GCC defines a preprocessor macro for the specified @var{cpu}.
23759 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23760 provided by libgloss to be linked in if @option{-msim} is not given.
23762 Without this option, @samp{bf532} is used as the processor by default.
23764 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
23765 only the preprocessor macro is defined.
23767 @opindex msim
23768 @item -msim
23769 Specifies that the program will be run on the simulator.  This causes
23770 the simulator BSP provided by libgloss to be linked in.  This option
23771 has effect only for @samp{bfin-elf} toolchain.
23772 Certain other options, such as @option{-mid-shared-library} and
23773 @option{-mfdpic}, imply @option{-msim}.
23775 @opindex momit-leaf-frame-pointer
23776 @item -momit-leaf-frame-pointer
23777 Don't keep the frame pointer in a register for leaf functions.  This
23778 avoids the instructions to save, set up and restore frame pointers and
23779 makes an extra register available in leaf functions.
23781 @opindex mspecld-anomaly
23782 @item -mspecld-anomaly
23783 When enabled, the compiler ensures that the generated code does not
23784 contain speculative loads after jump instructions. If this option is used,
23785 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23787 @opindex mno-specld-anomaly
23788 @opindex mspecld-anomaly
23789 @item -mno-specld-anomaly
23790 Don't generate extra code to prevent speculative loads from occurring.
23792 @opindex mcsync-anomaly
23793 @item -mcsync-anomaly
23794 When enabled, the compiler ensures that the generated code does not
23795 contain CSYNC or SSYNC instructions too soon after conditional branches.
23796 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23798 @opindex mno-csync-anomaly
23799 @opindex mcsync-anomaly
23800 @item -mno-csync-anomaly
23801 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23802 occurring too soon after a conditional branch.
23804 @opindex mlow64k
23805 @item -mlow64k
23806 When enabled, the compiler is free to take advantage of the knowledge that
23807 the entire program fits into the low 64k of memory.
23809 @opindex mno-low64k
23810 @item -mno-low64k
23811 Assume that the program is arbitrarily large.  This is the default.
23813 @opindex mstack-check-l1
23814 @item -mstack-check-l1
23815 Do stack checking using information placed into L1 scratchpad memory by the
23816 uClinux kernel.
23818 @opindex mid-shared-library
23819 @item -mid-shared-library
23820 Generate code that supports shared libraries via the library ID method.
23821 This allows for execute in place and shared libraries in an environment
23822 without virtual memory management.  This option implies @option{-fPIC}.
23823 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23825 @opindex mno-id-shared-library
23826 @opindex mid-shared-library
23827 @item -mno-id-shared-library
23828 Generate code that doesn't assume ID-based shared libraries are being used.
23829 This is the default.
23831 @opindex mleaf-id-shared-library
23832 @item -mleaf-id-shared-library
23833 Generate code that supports shared libraries via the library ID method,
23834 but assumes that this library or executable won't link against any other
23835 ID shared libraries.  That allows the compiler to use faster code for jumps
23836 and calls.
23838 @opindex mno-leaf-id-shared-library
23839 @opindex mleaf-id-shared-library
23840 @item -mno-leaf-id-shared-library
23841 Do not assume that the code being compiled won't link against any ID shared
23842 libraries.  Slower code is generated for jump and call insns.
23844 @opindex mshared-library-id
23845 @item -mshared-library-id=n
23846 Specifies the identification number of the ID-based shared library being
23847 compiled.  Specifying a value of 0 generates more compact code; specifying
23848 other values forces the allocation of that number to the current
23849 library but is no more space- or time-efficient than omitting this option.
23851 @opindex msep-data
23852 @item -msep-data
23853 Generate code that allows the data segment to be located in a different
23854 area of memory from the text segment.  This allows for execute in place in
23855 an environment without virtual memory management by eliminating relocations
23856 against the text section.
23858 @opindex mno-sep-data
23859 @opindex msep-data
23860 @item -mno-sep-data
23861 Generate code that assumes that the data segment follows the text segment.
23862 This is the default.
23864 @opindex mlong-calls
23865 @opindex mno-long-calls
23866 @item -mlong-calls
23867 @itemx -mno-long-calls
23868 Tells the compiler to perform function calls by first loading the
23869 address of the function into a register and then performing a subroutine
23870 call on this register.  This switch is needed if the target function
23871 lies outside of the 24-bit addressing range of the offset-based
23872 version of subroutine call instruction.
23874 This feature is not enabled by default.  Specifying
23875 @option{-mno-long-calls} restores the default behavior.  Note these
23876 switches have no effect on how the compiler generates code to handle
23877 function calls via function pointers.
23879 @opindex mfast-fp
23880 @item -mfast-fp
23881 Link with the fast floating-point library. This library relaxes some of
23882 the IEEE floating-point standard's rules for checking inputs against
23883 Not-a-Number (NAN), in the interest of performance.
23885 @opindex minline-plt
23886 @item -minline-plt
23887 Enable inlining of PLT entries in function calls to functions that are
23888 not known to bind locally.  It has no effect without @option{-mfdpic}.
23890 @opindex mmulticore
23891 @item -mmulticore
23892 Build a standalone application for multicore Blackfin processors. 
23893 This option causes proper start files and link scripts supporting 
23894 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
23895 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
23897 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23898 selects the one-application-per-core programming model.  Without
23899 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23900 programming model is used. In this model, the main function of Core B
23901 should be named as @code{coreb_main}.
23903 If this option is not used, the single-core application programming
23904 model is used.
23906 @opindex mcorea
23907 @item -mcorea
23908 Build a standalone application for Core A of BF561 when using
23909 the one-application-per-core programming model. Proper start files
23910 and link scripts are used to support Core A, and the macro
23911 @code{__BFIN_COREA} is defined.
23912 This option can only be used in conjunction with @option{-mmulticore}.
23914 @opindex mcoreb
23915 @item -mcoreb
23916 Build a standalone application for Core B of BF561 when using
23917 the one-application-per-core programming model. Proper start files
23918 and link scripts are used to support Core B, and the macro
23919 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23920 should be used instead of @code{main}. 
23921 This option can only be used in conjunction with @option{-mmulticore}.
23923 @opindex msdram
23924 @item -msdram
23925 Build a standalone application for SDRAM. Proper start files and
23926 link scripts are used to put the application into SDRAM, and the macro
23927 @code{__BFIN_SDRAM} is defined.
23928 The loader should initialize SDRAM before loading the application.
23930 @opindex micplb
23931 @item -micplb
23932 Assume that ICPLBs are enabled at run time.  This has an effect on certain
23933 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
23934 are enabled; for standalone applications the default is off.
23935 @end table
23937 @node C6X Options
23938 @subsection C6X Options
23939 @cindex C6X Options
23941 @table @gcctabopt
23942 @opindex march
23943 @item -march=@var{name}
23944 This specifies the name of the target architecture.  GCC uses this
23945 name to determine what kind of instructions it can emit when generating
23946 assembly code.  Permissible names are: @samp{c62x},
23947 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23949 @opindex mbig-endian
23950 @item -mbig-endian
23951 Generate code for a big-endian target.
23953 @opindex mlittle-endian
23954 @item -mlittle-endian
23955 Generate code for a little-endian target.  This is the default.
23957 @opindex msim
23958 @item -msim
23959 Choose startup files and linker script suitable for the simulator.
23961 @opindex msdata=default
23962 @item -msdata=default
23963 Put small global and static data in the @code{.neardata} section,
23964 which is pointed to by register @code{B14}.  Put small uninitialized
23965 global and static data in the @code{.bss} section, which is adjacent
23966 to the @code{.neardata} section.  Put small read-only data into the
23967 @code{.rodata} section.  The corresponding sections used for large
23968 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23970 @opindex msdata=all
23971 @item -msdata=all
23972 Put all data, not just small objects, into the sections reserved for
23973 small data, and use addressing relative to the @code{B14} register to
23974 access them.
23976 @opindex msdata=none
23977 @item -msdata=none
23978 Make no use of the sections reserved for small data, and use absolute
23979 addresses to access all data.  Put all initialized global and static
23980 data in the @code{.fardata} section, and all uninitialized data in the
23981 @code{.far} section.  Put all constant data into the @code{.const}
23982 section.
23983 @end table
23985 @node CRIS Options
23986 @subsection CRIS Options
23987 @cindex CRIS Options
23989 These options are defined specifically for the CRIS ports.
23991 @table @gcctabopt
23992 @opindex march
23993 @opindex mcpu
23994 @item -march=@var{architecture-type}
23995 @itemx -mcpu=@var{architecture-type}
23996 Generate code for the specified architecture.  The choices for
23997 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23998 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23999 Default is @samp{v0}.
24001 @opindex mtune
24002 @item -mtune=@var{architecture-type}
24003 Tune to @var{architecture-type} everything applicable about the generated
24004 code, except for the ABI and the set of available instructions.  The
24005 choices for @var{architecture-type} are the same as for
24006 @option{-march=@var{architecture-type}}.
24008 @opindex mmax-stack-frame
24009 @item -mmax-stack-frame=@var{n}
24010 Warn when the stack frame of a function exceeds @var{n} bytes.
24012 @opindex metrax4
24013 @opindex metrax100
24014 @item -metrax4
24015 @itemx -metrax100
24016 The options @option{-metrax4} and @option{-metrax100} are synonyms for
24017 @option{-march=v3} and @option{-march=v8} respectively.
24019 @opindex mmul-bug-workaround
24020 @opindex mno-mul-bug-workaround
24021 @item -mmul-bug-workaround
24022 @itemx -mno-mul-bug-workaround
24023 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
24024 models where it applies.  This option is disabled by default.
24026 @opindex mpdebug
24027 @item -mpdebug
24028 Enable CRIS-specific verbose debug-related information in the assembly
24029 code.  This option also has the effect of turning off the @samp{#NO_APP}
24030 formatted-code indicator to the assembler at the beginning of the
24031 assembly file.
24033 @opindex mcc-init
24034 @item -mcc-init
24035 Do not use condition-code results from previous instruction; always emit
24036 compare and test instructions before use of condition codes.
24038 @opindex mno-side-effects
24039 @opindex mside-effects
24040 @item -mno-side-effects
24041 Do not emit instructions with side effects in addressing modes other than
24042 post-increment.
24044 @opindex mstack-align
24045 @opindex mno-stack-align
24046 @opindex mdata-align
24047 @opindex mno-data-align
24048 @opindex mconst-align
24049 @opindex mno-const-align
24050 @item -mstack-align
24051 @itemx -mno-stack-align
24052 @itemx -mdata-align
24053 @itemx -mno-data-align
24054 @itemx -mconst-align
24055 @itemx -mno-const-align
24056 These options (@samp{no-} options) arrange (eliminate arrangements) for the
24057 stack frame, individual data and constants to be aligned for the maximum
24058 single data access size for the chosen CPU model.  The default is to
24059 arrange for 32-bit alignment.  ABI details such as structure layout are
24060 not affected by these options.
24062 @opindex m32-bit
24063 @opindex m16-bit
24064 @opindex m8-bit
24065 @item -m32-bit
24066 @itemx -m16-bit
24067 @itemx -m8-bit
24068 Similar to the stack- data- and const-align options above, these options
24069 arrange for stack frame, writable data and constants to all be 32-bit,
24070 16-bit or 8-bit aligned.  The default is 32-bit alignment.
24072 @opindex mno-prologue-epilogue
24073 @opindex mprologue-epilogue
24074 @item -mno-prologue-epilogue
24075 @itemx -mprologue-epilogue
24076 With @option{-mno-prologue-epilogue}, the normal function prologue and
24077 epilogue which set up the stack frame are omitted and no return
24078 instructions or return sequences are generated in the code.  Use this
24079 option only together with visual inspection of the compiled code: no
24080 warnings or errors are generated when call-saved registers must be saved,
24081 or storage for local variables needs to be allocated.
24083 @opindex melf
24084 @item -melf
24085 Legacy no-op option.
24087 @opindex sim
24088 @item -sim
24089 This option arranges
24090 to link with input-output functions from a simulator library.  Code,
24091 initialized data and zero-initialized data are allocated consecutively.
24093 @opindex sim2
24094 @item -sim2
24095 Like @option{-sim}, but pass linker options to locate initialized data at
24096 0x40000000 and zero-initialized data at 0x80000000.
24097 @end table
24099 @node C-SKY Options
24100 @subsection C-SKY Options
24101 @cindex C-SKY Options
24103 GCC supports these options when compiling for C-SKY V2 processors.
24105 @table @gcctabopt
24107 @opindex march=
24108 @item -march=@var{arch}
24109 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
24110 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
24111 The default is @samp{ck810}.
24113 @opindex mcpu=
24114 @item -mcpu=@var{cpu}
24115 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
24116 @samp{ck801}, @samp{ck801t},
24117 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
24118 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
24119 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
24120 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
24121 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
24122 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
24123 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
24124 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
24125 @samp{ck803eftr1}, @samp{ck803efhtr1},
24126 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
24127 @samp{ck803sef}, @samp{ck803seft},
24128 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
24129 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
24130 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
24131 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
24133 @opindex mbig-endian
24134 @opindex EB
24135 @opindex mlittle-endian
24136 @opindex EL
24137 @item -mbig-endian
24138 @itemx -EB
24139 @itemx -mlittle-endian
24140 @itemx -EL
24142 Select big- or little-endian code.  The default is little-endian.
24144 @opindex mfloat-abi
24145 @item -mfloat-abi=@var{name}
24146 Specifies which floating-point ABI to use.  Permissible values
24147 are: @samp{soft}, @samp{softfp} and @samp{hard}.
24149 Specifying @samp{soft} causes GCC to generate output containing
24150 library calls for floating-point operations.
24151 @samp{softfp} allows the generation of code using hardware floating-point
24152 instructions, but still uses the soft-float calling conventions.
24153 @samp{hard} allows generation of floating-point instructions
24154 and uses FPU-specific calling conventions.
24156 The default depends on the specific target configuration.  Note that
24157 the hard-float and soft-float ABIs are not link-compatible; you must
24158 compile your entire program with the same ABI, and link with a
24159 compatible set of libraries.
24161 @opindex mhard-float
24162 @opindex msoft-float
24163 @item -mhard-float
24164 @itemx -msoft-float
24166 Select hardware or software floating-point implementations.
24167 The default is soft float.
24169 @opindex mdouble-float
24170 @item -mdouble-float
24171 @itemx -mno-double-float
24172 When @option{-mhard-float} is in effect, enable generation of
24173 double-precision float instructions.  This is the default except
24174 when compiling for CK803.
24176 @opindex mfdivdu
24177 @item -mfdivdu
24178 @itemx -mno-fdivdu
24179 When @option{-mhard-float} is in effect, enable generation of
24180 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24181 This is the default except when compiling for CK803.
24183 @opindex mfpu=
24184 @item -mfpu=@var{fpu}
24185 Select the floating-point processor.  This option can only be used with
24186 @option{-mhard-float}.
24187 Values for @var{fpu} are
24188 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24189 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24190 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24192 @opindex melrw
24193 @item -melrw
24194 @itemx -mno-elrw
24195 Enable the extended @code{lrw} instruction.  This option defaults to on
24196 for CK801 and off otherwise.
24198 @opindex mistack
24199 @item -mistack
24200 @itemx -mno-istack
24201 Enable interrupt stack instructions; the default is off.
24203 The @option{-mistack} option is required to handle the
24204 @code{interrupt} and @code{isr} function attributes
24205 (@pxref{C-SKY Function Attributes}).
24207 @opindex mmp
24208 @item -mmp
24209 Enable multiprocessor instructions; the default is off.
24211 @opindex mcp
24212 @item -mcp
24213 Enable coprocessor instructions; the default is off.
24215 @opindex mcache
24216 @item -mcache
24217 Enable coprocessor instructions; the default is off.
24219 @opindex msecurity
24220 @item -msecurity
24221 Enable C-SKY security instructions; the default is off.
24223 @opindex mtrust
24224 @item -mtrust
24225 Enable C-SKY trust instructions; the default is off.
24227 @opindex mdsp
24228 @opindex medsp
24229 @opindex mvdsp
24230 @item -mdsp
24231 @itemx -medsp
24232 @itemx -mvdsp
24233 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24234 All of these options default to off.
24236 @opindex mdiv
24237 @item -mdiv
24238 @itemx -mno-div
24239 Generate divide instructions.  Default is off.
24241 @opindex msmart
24242 @item -msmart
24243 @itemx -mno-smart
24244 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24245 use of 16-bit instructions.  This option is ignored for CK801 where this
24246 is the required behavior, and it defaults to on for CK802.
24247 For other targets, the default is off.
24249 @opindex mhigh-registers
24250 @item -mhigh-registers
24251 @itemx -mno-high-registers
24252 Generate code using the high registers numbered 16-31.  This option
24253 is not supported on CK801, CK802, or CK803, and is enabled by default
24254 for other processors.
24256 @opindex manchor
24257 @item -manchor
24258 @itemx -mno-anchor
24259 Generate code using global anchor symbol addresses.
24261 @opindex mpushpop
24262 @item -mpushpop
24263 @itemx -mno-pushpop
24264 Generate code using @code{push} and @code{pop} instructions.  This option
24265 defaults to on.
24267 @opindex mmultiple-stld
24268 @item -mmultiple-stld
24269 @itemx -mstm
24270 @itemx -mno-multiple-stld
24271 @itemx -mno-stm
24272 Generate code using @code{stm} and @code{ldm} instructions.  This option
24273 isn't supported on CK801 but is enabled by default on other processors.
24275 @opindex mconstpool
24276 @item -mconstpool
24277 @itemx -mno-constpool
24278 Create constant pools in the compiler instead of deferring it to the
24279 assembler.  This option is the default and required for correct code
24280 generation on CK801 and CK802, and is optional on other processors.
24282 @opindex mstack-size
24283 @item -mstack-size
24284 @item -mno-stack-size
24285 Emit @code{.stack_size} directives for each function in the assembly
24286 output.  This option defaults to off.
24288 @opindex mccrt
24289 @item -mccrt
24290 @itemx -mno-ccrt
24291 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24292 option defaults to off.
24294 @opindex mbranch-cost=
24295 @item -mbranch-cost=@var{n}
24296 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24298 @opindex msched-prolog
24299 @item -msched-prolog
24300 @itemx -mno-sched-prolog
24301 Permit scheduling of function prologue and epilogue sequences.  Using
24302 this option can result in code that is not compliant with the C-SKY V2 ABI
24303 prologue requirements and that cannot be debugged or backtraced.
24304 It is disabled by default.
24306 @opindex msim
24307 @item -msim
24308 Links the library libsemi.a which is in compatible with simulator. Applicable
24309 to ELF compiler only.
24311 @end table
24313 @node Darwin Options
24314 @subsection Darwin Options
24315 @cindex Darwin options
24317 These options are defined for all architectures running the Darwin operating
24318 system.
24320 FSF GCC on Darwin does not create ``fat'' object files; it creates
24321 an object file for the single architecture that GCC was built to
24322 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
24323 @option{-arch} options are used; it does so by running the compiler or
24324 linker multiple times and joining the results together with
24325 @file{lipo}.
24327 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
24328 @samp{i686}) is determined by the flags that specify the ISA
24329 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
24330 @option{-force_cpusubtype_ALL} option can be used to override this.
24332 The Darwin tools vary in their behavior when presented with an ISA
24333 mismatch.  The assembler, @file{as}, only permits instructions to
24334 be used that are valid for the subtype of the file it is generating,
24335 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
24336 The linker for shared libraries, @file{/usr/bin/libtool}, fails
24337 and prints an error if asked to create a shared library with a less
24338 restrictive subtype than its input files (for instance, trying to put
24339 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
24340 for executables, @command{ld}, quietly gives the executable the most
24341 restrictive subtype of any of its input files.
24343 @table @gcctabopt
24344 @opindex F
24345 @item -F@var{dir}
24346 Add the framework directory @var{dir} to the head of the list of
24347 directories to be searched for header files.  These directories are
24348 interleaved with those specified by @option{-I} options and are
24349 scanned in a left-to-right order.
24351 A framework directory is a directory with frameworks in it.  A
24352 framework is a directory with a @file{Headers} and/or
24353 @file{PrivateHeaders} directory contained directly in it that ends
24354 in @file{.framework}.  The name of a framework is the name of this
24355 directory excluding the @file{.framework}.  Headers associated with
24356 the framework are found in one of those two directories, with
24357 @file{Headers} being searched first.  A subframework is a framework
24358 directory that is in a framework's @file{Frameworks} directory.
24359 Includes of subframework headers can only appear in a header of a
24360 framework that contains the subframework, or in a sibling subframework
24361 header.  Two subframeworks are siblings if they occur in the same
24362 framework.  A subframework should not have the same name as a
24363 framework; a warning is issued if this is violated.  Currently a
24364 subframework cannot have subframeworks; in the future, the mechanism
24365 may be extended to support this.  The standard frameworks can be found
24366 in @file{/System/Library/Frameworks} and
24367 @file{/Library/Frameworks}.  An example include looks like
24368 @code{#include <Framework/header.h>}, where @file{Framework} denotes
24369 the name of the framework and @file{header.h} is found in the
24370 @file{PrivateHeaders} or @file{Headers} directory.
24372 @opindex iframework
24373 @item -iframework@var{dir}
24374 Like @option{-F} except the directory is a treated as a system
24375 directory.  The main difference between this @option{-iframework} and
24376 @option{-F} is that with @option{-iframework} the compiler does not
24377 warn about constructs contained within header files found via
24378 @var{dir}.  This option is valid only for the C family of languages.
24380 @opindex gused
24381 @item -gused
24382 Emit debugging information for symbols that are used.  For stabs
24383 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
24384 This is by default ON@.
24386 @opindex gfull
24387 @item -gfull
24388 Emit debugging information for all symbols and types.
24390 @opindex fconstant-cfstrings
24391 @item -fconstant-cfstrings
24392 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
24394 @opindex mconstant-cfstrings
24395 @item -mconstant-cfstrings
24396 When the NeXT runtime is being used (the default on these systems), override
24397 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
24398 literals to be laid out as constant CoreFoundation strings.
24400 @opindex mmacosx-version-min
24401 @item -mmacosx-version-min=@var{version}
24402 The earliest version of MacOS X that this executable will run on is
24403 @var{version}.  Typical values supported for @var{version} include @code{12},
24404 @code{10.12}, and @code{10.5.8}.
24406 If the compiler was built to use the system's headers by default,
24407 then the default for this option is the system version on which the
24408 compiler is running, otherwise the default is to make choices that
24409 are compatible with as many systems and code bases as possible.
24411 @opindex mkernel
24412 @item -mkernel
24413 Enable kernel development mode.  The @option{-mkernel} option sets
24414 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
24415 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
24416 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
24417 applicable.  This mode also sets @option{-mno-altivec},
24418 @option{-msoft-float}, @option{-fno-builtin} and
24419 @option{-mlong-branch} for PowerPC targets.
24421 @opindex mone-byte-bool
24422 @item -mone-byte-bool
24423 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
24424 By default @code{sizeof(bool)} is @code{4} when compiling for
24425 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
24426 option has no effect on x86.
24428 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
24429 to generate code that is not binary compatible with code generated
24430 without that switch.  Using this switch may require recompiling all
24431 other modules in a program, including system libraries.  Use this
24432 switch to conform to a non-default data model.
24434 @opindex mfix-and-continue
24435 @opindex ffix-and-continue
24436 @opindex findirect-data
24437 @item -mfix-and-continue
24438 @itemx -ffix-and-continue
24439 @itemx -findirect-data
24440 Generate code suitable for fast turnaround development, such as to
24441 allow GDB to dynamically load @file{.o} files into already-running
24442 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
24443 are provided for backwards compatibility.
24445 @opindex all_load
24446 @item -all_load
24447 Loads all members of static archive libraries.
24448 See man ld(1) for more information.
24450 @opindex arch_errors_fatal
24451 @item -arch_errors_fatal
24452 Cause the errors having to do with files that have the wrong architecture
24453 to be fatal.
24455 @opindex bind_at_load
24456 @item -bind_at_load
24457 Causes the output file to be marked such that the dynamic linker will
24458 bind all undefined references when the file is loaded or launched.
24460 @opindex bundle
24461 @item -bundle
24462 Produce a Mach-o bundle format file.
24463 See man ld(1) for more information.
24465 @opindex bundle_loader
24466 @item -bundle_loader @var{executable}
24467 This option specifies the @var{executable} that will load the build
24468 output file being linked.  See man ld(1) for more information.
24470 @opindex dynamiclib
24471 @item -dynamiclib
24472 When passed this option, GCC produces a dynamic library instead of
24473 an executable when linking, using the Darwin @file{libtool} command.
24475 @opindex force_cpusubtype_ALL
24476 @item -force_cpusubtype_ALL
24477 This causes GCC's output file to have the @samp{ALL} subtype, instead of
24478 one controlled by the @option{-mcpu} or @option{-march} option.
24480 @opindex nodefaultrpaths
24481 @item -nodefaultrpaths
24482 Do not add default run paths for the compiler library directories to
24483 executables, modules or dynamic libraries. On macOS 10.5 and later,
24484 the embedded runpath is added by default unless the user adds
24485 @option{-nodefaultrpaths} to the link line. Run paths are needed
24486 (and therefore enforced) to build on macOS version 10.11 or later.
24488 @item -allowable_client  @var{client_name}
24489 @itemx -client_name
24490 @itemx -compatibility_version
24491 @itemx -current_version
24492 @itemx -dead_strip
24493 @itemx -dependency-file
24494 @itemx -dylib_file
24495 @itemx -dylinker_install_name
24496 @itemx -dynamic
24497 @itemx -exported_symbols_list
24498 @itemx -filelist
24499 @need 800
24500 @itemx -flat_namespace
24501 @itemx -force_flat_namespace
24502 @itemx -headerpad_max_install_names
24503 @itemx -image_base
24504 @itemx -init
24505 @itemx -install_name
24506 @itemx -keep_private_externs
24507 @itemx -multi_module
24508 @itemx -multiply_defined
24509 @itemx -multiply_defined_unused
24510 @need 800
24511 @itemx -noall_load
24512 @itemx -no_dead_strip_inits_and_terms
24513 @itemx -nofixprebinding
24514 @itemx -nomultidefs
24515 @itemx -noprebind
24516 @itemx -noseglinkedit
24517 @itemx -pagezero_size
24518 @itemx -prebind
24519 @itemx -prebind_all_twolevel_modules
24520 @itemx -private_bundle
24521 @need 800
24522 @itemx -read_only_relocs
24523 @itemx -sectalign
24524 @itemx -sectobjectsymbols
24525 @itemx -whyload
24526 @itemx -seg1addr
24527 @itemx -sectcreate
24528 @itemx -sectobjectsymbols
24529 @itemx -sectorder
24530 @itemx -segaddr
24531 @itemx -segs_read_only_addr
24532 @need 800
24533 @itemx -segs_read_write_addr
24534 @itemx -seg_addr_table
24535 @itemx -seg_addr_table_filename
24536 @itemx -seglinkedit
24537 @itemx -segprot
24538 @itemx -segs_read_only_addr
24539 @itemx -segs_read_write_addr
24540 @itemx -single_module
24541 @itemx -static
24542 @itemx -sub_library
24543 @need 800
24544 @opindex allowable_client
24545 @opindex client_name
24546 @opindex compatibility_version
24547 @opindex current_version
24548 @opindex dead_strip
24549 @opindex dependency-file
24550 @opindex dylib_file
24551 @opindex dylinker_install_name
24552 @opindex dynamic
24553 @opindex exported_symbols_list
24554 @opindex filelist
24555 @opindex flat_namespace
24556 @opindex force_flat_namespace
24557 @opindex headerpad_max_install_names
24558 @opindex image_base
24559 @opindex init
24560 @opindex install_name
24561 @opindex keep_private_externs
24562 @opindex multi_module
24563 @opindex multiply_defined
24564 @opindex multiply_defined_unused
24565 @opindex noall_load
24566 @opindex no_dead_strip_inits_and_terms
24567 @opindex nofixprebinding
24568 @opindex nomultidefs
24569 @opindex noprebind
24570 @opindex noseglinkedit
24571 @opindex pagezero_size
24572 @opindex prebind
24573 @opindex prebind_all_twolevel_modules
24574 @opindex private_bundle
24575 @opindex read_only_relocs
24576 @opindex sectalign
24577 @opindex sectobjectsymbols
24578 @opindex whyload
24579 @opindex seg1addr
24580 @opindex sectcreate
24581 @opindex sectobjectsymbols
24582 @opindex sectorder
24583 @opindex segaddr
24584 @opindex segs_read_only_addr
24585 @opindex segs_read_write_addr
24586 @opindex seg_addr_table
24587 @opindex seg_addr_table_filename
24588 @opindex seglinkedit
24589 @opindex segprot
24590 @opindex segs_read_only_addr
24591 @opindex segs_read_write_addr
24592 @opindex single_module
24593 @opindex static
24594 @opindex sub_library
24595 @opindex sub_umbrella
24596 @opindex twolevel_namespace
24597 @opindex umbrella
24598 @opindex undefined
24599 @opindex unexported_symbols_list
24600 @opindex weak_reference_mismatches
24601 @opindex whatsloaded
24602 @itemx -sub_umbrella
24603 @itemx -twolevel_namespace
24604 @itemx -umbrella
24605 @itemx -undefined
24606 @itemx -unexported_symbols_list
24607 @itemx -weak_reference_mismatches
24608 @itemx -whatsloaded
24609 These options are passed to the Darwin linker.  The Darwin linker man page
24610 describes them in detail.
24611 @end table
24613 @node DEC Alpha Options
24614 @subsection DEC Alpha Options
24616 These @samp{-m} options are defined for the DEC Alpha implementations:
24618 @table @gcctabopt
24619 @opindex mno-soft-float
24620 @opindex msoft-float
24621 @item -mno-soft-float
24622 @itemx -msoft-float
24623 Use (do not use) the hardware floating-point instructions for
24624 floating-point operations.  When @option{-msoft-float} is specified,
24625 functions in @file{libgcc.a} are used to perform floating-point
24626 operations.  Unless they are replaced by routines that emulate the
24627 floating-point operations, or compiled in such a way as to call such
24628 emulations routines, these routines issue floating-point
24629 operations.   If you are compiling for an Alpha without floating-point
24630 operations, you must ensure that the library is built so as not to call
24631 them.
24633 Note that Alpha implementations without floating-point operations are
24634 required to have floating-point registers.
24636 @opindex mfp-reg
24637 @opindex mno-fp-regs
24638 @item -mfp-reg
24639 @itemx -mno-fp-regs
24640 Generate code that uses (does not use) the floating-point register set.
24641 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
24642 register set is not used, floating-point operands are passed in integer
24643 registers as if they were integers and floating-point results are passed
24644 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
24645 so any function with a floating-point argument or return value called by code
24646 compiled with @option{-mno-fp-regs} must also be compiled with that
24647 option.
24649 A typical use of this option is building a kernel that does not use,
24650 and hence need not save and restore, any floating-point registers.
24652 @opindex mieee
24653 @item -mieee
24654 The Alpha architecture implements floating-point hardware optimized for
24655 maximum performance.  It is mostly compliant with the IEEE floating-point
24656 standard.  However, for full compliance, software assistance is
24657 required.  This option generates code fully IEEE-compliant code
24658 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24659 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24660 defined during compilation.  The resulting code is less efficient but is
24661 able to correctly support denormalized numbers and exceptional IEEE
24662 values such as not-a-number and plus/minus infinity.  Other Alpha
24663 compilers call this option @option{-ieee_with_no_inexact}.
24665 @opindex mieee-with-inexact
24666 @item -mieee-with-inexact
24667 This is like @option{-mieee} except the generated code also maintains
24668 the IEEE @var{inexact-flag}.  Turning on this option causes the
24669 generated code to implement fully-compliant IEEE math.  In addition to
24670 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24671 macro.  On some Alpha implementations the resulting code may execute
24672 significantly slower than the code generated by default.  Since there is
24673 very little code that depends on the @var{inexact-flag}, you should
24674 normally not specify this option.  Other Alpha compilers call this
24675 option @option{-ieee_with_inexact}.
24677 @opindex mfp-trap-mode
24678 @item -mfp-trap-mode=@var{trap-mode}
24679 This option controls what floating-point related traps are enabled.
24680 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24681 The trap mode can be set to one of four values:
24683 @table @samp
24684 @item n
24685 This is the default (normal) setting.  The only traps that are enabled
24686 are the ones that cannot be disabled in software (e.g., division by zero
24687 trap).
24689 @item u
24690 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24691 as well.
24693 @item su
24694 Like @samp{u}, but the instructions are marked to be safe for software
24695 completion (see Alpha architecture manual for details).
24697 @item sui
24698 Like @samp{su}, but inexact traps are enabled as well.
24699 @end table
24701 @opindex mfp-rounding-mode
24702 @item -mfp-rounding-mode=@var{rounding-mode}
24703 Selects the IEEE rounding mode.  Other Alpha compilers call this option
24704 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
24707 @table @samp
24708 @item n
24709 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
24710 the nearest machine number or towards the even machine number in case
24711 of a tie.
24713 @item m
24714 Round towards minus infinity.
24716 @item c
24717 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
24719 @item d
24720 Dynamic rounding mode.  A field in the floating-point control register
24721 (@var{fpcr}, see Alpha architecture reference manual) controls the
24722 rounding mode in effect.  The C library initializes this register for
24723 rounding towards plus infinity.  Thus, unless your program modifies the
24724 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24725 @end table
24727 @opindex mtrap-precision
24728 @item -mtrap-precision=@var{trap-precision}
24729 In the Alpha architecture, floating-point traps are imprecise.  This
24730 means without software assistance it is impossible to recover from a
24731 floating trap and program execution normally needs to be terminated.
24732 GCC can generate code that can assist operating system trap handlers
24733 in determining the exact location that caused a floating-point trap.
24734 Depending on the requirements of an application, different levels of
24735 precisions can be selected:
24737 @table @samp
24738 @item p
24739 Program precision.  This option is the default and means a trap handler
24740 can only identify which program caused a floating-point exception.
24742 @item f
24743 Function precision.  The trap handler can determine the function that
24744 caused a floating-point exception.
24746 @item i
24747 Instruction precision.  The trap handler can determine the exact
24748 instruction that caused a floating-point exception.
24749 @end table
24751 Other Alpha compilers provide the equivalent options called
24752 @option{-scope_safe} and @option{-resumption_safe}.
24754 @opindex mieee-conformant
24755 @item -mieee-conformant
24756 This option marks the generated code as IEEE conformant.  You must not
24757 use this option unless you also specify @option{-mtrap-precision=i} and either
24758 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
24759 is to emit the line @samp{.eflag 48} in the function prologue of the
24760 generated assembly file.
24762 @opindex mbuild-constants
24763 @item -mbuild-constants
24764 Normally GCC examines a 32- or 64-bit integer constant to
24765 see if it can construct it from smaller constants in two or three
24766 instructions.  If it cannot, it outputs the constant as a literal and
24767 generates code to load it from the data segment at run time.
24769 Use this option to require GCC to construct @emph{all} integer constants
24770 using code, even if it takes more instructions (the maximum is six).
24772 You typically use this option to build a shared library dynamic
24773 loader.  Itself a shared library, it must relocate itself in memory
24774 before it can find the variables and constants in its own data segment.
24776 @opindex mbwx
24777 @opindex mno-bwx
24778 @opindex mcix
24779 @opindex mno-cix
24780 @opindex mfix
24781 @opindex mno-fix
24782 @opindex mmax
24783 @opindex mno-max
24784 @item -mbwx
24785 @itemx -mno-bwx
24786 @itemx -mcix
24787 @itemx -mno-cix
24788 @itemx -mfix
24789 @itemx -mno-fix
24790 @itemx -mmax
24791 @itemx -mno-max
24792 Indicate whether GCC should generate code to use the optional BWX,
24793 CIX, FIX and MAX instruction sets.  The default is to use the instruction
24794 sets supported by the CPU type specified via @option{-mcpu=} option or that
24795 of the CPU on which GCC was built if none is specified.
24797 @opindex mfloat-vax
24798 @opindex mfloat-ieee
24799 @item -mfloat-vax
24800 @itemx -mfloat-ieee
24801 Generate code that uses (does not use) VAX F and G floating-point
24802 arithmetic instead of IEEE single and double precision.
24804 @opindex mexplicit-relocs
24805 @opindex mno-explicit-relocs
24806 @item -mexplicit-relocs
24807 @itemx -mno-explicit-relocs
24808 Older Alpha assemblers provided no way to generate symbol relocations
24809 except via assembler macros.  Use of these macros does not allow
24810 optimal instruction scheduling.  GNU binutils as of version 2.12
24811 supports a new syntax that allows the compiler to explicitly mark
24812 which relocations should apply to which instructions.  This option
24813 is mostly useful for debugging, as GCC detects the capabilities of
24814 the assembler when it is built and sets the default accordingly.
24816 @opindex msmall-data
24817 @opindex mlarge-data
24818 @item -msmall-data
24819 @itemx -mlarge-data
24820 When @option{-mexplicit-relocs} is in effect, static data is
24821 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
24822 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24823 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24824 16-bit relocations off of the @code{$gp} register.  This limits the
24825 size of the small data area to 64KB, but allows the variables to be
24826 directly accessed via a single instruction.
24828 The default is @option{-mlarge-data}.  With this option the data area
24829 is limited to just below 2GB@.  Programs that require more than 2GB of
24830 data must use @code{malloc} or @code{mmap} to allocate the data in the
24831 heap instead of in the program's data segment.
24833 When generating code for shared libraries, @option{-fpic} implies
24834 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24836 @opindex msmall-text
24837 @opindex mlarge-text
24838 @item -msmall-text
24839 @itemx -mlarge-text
24840 When @option{-msmall-text} is used, the compiler assumes that the
24841 code of the entire program (or shared library) fits in 4MB, and is
24842 thus reachable with a branch instruction.  When @option{-msmall-data}
24843 is used, the compiler can assume that all local symbols share the
24844 same @code{$gp} value, and thus reduce the number of instructions
24845 required for a function call from 4 to 1.
24847 The default is @option{-mlarge-text}.
24849 @opindex mcpu
24850 @item -mcpu=@var{cpu_type}
24851 Set the instruction set and instruction scheduling parameters for
24852 machine type @var{cpu_type}.  You can specify either the @samp{EV}
24853 style name or the corresponding chip number.  GCC supports scheduling
24854 parameters for the EV4, EV5 and EV6 family of processors and
24855 chooses the default values for the instruction set from the processor
24856 you specify.  If you do not specify a processor type, GCC defaults
24857 to the processor on which the compiler was built.
24859 Supported values for @var{cpu_type} are
24861 @table @samp
24862 @item ev4
24863 @itemx ev45
24864 @itemx 21064
24865 Schedules as an EV4 and has no instruction set extensions.
24867 @item ev5
24868 @itemx 21164
24869 Schedules as an EV5 and has no instruction set extensions.
24871 @item ev56
24872 @itemx 21164a
24873 Schedules as an EV5 and supports the BWX extension.
24875 @item pca56
24876 @itemx 21164pc
24877 @itemx 21164PC
24878 Schedules as an EV5 and supports the BWX and MAX extensions.
24880 @item ev6
24881 @itemx 21264
24882 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24884 @item ev67
24885 @itemx 21264a
24886 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24887 @end table
24889 Native toolchains also support the value @samp{native},
24890 which selects the best architecture option for the host processor.
24891 @option{-mcpu=native} has no effect if GCC does not recognize
24892 the processor.
24894 @opindex mtune
24895 @item -mtune=@var{cpu_type}
24896 Set only the instruction scheduling parameters for machine type
24897 @var{cpu_type}.  The instruction set is not changed.
24899 Native toolchains also support the value @samp{native},
24900 which selects the best architecture option for the host processor.
24901 @option{-mtune=native} has no effect if GCC does not recognize
24902 the processor.
24904 @opindex mmemory-latency
24905 @item -mmemory-latency=@var{time}
24906 Sets the latency the scheduler should assume for typical memory
24907 references as seen by the application.  This number is highly
24908 dependent on the memory access patterns used by the application
24909 and the size of the external cache on the machine.
24911 Valid options for @var{time} are
24913 @table @samp
24914 @item @var{number}
24915 A decimal number representing clock cycles.
24917 @item L1
24918 @itemx L2
24919 @itemx L3
24920 @itemx main
24921 The compiler contains estimates of the number of clock cycles for
24922 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24923 (also called Dcache, Scache, and Bcache), as well as to main memory.
24924 Note that L3 is only valid for EV5.
24926 @end table
24927 @end table
24929 @node eBPF Options
24930 @subsection eBPF Options
24931 @cindex eBPF Options
24933 @table @gcctabopt
24934 @item -mframe-limit=@var{bytes}
24935 This specifies the hard limit for frame sizes, in bytes.  Currently,
24936 the value that can be specified should be less than or equal to
24937 @samp{32767}.  Defaults to whatever limit is imposed by the version of
24938 the Linux kernel targeted.
24940 @opindex mbig-endian
24941 @item -mbig-endian
24942 Generate code for a big-endian target.
24944 @opindex mlittle-endian
24945 @item -mlittle-endian
24946 Generate code for a little-endian target.  This is the default.
24948 @opindex mjmpext
24949 @item -mjmpext
24950 @itemx -mno-jmpext
24951 Enable or disable generation of extra conditional-branch instructions.
24952 Enabled for CPU v2 and above.
24954 @opindex mjmp32
24955 @item -mjmp32
24956 @itemx -mno-jmp32
24957 Enable or disable generation of 32-bit jump instructions.
24958 Enabled for CPU v3 and above.
24960 @opindex malu32
24961 @item -malu32
24962 @itemx -mno-alu32
24963 Enable or disable generation of 32-bit ALU instructions.
24964 Enabled for CPU v3 and above.
24966 @opindex mv3-atomics
24967 @item -mv3-atomics
24968 @itemx -mno-v3-atomics
24969 Enable or disable instructions for general atomic operations introduced
24970 in CPU v3.  Enabled for CPU v3 and above.
24972 @opindex mbswap
24973 @item -mbswap
24974 @itemx -mno-bswap
24975 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
24977 @opindex msdiv
24978 @item -msdiv
24979 @itemx -mno-sdiv
24980 Enable or disable signed division and modulus instructions.  Enabled for
24981 CPU v4 and above.
24983 @opindex msmov
24984 @item -msmov
24985 @itemx -mno-smov
24986 Enable or disable sign-extending move and memory load instructions.
24987 Enabled for CPU v4 and above.
24989 @opindex mcpu
24990 @item -mcpu=@var{version}
24991 This specifies which version of the eBPF ISA to target. Newer versions
24992 may not be supported by all kernels. The default is @samp{v4}.
24994 Supported values for @var{version} are:
24996 @table @samp
24997 @item v1
24998 The first stable eBPF ISA with no special features or extensions.
25000 @item v2
25001 Supports the jump extensions, as in @option{-mjmpext}.
25003 @item v3
25004 All features of v2, plus:
25005 @itemize @minus
25006 @item 32-bit jump operations, as in @option{-mjmp32}
25007 @item 32-bit ALU operations, as in @option{-malu32}
25008 @item general atomic operations, as in @option{-mv3-atomics}
25009 @end itemize
25011 @item v4
25012 All features of v3, plus:
25013 @itemize @minus
25014 @item Byte swap instructions, as in @option{-mbswap}
25015 @item Signed division and modulus instructions, as in @option{-msdiv}
25016 @item Sign-extending move and memory load instructions, as in @option{-msmov}
25017 @end itemize
25018 @end table
25020 @opindex mco-re
25021 @item -mco-re
25022 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
25023 is implied by @option{-gbtf}.
25025 @opindex mno-co-re
25026 @item -mno-co-re
25027 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
25028 support is enabled by default when generating BTF debug information for
25029 the BPF target.
25031 @item -mxbpf
25032 Generate code for an expanded version of BPF, which relaxes some of
25033 the restrictions imposed by the BPF architecture:
25034 @itemize @minus
25035 @item Save and restore callee-saved registers at function entry and
25036 exit, respectively.
25037 @end itemize
25039 @opindex masm=@var{dialect}
25040 @item -masm=@var{dialect}
25041 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
25042 is @samp{normal}.
25044 Supported values for @var{dialect} are:
25046 @table @samp
25047 @item normal
25048 Outputs normal assembly dialect.
25050 @item pseudoc
25051 Outputs pseudo-c assembly dialect.
25053 @end table
25055 @end table
25057 @node FR30 Options
25058 @subsection FR30 Options
25059 @cindex FR30 Options
25061 These options are defined specifically for the FR30 port.
25063 @table @gcctabopt
25065 @opindex msmall-model
25066 @item -msmall-model
25067 Use the small address space model.  This can produce smaller code, but
25068 it does assume that all symbolic values and addresses fit into a
25069 20-bit range.
25071 @opindex mno-lsim
25072 @item -mno-lsim
25073 Assume that runtime support has been provided and so there is no need
25074 to include the simulator library (@file{libsim.a}) on the linker
25075 command line.
25077 @end table
25079 @node FT32 Options
25080 @subsection FT32 Options
25081 @cindex FT32 Options
25083 These options are defined specifically for the FT32 port.
25085 @table @gcctabopt
25087 @opindex msim
25088 @item -msim
25089 Specifies that the program will be run on the simulator.  This causes
25090 an alternate runtime startup and library to be linked.
25091 You must not use this option when generating programs that will run on
25092 real hardware; you must provide your own runtime library for whatever
25093 I/O functions are needed.
25095 @opindex mlra
25096 @item -mlra
25097 Enable Local Register Allocation.  This is still experimental for FT32,
25098 so by default the compiler uses standard reload.
25100 @opindex mnodiv
25101 @item -mnodiv
25102 Do not use div and mod instructions.
25104 @opindex mft32b
25105 @item -mft32b
25106 Enable use of the extended instructions of the FT32B processor.
25108 @opindex mcompress
25109 @item -mcompress
25110 Compress all code using the Ft32B code compression scheme.
25112 @opindex  mnopm
25113 @item -mnopm
25114 Do not generate code that reads program memory.
25116 @end table
25118 @node FRV Options
25119 @subsection FRV Options
25120 @cindex FRV Options
25122 @table @gcctabopt
25123 @opindex mgpr-32
25124 @item -mgpr-32
25126 Only use the first 32 general-purpose registers.
25128 @opindex mgpr-64
25129 @item -mgpr-64
25131 Use all 64 general-purpose registers.
25133 @opindex mfpr-32
25134 @item -mfpr-32
25136 Use only the first 32 floating-point registers.
25138 @opindex mfpr-64
25139 @item -mfpr-64
25141 Use all 64 floating-point registers.
25143 @opindex mhard-float
25144 @item -mhard-float
25146 Use hardware instructions for floating-point operations.
25148 @opindex msoft-float
25149 @item -msoft-float
25151 Use library routines for floating-point operations.
25153 @opindex malloc-cc
25154 @item -malloc-cc
25156 Dynamically allocate condition code registers.
25158 @opindex mfixed-cc
25159 @item -mfixed-cc
25161 Do not try to dynamically allocate condition code registers, only
25162 use @code{icc0} and @code{fcc0}.
25164 @opindex mdword
25165 @item -mdword
25167 Change ABI to use double word insns.
25169 @opindex mno-dword
25170 @opindex mdword
25171 @item -mno-dword
25173 Do not use double word instructions.
25175 @opindex mdouble
25176 @item -mdouble
25178 Use floating-point double instructions.
25180 @opindex mno-double
25181 @item -mno-double
25183 Do not use floating-point double instructions.
25185 @opindex mmedia
25186 @item -mmedia
25188 Use media instructions.
25190 @opindex mno-media
25191 @item -mno-media
25193 Do not use media instructions.
25195 @opindex mmuladd
25196 @item -mmuladd
25198 Use multiply and add/subtract instructions.
25200 @opindex mno-muladd
25201 @item -mno-muladd
25203 Do not use multiply and add/subtract instructions.
25205 @opindex mfdpic
25206 @item -mfdpic
25208 Select the FDPIC ABI, which uses function descriptors to represent
25209 pointers to functions.  Without any PIC/PIE-related options, it
25210 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25211 assumes GOT entries and small data are within a 12-bit range from the
25212 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25213 are computed with 32 bits.
25214 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25216 @opindex minline-plt
25217 @item -minline-plt
25219 Enable inlining of PLT entries in function calls to functions that are
25220 not known to bind locally.  It has no effect without @option{-mfdpic}.
25221 It's enabled by default if optimizing for speed and compiling for
25222 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25223 optimization option such as @option{-O3} or above is present in the
25224 command line.
25226 @opindex mTLS
25227 @item -mTLS
25229 Assume a large TLS segment when generating thread-local code.
25231 @opindex mtls
25232 @item -mtls
25234 Do not assume a large TLS segment when generating thread-local code.
25236 @opindex mgprel-ro
25237 @item -mgprel-ro
25239 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25240 that is known to be in read-only sections.  It's enabled by default,
25241 except for @option{-fpic} or @option{-fpie}: even though it may help
25242 make the global offset table smaller, it trades 1 instruction for 4.
25243 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25244 one of which may be shared by multiple symbols, and it avoids the need
25245 for a GOT entry for the referenced symbol, so it's more likely to be a
25246 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25248 @opindex multilib-library-pic
25249 @item -multilib-library-pic
25251 Link with the (library, not FD) pic libraries.  It's implied by
25252 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25253 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25254 it explicitly.
25256 @opindex mlinked-fp
25257 @item -mlinked-fp
25259 Follow the EABI requirement of always creating a frame pointer whenever
25260 a stack frame is allocated.  This option is enabled by default and can
25261 be disabled with @option{-mno-linked-fp}.
25263 @opindex mlong-calls
25264 @item -mlong-calls
25266 Use indirect addressing to call functions outside the current
25267 compilation unit.  This allows the functions to be placed anywhere
25268 within the 32-bit address space.
25270 @opindex malign-labels
25271 @item -malign-labels
25273 Try to align labels to an 8-byte boundary by inserting NOPs into the
25274 previous packet.  This option only has an effect when VLIW packing
25275 is enabled.  It doesn't create new packets; it merely adds NOPs to
25276 existing ones.
25278 @opindex mlibrary-pic
25279 @item -mlibrary-pic
25281 Generate position-independent EABI code.
25283 @opindex macc-4
25284 @item -macc-4
25286 Use only the first four media accumulator registers.
25288 @opindex macc-8
25289 @item -macc-8
25291 Use all eight media accumulator registers.
25293 @opindex mpack
25294 @item -mpack
25296 Pack VLIW instructions.
25298 @opindex mno-pack
25299 @item -mno-pack
25301 Do not pack VLIW instructions.
25303 @opindex mno-eflags
25304 @item -mno-eflags
25306 Do not mark ABI switches in e_flags.
25308 @opindex mcond-move
25309 @item -mcond-move
25311 Enable the use of conditional-move instructions (default).
25313 This switch is mainly for debugging the compiler and will likely be removed
25314 in a future version.
25316 @opindex mno-cond-move
25317 @item -mno-cond-move
25319 Disable the use of conditional-move instructions.
25321 This switch is mainly for debugging the compiler and will likely be removed
25322 in a future version.
25324 @opindex mscc
25325 @item -mscc
25327 Enable the use of conditional set instructions (default).
25329 This switch is mainly for debugging the compiler and will likely be removed
25330 in a future version.
25332 @opindex mno-scc
25333 @item -mno-scc
25335 Disable the use of conditional set instructions.
25337 This switch is mainly for debugging the compiler and will likely be removed
25338 in a future version.
25340 @opindex mcond-exec
25341 @item -mcond-exec
25343 Enable the use of conditional execution (default).
25345 This switch is mainly for debugging the compiler and will likely be removed
25346 in a future version.
25348 @opindex mno-cond-exec
25349 @item -mno-cond-exec
25351 Disable the use of conditional execution.
25353 This switch is mainly for debugging the compiler and will likely be removed
25354 in a future version.
25356 @opindex mvliw-branch
25357 @item -mvliw-branch
25359 Run a pass to pack branches into VLIW instructions (default).
25361 This switch is mainly for debugging the compiler and will likely be removed
25362 in a future version.
25364 @opindex mno-vliw-branch
25365 @item -mno-vliw-branch
25367 Do not run a pass to pack branches into VLIW instructions.
25369 This switch is mainly for debugging the compiler and will likely be removed
25370 in a future version.
25372 @opindex mmulti-cond-exec
25373 @item -mmulti-cond-exec
25375 Enable optimization of @code{&&} and @code{||} in conditional execution
25376 (default).
25378 This switch is mainly for debugging the compiler and will likely be removed
25379 in a future version.
25381 @opindex mno-multi-cond-exec
25382 @item -mno-multi-cond-exec
25384 Disable optimization of @code{&&} and @code{||} in conditional execution.
25386 This switch is mainly for debugging the compiler and will likely be removed
25387 in a future version.
25389 @opindex mnested-cond-exec
25390 @item -mnested-cond-exec
25392 Enable nested conditional execution optimizations (default).
25394 This switch is mainly for debugging the compiler and will likely be removed
25395 in a future version.
25397 @opindex mno-nested-cond-exec
25398 @item -mno-nested-cond-exec
25400 Disable nested conditional execution optimizations.
25402 This switch is mainly for debugging the compiler and will likely be removed
25403 in a future version.
25405 @opindex moptimize-membar
25406 @item -moptimize-membar
25408 This switch removes redundant @code{membar} instructions from the
25409 compiler-generated code.  It is enabled by default.
25411 @opindex mno-optimize-membar
25412 @opindex moptimize-membar
25413 @item -mno-optimize-membar
25415 This switch disables the automatic removal of redundant @code{membar}
25416 instructions from the generated code.
25418 @opindex mtomcat-stats
25419 @item -mtomcat-stats
25421 Cause gas to print out tomcat statistics.
25423 @opindex mcpu
25424 @item -mcpu=@var{cpu}
25426 Select the processor type for which to generate code.  Possible values are
25427 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
25428 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
25430 @end table
25432 @node GNU/Linux Options
25433 @subsection GNU/Linux Options
25435 These @samp{-m} options are defined for GNU/Linux targets:
25437 @table @gcctabopt
25438 @opindex mglibc
25439 @item -mglibc
25440 Use the GNU C library.  This is the default except
25441 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
25442 @samp{*-*-linux-*android*} targets.
25444 @opindex muclibc
25445 @item -muclibc
25446 Use uClibc C library.  This is the default on
25447 @samp{*-*-linux-*uclibc*} targets.
25449 @opindex mmusl
25450 @item -mmusl
25451 Use the musl C library.  This is the default on
25452 @samp{*-*-linux-*musl*} targets.
25454 @opindex mbionic
25455 @item -mbionic
25456 Use Bionic C library.  This is the default on
25457 @samp{*-*-linux-*android*} targets.
25459 @opindex mandroid
25460 @item -mandroid
25461 Compile code compatible with Android platform.  This is the default on
25462 @samp{*-*-linux-*android*} targets.
25464 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
25465 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
25466 this option makes the GCC driver pass Android-specific options to the linker.
25467 Finally, this option causes the preprocessor macro @code{__ANDROID__}
25468 to be defined.
25470 @opindex tno-android-cc
25471 @item -tno-android-cc
25472 Disable compilation effects of @option{-mandroid}, i.e., do not enable
25473 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
25474 @option{-fno-rtti} by default.
25476 @opindex tno-android-ld
25477 @item -tno-android-ld
25478 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
25479 linking options to the linker.
25481 @end table
25483 @node H8/300 Options
25484 @subsection H8/300 Options
25486 These @samp{-m} options are defined for the H8/300 implementations:
25488 @table @gcctabopt
25489 @opindex mrelax
25490 @item -mrelax
25491 Shorten some address references at link time, when possible; uses the
25492 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
25493 ld, Using ld}, for a fuller description.
25495 @opindex mh
25496 @item -mh
25497 Generate code for the H8/300H@.
25499 @opindex ms
25500 @item -ms
25501 Generate code for the H8S@.
25503 @opindex mn
25504 @item -mn
25505 Generate code for the H8S and H8/300H in the normal mode.  This switch
25506 must be used either with @option{-mh} or @option{-ms}.
25508 @opindex ms2600
25509 @item -ms2600
25510 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
25512 @opindex mexr
25513 @item -mexr
25514 Extended registers are stored on stack before execution of function
25515 with monitor attribute. Default option is @option{-mexr}.
25516 This option is valid only for H8S targets.
25518 @opindex mno-exr
25519 @opindex mexr
25520 @item -mno-exr
25521 Extended registers are not stored on stack before execution of function 
25522 with monitor attribute. Default option is @option{-mno-exr}. 
25523 This option is valid only for H8S targets.
25525 @opindex mint32
25526 @item -mint32
25527 Make @code{int} data 32 bits by default.
25529 @opindex malign-300
25530 @item -malign-300
25531 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
25532 The default for the H8/300H and H8S is to align longs and floats on
25533 4-byte boundaries.
25534 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
25535 This option has no effect on the H8/300.
25536 @end table
25538 @node HPPA Options
25539 @subsection HPPA Options
25540 @cindex HPPA Options
25542 These @samp{-m} options are defined for the HPPA family of computers:
25544 @table @gcctabopt
25545 @opindex march
25546 @item -march=@var{architecture-type}
25547 Generate code for the specified architecture.  The choices for
25548 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
25549 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
25550 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
25551 architecture option for your machine.  Code compiled for lower numbered
25552 architectures runs on higher numbered architectures, but not the
25553 other way around.
25555 @opindex mpa-risc-1-0
25556 @opindex mpa-risc-1-1
25557 @opindex mpa-risc-2-0
25558 @item -mpa-risc-1-0
25559 @itemx -mpa-risc-1-1
25560 @itemx -mpa-risc-2-0
25561 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
25563 @opindex matomic-libcalls
25564 @opindex mno-atomic-libcalls
25565 @item -matomic-libcalls
25566 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
25567 This option is enabled by default.  It only affects the generation of
25568 atomic libcalls by the HPPA backend.
25570 Both the sync and @file{libatomic} libcall implementations use locking.
25571 As a result, processor stores are not atomic with respect to other
25572 atomic operations.  Processor loads up to DImode are atomic with
25573 respect to other atomic operations provided they are implemented as
25574 a single access.
25576 The PA-RISC architecture does not support any atomic operations in
25577 hardware except for the @code{ldcw} instruction.  Thus, all atomic
25578 support is implemented using sync and atomic libcalls.  Sync libcall
25579 support is in @file{libgcc.a}.  Atomic libcall support is in
25580 @file{libatomic}.
25582 This option generates @code{__atomic_exchange} calls for atomic stores.
25583 It also provides special handling for atomic DImode accesses on 32-bit
25584 targets.
25586 @opindex mbig-switch
25587 @item -mbig-switch
25588 Does nothing.  Preserved for backward compatibility.
25590 @opindex mcaller-copies
25591 @item -mcaller-copies
25592 The caller copies function arguments passed by hidden reference.  This
25593 option should be used with care as it is not compatible with the default
25594 32-bit runtime.  However, only aggregates larger than eight bytes are
25595 passed by hidden reference and the option provides better compatibility
25596 with OpenMP.
25598 @opindex mcoherent-ldcw
25599 @item -mcoherent-ldcw
25600 Use ldcw/ldcd coherent cache-control hint.
25602 @opindex mdisable-fpregs
25603 @item -mdisable-fpregs
25604 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
25606 @opindex mdisable-indexing
25607 @item -mdisable-indexing
25608 Prevent the compiler from using indexing address modes.  This avoids some
25609 rather obscure problems when compiling MIG generated code under MACH@.
25611 @opindex mfast-indirect-calls
25612 @item -mfast-indirect-calls
25613 Generate code that assumes calls never cross space boundaries.  This
25614 allows GCC to emit code that performs faster indirect calls.
25616 This option does not work in the presence of shared libraries or nested
25617 functions.
25619 @opindex mfixed-range
25620 @item -mfixed-range=@var{register-range}
25621 Generate code treating the given register range as fixed registers.
25622 A fixed register is one that the register allocator cannot use.  This is
25623 useful when compiling kernel code.  A register range is specified as
25624 two registers separated by a dash.  Multiple register ranges can be
25625 specified separated by a comma.
25627 @opindex mgas
25628 @item -mgas
25629 Enable the use of assembler directives only GAS understands.
25631 @opindex mgnu-ld
25632 @item -mgnu-ld
25633 Use options specific to GNU @command{ld}.
25634 This passes @option{-shared} to @command{ld} when
25635 building a shared library.  It is the default when GCC is configured,
25636 explicitly or implicitly, with the GNU linker.  This option does not
25637 affect which @command{ld} is called; it only changes what parameters
25638 are passed to that @command{ld}.
25639 The @command{ld} that is called is determined by the
25640 @option{--with-ld} configure option, GCC's program search path, and
25641 finally by the user's @env{PATH}.  The linker used by GCC can be printed
25642 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
25643 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25645 @opindex mhp-ld
25646 @item -mhp-ld
25647 Use options specific to HP @command{ld}.
25648 This passes @option{-b} to @command{ld} when building
25649 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25650 links.  It is the default when GCC is configured, explicitly or
25651 implicitly, with the HP linker.  This option does not affect
25652 which @command{ld} is called; it only changes what parameters are passed to that
25653 @command{ld}.
25654 The @command{ld} that is called is determined by the @option{--with-ld}
25655 configure option, GCC's program search path, and finally by the user's
25656 @env{PATH}.  The linker used by GCC can be printed using @samp{which
25657 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
25658 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25660 @opindex mlinker-opt
25661 @item -mlinker-opt
25662 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
25663 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
25664 linkers in which they give bogus error messages when linking some programs.
25666 @opindex mno-long-calls
25667 @opindex mlong-calls
25668 @item -mlong-calls
25669 Generate code that uses long call sequences.  This ensures that a call
25670 is always able to reach linker generated stubs.  The default is to generate
25671 long calls only when the distance from the call site to the beginning
25672 of the function or translation unit, as the case may be, exceeds a
25673 predefined limit set by the branch type being used.  The limits for
25674 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25675 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
25676 240,000 bytes.
25678 Distances are measured from the beginning of functions when using the
25679 @option{-ffunction-sections} option, or when using the @option{-mgas}
25680 and @option{-mno-portable-runtime} options together under HP-UX with
25681 the SOM linker.
25683 It is normally not desirable to use this option as it degrades
25684 performance.  However, it may be useful in large applications,
25685 particularly when partial linking is used to build the application.
25687 The types of long calls used depends on the capabilities of the
25688 assembler and linker, and the type of code being generated.  The
25689 impact on systems that support long absolute calls, and long pic
25690 symbol-difference or pc-relative calls should be relatively small.
25691 However, an indirect call is used on 32-bit ELF systems in pic code
25692 and it is quite long.
25694 @opindex mlong-load-store
25695 @item -mlong-load-store
25696 Generate 3-instruction load and store sequences as sometimes required by
25697 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
25698 the HP compilers.
25700 @opindex mjump-in-delay
25701 @item -mjump-in-delay
25702 This option is ignored and provided for compatibility purposes only.
25704 @opindex mno-space-regs
25705 @opindex mspace-regs
25706 @item -mno-space-regs
25707 Generate code that assumes the target has no space registers.  This allows
25708 GCC to generate faster indirect calls and use unscaled index address modes.
25710 Such code is suitable for level 0 PA systems and kernels.
25712 @opindex mordered
25713 @item -mordered
25714 Assume memory references are ordered and barriers are not needed.
25716 @opindex mportable-runtime
25717 @item -mportable-runtime
25718 Use the portable calling conventions proposed by HP for ELF systems.
25720 @opindex mschedule
25721 @item -mschedule=@var{cpu-type}
25722 Schedule code according to the constraints for the machine type
25723 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
25724 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
25725 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25726 proper scheduling option for your machine.  The default scheduling is
25727 @samp{8000}.
25729 @opindex msio
25730 @item -msio
25731 Generate the predefine, @code{_SIO}, for server IO@.  The default is
25732 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
25733 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
25734 options are available under HP-UX and HI-UX@.
25736 @opindex msoft-float
25737 @item -msoft-float
25738 Generate output containing library calls for floating point.
25739 @strong{Warning:} the requisite libraries are not available for all HPPA
25740 targets.  Normally the facilities of the machine's usual C compiler are
25741 used, but this cannot be done directly in cross-compilation.  You must make
25742 your own arrangements to provide suitable library functions for
25743 cross-compilation.
25745 @option{-msoft-float} changes the calling convention in the output file;
25746 therefore, it is only useful if you compile @emph{all} of a program with
25747 this option.  In particular, you need to compile @file{libgcc.a}, the
25748 library that comes with GCC, with @option{-msoft-float} in order for
25749 this to work.
25751 @opindex msoft-mult
25752 @item -msoft-mult
25753 Use software integer multiplication.
25755 This disables the use of the @code{xmpyu} instruction.
25757 @opindex march
25758 @item -munix=@var{unix-std}
25759 Generate compiler predefines and select a startfile for the specified
25760 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
25761 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
25762 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
25763 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
25764 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25765 and later.
25767 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25768 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25769 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25770 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25771 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25772 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25774 It is @emph{important} to note that this option changes the interfaces
25775 for various library routines.  It also affects the operational behavior
25776 of the C library.  Thus, @emph{extreme} care is needed in using this
25777 option.
25779 Library code that is intended to operate with more than one UNIX
25780 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25781 as appropriate.  Most GNU software doesn't provide this capability.
25783 @opindex nolibdld
25784 @item -nolibdld
25785 Suppress the generation of link options to search libdld.sl when the
25786 @option{-static} option is specified on HP-UX 10 and later.
25788 @opindex static
25789 @item -static
25790 The HP-UX implementation of setlocale in libc has a dependency on
25791 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
25792 when the @option{-static} option is specified, special link options
25793 are needed to resolve this dependency.
25795 On HP-UX 10 and later, the GCC driver adds the necessary options to
25796 link with libdld.sl when the @option{-static} option is specified.
25797 This causes the resulting binary to be dynamic.  On the 64-bit port,
25798 the linkers generate dynamic binaries by default in any case.  The
25799 @option{-nolibdld} option can be used to prevent the GCC driver from
25800 adding these link options.
25802 @opindex threads
25803 @item -threads
25804 Add support for multithreading with the @dfn{dce thread} library
25805 under HP-UX@.  This option sets flags for both the preprocessor and
25806 linker.
25807 @end table
25809 @node IA-64 Options
25810 @subsection IA-64 Options
25811 @cindex IA-64 Options
25813 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25815 @table @gcctabopt
25816 @opindex mbig-endian
25817 @item -mbig-endian
25818 Generate code for a big-endian target.  This is the default for HP-UX@.
25820 @opindex mlittle-endian
25821 @item -mlittle-endian
25822 Generate code for a little-endian target.  This is the default for AIX5
25823 and GNU/Linux.
25825 @opindex mgnu-as
25826 @opindex mno-gnu-as
25827 @item -mgnu-as
25828 @itemx -mno-gnu-as
25829 Generate (or don't) code for the GNU assembler.  This is the default.
25830 @c Also, this is the default if the configure option @option{--with-gnu-as}
25831 @c is used.
25833 @opindex mgnu-ld
25834 @opindex mno-gnu-ld
25835 @item -mgnu-ld
25836 @itemx -mno-gnu-ld
25837 Generate (or don't) code for the GNU linker.  This is the default.
25838 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25839 @c is used.
25841 @opindex mno-pic
25842 @item -mno-pic
25843 Generate code that does not use a global pointer register.  The result
25844 is not position independent code, and violates the IA-64 ABI@.
25846 @opindex mvolatile-asm-stop
25847 @opindex mno-volatile-asm-stop
25848 @item -mvolatile-asm-stop
25849 @itemx -mno-volatile-asm-stop
25850 Generate (or don't) a stop bit immediately before and after volatile asm
25851 statements.
25853 @opindex mregister-names
25854 @opindex mno-register-names
25855 @item -mregister-names
25856 @itemx -mno-register-names
25857 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25858 the stacked registers.  This may make assembler output more readable.
25860 @opindex mno-sdata
25861 @opindex msdata
25862 @item -mno-sdata
25863 @itemx -msdata
25864 Disable (or enable) optimizations that use the small data section.  This may
25865 be useful for working around optimizer bugs.
25867 @opindex mconstant-gp
25868 @item -mconstant-gp
25869 Generate code that uses a single constant global pointer value.  This is
25870 useful when compiling kernel code.
25872 @opindex mauto-pic
25873 @item -mauto-pic
25874 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
25875 This is useful when compiling firmware code.
25877 @opindex minline-float-divide-min-latency
25878 @item -minline-float-divide-min-latency
25879 Generate code for inline divides of floating-point values
25880 using the minimum latency algorithm.
25882 @opindex minline-float-divide-max-throughput
25883 @item -minline-float-divide-max-throughput
25884 Generate code for inline divides of floating-point values
25885 using the maximum throughput algorithm.
25887 @opindex mno-inline-float-divide
25888 @item -mno-inline-float-divide
25889 Do not generate inline code for divides of floating-point values.
25891 @opindex minline-int-divide-min-latency
25892 @item -minline-int-divide-min-latency
25893 Generate code for inline divides of integer values
25894 using the minimum latency algorithm.
25896 @opindex minline-int-divide-max-throughput
25897 @item -minline-int-divide-max-throughput
25898 Generate code for inline divides of integer values
25899 using the maximum throughput algorithm.
25901 @opindex mno-inline-int-divide
25902 @opindex minline-int-divide
25903 @item -mno-inline-int-divide
25904 Do not generate inline code for divides of integer values.
25906 @opindex minline-sqrt-min-latency
25907 @item -minline-sqrt-min-latency
25908 Generate code for inline square roots
25909 using the minimum latency algorithm.
25911 @opindex minline-sqrt-max-throughput
25912 @item -minline-sqrt-max-throughput
25913 Generate code for inline square roots
25914 using the maximum throughput algorithm.
25916 @opindex mno-inline-sqrt
25917 @item -mno-inline-sqrt
25918 Do not generate inline code for @code{sqrt}.
25920 @opindex mfused-madd
25921 @opindex mno-fused-madd
25922 @item -mfused-madd
25923 @itemx -mno-fused-madd
25924 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25925 instructions.  The default is to use these instructions.
25927 @opindex mno-dwarf2-asm
25928 @opindex mdwarf2-asm
25929 @item -mno-dwarf2-asm
25930 @itemx -mdwarf2-asm
25931 Don't (or do) generate assembler code for the DWARF line number debugging
25932 info.  This may be useful when not using the GNU assembler.
25934 @opindex mearly-stop-bits
25935 @opindex mno-early-stop-bits
25936 @item -mearly-stop-bits
25937 @itemx -mno-early-stop-bits
25938 Allow stop bits to be placed earlier than immediately preceding the
25939 instruction that triggered the stop bit.  This can improve instruction
25940 scheduling, but does not always do so.
25942 @opindex mfixed-range
25943 @item -mfixed-range=@var{register-range}
25944 Generate code treating the given register range as fixed registers.
25945 A fixed register is one that the register allocator cannot use.  This is
25946 useful when compiling kernel code.  A register range is specified as
25947 two registers separated by a dash.  Multiple register ranges can be
25948 specified separated by a comma.
25950 @opindex mtls-size
25951 @item -mtls-size=@var{tls-size}
25952 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
25955 @opindex mtune
25956 @item -mtune=@var{cpu-type}
25957 Tune the instruction scheduling for a particular CPU, Valid values are
25958 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25959 and @samp{mckinley}.
25961 @opindex milp32
25962 @opindex mlp64
25963 @item -milp32
25964 @itemx -mlp64
25965 Generate code for a 32-bit or 64-bit environment.
25966 The 32-bit environment sets int, long and pointer to 32 bits.
25967 The 64-bit environment sets int to 32 bits and long and pointer
25968 to 64 bits.  These are HP-UX specific flags.
25970 @opindex mno-sched-br-data-spec
25971 @opindex msched-br-data-spec
25972 @item -mno-sched-br-data-spec
25973 @itemx -msched-br-data-spec
25974 (Dis/En)able data speculative scheduling before reload.
25975 This results in generation of @code{ld.a} instructions and
25976 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25977 The default setting is disabled.
25979 @opindex msched-ar-data-spec
25980 @opindex mno-sched-ar-data-spec
25981 @item -msched-ar-data-spec
25982 @itemx -mno-sched-ar-data-spec
25983 (En/Dis)able data speculative scheduling after reload.
25984 This results in generation of @code{ld.a} instructions and
25985 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25986 The default setting is enabled.
25988 @opindex mno-sched-control-spec
25989 @opindex msched-control-spec
25990 @item -mno-sched-control-spec
25991 @itemx -msched-control-spec
25992 (Dis/En)able control speculative scheduling.  This feature is
25993 available only during region scheduling (i.e.@: before reload).
25994 This results in generation of the @code{ld.s} instructions and
25995 the corresponding check instructions @code{chk.s}.
25996 The default setting is disabled.
25998 @opindex msched-br-in-data-spec
25999 @opindex mno-sched-br-in-data-spec
26000 @item -msched-br-in-data-spec
26001 @itemx -mno-sched-br-in-data-spec
26002 (En/Dis)able speculative scheduling of the instructions that
26003 are dependent on the data speculative loads before reload.
26004 This is effective only with @option{-msched-br-data-spec} enabled.
26005 The default setting is enabled.
26007 @opindex msched-ar-in-data-spec
26008 @opindex mno-sched-ar-in-data-spec
26009 @item -msched-ar-in-data-spec
26010 @itemx -mno-sched-ar-in-data-spec
26011 (En/Dis)able speculative scheduling of the instructions that
26012 are dependent on the data speculative loads after reload.
26013 This is effective only with @option{-msched-ar-data-spec} enabled.
26014 The default setting is enabled.
26016 @opindex msched-in-control-spec
26017 @opindex mno-sched-in-control-spec
26018 @item -msched-in-control-spec
26019 @itemx -mno-sched-in-control-spec
26020 (En/Dis)able speculative scheduling of the instructions that
26021 are dependent on the control speculative loads.
26022 This is effective only with @option{-msched-control-spec} enabled.
26023 The default setting is enabled.
26025 @opindex mno-sched-prefer-non-data-spec-insns
26026 @opindex msched-prefer-non-data-spec-insns
26027 @item -mno-sched-prefer-non-data-spec-insns
26028 @itemx -msched-prefer-non-data-spec-insns
26029 If enabled, data-speculative instructions are chosen for schedule
26030 only if there are no other choices at the moment.  This makes
26031 the use of the data speculation much more conservative.
26032 The default setting is disabled.
26034 @opindex mno-sched-prefer-non-control-spec-insns
26035 @opindex msched-prefer-non-control-spec-insns
26036 @item -mno-sched-prefer-non-control-spec-insns
26037 @itemx -msched-prefer-non-control-spec-insns
26038 If enabled, control-speculative instructions are chosen for schedule
26039 only if there are no other choices at the moment.  This makes
26040 the use of the control speculation much more conservative.
26041 The default setting is disabled.
26043 @opindex mno-sched-count-spec-in-critical-path
26044 @opindex msched-count-spec-in-critical-path
26045 @item -mno-sched-count-spec-in-critical-path
26046 @itemx -msched-count-spec-in-critical-path
26047 If enabled, speculative dependencies are considered during
26048 computation of the instructions priorities.  This makes the use of the
26049 speculation a bit more conservative.
26050 The default setting is disabled.
26052 @opindex msched-spec-ldc
26053 @item -msched-spec-ldc
26054 Use a simple data speculation check.  This option is on by default.
26056 @opindex msched-spec-ldc
26057 @item -msched-control-spec-ldc
26058 Use a simple check for control speculation.  This option is on by default.
26060 @opindex msched-stop-bits-after-every-cycle
26061 @item -msched-stop-bits-after-every-cycle
26062 Place a stop bit after every cycle when scheduling.  This option is on
26063 by default.
26065 @opindex msched-fp-mem-deps-zero-cost
26066 @item -msched-fp-mem-deps-zero-cost
26067 Assume that floating-point stores and loads are not likely to cause a conflict
26068 when placed into the same instruction group.  This option is disabled by
26069 default.
26071 @opindex msel-sched-dont-check-control-spec
26072 @item -msel-sched-dont-check-control-spec
26073 Generate checks for control speculation in selective scheduling.
26074 This flag is disabled by default.
26076 @opindex msched-max-memory-insns
26077 @item -msched-max-memory-insns=@var{max-insns}
26078 Limit on the number of memory insns per instruction group, giving lower
26079 priority to subsequent memory insns attempting to schedule in the same
26080 instruction group. Frequently useful to prevent cache bank conflicts.
26081 The default value is 1.
26083 @opindex msched-max-memory-insns-hard-limit
26084 @item -msched-max-memory-insns-hard-limit
26085 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
26086 disallowing more than that number in an instruction group.
26087 Otherwise, the limit is ``soft'', meaning that non-memory operations
26088 are preferred when the limit is reached, but memory operations may still
26089 be scheduled.
26091 @end table
26093 @node LM32 Options
26094 @subsection LM32 Options
26095 @cindex LM32 options
26097 These @option{-m} options are defined for the LatticeMico32 architecture:
26099 @table @gcctabopt
26100 @opindex mbarrel-shift-enabled
26101 @item -mbarrel-shift-enabled
26102 Enable barrel-shift instructions.
26104 @opindex mdivide-enabled
26105 @item -mdivide-enabled
26106 Enable divide and modulus instructions.
26108 @opindex multiply-enabled
26109 @item -mmultiply-enabled
26110 Enable multiply instructions.
26112 @opindex msign-extend-enabled
26113 @item -msign-extend-enabled
26114 Enable sign extend instructions.
26116 @opindex muser-enabled
26117 @item -muser-enabled
26118 Enable user-defined instructions.
26120 @end table
26122 @node LoongArch Options
26123 @subsection LoongArch Options
26124 @cindex LoongArch Options
26126 These command-line options are defined for LoongArch targets:
26128 @table @gcctabopt
26129 @opindex march
26130 @item -march=@var{cpu-type}
26131 Generate instructions for the machine type @var{cpu-type}.  In contrast to
26132 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26133 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26134 to generate code that may not run at all on processors other than the one
26135 indicated.  Specifying @option{-march=@var{cpu-type}} implies
26136 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
26138 The choices for @var{cpu-type} are:
26140 @table @samp
26141 @item native
26142 This selects the CPU to generate code for at compilation time by determining
26143 the processor type of the compiling machine.  Using @option{-march=native}
26144 enables all instruction subsets supported by the local machine (hence
26145 the result might not run on different machines).  Using @option{-mtune=native}
26146 produces code optimized for the local machine under the constraints
26147 of the selected instruction set.
26148 @item loongarch64
26149 A generic CPU with 64-bit extensions.
26150 @item la464
26151 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
26152 @end table
26154 @opindex mtune
26155 @item -mtune=@var{cpu-type}
26156 Optimize the output for the given processor, specified by microarchitecture
26157 name.
26159 @opindex mabi
26160 @item -mabi=@var{base-abi-type}
26161 Generate code for the specified calling convention.
26162 @var{base-abi-type} can be one of:
26163 @table @samp
26164 @item lp64d
26165 Uses 64-bit general purpose registers and 32/64-bit floating-point
26166 registers for parameter passing.  Data model is LP64, where @samp{int}
26167 is 32 bits, while @samp{long int} and pointers are 64 bits.
26168 @item lp64f
26169 Uses 64-bit general purpose registers and 32-bit floating-point
26170 registers for parameter passing.  Data model is LP64, where @samp{int}
26171 is 32 bits, while @samp{long int} and pointers are 64 bits.
26172 @item lp64s
26173 Uses 64-bit general purpose registers and no floating-point
26174 registers for parameter passing.  Data model is LP64, where @samp{int}
26175 is 32 bits, while @samp{long int} and pointers are 64 bits.
26176 @end table
26178 @opindex mfpu
26179 @item -mfpu=@var{fpu-type}
26180 Generate code for the specified FPU type, which can be one of:
26181 @table @samp
26182 @item 64
26183 Allow the use of hardware floating-point instructions for 32-bit
26184 and 64-bit operations.
26185 @item 32
26186 Allow the use of hardware floating-point instructions for 32-bit
26187 operations.
26188 @item none
26189 @item 0
26190 Prevent the use of hardware floating-point instructions.
26191 @end table
26193 @opindex msimd
26194 @item -msimd=@var{simd-type}
26195 Enable generation of LoongArch SIMD instructions for vectorization
26196 and via builtin functions.  The value can be one of:
26197 @table @samp
26198 @item lasx
26199 Enable generating instructions from the 256-bit LoongArch Advanced
26200 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26201 @item lsx
26202 Enable generating instructions from the 128-bit LoongArch SIMD
26203 Extension (LSX).
26204 @item none
26205 No LoongArch SIMD instruction may be generated.
26206 @end table
26208 @opindex msoft-float
26209 @item -msoft-float
26210 Force @option{-mfpu=none} and prevents the use of floating-point
26211 registers for parameter passing.  This option may change the target
26212 ABI.
26214 @opindex msingle-float
26215 @item -msingle-float
26216 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26217 registers for parameter passing.  This option may change the target
26218 ABI.
26220 @opindex mdouble-float
26221 @item -mdouble-float
26222 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26223 registers for parameter passing.  This option may change the target
26224 ABI.
26226 @opindex ml[a]sx
26227 @item -mlasx
26228 @itemx -mno-lasx
26229 @item -mlsx
26230 @itemx -mno-lsx
26231 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26232 that can be used by the compiler for code generation.  Enabling LASX with
26233 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26234 automatically disables LASX.  These driver-only options act upon the final
26235 @option{msimd} configuration state and make incremental chagnes in the order
26236 they appear on the GCC driver's command line, deriving the final / canonicalized
26237 @option{msimd} option that is passed to the compiler proper.
26239 @opindex mbranch-cost
26240 @item -mbranch-cost=@var{n}
26241 Set the cost of branches to roughly @var{n} instructions.
26243 @opindex mcheck-zero-division
26244 @item -mcheck-zero-division
26245 @itemx -mno-check-zero-divison
26246 Trap (do not trap) on integer division by zero.  The default is
26247 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26248 @option{-mno-check-zero-division} for other optimization levels.
26250 @opindex mcond-move-int
26251 @item -mcond-move-int
26252 @itemx -mno-cond-move-int
26253 Conditional moves for integral data in general-purpose registers
26254 are enabled (disabled).  The default is @option{-mcond-move-int}.
26256 @opindex mcond-move-float
26257 @item -mcond-move-float
26258 @itemx -mno-cond-move-float
26259 Conditional moves for floating-point registers are enabled (disabled).
26260 The default is @option{-mcond-move-float}.
26262 @opindex mmemcpy
26263 @item -mmemcpy
26264 @itemx -mno-memcpy
26265 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26266 The default is @option{-mno-memcpy}, which allows GCC to inline most
26267 constant-sized copies.  Setting optimization level to @option{-Os} also
26268 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26269 behavior if explicitly specified, regardless of the order these options on
26270 the command line.
26272 @opindex mstrict-align
26273 @item -mstrict-align
26274 @itemx -mno-strict-align
26275 Avoid or allow generating memory accesses that may not be aligned on a natural
26276 object boundary as described in the architecture specification. The default is
26277 @option{-mno-strict-align}.
26279 @opindex msmall-data-limit
26280 @item -msmall-data-limit=@var{number}
26281 Put global and static data smaller than @var{number} bytes into a special
26282 section (on some targets).  The default value is 0.
26284 @opindex mmax-inline-memcpy-size
26285 @item -mmax-inline-memcpy-size=@var{n}
26286 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26287 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26289 @item -mcmodel=@var{code-model}
26290 Set the code model to one of:
26291 @table @samp
26292 @item tiny-static (Not implemented yet)
26293 @item tiny (Not implemented yet)
26295 @item normal
26296 The text segment must be within 128MB addressing space.  The data segment must
26297 be within 2GB addressing space.
26299 @item medium
26300 The text segment and data segment must be within 2GB addressing space.
26302 @item large (Not implemented yet)
26304 @item extreme
26305 This mode does not limit the size of the code segment and data segment.
26306 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt},
26307 and it requires @option{-mexplicit-relocs=always}.
26308 @end table
26309 The default code model is @code{normal}.
26311 @item -mexplicit-relocs=@var{style}
26312 Set when to use assembler relocation operators when dealing with symbolic
26313 addresses.  The alternative is to use assembler macros instead, which may
26314 limit instruction scheduling but allow linker relaxation.
26315 with @option{-mexplicit-relocs=none} the assembler macros are always used,
26316 with @option{-mexplicit-relocs=always} the assembler relocation operators
26317 are always used, with @option{-mexplicit-relocs=auto} the compiler will
26318 use the relocation operators where the linker relaxation is impossible to
26319 improve the code quality, and macros elsewhere.  The default
26320 value for the option is determined with the assembler capability detected
26321 during GCC build-time and the setting of @option{-mrelax}:
26322 @option{-mexplicit-relocs=none} if the assembler does not support
26323 relocation operators at all,
26324 @option{-mexplicit-relocs=always} if the assembler supports relocation
26325 operators but @option{-mrelax} is not enabled,
26326 @option{-mexplicit-relocs=auto} if the assembler supports relocation
26327 operators and @option{-mrelax} is enabled.
26329 @opindex mexplicit-relocs
26330 @item -mexplicit-relocs
26331 An alias of @option{-mexplicit-relocs=always} for backward compatibility.
26333 @opindex mno-explicit-relocs
26334 @item -mno-explicit-relocs
26335 An alias of @option{-mexplicit-relocs=none} for backward compatibility.
26337 @opindex mdirect-extern-access
26338 @item -mdirect-extern-access
26339 @itemx -mno-direct-extern-access
26340 Do not use or use GOT to access external symbols.  The default is
26341 @option{-mno-direct-extern-access}: GOT is used for external symbols with
26342 default visibility, but not used for other external symbols.
26344 With @option{-mdirect-extern-access}, GOT is not used and all external
26345 symbols are PC-relatively addressed.  It is @strong{only} suitable for
26346 environments where no dynamic link is performed, like firmwares, OS
26347 kernels, executables linked with @option{-static} or @option{-static-pie}.
26348 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
26349 @option{-fpic}.
26351 @item -mrelax
26352 @itemx -mno-relax
26353 Take (do not take) advantage of linker relaxations.  If
26354 @option{-mpass-mrelax-to-as} is enabled, this option is also passed to
26355 the assembler.  The default is determined during GCC build-time by
26356 detecting corresponding assembler support:
26357 @option{-mrelax} if the assembler supports both the @option{-mrelax}
26358 option and the conditional branch relaxation (it's required or the
26359 @code{.align} directives and conditional branch instructions in the
26360 assembly code outputted by GCC may be rejected by the assembler because
26361 of a relocation overflow), @option{-mno-relax} otherwise.
26363 @item -mpass-mrelax-to-as
26364 @itemx -mno-pass-mrelax-to-as
26365 Pass (do not pass) the @option{-mrelax} or @option{-mno-relax} option
26366 to the assembler.  The default is determined during GCC build-time by
26367 detecting corresponding assembler support:
26368 @option{-mpass-mrelax-to-as} if the assembler supports the
26369 @option{-mrelax} option, @option{-mno-pass-mrelax-to-as} otherwise.
26370 This option is mostly useful for debugging, or interoperation with
26371 assemblers different from the build-time one.
26373 @item loongarch-vect-unroll-limit
26374 The vectorizer will use available tuning information to determine whether it
26375 would be beneficial to unroll the main vectorized loop and by how much.  This
26376 parameter set's the upper bound of how much the vectorizer will unroll the main
26377 loop.  The default value is six.
26379 @end table
26382 @node M32C Options
26383 @subsection M32C Options
26384 @cindex M32C options
26386 @table @gcctabopt
26387 @opindex mcpu=
26388 @item -mcpu=@var{name}
26389 Select the CPU for which code is generated.  @var{name} may be one of
26390 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
26391 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
26392 the M32C/80 series.
26394 @opindex msim
26395 @item -msim
26396 Specifies that the program will be run on the simulator.  This causes
26397 an alternate runtime library to be linked in which supports, for
26398 example, file I/O@.  You must not use this option when generating
26399 programs that will run on real hardware; you must provide your own
26400 runtime library for whatever I/O functions are needed.
26402 @opindex memregs=
26403 @item -memregs=@var{number}
26404 Specifies the number of memory-based pseudo-registers GCC uses
26405 during code generation.  These pseudo-registers are used like real
26406 registers, so there is a tradeoff between GCC's ability to fit the
26407 code into available registers, and the performance penalty of using
26408 memory instead of registers.  Note that all modules in a program must
26409 be compiled with the same value for this option.  Because of that, you
26410 must not use this option with GCC's default runtime libraries.
26412 @end table
26414 @node M32R/D Options
26415 @subsection M32R/D Options
26416 @cindex M32R/D options
26418 These @option{-m} options are defined for Renesas M32R/D architectures:
26420 @table @gcctabopt
26421 @opindex m32r2
26422 @item -m32r2
26423 Generate code for the M32R/2@.
26425 @opindex m32rx
26426 @item -m32rx
26427 Generate code for the M32R/X@.
26429 @opindex m32r
26430 @item -m32r
26431 Generate code for the M32R@.  This is the default.
26433 @opindex mmodel=small
26434 @item -mmodel=small
26435 Assume all objects live in the lower 16MB of memory (so that their addresses
26436 can be loaded with the @code{ld24} instruction), and assume all subroutines
26437 are reachable with the @code{bl} instruction.
26438 This is the default.
26440 The addressability of a particular object can be set with the
26441 @code{model} attribute.
26443 @opindex mmodel=medium
26444 @item -mmodel=medium
26445 Assume objects may be anywhere in the 32-bit address space (the compiler
26446 generates @code{seth/add3} instructions to load their addresses), and
26447 assume all subroutines are reachable with the @code{bl} instruction.
26449 @opindex mmodel=large
26450 @item -mmodel=large
26451 Assume objects may be anywhere in the 32-bit address space (the compiler
26452 generates @code{seth/add3} instructions to load their addresses), and
26453 assume subroutines may not be reachable with the @code{bl} instruction
26454 (the compiler generates the much slower @code{seth/add3/jl}
26455 instruction sequence).
26457 @opindex msdata=none
26458 @item -msdata=none
26459 Disable use of the small data area.  Variables are put into
26460 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
26461 @code{section} attribute has been specified).
26462 This is the default.
26464 The small data area consists of sections @code{.sdata} and @code{.sbss}.
26465 Objects may be explicitly put in the small data area with the
26466 @code{section} attribute using one of these sections.
26468 @opindex msdata=sdata
26469 @item -msdata=sdata
26470 Put small global and static data in the small data area, but do not
26471 generate special code to reference them.
26473 @opindex msdata=use
26474 @item -msdata=use
26475 Put small global and static data in the small data area, and generate
26476 special instructions to reference them.
26478 @opindex G
26479 @cindex smaller data references
26480 @item -G @var{num}
26481 Put global and static objects less than or equal to @var{num} bytes
26482 into the small data or BSS sections instead of the normal data or BSS
26483 sections.  The default value of @var{num} is 8.
26484 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
26485 for this option to have any effect.
26487 All modules should be compiled with the same @option{-G @var{num}} value.
26488 Compiling with different values of @var{num} may or may not work; if it
26489 doesn't the linker gives an error message---incorrect code is not
26490 generated.
26492 @opindex mdebug
26493 @item -mdebug
26494 Makes the M32R-specific code in the compiler display some statistics
26495 that might help in debugging programs.
26497 @opindex malign-loops
26498 @item -malign-loops
26499 Align all loops to a 32-byte boundary.
26501 @opindex mno-align-loops
26502 @item -mno-align-loops
26503 Do not enforce a 32-byte alignment for loops.  This is the default.
26505 @opindex missue-rate=@var{number}
26506 @item -missue-rate=@var{number}
26507 Issue @var{number} instructions per cycle.  @var{number} can only be 1
26508 or 2.
26510 @opindex mbranch-cost=@var{number}
26511 @item -mbranch-cost=@var{number}
26512 @var{number} can only be 1 or 2.  If it is 1 then branches are
26513 preferred over conditional code, if it is 2, then the opposite applies.
26515 @opindex mflush-trap=@var{number}
26516 @item -mflush-trap=@var{number}
26517 Specifies the trap number to use to flush the cache.  The default is
26518 12.  Valid numbers are between 0 and 15 inclusive.
26520 @opindex mno-flush-trap
26521 @item -mno-flush-trap
26522 Specifies that the cache cannot be flushed by using a trap.
26524 @opindex mflush-func=@var{name}
26525 @item -mflush-func=@var{name}
26526 Specifies the name of the operating system function to call to flush
26527 the cache.  The default is @samp{_flush_cache}, but a function call
26528 is only used if a trap is not available.
26530 @opindex mno-flush-func
26531 @item -mno-flush-func
26532 Indicates that there is no OS function for flushing the cache.
26534 @end table
26536 @node M680x0 Options
26537 @subsection M680x0 Options
26538 @cindex M680x0 options
26540 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
26541 The default settings depend on which architecture was selected when
26542 the compiler was configured; the defaults for the most common choices
26543 are given below.
26545 @table @gcctabopt
26546 @opindex march
26547 @item -march=@var{arch}
26548 Generate code for a specific M680x0 or ColdFire instruction set
26549 architecture.  Permissible values of @var{arch} for M680x0
26550 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
26551 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
26552 architectures are selected according to Freescale's ISA classification
26553 and the permissible values are: @samp{isaa}, @samp{isaaplus},
26554 @samp{isab} and @samp{isac}.
26556 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
26557 code for a ColdFire target.  The @var{arch} in this macro is one of the
26558 @option{-march} arguments given above.
26560 When used together, @option{-march} and @option{-mtune} select code
26561 that runs on a family of similar processors but that is optimized
26562 for a particular microarchitecture.
26564 @opindex mcpu
26565 @item -mcpu=@var{cpu}
26566 Generate code for a specific M680x0 or ColdFire processor.
26567 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
26568 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
26569 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
26570 below, which also classifies the CPUs into families:
26572 @multitable @columnfractions 0.20 0.80
26573 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
26574 @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}
26575 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
26576 @item @samp{5206e} @tab @samp{5206e}
26577 @item @samp{5208} @tab @samp{5207} @samp{5208}
26578 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
26579 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
26580 @item @samp{5216} @tab @samp{5214} @samp{5216}
26581 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
26582 @item @samp{5225} @tab @samp{5224} @samp{5225}
26583 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
26584 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
26585 @item @samp{5249} @tab @samp{5249}
26586 @item @samp{5250} @tab @samp{5250}
26587 @item @samp{5271} @tab @samp{5270} @samp{5271}
26588 @item @samp{5272} @tab @samp{5272}
26589 @item @samp{5275} @tab @samp{5274} @samp{5275}
26590 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
26591 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
26592 @item @samp{5307} @tab @samp{5307}
26593 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
26594 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
26595 @item @samp{5407} @tab @samp{5407}
26596 @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}
26597 @end multitable
26599 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
26600 @var{arch} is compatible with @var{cpu}.  Other combinations of
26601 @option{-mcpu} and @option{-march} are rejected.
26603 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
26604 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
26605 where the value of @var{family} is given by the table above.
26607 @opindex mtune
26608 @item -mtune=@var{tune}
26609 Tune the code for a particular microarchitecture within the
26610 constraints set by @option{-march} and @option{-mcpu}.
26611 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
26612 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
26613 and @samp{cpu32}.  The ColdFire microarchitectures
26614 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
26616 You can also use @option{-mtune=68020-40} for code that needs
26617 to run relatively well on 68020, 68030 and 68040 targets.
26618 @option{-mtune=68020-60} is similar but includes 68060 targets
26619 as well.  These two options select the same tuning decisions as
26620 @option{-m68020-40} and @option{-m68020-60} respectively.
26622 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
26623 when tuning for 680x0 architecture @var{arch}.  It also defines
26624 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
26625 option is used.  If GCC is tuning for a range of architectures,
26626 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
26627 it defines the macros for every architecture in the range.
26629 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
26630 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
26631 of the arguments given above.
26633 @opindex m68000
26634 @opindex mc68000
26635 @item -m68000
26636 @itemx -mc68000
26637 Generate output for a 68000.  This is the default
26638 when the compiler is configured for 68000-based systems.
26639 It is equivalent to @option{-march=68000}.
26641 Use this option for microcontrollers with a 68000 or EC000 core,
26642 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
26644 @opindex m68010
26645 @item -m68010
26646 Generate output for a 68010.  This is the default
26647 when the compiler is configured for 68010-based systems.
26648 It is equivalent to @option{-march=68010}.
26650 @opindex m68020
26651 @opindex mc68020
26652 @item -m68020
26653 @itemx -mc68020
26654 Generate output for a 68020.  This is the default
26655 when the compiler is configured for 68020-based systems.
26656 It is equivalent to @option{-march=68020}.
26658 @opindex m68030
26659 @item -m68030
26660 Generate output for a 68030.  This is the default when the compiler is
26661 configured for 68030-based systems.  It is equivalent to
26662 @option{-march=68030}.
26664 @opindex m68040
26665 @item -m68040
26666 Generate output for a 68040.  This is the default when the compiler is
26667 configured for 68040-based systems.  It is equivalent to
26668 @option{-march=68040}.
26670 This option inhibits the use of 68881/68882 instructions that have to be
26671 emulated by software on the 68040.  Use this option if your 68040 does not
26672 have code to emulate those instructions.
26674 @opindex m68060
26675 @item -m68060
26676 Generate output for a 68060.  This is the default when the compiler is
26677 configured for 68060-based systems.  It is equivalent to
26678 @option{-march=68060}.
26680 This option inhibits the use of 68020 and 68881/68882 instructions that
26681 have to be emulated by software on the 68060.  Use this option if your 68060
26682 does not have code to emulate those instructions.
26684 @opindex mcpu32
26685 @item -mcpu32
26686 Generate output for a CPU32.  This is the default
26687 when the compiler is configured for CPU32-based systems.
26688 It is equivalent to @option{-march=cpu32}.
26690 Use this option for microcontrollers with a
26691 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
26692 68336, 68340, 68341, 68349 and 68360.
26694 @opindex m5200
26695 @item -m5200
26696 Generate output for a 520X ColdFire CPU@.  This is the default
26697 when the compiler is configured for 520X-based systems.
26698 It is equivalent to @option{-mcpu=5206}, and is now deprecated
26699 in favor of that option.
26701 Use this option for microcontroller with a 5200 core, including
26702 the MCF5202, MCF5203, MCF5204 and MCF5206.
26704 @opindex m5206e
26705 @item -m5206e
26706 Generate output for a 5206e ColdFire CPU@.  The option is now
26707 deprecated in favor of the equivalent @option{-mcpu=5206e}.
26709 @opindex m528x
26710 @item -m528x
26711 Generate output for a member of the ColdFire 528X family.
26712 The option is now deprecated in favor of the equivalent
26713 @option{-mcpu=528x}.
26715 @opindex m5307
26716 @item -m5307
26717 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
26718 in favor of the equivalent @option{-mcpu=5307}.
26720 @opindex m5407
26721 @item -m5407
26722 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
26723 in favor of the equivalent @option{-mcpu=5407}.
26725 @opindex mcfv4e
26726 @item -mcfv4e
26727 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
26728 This includes use of hardware floating-point instructions.
26729 The option is equivalent to @option{-mcpu=547x}, and is now
26730 deprecated in favor of that option.
26732 @opindex m68020-40
26733 @item -m68020-40
26734 Generate output for a 68040, without using any of the new instructions.
26735 This results in code that can run relatively efficiently on either a
26736 68020/68881 or a 68030 or a 68040.  The generated code does use the
26737 68881 instructions that are emulated on the 68040.
26739 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26741 @opindex m68020-60
26742 @item -m68020-60
26743 Generate output for a 68060, without using any of the new instructions.
26744 This results in code that can run relatively efficiently on either a
26745 68020/68881 or a 68030 or a 68040.  The generated code does use the
26746 68881 instructions that are emulated on the 68060.
26748 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26750 @opindex mhard-float
26751 @opindex m68881
26752 @item -mhard-float
26753 @itemx -m68881
26754 Generate floating-point instructions.  This is the default for 68020
26755 and above, and for ColdFire devices that have an FPU@.  It defines the
26756 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26757 on ColdFire targets.
26759 @opindex msoft-float
26760 @item -msoft-float
26761 Do not generate floating-point instructions; use library calls instead.
26762 This is the default for 68000, 68010, and 68832 targets.  It is also
26763 the default for ColdFire devices that have no FPU.
26765 @opindex mdiv
26766 @opindex mno-div
26767 @item -mdiv
26768 @itemx -mno-div
26769 Generate (do not generate) ColdFire hardware divide and remainder
26770 instructions.  If @option{-march} is used without @option{-mcpu},
26771 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26772 architectures.  Otherwise, the default is taken from the target CPU
26773 (either the default CPU, or the one specified by @option{-mcpu}).  For
26774 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26775 @option{-mcpu=5206e}.
26777 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26779 @opindex mshort
26780 @item -mshort
26781 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26782 Additionally, parameters passed on the stack are also aligned to a
26783 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26785 @opindex mno-short
26786 @item -mno-short
26787 Do not consider type @code{int} to be 16 bits wide.  This is the default.
26789 @opindex mnobitfield
26790 @opindex mno-bitfield
26791 @item -mnobitfield
26792 @itemx -mno-bitfield
26793 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
26794 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26796 @opindex mbitfield
26797 @item -mbitfield
26798 Do use the bit-field instructions.  The @option{-m68020} option implies
26799 @option{-mbitfield}.  This is the default if you use a configuration
26800 designed for a 68020.
26802 @opindex mrtd
26803 @item -mrtd
26804 Use a different function-calling convention, in which functions
26805 that take a fixed number of arguments return with the @code{rtd}
26806 instruction, which pops their arguments while returning.  This
26807 saves one instruction in the caller since there is no need to pop
26808 the arguments there.
26810 This calling convention is incompatible with the one normally
26811 used on Unix, so you cannot use it if you need to call libraries
26812 compiled with the Unix compiler.
26814 Also, you must provide function prototypes for all functions that
26815 take variable numbers of arguments (including @code{printf});
26816 otherwise incorrect code is generated for calls to those
26817 functions.
26819 In addition, seriously incorrect code results if you call a
26820 function with too many arguments.  (Normally, extra arguments are
26821 harmlessly ignored.)
26823 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26824 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26826 The default is @option{-mno-rtd}.
26828 @opindex malign-int
26829 @opindex mno-align-int
26830 @item -malign-int
26831 @itemx -mno-align-int
26832 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26833 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26834 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26835 Aligning variables on 32-bit boundaries produces code that runs somewhat
26836 faster on processors with 32-bit busses at the expense of more memory.
26838 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26839 aligns structures containing the above types differently than
26840 most published application binary interface specifications for the m68k.
26842 @opindex mpcrel
26843 Use the pc-relative addressing mode of the 68000 directly, instead of
26844 using a global offset table.  At present, this option implies @option{-fpic},
26845 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
26846 not presently supported with @option{-mpcrel}, though this could be supported for
26847 68020 and higher processors.
26849 @opindex mno-strict-align
26850 @opindex mstrict-align
26851 @item -mno-strict-align
26852 @itemx -mstrict-align
26853 Do not (do) assume that unaligned memory references are handled by
26854 the system.
26856 @item -msep-data
26857 Generate code that allows the data segment to be located in a different
26858 area of memory from the text segment.  This allows for execute-in-place in
26859 an environment without virtual memory management.  This option implies
26860 @option{-fPIC}.
26862 @item -mno-sep-data
26863 Generate code that assumes that the data segment follows the text segment.
26864 This is the default.
26866 @item -mid-shared-library
26867 Generate code that supports shared libraries via the library ID method.
26868 This allows for execute-in-place and shared libraries in an environment
26869 without virtual memory management.  This option implies @option{-fPIC}.
26871 @item -mno-id-shared-library
26872 Generate code that doesn't assume ID-based shared libraries are being used.
26873 This is the default.
26875 @item -mshared-library-id=n
26876 Specifies the identification number of the ID-based shared library being
26877 compiled.  Specifying a value of 0 generates more compact code; specifying
26878 other values forces the allocation of that number to the current
26879 library, but is no more space- or time-efficient than omitting this option.
26881 @opindex mxgot
26882 @opindex mno-xgot
26883 @item -mxgot
26884 @itemx -mno-xgot
26885 When generating position-independent code for ColdFire, generate code
26886 that works if the GOT has more than 8192 entries.  This code is
26887 larger and slower than code generated without this option.  On M680x0
26888 processors, this option is not needed; @option{-fPIC} suffices.
26890 GCC normally uses a single instruction to load values from the GOT@.
26891 While this is relatively efficient, it only works if the GOT
26892 is smaller than about 64k.  Anything larger causes the linker
26893 to report an error such as:
26895 @cindex relocation truncated to fit (ColdFire)
26896 @smallexample
26897 relocation truncated to fit: R_68K_GOT16O foobar
26898 @end smallexample
26900 If this happens, you should recompile your code with @option{-mxgot}.
26901 It should then work with very large GOTs.  However, code generated with
26902 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26903 the value of a global symbol.
26905 Note that some linkers, including newer versions of the GNU linker,
26906 can create multiple GOTs and sort GOT entries.  If you have such a linker,
26907 you should only need to use @option{-mxgot} when compiling a single
26908 object file that accesses more than 8192 GOT entries.  Very few do.
26910 These options have no effect unless GCC is generating
26911 position-independent code.
26913 @opindex mlong-jump-table-offsets
26914 @item -mlong-jump-table-offsets
26915 Use 32-bit offsets in @code{switch} tables.  The default is to use
26916 16-bit offsets.
26918 @end table
26920 @node MCore Options
26921 @subsection MCore Options
26922 @cindex MCore options
26924 These are the @samp{-m} options defined for the Motorola M*Core
26925 processors.
26927 @table @gcctabopt
26929 @opindex mhardlit
26930 @opindex mno-hardlit
26931 @item -mhardlit
26932 @itemx -mno-hardlit
26933 Inline constants into the code stream if it can be done in two
26934 instructions or less.
26936 @opindex mdiv
26937 @opindex mno-div
26938 @item -mdiv
26939 @itemx -mno-div
26940 Use the divide instruction.  (Enabled by default).
26942 @opindex mrelax-immediate
26943 @opindex mno-relax-immediate
26944 @item -mrelax-immediate
26945 @itemx -mno-relax-immediate
26946 Allow arbitrary-sized immediates in bit operations.
26948 @opindex mwide-bitfields
26949 @opindex mno-wide-bitfields
26950 @item -mwide-bitfields
26951 @itemx -mno-wide-bitfields
26952 Always treat bit-fields as @code{int}-sized.
26954 @opindex m4byte-functions
26955 @opindex mno-4byte-functions
26956 @item -m4byte-functions
26957 @itemx -mno-4byte-functions
26958 Force all functions to be aligned to a 4-byte boundary.
26960 @opindex mcallgraph-data
26961 @opindex mno-callgraph-data
26962 @item -mcallgraph-data
26963 @itemx -mno-callgraph-data
26964 Emit callgraph information.
26966 @opindex mslow-bytes
26967 @opindex mno-slow-bytes
26968 @item -mslow-bytes
26969 @itemx -mno-slow-bytes
26970 Prefer word access when reading byte quantities.
26972 @opindex mlittle-endian
26973 @opindex mbig-endian
26974 @item -mlittle-endian
26975 @itemx -mbig-endian
26976 Generate code for a little-endian target.
26978 @opindex m210
26979 @opindex m340
26980 @item -m210
26981 @itemx -m340
26982 Generate code for the 210 processor.
26984 @opindex mno-lsim
26985 @item -mno-lsim
26986 Assume that runtime support has been provided and so omit the
26987 simulator library (@file{libsim.a)} from the linker command line.
26989 @opindex mstack-increment
26990 @item -mstack-increment=@var{size}
26991 Set the maximum amount for a single stack increment operation.  Large
26992 values can increase the speed of programs that contain functions
26993 that need a large amount of stack space, but they can also trigger a
26994 segmentation fault if the stack is extended too much.  The default
26995 value is 0x1000.
26997 @end table
26999 @node MicroBlaze Options
27000 @subsection MicroBlaze Options
27001 @cindex MicroBlaze Options
27003 @table @gcctabopt
27005 @opindex msoft-float
27006 @item -msoft-float
27007 Use software emulation for floating point (default).
27009 @opindex mhard-float
27010 @item -mhard-float
27011 Use hardware floating-point instructions.
27013 @opindex mmemcpy
27014 @item -mmemcpy
27015 Do not optimize block moves, use @code{memcpy}.
27017 @opindex mno-clearbss
27018 @item -mno-clearbss
27019 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
27021 @opindex mcpu=
27022 @item -mcpu=@var{cpu-type}
27023 Use features of, and schedule code for, the given CPU.
27024 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
27025 where @var{X} is a major version, @var{YY} is the minor version, and
27026 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
27027 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
27029 @opindex mxl-soft-mul
27030 @item -mxl-soft-mul
27031 Use software multiply emulation (default).
27033 @opindex mxl-soft-div
27034 @item -mxl-soft-div
27035 Use software emulation for divides (default).
27037 @opindex mxl-barrel-shift
27038 @item -mxl-barrel-shift
27039 Use the hardware barrel shifter.
27041 @opindex mxl-pattern-compare
27042 @item -mxl-pattern-compare
27043 Use pattern compare instructions.
27045 @opindex msmall-divides
27046 @item -msmall-divides
27047 Use table lookup optimization for small signed integer divisions.
27049 @opindex mxl-stack-check
27050 @item -mxl-stack-check
27051 This option is deprecated.  Use @option{-fstack-check} instead.
27053 @opindex mxl-gp-opt
27054 @item -mxl-gp-opt
27055 Use GP-relative @code{.sdata}/@code{.sbss} sections.
27057 @opindex mxl-multiply-high
27058 @item -mxl-multiply-high
27059 Use multiply high instructions for high part of 32x32 multiply.
27061 @opindex mxl-float-convert
27062 @item -mxl-float-convert
27063 Use hardware floating-point conversion instructions.
27065 @opindex mxl-float-sqrt
27066 @item -mxl-float-sqrt
27067 Use hardware floating-point square root instruction.
27069 @opindex mbig-endian
27070 @item -mbig-endian
27071 Generate code for a big-endian target.
27073 @opindex mlittle-endian
27074 @item -mlittle-endian
27075 Generate code for a little-endian target.
27077 @opindex mxl-reorder
27078 @item -mxl-reorder
27079 Use reorder instructions (swap and byte reversed load/store).
27081 @item -mxl-mode-@var{app-model}
27082 Select application model @var{app-model}.  Valid models are
27083 @table @samp
27084 @item executable
27085 normal executable (default), uses startup code @file{crt0.o}.
27087 @item xmdstub
27088 for use with Xilinx Microprocessor Debugger (XMD) based
27089 software intrusive debug agent called xmdstub. This uses startup file
27090 @file{crt1.o} and sets the start address of the program to 0x800.
27092 @item bootstrap
27093 for applications that are loaded using a bootloader.
27094 This model uses startup file @file{crt2.o} which does not contain a processor
27095 reset vector handler. This is suitable for transferring control on a
27096 processor reset to the bootloader rather than the application.
27098 @item novectors
27099 for applications that do not require any of the
27100 MicroBlaze vectors. This option may be useful for applications running
27101 within a monitoring application. This model uses @file{crt3.o} as a startup file.
27102 @end table
27104 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
27105 @option{-mxl-mode-@var{app-model}}.
27107 @opindex mpic-data-is-text-relative
27108 @item -mpic-data-is-text-relative
27109 Assume that the displacement between the text and data segments is fixed
27110 at static link time.  This allows data to be referenced by offset from start of
27111 text address instead of GOT since PC-relative addressing is not supported.
27113 @end table
27115 @node MIPS Options
27116 @subsection MIPS Options
27117 @cindex MIPS options
27119 @table @gcctabopt
27121 @opindex EB
27122 @item -EB
27123 Generate big-endian code.
27125 @opindex EL
27126 @item -EL
27127 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
27128 configurations.
27130 @opindex march
27131 @item -march=@var{arch}
27132 Generate code that runs on @var{arch}, which can be the name of a
27133 generic MIPS ISA, or the name of a particular processor.
27134 The ISA names are:
27135 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
27136 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
27137 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
27138 @samp{mips64r5} and @samp{mips64r6}.
27139 The processor names are:
27140 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
27141 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
27142 @samp{5kc}, @samp{5kf},
27143 @samp{20kc},
27144 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
27145 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
27146 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
27147 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
27148 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
27149 @samp{i6400}, @samp{i6500},
27150 @samp{interaptiv},
27151 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
27152 @samp{gs464e}, @samp{gs264e},
27153 @samp{m4k},
27154 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
27155 @samp{m5100}, @samp{m5101},
27156 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
27157 @samp{orion},
27158 @samp{p5600}, @samp{p6600},
27159 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
27160 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
27161 @samp{r6000}, @samp{r8000},
27162 @samp{rm7000}, @samp{rm9000},
27163 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
27164 @samp{sb1},
27165 @samp{sr71000},
27166 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
27167 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
27168 @samp{xlr} and @samp{xlp}.
27169 The special value @samp{from-abi} selects the
27170 most compatible architecture for the selected ABI (that is,
27171 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
27173 The native Linux/GNU toolchain also supports the value @samp{native},
27174 which selects the best architecture option for the host processor.
27175 @option{-march=native} has no effect if GCC does not recognize
27176 the processor.
27178 In processor names, a final @samp{000} can be abbreviated as @samp{k}
27179 (for example, @option{-march=r2k}).  Prefixes are optional, and
27180 @samp{vr} may be written @samp{r}.
27182 Names of the form @samp{@var{n}f2_1} refer to processors with
27183 FPUs clocked at half the rate of the core, names of the form
27184 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
27185 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
27186 processors with FPUs clocked a ratio of 3:2 with respect to the core.
27187 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
27188 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
27189 accepted as synonyms for @samp{@var{n}f1_1}.
27191 GCC defines two macros based on the value of this option.  The first
27192 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
27193 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
27194 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
27195 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
27196 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
27198 Note that the @code{_MIPS_ARCH} macro uses the processor names given
27199 above.  In other words, it has the full prefix and does not
27200 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
27201 the macro names the resolved architecture (either @code{"mips1"} or
27202 @code{"mips3"}).  It names the default architecture when no
27203 @option{-march} option is given.
27205 @opindex mtune
27206 @item -mtune=@var{arch}
27207 Optimize for @var{arch}.  Among other things, this option controls
27208 the way instructions are scheduled, and the perceived cost of arithmetic
27209 operations.  The list of @var{arch} values is the same as for
27210 @option{-march}.
27212 When this option is not used, GCC optimizes for the processor
27213 specified by @option{-march}.  By using @option{-march} and
27214 @option{-mtune} together, it is possible to generate code that
27215 runs on a family of processors, but optimize the code for one
27216 particular member of that family.
27218 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
27219 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
27220 @option{-march} ones described above.
27222 @opindex mips1
27223 @item -mips1
27224 Equivalent to @option{-march=mips1}.
27226 @opindex mips2
27227 @item -mips2
27228 Equivalent to @option{-march=mips2}.
27230 @opindex mips3
27231 @item -mips3
27232 Equivalent to @option{-march=mips3}.
27234 @opindex mips4
27235 @item -mips4
27236 Equivalent to @option{-march=mips4}.
27238 @opindex mips32
27239 @item -mips32
27240 Equivalent to @option{-march=mips32}.
27242 @opindex mips32r3
27243 @item -mips32r3
27244 Equivalent to @option{-march=mips32r3}.
27246 @opindex mips32r5
27247 @item -mips32r5
27248 Equivalent to @option{-march=mips32r5}.
27250 @opindex mips32r6
27251 @item -mips32r6
27252 Equivalent to @option{-march=mips32r6}.
27254 @opindex mips64
27255 @item -mips64
27256 Equivalent to @option{-march=mips64}.
27258 @opindex mips64r2
27259 @item -mips64r2
27260 Equivalent to @option{-march=mips64r2}.
27262 @opindex mips64r3
27263 @item -mips64r3
27264 Equivalent to @option{-march=mips64r3}.
27266 @opindex mips64r5
27267 @item -mips64r5
27268 Equivalent to @option{-march=mips64r5}.
27270 @opindex mips64r6
27271 @item -mips64r6
27272 Equivalent to @option{-march=mips64r6}.
27274 @opindex mips16
27275 @opindex mno-mips16
27276 @item -mips16
27277 @itemx -mno-mips16
27278 Generate (do not generate) MIPS16 code.  If GCC is targeting a
27279 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
27281 MIPS16 code generation can also be controlled on a per-function basis
27282 by means of @code{mips16} and @code{nomips16} attributes.
27283 @xref{Function Attributes}, for more information.
27285 @opindex mmips16e2
27286 @opindex mno-mips16e2
27287 @item -mmips16e2
27288 @itemx -mno-mips16e2
27289 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
27290 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
27292 @opindex mflip-mips16
27293 @item -mflip-mips16
27294 Generate MIPS16 code on alternating functions.  This option is provided
27295 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
27296 not intended for ordinary use in compiling user code.
27298 @opindex minterlink-compressed
27299 @opindex mno-interlink-compressed
27300 @item -minterlink-compressed
27301 @itemx -mno-interlink-compressed
27302 Require (do not require) that code using the standard (uncompressed) MIPS ISA
27303 be link-compatible with MIPS16 and microMIPS code, and vice versa.
27305 For example, code using the standard ISA encoding cannot jump directly
27306 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
27307 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
27308 knows that the target of the jump is not compressed.
27310 @opindex minterlink-mips16
27311 @opindex mno-interlink-mips16
27312 @item -minterlink-mips16
27313 @itemx -mno-interlink-mips16
27314 Aliases of @option{-minterlink-compressed} and
27315 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
27316 and are retained for backwards compatibility.
27318 @opindex mabi=32
27319 @opindex mabi=o64
27320 @opindex mabi=n32
27321 @opindex mabi=64
27322 @opindex mabi=eabi
27323 @item -mabi=32
27324 @itemx -mabi=o64
27325 @itemx -mabi=n32
27326 @itemx -mabi=64
27327 @itemx -mabi=eabi
27328 Generate code for the given ABI@.
27330 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
27331 generates 64-bit code when you select a 64-bit architecture, but you
27332 can use @option{-mgp32} to get 32-bit code instead.
27334 For information about the O64 ABI, see
27335 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
27337 GCC supports a variant of the o32 ABI in which floating-point registers
27338 are 64 rather than 32 bits wide.  You can select this combination with
27339 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
27340 and @code{mfhc1} instructions and is therefore only supported for
27341 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
27343 The register assignments for arguments and return values remain the
27344 same, but each scalar value is passed in a single 64-bit register
27345 rather than a pair of 32-bit registers.  For example, scalar
27346 floating-point values are returned in @samp{$f0} only, not a
27347 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
27348 remains the same in that the even-numbered double-precision registers
27349 are saved.
27351 Two additional variants of the o32 ABI are supported to enable
27352 a transition from 32-bit to 64-bit registers.  These are FPXX
27353 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
27354 The FPXX extension mandates that all code must execute correctly
27355 when run using 32-bit or 64-bit registers.  The code can be interlinked
27356 with either FP32 or FP64, but not both.
27357 The FP64A extension is similar to the FP64 extension but forbids the
27358 use of odd-numbered single-precision registers.  This can be used
27359 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
27360 processors and allows both FP32 and FP64A code to interlink and
27361 run in the same process without changing FPU modes.
27363 @opindex mabicalls
27364 @opindex mno-abicalls
27365 @item -mabicalls
27366 @itemx -mno-abicalls
27367 Generate (do not generate) code that is suitable for SVR4-style
27368 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
27369 systems.
27371 @item -mshared
27372 @itemx -mno-shared
27373 Generate (do not generate) code that is fully position-independent,
27374 and that can therefore be linked into shared libraries.  This option
27375 only affects @option{-mabicalls}.
27377 All @option{-mabicalls} code has traditionally been position-independent,
27378 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
27379 as an extension, the GNU toolchain allows executables to use absolute
27380 accesses for locally-binding symbols.  It can also use shorter GP
27381 initialization sequences and generate direct calls to locally-defined
27382 functions.  This mode is selected by @option{-mno-shared}.
27384 @option{-mno-shared} depends on binutils 2.16 or higher and generates
27385 objects that can only be linked by the GNU linker.  However, the option
27386 does not affect the ABI of the final executable; it only affects the ABI
27387 of relocatable objects.  Using @option{-mno-shared} generally makes
27388 executables both smaller and quicker.
27390 @option{-mshared} is the default.
27392 @opindex mplt
27393 @opindex mno-plt
27394 @item -mplt
27395 @itemx -mno-plt
27396 Assume (do not assume) that the static and dynamic linkers
27397 support PLTs and copy relocations.  This option only affects
27398 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
27399 has no effect without @option{-msym32}.
27401 You can make @option{-mplt} the default by configuring
27402 GCC with @option{--with-mips-plt}.  The default is
27403 @option{-mno-plt} otherwise.
27405 @opindex mxgot
27406 @opindex mno-xgot
27407 @item -mxgot
27408 @itemx -mno-xgot
27409 Lift (do not lift) the usual restrictions on the size of the global
27410 offset table.
27412 GCC normally uses a single instruction to load values from the GOT@.
27413 While this is relatively efficient, it only works if the GOT
27414 is smaller than about 64k.  Anything larger causes the linker
27415 to report an error such as:
27417 @cindex relocation truncated to fit (MIPS)
27418 @smallexample
27419 relocation truncated to fit: R_MIPS_GOT16 foobar
27420 @end smallexample
27422 If this happens, you should recompile your code with @option{-mxgot}.
27423 This works with very large GOTs, although the code is also
27424 less efficient, since it takes three instructions to fetch the
27425 value of a global symbol.
27427 Note that some linkers can create multiple GOTs.  If you have such a
27428 linker, you should only need to use @option{-mxgot} when a single object
27429 file accesses more than 64k's worth of GOT entries.  Very few do.
27431 These options have no effect unless GCC is generating position
27432 independent code.
27434 @opindex mgp32
27435 @item -mgp32
27436 Assume that general-purpose registers are 32 bits wide.
27438 @opindex mgp64
27439 @item -mgp64
27440 Assume that general-purpose registers are 64 bits wide.
27442 @opindex mfp32
27443 @item -mfp32
27444 Assume that floating-point registers are 32 bits wide.
27446 @opindex mfp64
27447 @item -mfp64
27448 Assume that floating-point registers are 64 bits wide.
27450 @opindex mfpxx
27451 @item -mfpxx
27452 Do not assume the width of floating-point registers.
27454 @opindex mhard-float
27455 @item -mhard-float
27456 Use floating-point coprocessor instructions.
27458 @opindex msoft-float
27459 @item -msoft-float
27460 Do not use floating-point coprocessor instructions.  Implement
27461 floating-point calculations using library calls instead.
27463 @opindex mno-float
27464 @item -mno-float
27465 Equivalent to @option{-msoft-float}, but additionally asserts that the
27466 program being compiled does not perform any floating-point operations.
27467 This option is presently supported only by some bare-metal MIPS
27468 configurations, where it may select a special set of libraries
27469 that lack all floating-point support (including, for example, the
27470 floating-point @code{printf} formats).  
27471 If code compiled with @option{-mno-float} accidentally contains
27472 floating-point operations, it is likely to suffer a link-time
27473 or run-time failure.
27475 @opindex msingle-float
27476 @item -msingle-float
27477 Assume that the floating-point coprocessor only supports single-precision
27478 operations.
27480 @opindex mdouble-float
27481 @item -mdouble-float
27482 Assume that the floating-point coprocessor supports double-precision
27483 operations.  This is the default.
27485 @opindex modd-spreg
27486 @opindex mno-odd-spreg
27487 @item -modd-spreg
27488 @itemx -mno-odd-spreg
27489 Enable the use of odd-numbered single-precision floating-point registers
27490 for the o32 ABI.  This is the default for processors that are known to
27491 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
27492 is set by default.
27494 @opindex mabs=2008
27495 @opindex mabs=legacy
27496 @item -mabs=2008
27497 @itemx -mabs=legacy
27498 These options control the treatment of the special not-a-number (NaN)
27499 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
27500 @code{neg.@i{fmt}} machine instructions.
27502 By default or when @option{-mabs=legacy} is used the legacy
27503 treatment is selected.  In this case these instructions are considered
27504 arithmetic and avoided where correct operation is required and the
27505 input operand might be a NaN.  A longer sequence of instructions that
27506 manipulate the sign bit of floating-point datum manually is used
27507 instead unless the @option{-ffinite-math-only} option has also been
27508 specified.
27510 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
27511 this case these instructions are considered non-arithmetic and therefore
27512 operating correctly in all cases, including in particular where the
27513 input operand is a NaN.  These instructions are therefore always used
27514 for the respective operations.
27516 @opindex mnan=2008
27517 @opindex mnan=legacy
27518 @item -mnan=2008
27519 @itemx -mnan=legacy
27520 These options control the encoding of the special not-a-number (NaN)
27521 IEEE 754 floating-point data.
27523 The @option{-mnan=legacy} option selects the legacy encoding.  In this
27524 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
27525 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
27526 by the first bit of their trailing significand field being 1.
27528 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
27529 this case qNaNs are denoted by the first bit of their trailing
27530 significand field being 1, whereas sNaNs are denoted by the first bit of
27531 their trailing significand field being 0.
27533 The default is @option{-mnan=legacy} unless GCC has been configured with
27534 @option{--with-nan=2008}.
27536 @opindex mllsc
27537 @opindex mno-llsc
27538 @item -mllsc
27539 @itemx -mno-llsc
27540 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
27541 implement atomic memory built-in functions.  When neither option is
27542 specified, GCC uses the instructions if the target architecture
27543 supports them.
27545 @option{-mllsc} is useful if the runtime environment can emulate the
27546 instructions and @option{-mno-llsc} can be useful when compiling for
27547 nonstandard ISAs.  You can make either option the default by
27548 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
27549 respectively.  @option{--with-llsc} is the default for some
27550 configurations; see the installation documentation for details.
27552 @opindex mdsp
27553 @opindex mno-dsp
27554 @item -mdsp
27555 @itemx -mno-dsp
27556 Use (do not use) revision 1 of the MIPS DSP ASE@.
27557 @xref{MIPS DSP Built-in Functions}.  This option defines the
27558 preprocessor macro @code{__mips_dsp}.  It also defines
27559 @code{__mips_dsp_rev} to 1.
27561 @opindex mdspr2
27562 @opindex mno-dspr2
27563 @item -mdspr2
27564 @itemx -mno-dspr2
27565 Use (do not use) revision 2 of the MIPS DSP ASE@.
27566 @xref{MIPS DSP Built-in Functions}.  This option defines the
27567 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
27568 It also defines @code{__mips_dsp_rev} to 2.
27570 @opindex msmartmips
27571 @opindex mno-smartmips
27572 @item -msmartmips
27573 @itemx -mno-smartmips
27574 Use (do not use) the MIPS SmartMIPS ASE.
27576 @opindex mpaired-single
27577 @opindex mno-paired-single
27578 @item -mpaired-single
27579 @itemx -mno-paired-single
27580 Use (do not use) paired-single floating-point instructions.
27581 @xref{MIPS Paired-Single Support}.  This option requires
27582 hardware floating-point support to be enabled.
27584 @opindex mdmx
27585 @opindex mno-mdmx
27586 @item -mdmx
27587 @itemx -mno-mdmx
27588 Use (do not use) MIPS Digital Media Extension instructions.
27589 This option can only be used when generating 64-bit code and requires
27590 hardware floating-point support to be enabled.
27592 @opindex mips3d
27593 @opindex mno-mips3d
27594 @item -mips3d
27595 @itemx -mno-mips3d
27596 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
27597 The option @option{-mips3d} implies @option{-mpaired-single}.
27599 @opindex mmicromips
27600 @opindex mno-mmicromips
27601 @item -mmicromips
27602 @itemx -mno-micromips
27603 Generate (do not generate) microMIPS code.
27605 MicroMIPS code generation can also be controlled on a per-function basis
27606 by means of @code{micromips} and @code{nomicromips} attributes.
27607 @xref{Function Attributes}, for more information.
27609 @opindex mmt
27610 @opindex mno-mt
27611 @item -mmt
27612 @itemx -mno-mt
27613 Use (do not use) MT Multithreading instructions.
27615 @opindex mmcu
27616 @opindex mno-mcu
27617 @item -mmcu
27618 @itemx -mno-mcu
27619 Use (do not use) the MIPS MCU ASE instructions.
27621 @opindex meva
27622 @opindex mno-eva
27623 @item -meva
27624 @itemx -mno-eva
27625 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
27627 @opindex mvirt
27628 @opindex mno-virt
27629 @item -mvirt
27630 @itemx -mno-virt
27631 Use (do not use) the MIPS Virtualization (VZ) instructions.
27633 @opindex mxpa
27634 @opindex mno-xpa
27635 @item -mxpa
27636 @itemx -mno-xpa
27637 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
27639 @opindex mcrc
27640 @opindex mno-crc
27641 @item -mcrc
27642 @itemx -mno-crc
27643 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
27645 @opindex mginv
27646 @opindex mno-ginv
27647 @item -mginv
27648 @itemx -mno-ginv
27649 Use (do not use) the MIPS Global INValidate (GINV) instructions.
27651 @opindex mloongson-mmi
27652 @opindex mno-loongson-mmi
27653 @item -mloongson-mmi
27654 @itemx -mno-loongson-mmi
27655 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
27657 @opindex mloongson-ext
27658 @opindex mno-loongson-ext
27659 @item -mloongson-ext
27660 @itemx -mno-loongson-ext
27661 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
27663 @opindex mloongson-ext2
27664 @opindex mno-loongson-ext2
27665 @item -mloongson-ext2
27666 @itemx -mno-loongson-ext2
27667 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
27669 @opindex mlong64
27670 @item -mlong64
27671 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
27672 an explanation of the default and the way that the pointer size is
27673 determined.
27675 @opindex mlong32
27676 @item -mlong32
27677 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
27679 The default size of @code{int}s, @code{long}s and pointers depends on
27680 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
27681 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
27682 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
27683 or the same size as integer registers, whichever is smaller.
27685 @opindex msym32
27686 @opindex mno-sym32
27687 @item -msym32
27688 @itemx -mno-sym32
27689 Assume (do not assume) that all symbols have 32-bit values, regardless
27690 of the selected ABI@.  This option is useful in combination with
27691 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
27692 to generate shorter and faster references to symbolic addresses.
27694 @opindex G
27695 @item -G @var{num}
27696 Put definitions of externally-visible data in a small data section
27697 if that data is no bigger than @var{num} bytes.  GCC can then generate
27698 more efficient accesses to the data; see @option{-mgpopt} for details.
27700 The default @option{-G} option depends on the configuration.
27702 @opindex mlocal-sdata
27703 @opindex mno-local-sdata
27704 @item -mlocal-sdata
27705 @itemx -mno-local-sdata
27706 Extend (do not extend) the @option{-G} behavior to local data too,
27707 such as to static variables in C@.  @option{-mlocal-sdata} is the
27708 default for all configurations.
27710 If the linker complains that an application is using too much small data,
27711 you might want to try rebuilding the less performance-critical parts with
27712 @option{-mno-local-sdata}.  You might also want to build large
27713 libraries with @option{-mno-local-sdata}, so that the libraries leave
27714 more room for the main program.
27716 @opindex mextern-sdata
27717 @opindex mno-extern-sdata
27718 @item -mextern-sdata
27719 @itemx -mno-extern-sdata
27720 Assume (do not assume) that externally-defined data is in
27721 a small data section if the size of that data is within the @option{-G} limit.
27722 @option{-mextern-sdata} is the default for all configurations.
27724 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
27725 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
27726 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
27727 is placed in a small data section.  If @var{Var} is defined by another
27728 module, you must either compile that module with a high-enough
27729 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
27730 definition.  If @var{Var} is common, you must link the application
27731 with a high-enough @option{-G} setting.
27733 The easiest way of satisfying these restrictions is to compile
27734 and link every module with the same @option{-G} option.  However,
27735 you may wish to build a library that supports several different
27736 small data limits.  You can do this by compiling the library with
27737 the highest supported @option{-G} setting and additionally using
27738 @option{-mno-extern-sdata} to stop the library from making assumptions
27739 about externally-defined data.
27741 @opindex mgpopt
27742 @opindex mno-gpopt
27743 @item -mgpopt
27744 @itemx -mno-gpopt
27745 Use (do not use) GP-relative accesses for symbols that are known to be
27746 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27747 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
27748 configurations.
27750 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27751 might not hold the value of @code{_gp}.  For example, if the code is
27752 part of a library that might be used in a boot monitor, programs that
27753 call boot monitor routines pass an unknown value in @code{$gp}.
27754 (In such situations, the boot monitor itself is usually compiled
27755 with @option{-G0}.)
27757 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27758 @option{-mno-extern-sdata}.
27760 @opindex membedded-data
27761 @opindex mno-embedded-data
27762 @item -membedded-data
27763 @itemx -mno-embedded-data
27764 Allocate variables to the read-only data section first if possible, then
27765 next in the small data section if possible, otherwise in data.  This gives
27766 slightly slower code than the default, but reduces the amount of RAM required
27767 when executing, and thus may be preferred for some embedded systems.
27769 @opindex muninit-const-in-rodata
27770 @opindex mno-uninit-const-in-rodata
27771 @item -muninit-const-in-rodata
27772 @itemx -mno-uninit-const-in-rodata
27773 Put uninitialized @code{const} variables in the read-only data section.
27774 This option is only meaningful in conjunction with @option{-membedded-data}.
27776 @opindex mcode-readable
27777 @item -mcode-readable=@var{setting}
27778 Specify whether GCC may generate code that reads from executable sections.
27779 There are three possible settings:
27781 @table @gcctabopt
27782 @item -mcode-readable=yes
27783 Instructions may freely access executable sections.  This is the
27784 default setting.
27786 @item -mcode-readable=pcrel
27787 MIPS16 PC-relative load instructions can access executable sections,
27788 but other instructions must not do so.  This option is useful on 4KSc
27789 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27790 It is also useful on processors that can be configured to have a dual
27791 instruction/data SRAM interface and that, like the M4K, automatically
27792 redirect PC-relative loads to the instruction RAM.
27794 @item -mcode-readable=no
27795 Instructions must not access executable sections.  This option can be
27796 useful on targets that are configured to have a dual instruction/data
27797 SRAM interface but that (unlike the M4K) do not automatically redirect
27798 PC-relative loads to the instruction RAM.
27799 @end table
27801 @opindex msplit-addresses
27802 @opindex mno-split-addresses
27803 @item -msplit-addresses
27804 @itemx -mno-split-addresses
27805 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27806 relocation operators.  This option has been superseded by
27807 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27809 @opindex mexplicit-relocs
27810 @opindex mno-explicit-relocs
27811 @item -mexplicit-relocs
27812 @itemx -mno-explicit-relocs
27813 Use (do not use) assembler relocation operators when dealing with symbolic
27814 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
27815 is to use assembler macros instead.
27817 @option{-mexplicit-relocs} is the default if GCC was configured
27818 to use an assembler that supports relocation operators.
27820 @opindex mcheck-zero-division
27821 @opindex mno-check-zero-division
27822 @item -mcheck-zero-division
27823 @itemx -mno-check-zero-division
27824 Trap (do not trap) on integer division by zero.
27826 The default is @option{-mcheck-zero-division}.
27828 @opindex mdivide-traps
27829 @opindex mdivide-breaks
27830 @item -mdivide-traps
27831 @itemx -mdivide-breaks
27832 MIPS systems check for division by zero by generating either a
27833 conditional trap or a break instruction.  Using traps results in
27834 smaller code, but is only supported on MIPS II and later.  Also, some
27835 versions of the Linux kernel have a bug that prevents trap from
27836 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
27837 allow conditional traps on architectures that support them and
27838 @option{-mdivide-breaks} to force the use of breaks.
27840 The default is usually @option{-mdivide-traps}, but this can be
27841 overridden at configure time using @option{--with-divide=breaks}.
27842 Divide-by-zero checks can be completely disabled using
27843 @option{-mno-check-zero-division}.
27845 @opindex mload-store-pairs
27846 @opindex mno-load-store-pairs
27847 @item -mload-store-pairs
27848 @itemx -mno-load-store-pairs
27849 Enable (disable) an optimization that pairs consecutive load or store
27850 instructions to enable load/store bonding.  This option is enabled by
27851 default but only takes effect when the selected architecture is known
27852 to support bonding.
27854 @opindex munaligned-access
27855 @opindex mno-unaligned-access
27856 @item -munaligned-access
27857 @itemx -mno-unaligned-access
27858 Enable (disable) direct unaligned access for MIPS Release 6.
27859 MIPSr6 requires load/store unaligned-access support,
27860 by hardware or trap&emulate.
27861 So @option{-mno-unaligned-access} may be needed by kernel.
27863 @opindex mmemcpy
27864 @opindex mno-memcpy
27865 @item -mmemcpy
27866 @itemx -mno-memcpy
27867 Force (do not force) the use of @code{memcpy} for non-trivial block
27868 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
27869 most constant-sized copies.
27871 @opindex mlong-calls
27872 @opindex mno-long-calls
27873 @item -mlong-calls
27874 @itemx -mno-long-calls
27875 Disable (do not disable) use of the @code{jal} instruction.  Calling
27876 functions using @code{jal} is more efficient but requires the caller
27877 and callee to be in the same 256 megabyte segment.
27879 This option has no effect on abicalls code.  The default is
27880 @option{-mno-long-calls}.
27882 @opindex mmad
27883 @opindex mno-mad
27884 @item -mmad
27885 @itemx -mno-mad
27886 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27887 instructions, as provided by the R4650 ISA@.
27889 @opindex mimadd
27890 @opindex mno-imadd
27891 @item -mimadd
27892 @itemx -mno-imadd
27893 Enable (disable) use of the @code{madd} and @code{msub} integer
27894 instructions.  The default is @option{-mimadd} on architectures
27895 that support @code{madd} and @code{msub} except for the 74k 
27896 architecture where it was found to generate slower code.
27898 @opindex mfused-madd
27899 @opindex mno-fused-madd
27900 @item -mfused-madd
27901 @itemx -mno-fused-madd
27902 Enable (disable) use of the floating-point multiply-accumulate
27903 instructions, when they are available.  The default is
27904 @option{-mfused-madd}.
27906 On the R8000 CPU when multiply-accumulate instructions are used,
27907 the intermediate product is calculated to infinite precision
27908 and is not subject to the FCSR Flush to Zero bit.  This may be
27909 undesirable in some circumstances.  On other processors the result
27910 is numerically identical to the equivalent computation using
27911 separate multiply, add, subtract and negate instructions.
27913 @opindex nocpp
27914 @item -nocpp
27915 Tell the MIPS assembler to not run its preprocessor over user
27916 assembler files (with a @samp{.s} suffix) when assembling them.
27918 @opindex mfix-24k
27919 @opindex mno-fix-24k
27920 @item -mfix-24k
27921 @itemx -mno-fix-24k
27922 Work around the 24K E48 (lost data on stores during refill) errata.
27923 The workarounds are implemented by the assembler rather than by GCC@.
27925 @opindex mfix-r4000
27926 @opindex mno-fix-r4000
27927 @item -mfix-r4000
27928 @itemx -mno-fix-r4000
27929 Work around certain R4000 CPU errata:
27930 @itemize @minus
27931 @item
27932 A double-word or a variable shift may give an incorrect result if executed
27933 immediately after starting an integer division.
27934 @item
27935 A double-word or a variable shift may give an incorrect result if executed
27936 while an integer multiplication is in progress.
27937 @item
27938 An integer division may give an incorrect result if started in a delay slot
27939 of a taken branch or a jump.
27940 @end itemize
27942 @opindex mfix-r4400
27943 @opindex mno-fix-r4400
27944 @item -mfix-r4400
27945 @itemx -mno-fix-r4400
27946 Work around certain R4400 CPU errata:
27947 @itemize @minus
27948 @item
27949 A double-word or a variable shift may give an incorrect result if executed
27950 immediately after starting an integer division.
27951 @end itemize
27953 @opindex mfix-r10000
27954 @opindex mno-fix-r10000
27955 @item -mfix-r10000
27956 @itemx -mno-fix-r10000
27957 Work around certain R10000 errata:
27958 @itemize @minus
27959 @item
27960 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27961 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
27962 @end itemize
27964 This option can only be used if the target architecture supports
27965 branch-likely instructions.  @option{-mfix-r10000} is the default when
27966 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27967 otherwise.
27969 @opindex mfix-r5900
27970 @item -mfix-r5900
27971 @itemx -mno-fix-r5900
27972 Do not attempt to schedule the preceding instruction into the delay slot
27973 of a branch instruction placed at the end of a short loop of six
27974 instructions or fewer and always schedule a @code{nop} instruction there
27975 instead.  The short loop bug under certain conditions causes loops to
27976 execute only once or twice, due to a hardware bug in the R5900 chip.  The
27977 workaround is implemented by the assembler rather than by GCC@.
27979 @opindex mfix-rm7000
27980 @item -mfix-rm7000
27981 @itemx -mno-fix-rm7000
27982 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
27983 workarounds are implemented by the assembler rather than by GCC@.
27985 @opindex mfix-vr4120
27986 @item -mfix-vr4120
27987 @itemx -mno-fix-vr4120
27988 Work around certain VR4120 errata:
27989 @itemize @minus
27990 @item
27991 @code{dmultu} does not always produce the correct result.
27992 @item
27993 @code{div} and @code{ddiv} do not always produce the correct result if one
27994 of the operands is negative.
27995 @end itemize
27996 The workarounds for the division errata rely on special functions in
27997 @file{libgcc.a}.  At present, these functions are only provided by
27998 the @code{mips64vr*-elf} configurations.
28000 Other VR4120 errata require a NOP to be inserted between certain pairs of
28001 instructions.  These errata are handled by the assembler, not by GCC itself.
28003 @opindex mfix-vr4130
28004 @item -mfix-vr4130
28005 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
28006 workarounds are implemented by the assembler rather than by GCC,
28007 although GCC avoids using @code{mflo} and @code{mfhi} if the
28008 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
28009 instructions are available instead.
28011 @opindex mfix-sb1
28012 @item -mfix-sb1
28013 @itemx -mno-fix-sb1
28014 Work around certain SB-1 CPU core errata.
28015 (This flag currently works around the SB-1 revision 2
28016 ``F1'' and ``F2'' floating-point errata.)
28018 @opindex mr10k-cache-barrier
28019 @item -mr10k-cache-barrier=@var{setting}
28020 Specify whether GCC should insert cache barriers to avoid the
28021 side effects of speculation on R10K processors.
28023 In common with many processors, the R10K tries to predict the outcome
28024 of a conditional branch and speculatively executes instructions from
28025 the ``taken'' branch.  It later aborts these instructions if the
28026 predicted outcome is wrong.  However, on the R10K, even aborted
28027 instructions can have side effects.
28029 This problem only affects kernel stores and, depending on the system,
28030 kernel loads.  As an example, a speculatively-executed store may load
28031 the target memory into cache and mark the cache line as dirty, even if
28032 the store itself is later aborted.  If a DMA operation writes to the
28033 same area of memory before the ``dirty'' line is flushed, the cached
28034 data overwrites the DMA-ed data.  See the R10K processor manual
28035 for a full description, including other potential problems.
28037 One workaround is to insert cache barrier instructions before every memory
28038 access that might be speculatively executed and that might have side
28039 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
28040 controls GCC's implementation of this workaround.  It assumes that
28041 aborted accesses to any byte in the following regions does not have
28042 side effects:
28044 @enumerate
28045 @item
28046 the memory occupied by the current function's stack frame;
28048 @item
28049 the memory occupied by an incoming stack argument;
28051 @item
28052 the memory occupied by an object with a link-time-constant address.
28053 @end enumerate
28055 It is the kernel's responsibility to ensure that speculative
28056 accesses to these regions are indeed safe.
28058 If the input program contains a function declaration such as:
28060 @smallexample
28061 void foo (void);
28062 @end smallexample
28064 then the implementation of @code{foo} must allow @code{j foo} and
28065 @code{jal foo} to be executed speculatively.  GCC honors this
28066 restriction for functions it compiles itself.  It expects non-GCC
28067 functions (such as hand-written assembly code) to do the same.
28069 The option has three forms:
28071 @table @gcctabopt
28072 @item -mr10k-cache-barrier=load-store
28073 Insert a cache barrier before a load or store that might be
28074 speculatively executed and that might have side effects even
28075 if aborted.
28077 @item -mr10k-cache-barrier=store
28078 Insert a cache barrier before a store that might be speculatively
28079 executed and that might have side effects even if aborted.
28081 @item -mr10k-cache-barrier=none
28082 Disable the insertion of cache barriers.  This is the default setting.
28083 @end table
28085 @opindex mflush-func
28086 @item -mflush-func=@var{func}
28087 @itemx -mno-flush-func
28088 Specifies the function to call to flush the I and D caches, or to not
28089 call any such function.  If called, the function must take the same
28090 arguments as the common @code{_flush_func}, that is, the address of the
28091 memory range for which the cache is being flushed, the size of the
28092 memory range, and the number 3 (to flush both caches).  The default
28093 depends on the target GCC was configured for, but commonly is either
28094 @code{_flush_func} or @code{__cpu_flush}.
28096 @opindex mbranch-cost
28097 @item mbranch-cost=@var{num}
28098 Set the cost of branches to roughly @var{num} ``simple'' instructions.
28099 This cost is only a heuristic and is not guaranteed to produce
28100 consistent results across releases.  A zero cost redundantly selects
28101 the default, which is based on the @option{-mtune} setting.
28103 @opindex mbranch-likely
28104 @opindex mno-branch-likely
28105 @item -mbranch-likely
28106 @itemx -mno-branch-likely
28107 Enable or disable use of Branch Likely instructions, regardless of the
28108 default for the selected architecture.  By default, Branch Likely
28109 instructions may be generated if they are supported by the selected
28110 architecture.  An exception is for the MIPS32 and MIPS64 architectures
28111 and processors that implement those architectures; for those, Branch
28112 Likely instructions are not be generated by default because the MIPS32
28113 and MIPS64 architectures specifically deprecate their use.
28115 @opindex mcompact-branches=never
28116 @opindex mcompact-branches=optimal
28117 @opindex mcompact-branches=always
28118 @item -mcompact-branches=never
28119 @itemx -mcompact-branches=optimal
28120 @itemx -mcompact-branches=always
28121 These options control which form of branches will be generated.  The
28122 default is @option{-mcompact-branches=optimal}.
28124 The @option{-mcompact-branches=never} option ensures that compact branch
28125 instructions will never be generated.
28127 The @option{-mcompact-branches=always} option ensures that a compact
28128 branch instruction will be generated if available for MIPS Release 6 onwards.
28129 If a compact branch instruction is not available (or pre-R6),
28130 a delay slot form of the branch will be used instead.
28132 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
28133 The behaviour for MIPS16/microMIPS may change in future,
28134 since they do have some compact branch instructions.
28136 The @option{-mcompact-branches=optimal} option will cause a delay slot
28137 branch to be used if one is available in the current ISA and the delay
28138 slot is successfully filled.  If the delay slot is not filled, a compact
28139 branch will be chosen if one is available.
28141 @opindex mfp-exceptions
28142 @item -mfp-exceptions
28143 @itemx -mno-fp-exceptions
28144 Specifies whether FP exceptions are enabled.  This affects how
28145 FP instructions are scheduled for some processors.
28146 The default is that FP exceptions are
28147 enabled.
28149 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
28150 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
28151 FP pipe.
28153 @opindex mvr4130-align
28154 @item -mvr4130-align
28155 @itemx -mno-vr4130-align
28156 The VR4130 pipeline is two-way superscalar, but can only issue two
28157 instructions together if the first one is 8-byte aligned.  When this
28158 option is enabled, GCC aligns pairs of instructions that it
28159 thinks should execute in parallel.
28161 This option only has an effect when optimizing for the VR4130.
28162 It normally makes code faster, but at the expense of making it bigger.
28163 It is enabled by default at optimization level @option{-O3}.
28165 @opindex msynci
28166 @item -msynci
28167 @itemx -mno-synci
28168 Enable (disable) generation of @code{synci} instructions on
28169 architectures that support it.  The @code{synci} instructions (if
28170 enabled) are generated when @code{__builtin___clear_cache} is
28171 compiled.
28173 This option defaults to @option{-mno-synci}, but the default can be
28174 overridden by configuring GCC with @option{--with-synci}.
28176 When compiling code for single processor systems, it is generally safe
28177 to use @code{synci}.  However, on many multi-core (SMP) systems, it
28178 does not invalidate the instruction caches on all cores and may lead
28179 to undefined behavior.
28181 @opindex mrelax-pic-calls
28182 @item -mrelax-pic-calls
28183 @itemx -mno-relax-pic-calls
28184 Try to turn PIC calls that are normally dispatched via register
28185 @code{$25} into direct calls.  This is only possible if the linker can
28186 resolve the destination at link time and if the destination is within
28187 range for a direct call.
28189 @option{-mrelax-pic-calls} is the default if GCC was configured to use
28190 an assembler and a linker that support the @code{.reloc} assembly
28191 directive and @option{-mexplicit-relocs} is in effect.  With
28192 @option{-mno-explicit-relocs}, this optimization can be performed by the
28193 assembler and the linker alone without help from the compiler.
28195 @opindex mmcount-ra-address
28196 @opindex mno-mcount-ra-address
28197 @item -mmcount-ra-address
28198 @itemx -mno-mcount-ra-address
28199 Emit (do not emit) code that allows @code{_mcount} to modify the
28200 calling function's return address.  When enabled, this option extends
28201 the usual @code{_mcount} interface with a new @var{ra-address}
28202 parameter, which has type @code{intptr_t *} and is passed in register
28203 @code{$12}.  @code{_mcount} can then modify the return address by
28204 doing both of the following:
28205 @itemize
28206 @item
28207 Returning the new address in register @code{$31}.
28208 @item
28209 Storing the new address in @code{*@var{ra-address}},
28210 if @var{ra-address} is nonnull.
28211 @end itemize
28213 The default is @option{-mno-mcount-ra-address}.
28215 @opindex mframe-header-opt
28216 @item -mframe-header-opt
28217 @itemx -mno-frame-header-opt
28218 Enable (disable) frame header optimization in the o32 ABI.  When using the
28219 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
28220 function to write out register arguments.  When enabled, this optimization
28221 will suppress the allocation of the frame header if it can be determined that
28222 it is unused.
28224 This optimization is off by default at all optimization levels.
28226 @opindex mlxc1-sxc1
28227 @item -mlxc1-sxc1
28228 @itemx -mno-lxc1-sxc1
28229 When applicable, enable (disable) the generation of @code{lwxc1},
28230 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
28232 @opindex mmadd4
28233 @item -mmadd4
28234 @itemx -mno-madd4
28235 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
28236 @code{madd.d} and related instructions.  Enabled by default.
28238 @end table
28240 @node MMIX Options
28241 @subsection MMIX Options
28242 @cindex MMIX Options
28244 These options are defined for the MMIX:
28246 @table @gcctabopt
28247 @opindex mlibfuncs
28248 @opindex mno-libfuncs
28249 @item -mlibfuncs
28250 @itemx -mno-libfuncs
28251 Specify that intrinsic library functions are being compiled, passing all
28252 values in registers, no matter the size.
28254 @opindex mepsilon
28255 @opindex mno-epsilon
28256 @item -mepsilon
28257 @itemx -mno-epsilon
28258 Generate floating-point comparison instructions that compare with respect
28259 to the @code{rE} epsilon register.
28261 @opindex mabi=mmixware
28262 @opindex mabi=gnu
28263 @item -mabi=mmixware
28264 @itemx -mabi=gnu
28265 Generate code that passes function parameters and return values that (in
28266 the called function) are seen as registers @code{$0} and up, as opposed to
28267 the GNU ABI which uses global registers @code{$231} and up.
28269 @opindex mzero-extend
28270 @opindex mno-zero-extend
28271 @item -mzero-extend
28272 @itemx -mno-zero-extend
28273 When reading data from memory in sizes shorter than 64 bits, use (do not
28274 use) zero-extending load instructions by default, rather than
28275 sign-extending ones.
28277 @opindex mknuthdiv
28278 @opindex mno-knuthdiv
28279 @item -mknuthdiv
28280 @itemx -mno-knuthdiv
28281 Make the result of a division yielding a remainder have the same sign as
28282 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
28283 remainder follows the sign of the dividend.  Both methods are
28284 arithmetically valid, the latter being almost exclusively used.
28286 @opindex mtoplevel-symbols
28287 @opindex mno-toplevel-symbols
28288 @item -mtoplevel-symbols
28289 @itemx -mno-toplevel-symbols
28290 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
28291 code can be used with the @code{PREFIX} assembly directive.
28293 @opindex melf
28294 @item -melf
28295 Generate an executable in the ELF format, rather than the default
28296 @samp{mmo} format used by the @command{mmix} simulator.
28298 @opindex mbranch-predict
28299 @opindex mno-branch-predict
28300 @item -mbranch-predict
28301 @itemx -mno-branch-predict
28302 Use (do not use) the probable-branch instructions, when static branch
28303 prediction indicates a probable branch.
28305 @opindex mbase-addresses
28306 @opindex mno-base-addresses
28307 @item -mbase-addresses
28308 @itemx -mno-base-addresses
28309 Generate (do not generate) code that uses @emph{base addresses}.  Using a
28310 base address automatically generates a request (handled by the assembler
28311 and the linker) for a constant to be set up in a global register.  The
28312 register is used for one or more base address requests within the range 0
28313 to 255 from the value held in the register.  The generally leads to short
28314 and fast code, but the number of different data items that can be
28315 addressed is limited.  This means that a program that uses lots of static
28316 data may require @option{-mno-base-addresses}.
28318 @opindex msingle-exit
28319 @opindex mno-single-exit
28320 @item -msingle-exit
28321 @itemx -mno-single-exit
28322 Force (do not force) generated code to have a single exit point in each
28323 function.
28324 @end table
28326 @node MN10300 Options
28327 @subsection MN10300 Options
28328 @cindex MN10300 options
28330 These @option{-m} options are defined for Matsushita MN10300 architectures:
28332 @table @gcctabopt
28333 @opindex mmult-bug
28334 @item -mmult-bug
28335 Generate code to avoid bugs in the multiply instructions for the MN10300
28336 processors.  This is the default.
28338 @opindex mno-mult-bug
28339 @item -mno-mult-bug
28340 Do not generate code to avoid bugs in the multiply instructions for the
28341 MN10300 processors.
28343 @opindex mam33
28344 @item -mam33
28345 Generate code using features specific to the AM33 processor.
28347 @opindex mno-am33
28348 @item -mno-am33
28349 Do not generate code using features specific to the AM33 processor.  This
28350 is the default.
28352 @opindex mam33-2
28353 @item -mam33-2
28354 Generate code using features specific to the AM33/2.0 processor.
28356 @opindex mam34
28357 @item -mam34
28358 Generate code using features specific to the AM34 processor.
28360 @opindex mtune
28361 @item -mtune=@var{cpu-type}
28362 Use the timing characteristics of the indicated CPU type when
28363 scheduling instructions.  This does not change the targeted processor
28364 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
28365 @samp{am33-2} or @samp{am34}.
28367 @opindex mreturn-pointer-on-d0
28368 @item -mreturn-pointer-on-d0
28369 When generating a function that returns a pointer, return the pointer
28370 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
28371 only in @code{a0}, and attempts to call such functions without a prototype
28372 result in errors.  Note that this option is on by default; use
28373 @option{-mno-return-pointer-on-d0} to disable it.
28375 @opindex mno-crt0
28376 @item -mno-crt0
28377 Do not link in the C run-time initialization object file.
28379 @opindex mrelax
28380 @item -mrelax
28381 Indicate to the linker that it should perform a relaxation optimization pass
28382 to shorten branches, calls and absolute memory addresses.  This option only
28383 has an effect when used on the command line for the final link step.
28385 This option makes symbolic debugging impossible.
28387 @opindex mliw
28388 @item -mliw
28389 Allow the compiler to generate @emph{Long Instruction Word}
28390 instructions if the target is the @samp{AM33} or later.  This is the
28391 default.  This option defines the preprocessor macro @code{__LIW__}.
28393 @opindex mno-liw
28394 @item -mno-liw
28395 Do not allow the compiler to generate @emph{Long Instruction Word}
28396 instructions.  This option defines the preprocessor macro
28397 @code{__NO_LIW__}.
28399 @opindex msetlb
28400 @item -msetlb
28401 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
28402 instructions if the target is the @samp{AM33} or later.  This is the
28403 default.  This option defines the preprocessor macro @code{__SETLB__}.
28405 @opindex mno-setlb
28406 @item -mno-setlb
28407 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
28408 instructions.  This option defines the preprocessor macro
28409 @code{__NO_SETLB__}.
28411 @end table
28413 @node Moxie Options
28414 @subsection Moxie Options
28415 @cindex Moxie Options
28417 @table @gcctabopt
28419 @opindex meb
28420 @item -meb
28421 Generate big-endian code.  This is the default for @samp{moxie-*-*}
28422 configurations.
28424 @opindex mel
28425 @item -mel
28426 Generate little-endian code.
28428 @opindex mmul.x
28429 @item -mmul.x
28430 Generate mul.x and umul.x instructions.  This is the default for
28431 @samp{moxiebox-*-*} configurations.
28433 @opindex mno-crt0
28434 @item -mno-crt0
28435 Do not link in the C run-time initialization object file.
28437 @end table
28439 @node MSP430 Options
28440 @subsection MSP430 Options
28441 @cindex MSP430 Options
28443 These options are defined for the MSP430:
28445 @table @gcctabopt
28447 @opindex masm-hex
28448 @item -masm-hex
28449 Force assembly output to always use hex constants.  Normally such
28450 constants are signed decimals, but this option is available for
28451 testsuite and/or aesthetic purposes.
28453 @opindex mmcu=
28454 @item -mmcu=
28455 Select the MCU to target.  This is used to create a C preprocessor
28456 symbol based upon the MCU name, converted to upper case and pre- and
28457 post-fixed with @samp{__}.  This in turn is used by the
28458 @file{msp430.h} header file to select an MCU-specific supplementary
28459 header file.
28461 The option also sets the ISA to use.  If the MCU name is one that is
28462 known to only support the 430 ISA then that is selected, otherwise the
28463 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
28464 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
28465 name selects the 430X ISA.
28467 In addition an MCU-specific linker script is added to the linker
28468 command line.  The script's name is the name of the MCU with
28469 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
28470 command line defines the C preprocessor symbol @code{__XXX__} and
28471 cause the linker to search for a script called @file{xxx.ld}.
28473 The ISA and hardware multiply supported for the different MCUs is hard-coded
28474 into GCC.  However, an external @samp{devices.csv} file can be used to
28475 extend device support beyond those that have been hard-coded.
28477 GCC searches for the @samp{devices.csv} file using the following methods in the
28478 given precedence order, where the first method takes precendence over the
28479 second which takes precedence over the third.
28481 @table @asis
28482 @item Include path specified with @code{-I} and @code{-L}
28483 @samp{devices.csv} will be searched for in each of the directories specified by
28484 include paths and linker library search paths.
28485 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
28486 Define the value of the global environment variable
28487 @samp{MSP430_GCC_INCLUDE_DIR}
28488 to the full path to the directory containing devices.csv, and GCC will search
28489 this directory for devices.csv.  If devices.csv is found, this directory will
28490 also be registered as an include path, and linker library path.  Header files
28491 and linker scripts in this directory can therefore be used without manually
28492 specifying @code{-I} and @code{-L} on the command line.
28493 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
28494 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
28495 toolchain root directory.  This directory does not exist in a default
28496 installation, but if the user has created it and copied @samp{devices.csv}
28497 there, then the MCU data will be read.  As above, this directory will
28498 also be registered as an include path, and linker library path.
28500 @end table
28501 If none of the above search methods find @samp{devices.csv}, then the
28502 hard-coded MCU data is used.
28505 @opindex mwarn-mcu
28506 @opindex mno-warn-mcu
28507 @item -mwarn-mcu
28508 @itemx -mno-warn-mcu
28509 This option enables or disables warnings about conflicts between the
28510 MCU name specified by the @option{-mmcu} option and the ISA set by the
28511 @option{-mcpu} option and/or the hardware multiply support set by the
28512 @option{-mhwmult} option.  It also toggles warnings about unrecognized
28513 MCU names.  This option is on by default.
28515 @opindex mcpu=
28516 @item -mcpu=
28517 Specifies the ISA to use.  Accepted values are @samp{msp430},
28518 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
28519 @option{-mmcu=} option should be used to select the ISA.
28521 @opindex msim
28522 @item -msim
28523 Link to the simulator runtime libraries and linker script.  Overrides
28524 any scripts that would be selected by the @option{-mmcu=} option.
28526 @opindex mlarge
28527 @item -mlarge
28528 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
28530 @opindex msmall
28531 @item -msmall
28532 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
28534 @opindex mrelax
28535 @item -mrelax
28536 This option is passed to the assembler and linker, and allows the
28537 linker to perform certain optimizations that cannot be done until
28538 the final link.
28540 @opindex mhwmult=
28541 @item mhwmult=
28542 Describes the type of hardware multiply supported by the target.
28543 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
28544 for the original 16-bit-only multiply supported by early MCUs.
28545 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
28546 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
28547 A value of @samp{auto} can also be given.  This tells GCC to deduce
28548 the hardware multiply support based upon the MCU name provided by the
28549 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
28550 the MCU name is not recognized then no hardware multiply support is
28551 assumed.  @code{auto} is the default setting.
28553 Hardware multiplies are normally performed by calling a library
28554 routine.  This saves space in the generated code.  When compiling at
28555 @option{-O3} or higher however the hardware multiplier is invoked
28556 inline.  This makes for bigger, but faster code.
28558 The hardware multiply routines disable interrupts whilst running and
28559 restore the previous interrupt state when they finish.  This makes
28560 them safe to use inside interrupt handlers as well as in normal code.
28562 @opindex minrt
28563 @item -minrt
28564 Enable the use of a minimum runtime environment - no static
28565 initializers or constructors.  This is intended for memory-constrained
28566 devices.  The compiler includes special symbols in some objects
28567 that tell the linker and runtime which code fragments are required.
28569 @opindex mtiny-printf
28570 @item -mtiny-printf
28571 Enable reduced code size @code{printf} and @code{puts} library functions.
28572 The @samp{tiny} implementations of these functions are not reentrant, so
28573 must be used with caution in multi-threaded applications.
28575 Support for streams has been removed and the string to be printed will
28576 always be sent to stdout via the @code{write} syscall.  The string is not
28577 buffered before it is sent to write.
28579 This option requires Newlib Nano IO, so GCC must be configured with
28580 @samp{--enable-newlib-nano-formatted-io}.
28582 @opindex mmax-inline-shift=
28583 @item -mmax-inline-shift=
28584 This option takes an integer between 0 and 64 inclusive, and sets
28585 the maximum number of inline shift instructions which should be emitted to
28586 perform a shift operation by a constant amount.  When this value needs to be
28587 exceeded, an mspabi helper function is used instead.  The default value is 4.
28589 This only affects cases where a shift by multiple positions cannot be
28590 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
28592 Shifts of a 32-bit value are at least twice as costly, so the value passed for
28593 this option is divided by 2 and the resulting value used instead.
28595 @opindex mcode-region
28596 @opindex mdata-region
28597 @item -mcode-region=
28598 @itemx -mdata-region=
28599 These options tell the compiler where to place functions and data that
28600 do not have one of the @code{lower}, @code{upper}, @code{either} or
28601 @code{section} attributes.  Possible values are @code{lower},
28602 @code{upper}, @code{either} or @code{any}.  The first three behave
28603 like the corresponding attribute.  The fourth possible value -
28604 @code{any} - is the default.  It leaves placement entirely up to the
28605 linker script and how it assigns the standard sections
28606 (@code{.text}, @code{.data}, etc) to the memory regions.
28608 @opindex msilicon-errata
28609 @item -msilicon-errata=
28610 This option passes on a request to assembler to enable the fixes for
28611 the named silicon errata.
28613 @opindex msilicon-errata-warn
28614 @item -msilicon-errata-warn=
28615 This option passes on a request to the assembler to enable warning
28616 messages when a silicon errata might need to be applied.
28618 @opindex mwarn-devices-csv
28619 @opindex mno-warn-devices-csv
28620 @item -mwarn-devices-csv
28621 @itemx -mno-warn-devices-csv
28622 Warn if @samp{devices.csv} is not found or there are problem parsing it
28623 (default: on).
28625 @end table
28627 @node NDS32 Options
28628 @subsection NDS32 Options
28629 @cindex NDS32 Options
28631 These options are defined for NDS32 implementations:
28633 @table @gcctabopt
28635 @opindex mbig-endian
28636 @item -mbig-endian
28637 Generate code in big-endian mode.
28639 @opindex mlittle-endian
28640 @item -mlittle-endian
28641 Generate code in little-endian mode.
28643 @opindex mreduced-regs
28644 @item -mreduced-regs
28645 Use reduced-set registers for register allocation.
28647 @opindex mfull-regs
28648 @item -mfull-regs
28649 Use full-set registers for register allocation.
28651 @opindex mcmov
28652 @item -mcmov
28653 Generate conditional move instructions.
28655 @opindex mno-cmov
28656 @item -mno-cmov
28657 Do not generate conditional move instructions.
28659 @opindex mext-perf
28660 @item -mext-perf
28661 Generate performance extension instructions.
28663 @opindex mno-ext-perf
28664 @item -mno-ext-perf
28665 Do not generate performance extension instructions.
28667 @opindex mext-perf2
28668 @item -mext-perf2
28669 Generate performance extension 2 instructions.
28671 @opindex mno-ext-perf2
28672 @item -mno-ext-perf2
28673 Do not generate performance extension 2 instructions.
28675 @opindex mext-string
28676 @item -mext-string
28677 Generate string extension instructions.
28679 @opindex mno-ext-string
28680 @item -mno-ext-string
28681 Do not generate string extension instructions.
28683 @opindex mv3push
28684 @item -mv3push
28685 Generate v3 push25/pop25 instructions.
28687 @opindex mno-v3push
28688 @item -mno-v3push
28689 Do not generate v3 push25/pop25 instructions.
28691 @opindex m16-bit
28692 @item -m16-bit
28693 Generate 16-bit instructions.
28695 @opindex mno-16-bit
28696 @item -mno-16-bit
28697 Do not generate 16-bit instructions.
28699 @opindex misr-vector-size
28700 @item -misr-vector-size=@var{num}
28701 Specify the size of each interrupt vector, which must be 4 or 16.
28703 @opindex mcache-block-size
28704 @item -mcache-block-size=@var{num}
28705 Specify the size of each cache block,
28706 which must be a power of 2 between 4 and 512.
28708 @opindex march
28709 @item -march=@var{arch}
28710 Specify the name of the target architecture.
28712 @opindex mcmodel
28713 @item -mcmodel=@var{code-model}
28714 Set the code model to one of
28715 @table @asis
28716 @item @samp{small}
28717 All the data and read-only data segments must be within 512KB addressing space.
28718 The text segment must be within 16MB addressing space.
28719 @item @samp{medium}
28720 The data segment must be within 512KB while the read-only data segment can be
28721 within 4GB addressing space.  The text segment should be still within 16MB
28722 addressing space.
28723 @item @samp{large}
28724 All the text and data segments can be within 4GB addressing space.
28725 @end table
28727 @opindex mctor-dtor
28728 @item -mctor-dtor
28729 Enable constructor/destructor feature.
28731 @opindex mrelax
28732 @item -mrelax
28733 Guide linker to relax instructions.
28735 @end table
28737 @node Nios II Options
28738 @subsection Nios II Options
28739 @cindex Nios II options
28740 @cindex Altera Nios II options
28742 These are the options defined for the Altera Nios II processor.
28744 @table @gcctabopt
28746 @opindex G
28747 @cindex smaller data references
28748 @item -G @var{num}
28749 Put global and static objects less than or equal to @var{num} bytes
28750 into the small data or BSS sections instead of the normal data or BSS
28751 sections.  The default value of @var{num} is 8.
28753 @opindex mgpopt
28754 @opindex mno-gpopt
28755 @item -mgpopt=@var{option}
28756 @itemx -mgpopt
28757 @itemx -mno-gpopt
28758 Generate (do not generate) GP-relative accesses.  The following 
28759 @var{option} names are recognized:
28761 @table @samp
28763 @item none
28764 Do not generate GP-relative accesses.
28766 @item local
28767 Generate GP-relative accesses for small data objects that are not 
28768 external, weak, or uninitialized common symbols.  
28769 Also use GP-relative addressing for objects that
28770 have been explicitly placed in a small data section via a @code{section}
28771 attribute.
28773 @item global
28774 As for @samp{local}, but also generate GP-relative accesses for
28775 small data objects that are external, weak, or common.  If you use this option,
28776 you must ensure that all parts of your program (including libraries) are
28777 compiled with the same @option{-G} setting.
28779 @item data
28780 Generate GP-relative accesses for all data objects in the program.  If you
28781 use this option, the entire data and BSS segments
28782 of your program must fit in 64K of memory and you must use an appropriate
28783 linker script to allocate them within the addressable range of the
28784 global pointer.
28786 @item all
28787 Generate GP-relative addresses for function pointers as well as data
28788 pointers.  If you use this option, the entire text, data, and BSS segments
28789 of your program must fit in 64K of memory and you must use an appropriate
28790 linker script to allocate them within the addressable range of the
28791 global pointer.
28793 @end table
28795 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28796 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28798 The default is @option{-mgpopt} except when @option{-fpic} or
28799 @option{-fPIC} is specified to generate position-independent code.
28800 Note that the Nios II ABI does not permit GP-relative accesses from
28801 shared libraries.
28803 You may need to specify @option{-mno-gpopt} explicitly when building
28804 programs that include large amounts of small data, including large
28805 GOT data sections.  In this case, the 16-bit offset for GP-relative
28806 addressing may not be large enough to allow access to the entire 
28807 small data section.
28809 @opindex mgprel-sec
28810 @item -mgprel-sec=@var{regexp}
28811 This option specifies additional section names that can be accessed via
28812 GP-relative addressing.  It is most useful in conjunction with 
28813 @code{section} attributes on variable declarations 
28814 (@pxref{Common Variable Attributes}) and a custom linker script.  
28815 The @var{regexp} is a POSIX Extended Regular Expression.
28817 This option does not affect the behavior of the @option{-G} option, and 
28818 the specified sections are in addition to the standard @code{.sdata}
28819 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28821 @opindex mr0rel-sec
28822 @item -mr0rel-sec=@var{regexp}
28823 This option specifies names of sections that can be accessed via a 
28824 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
28825 of the 32-bit address space.  It is most useful in conjunction with 
28826 @code{section} attributes on variable declarations 
28827 (@pxref{Common Variable Attributes}) and a custom linker script.  
28828 The @var{regexp} is a POSIX Extended Regular Expression.
28830 In contrast to the use of GP-relative addressing for small data, 
28831 zero-based addressing is never generated by default and there are no 
28832 conventional section names used in standard linker scripts for sections
28833 in the low or high areas of memory.
28835 @opindex mel
28836 @opindex meb
28837 @item -mel
28838 @itemx -meb
28839 Generate little-endian (default) or big-endian (experimental) code,
28840 respectively.
28842 @opindex march
28843 @item -march=@var{arch}
28844 This specifies the name of the target Nios II architecture.  GCC uses this
28845 name to determine what kind of instructions it can emit when generating
28846 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
28848 The preprocessor macro @code{__nios2_arch__} is available to programs,
28849 with value 1 or 2, indicating the targeted ISA level.
28851 @opindex mno-bypass-cache
28852 @opindex mbypass-cache
28853 @item -mbypass-cache
28854 @itemx -mno-bypass-cache
28855 Force all load and store instructions to always bypass cache by 
28856 using I/O variants of the instructions. The default is not to
28857 bypass the cache.
28859 @opindex mcache-volatile 
28860 @opindex mno-cache-volatile
28861 @item -mno-cache-volatile 
28862 @itemx -mcache-volatile       
28863 Volatile memory access bypass the cache using the I/O variants of 
28864 the load and store instructions. The default is not to bypass the cache.
28866 @opindex mno-fast-sw-div
28867 @opindex mfast-sw-div
28868 @item -mno-fast-sw-div
28869 @itemx -mfast-sw-div
28870 Do not use table-based fast divide for small numbers. The default 
28871 is to use the fast divide at @option{-O3} and above.
28873 @opindex mno-hw-mul
28874 @opindex mhw-mul
28875 @opindex mno-hw-mulx
28876 @opindex mhw-mulx
28877 @opindex mno-hw-div
28878 @opindex mhw-div
28879 @item -mno-hw-mul
28880 @itemx -mhw-mul
28881 @itemx -mno-hw-mulx
28882 @itemx -mhw-mulx
28883 @itemx -mno-hw-div
28884 @itemx -mhw-div
28885 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
28886 instructions by the compiler. The default is to emit @code{mul}
28887 and not emit @code{div} and @code{mulx}.
28889 @item -mbmx
28890 @itemx -mno-bmx
28891 @itemx -mcdx
28892 @itemx -mno-cdx
28893 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28894 CDX (code density) instructions.  Enabling these instructions also
28895 requires @option{-march=r2}.  Since these instructions are optional
28896 extensions to the R2 architecture, the default is not to emit them.
28898 @opindex mcustom-@var{insn}
28899 @opindex mno-custom-@var{insn}
28900 @item -mcustom-@var{insn}=@var{N}
28901 @itemx -mno-custom-@var{insn}
28902 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28903 custom instruction with encoding @var{N} when generating code that uses 
28904 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
28905 instruction 253 for single-precision floating-point add operations instead
28906 of the default behavior of using a library call.
28908 The following values of @var{insn} are supported.  Except as otherwise
28909 noted, floating-point operations are expected to be implemented with
28910 normal IEEE 754 semantics and correspond directly to the C operators or the
28911 equivalent GCC built-in functions (@pxref{Other Builtins}).
28913 Single-precision floating point:
28914 @table @asis
28916 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28917 Binary arithmetic operations.
28919 @item @samp{fnegs}
28920 Unary negation.
28922 @item @samp{fabss}
28923 Unary absolute value.
28925 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28926 Comparison operations.
28928 @item @samp{fmins}, @samp{fmaxs}
28929 Floating-point minimum and maximum.  These instructions are only
28930 generated if @option{-ffinite-math-only} is specified.
28932 @item @samp{fsqrts}
28933 Unary square root operation.
28935 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28936 Floating-point trigonometric and exponential functions.  These instructions
28937 are only generated if @option{-funsafe-math-optimizations} is also specified.
28939 @end table
28941 Double-precision floating point:
28942 @table @asis
28944 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28945 Binary arithmetic operations.
28947 @item @samp{fnegd}
28948 Unary negation.
28950 @item @samp{fabsd}
28951 Unary absolute value.
28953 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28954 Comparison operations.
28956 @item @samp{fmind}, @samp{fmaxd}
28957 Double-precision minimum and maximum.  These instructions are only
28958 generated if @option{-ffinite-math-only} is specified.
28960 @item @samp{fsqrtd}
28961 Unary square root operation.
28963 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28964 Double-precision trigonometric and exponential functions.  These instructions
28965 are only generated if @option{-funsafe-math-optimizations} is also specified.
28967 @end table
28969 Conversions:
28970 @table @asis
28971 @item @samp{fextsd}
28972 Conversion from single precision to double precision.
28974 @item @samp{ftruncds}
28975 Conversion from double precision to single precision.
28977 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28978 Conversion from floating point to signed or unsigned integer types, with
28979 truncation towards zero.
28981 @item @samp{round}
28982 Conversion from single-precision floating point to signed integer,
28983 rounding to the nearest integer and ties away from zero.
28984 This corresponds to the @code{__builtin_lroundf} function when
28985 @option{-fno-math-errno} is used.
28987 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28988 Conversion from signed or unsigned integer types to floating-point types.
28990 @end table
28992 In addition, all of the following transfer instructions for internal
28993 registers X and Y must be provided to use any of the double-precision
28994 floating-point instructions.  Custom instructions taking two
28995 double-precision source operands expect the first operand in the
28996 64-bit register X.  The other operand (or only operand of a unary
28997 operation) is given to the custom arithmetic instruction with the
28998 least significant half in source register @var{src1} and the most
28999 significant half in @var{src2}.  A custom instruction that returns a
29000 double-precision result returns the most significant 32 bits in the
29001 destination register and the other half in 32-bit register Y.  
29002 GCC automatically generates the necessary code sequences to write
29003 register X and/or read register Y when double-precision floating-point
29004 instructions are used.
29006 @table @asis
29008 @item @samp{fwrx}
29009 Write @var{src1} into the least significant half of X and @var{src2} into
29010 the most significant half of X.
29012 @item @samp{fwry}
29013 Write @var{src1} into Y.
29015 @item @samp{frdxhi}, @samp{frdxlo}
29016 Read the most or least (respectively) significant half of X and store it in
29017 @var{dest}.
29019 @item @samp{frdy}
29020 Read the value of Y and store it into @var{dest}.
29021 @end table
29023 Note that you can gain more local control over generation of Nios II custom
29024 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
29025 and @code{target("no-custom-@var{insn}")} function attributes
29026 (@pxref{Function Attributes})
29027 or pragmas (@pxref{Function Specific Option Pragmas}).
29029 @opindex mcustom-fpu-cfg
29030 @item -mcustom-fpu-cfg=@var{name}
29032 This option enables a predefined, named set of custom instruction encodings
29033 (see @option{-mcustom-@var{insn}} above).  
29034 Currently, the following sets are defined:
29036 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
29037 @gccoptlist{-mcustom-fmuls=252
29038 -mcustom-fadds=253
29039 -mcustom-fsubs=254
29040 -fsingle-precision-constant}
29042 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
29043 @gccoptlist{-mcustom-fmuls=252
29044 -mcustom-fadds=253
29045 -mcustom-fsubs=254
29046 -mcustom-fdivs=255
29047 -fsingle-precision-constant}
29049 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
29050 @gccoptlist{-mcustom-floatus=243
29051 -mcustom-fixsi=244
29052 -mcustom-floatis=245
29053 -mcustom-fcmpgts=246
29054 -mcustom-fcmples=249
29055 -mcustom-fcmpeqs=250
29056 -mcustom-fcmpnes=251
29057 -mcustom-fmuls=252
29058 -mcustom-fadds=253
29059 -mcustom-fsubs=254
29060 -mcustom-fdivs=255
29061 -fsingle-precision-constant}
29063 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
29064 @gccoptlist{-mcustom-fabss=224
29065 -mcustom-fnegs=225
29066 -mcustom-fcmpnes=226
29067 -mcustom-fcmpeqs=227
29068 -mcustom-fcmpges=228
29069 -mcustom-fcmpgts=229
29070 -mcustom-fcmples=230
29071 -mcustom-fcmplts=231
29072 -mcustom-fmaxs=232
29073 -mcustom-fmins=233
29074 -mcustom-round=248
29075 -mcustom-fixsi=249
29076 -mcustom-floatis=250
29077 -mcustom-fsqrts=251
29078 -mcustom-fmuls=252
29079 -mcustom-fadds=253
29080 -mcustom-fsubs=254
29081 -mcustom-fdivs=255}
29083 Custom instruction assignments given by individual
29084 @option{-mcustom-@var{insn}=} options override those given by
29085 @option{-mcustom-fpu-cfg=}, regardless of the
29086 order of the options on the command line.
29088 Note that you can gain more local control over selection of a FPU
29089 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
29090 function attribute (@pxref{Function Attributes})
29091 or pragma (@pxref{Function Specific Option Pragmas}).
29093 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
29094 Hardware 2 Component}.  Please note that the custom instructions enabled by
29095 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
29096 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
29097 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
29098 specified.  In contrast to the other configurations,
29099 @option{-fsingle-precision-constant} is not set.
29101 @end table
29103 These additional @samp{-m} options are available for the Altera Nios II
29104 ELF (bare-metal) target:
29106 @table @gcctabopt
29108 @opindex mhal
29109 @item -mhal
29110 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
29111 startup and termination code, and is typically used in conjunction with
29112 @option{-msys-crt0=} to specify the location of the alternate startup code
29113 provided by the HAL BSP.
29115 @opindex msmallc
29116 @item -msmallc
29117 Link with a limited version of the C library, @option{-lsmallc}, rather than
29118 Newlib.
29120 @opindex msys-crt0
29121 @item -msys-crt0=@var{startfile}
29122 @var{startfile} is the file name of the startfile (crt0) to use 
29123 when linking.  This option is only useful in conjunction with @option{-mhal}.
29125 @opindex msys-lib
29126 @item -msys-lib=@var{systemlib}
29127 @var{systemlib} is the library name of the library that provides
29128 low-level system calls required by the C library,
29129 e.g.@: @code{read} and @code{write}.
29130 This option is typically used to link with a library provided by a HAL BSP.
29132 @end table
29134 @node Nvidia PTX Options
29135 @subsection Nvidia PTX Options
29136 @cindex Nvidia PTX options
29137 @cindex nvptx options
29139 These options are defined for Nvidia PTX:
29141 @table @gcctabopt
29143 @opindex m64
29144 @item -m64
29145 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
29146 supported.
29148 @opindex march
29149 @item -march=@var{architecture-string}
29150 Generate code for the specified PTX ISA target architecture
29151 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
29152 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
29153 @samp{sm_80}.
29154 The default depends on how the compiler has been configured, see
29155 @option{--with-arch}.
29157 This option sets the value of the preprocessor macro
29158 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
29159 @samp{350}.
29161 @opindex misa
29162 @item -misa=@var{architecture-string}
29163 Alias of @option{-march=}.
29165 @opindex march
29166 @item -march-map=@var{architecture-string}
29167 Select the closest available @option{-march=} value that is not more
29168 capable.  For instance, for @option{-march-map=sm_50} select
29169 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
29170 @option{-march=sm_53}.
29172 @opindex mptx
29173 @item -mptx=@var{version-string}
29174 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
29175 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
29176 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
29177 version is required for specified PTX ISA target architecture via
29178 option @option{-march=}.
29180 This option sets the values of the preprocessor macros
29181 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
29182 for instance, for @samp{3.1} the macros have the values @samp{3} and
29183 @samp{1}, respectively.
29185 @opindex mmainkernel
29186 @item -mmainkernel
29187 Link in code for a __main kernel.  This is for stand-alone instead of
29188 offloading execution.
29190 @opindex moptimize
29191 @item -moptimize
29192 Apply partitioned execution optimizations.  This is the default when any
29193 level of optimization is selected.
29195 @opindex msoft-stack
29196 @item -msoft-stack
29197 Generate code that does not use @code{.local} memory
29198 directly for stack storage. Instead, a per-warp stack pointer is
29199 maintained explicitly. This enables variable-length stack allocation (with
29200 variable-length arrays or @code{alloca}), and when global memory is used for
29201 underlying storage, makes it possible to access automatic variables from other
29202 threads, or with atomic instructions. This code generation variant is used
29203 for OpenMP offloading, but the option is exposed on its own for the purpose
29204 of testing the compiler; to generate code suitable for linking into programs
29205 using OpenMP offloading, use option @option{-mgomp}.
29207 @opindex muniform-simt
29208 @item -muniform-simt
29209 Switch to code generation variant that allows to execute all threads in each
29210 warp, while maintaining memory state and side effects as if only one thread
29211 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
29212 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
29213 current lane index equals the master lane index), and the register being
29214 assigned is copied via a shuffle instruction from the master lane.  Outside of
29215 SIMD regions lane 0 is the master; inside, each thread sees itself as the
29216 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
29217 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
29218 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
29219 with current lane index to compute the master lane index.
29221 @opindex mgomp
29222 @item -mgomp
29223 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
29224 @option{-muniform-simt} options, and selects corresponding multilib variant.
29226 @end table
29228 @node OpenRISC Options
29229 @subsection OpenRISC Options
29230 @cindex OpenRISC Options
29232 These options are defined for OpenRISC:
29234 @table @gcctabopt
29236 @opindex mboard
29237 @item -mboard=@var{name}
29238 Configure a board specific runtime.  This will be passed to the linker for
29239 newlib board library linking.  The default is @code{or1ksim}.
29241 @opindex mnewlib
29242 @item -mnewlib
29243 This option is ignored; it is for compatibility purposes only.  This used to
29244 select linker and preprocessor options for use with newlib.
29246 @opindex msoft-div
29247 @opindex mhard-div
29248 @item -msoft-div
29249 @itemx -mhard-div
29250 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
29251 This default is hardware divide.
29253 @opindex msoft-mul
29254 @opindex mhard-mul
29255 @item -msoft-mul
29256 @itemx -mhard-mul
29257 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
29258 This default is hardware multiply.
29260 @opindex msoft-float
29261 @opindex mhard-float
29262 @item -msoft-float
29263 @itemx -mhard-float
29264 Select software or hardware for floating point operations.
29265 The default is software.
29267 @opindex mdouble-float
29268 @item -mdouble-float
29269 When @option{-mhard-float} is selected, enables generation of double-precision
29270 floating point instructions.  By default functions from @file{libgcc} are used
29271 to perform double-precision floating point operations.
29273 @opindex munordered-float
29274 @item -munordered-float
29275 When @option{-mhard-float} is selected, enables generation of unordered
29276 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
29277 functions from @file{libgcc} are used to perform unordered floating point
29278 compare and set flag operations.
29280 @opindex mcmov
29281 @item -mcmov
29282 Enable generation of conditional move (@code{l.cmov}) instructions.  By
29283 default the equivalent will be generated using set and branch.
29285 @opindex mror
29286 @item -mror
29287 Enable generation of rotate right (@code{l.ror}) instructions.  By default
29288 functions from @file{libgcc} are used to perform rotate right operations.
29290 @opindex mrori
29291 @item -mrori
29292 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
29293 By default functions from @file{libgcc} are used to perform rotate right with
29294 immediate operations.
29296 @opindex msext
29297 @item -msext
29298 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
29299 memory loads are used to perform sign extension.
29301 @opindex msfimm
29302 @item -msfimm
29303 Enable generation of compare and set flag with immediate (@code{l.sf*i})
29304 instructions.  By default extra instructions will be generated to store the
29305 immediate to a register first.
29307 @opindex mshftimm
29308 @item -mshftimm
29309 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
29310 @code{l.slli}) instructions.  By default extra instructions will be generated
29311 to store the immediate to a register first.
29313 @opindex mcmodel=small
29314 @item -mcmodel=small
29315 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
29316 the default model.
29318 @opindex mcmodel=large
29319 @item -mcmodel=large
29320 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
29323 @end table
29325 @node PDP-11 Options
29326 @subsection PDP-11 Options
29327 @cindex PDP-11 Options
29329 These options are defined for the PDP-11:
29331 @table @gcctabopt
29332 @opindex mfpu
29333 @item -mfpu
29334 Use hardware FPP floating point.  This is the default.  (FIS floating
29335 point on the PDP-11/40 is not supported.)  Implies -m45.
29337 @opindex msoft-float
29338 @item -msoft-float
29339 Do not use hardware floating point.
29341 @opindex mac0
29342 @item -mac0
29343 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
29345 @opindex mno-ac0
29346 @item -mno-ac0
29347 Return floating-point results in memory.  This is the default.
29349 @opindex m40
29350 @item -m40
29351 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
29353 @opindex m45
29354 @item -m45
29355 Generate code for a PDP-11/45.  This is the default.
29357 @opindex m10
29358 @item -m10
29359 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
29361 @opindex mint16
29362 @opindex mno-int32
29363 @item -mint16
29364 @itemx -mno-int32
29365 Use 16-bit @code{int}.  This is the default.
29367 @opindex mint32
29368 @opindex mno-int16
29369 @item -mint32
29370 @itemx -mno-int16
29371 Use 32-bit @code{int}.
29373 @opindex msplit
29374 @item -msplit
29375 Target has split instruction and data space.  Implies -m45.
29377 @opindex munix-asm
29378 @item -munix-asm
29379 Use Unix assembler syntax.
29381 @opindex mdec-asm
29382 @item -mdec-asm
29383 Use DEC assembler syntax.
29385 @opindex mgnu-asm
29386 @item -mgnu-asm
29387 Use GNU assembler syntax.  This is the default.
29389 @opindex mlra
29390 @item -mlra
29391 Use the new LRA register allocator.  By default, the old ``reload''
29392 allocator is used.
29393 @end table
29395 @node PowerPC Options
29396 @subsection PowerPC Options
29397 @cindex PowerPC options
29399 These are listed under @xref{RS/6000 and PowerPC Options}.
29401 @node PRU Options
29402 @subsection PRU Options
29403 @cindex PRU Options
29405 These command-line options are defined for PRU target:
29407 @table @gcctabopt
29408 @opindex minrt
29409 @item -minrt
29410 Link with a minimum runtime environment, with no support for static
29411 initializers and constructors.  Using this option can significantly reduce
29412 the size of the final ELF binary.  Beware that the compiler could still
29413 generate code with static initializers and constructors.  It is up to the
29414 programmer to ensure that the source program will not use those features.
29416 @opindex mmcu
29417 @item -mmcu=@var{mcu}
29418 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
29419 supported MCUs.
29421 @opindex mno-relax
29422 @item -mno-relax
29423 Make GCC pass the @option{--no-relax} command-line option to the linker
29424 instead of the @option{--relax} option.
29426 @opindex mloop
29427 @item -mloop
29428 Allow (or do not allow) GCC to use the LOOP instruction.
29430 @opindex mabi
29431 @item -mabi=@var{variant}
29432 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
29433 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
29434 more naturally with certain GCC assumptions.  These are the differences:
29436 @table @samp
29437 @item Function Pointer Size
29438 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
29439 supports only 32-bit data and code pointers.
29441 @item Optional Return Value Pointer
29442 Function return values larger than 64 bits are passed by using a hidden
29443 pointer as the first argument of the function.  TI ABI, though, mandates that
29444 the pointer can be NULL in case the caller is not using the returned value.
29445 GNU always passes and expects a valid return value pointer.
29447 @end table
29449 The current @option{-mabi=ti} implementation simply raises a compile error
29450 when any of the above code constructs is detected.  As a consequence
29451 the standard C library cannot be built and it is omitted when linking with
29452 @option{-mabi=ti}.
29454 Relaxation is a GNU feature and for safety reasons is disabled when using
29455 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
29456 instructions, so the GNU linker cannot adjust them when shortening adjacent
29457 LDI32 pseudo instructions.
29459 @end table
29461 @node RISC-V Options
29462 @subsection RISC-V Options
29463 @cindex RISC-V Options
29465 These command-line options are defined for RISC-V targets:
29467 @table @gcctabopt
29468 @opindex mbranch-cost
29469 @item -mbranch-cost=@var{n}
29470 Set the cost of branches to roughly @var{n} instructions.
29472 @opindex plt
29473 @item -mplt
29474 @itemx -mno-plt
29475 When generating PIC code, do or don't allow the use of PLTs. Ignored for
29476 non-PIC.  The default is @option{-mplt}.
29478 @opindex mabi
29479 @item -mabi=@var{ABI-string}
29480 Specify integer and floating-point calling convention.  @var{ABI-string}
29481 contains two parts: the size of integer types and the registers used for
29482 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
29483 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
29484 32-bit), and that floating-point values up to 64 bits wide are passed in F
29485 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
29486 allows the compiler to generate code that uses the F and D extensions but only
29487 allows floating-point values up to 32 bits long to be passed in registers; or
29488 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
29489 passed in registers.
29491 The default for this argument is system dependent, users who want a specific
29492 calling convention should specify one explicitly.  The valid calling
29493 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
29494 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
29495 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
29496 invalid because the ABI requires 64-bit values be passed in F registers, but F
29497 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
29498 only be used with the @samp{rv32e} architecture.  This ABI is not well
29499 specified at present, and is subject to change.
29501 @opindex mfdiv
29502 @item -mfdiv
29503 @itemx -mno-fdiv
29504 Do or don't use hardware floating-point divide and square root instructions.
29505 This requires the F or D extensions for floating-point registers.  The default
29506 is to use them if the specified architecture has these instructions.
29508 @opindex mdiv
29509 @item -mdiv
29510 @itemx -mno-div
29511 Do or don't use hardware instructions for integer division.  This requires the
29512 M extension.  The default is to use them if the specified architecture has
29513 these instructions.
29515 @opindex misa-spec
29516 @item -misa-spec=@var{ISA-spec-string}
29517 Specify the version of the RISC-V Unprivileged (formerly User-Level)
29518 ISA specification to produce code conforming to.  The possibilities
29519 for @var{ISA-spec-string} are:
29520 @table @code
29521 @item 2.2
29522 Produce code conforming to version 2.2.
29523 @item 20190608
29524 Produce code conforming to version 20190608.
29525 @item 20191213
29526 Produce code conforming to version 20191213.
29527 @end table
29528 The default is @option{-misa-spec=20191213} unless GCC has been configured
29529 with @option{--with-isa-spec=} specifying a different default version.
29531 @opindex march
29532 @item -march=@var{ISA-string}
29533 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
29534 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
29535 @samp{rv32imaf}.
29537 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
29539 If both @option{-march} and @option{-mcpu=} are not specified, the default for
29540 this argument is system dependent, users who want a specific architecture
29541 extensions should specify one explicitly.
29543 @opindex mcpu
29544 @item -mcpu=@var{processor-string}
29545 Use architecture of and optimize the output for the given processor, specified
29546 by particular CPU name.
29547 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
29548 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
29549 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
29550 @samp{sifive-u54}, and @samp{sifive-u74}.
29552 @opindex mtune
29553 @item -mtune=@var{processor-string}
29554 Optimize the output for the given processor, specified by microarchitecture or
29555 particular CPU name.  Permissible values for this option are: @samp{rocket},
29556 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
29557 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
29559 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
29560 the default is @samp{rocket} if both are not specified.
29562 The @samp{size} choice is not intended for use by end-users.  This is used
29563 when @option{-Os} is specified.  It overrides the instruction cost info
29564 provided by @option{-mtune=}, but does not override the pipeline info.  This
29565 helps reduce code size while still giving good performance.
29567 @opindex mpreferred-stack-boundary
29568 @item -mpreferred-stack-boundary=@var{num}
29569 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29570 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29571 the default is 4 (16 bytes or 128-bits).
29573 @strong{Warning:} If you use this switch, then you must build all modules with
29574 the same value, including any libraries.  This includes the system libraries
29575 and startup modules.
29577 @opindex msmall-data-limit
29578 @item -msmall-data-limit=@var{n}
29579 Put global and static data smaller than @var{n} bytes into a special section
29580 (on some targets).
29582 @opindex msave-restore
29583 @item -msave-restore
29584 @itemx -mno-save-restore
29585 Do or don't use smaller but slower prologue and epilogue code that uses
29586 library function calls.  The default is to use fast inline prologues and
29587 epilogues.
29589 @opindex minline-atomics
29590 @item -minline-atomics
29591 @itemx -mno-inline-atomics
29592 Do or don't use smaller but slower subword atomic emulation code that uses
29593 libatomic function calls.  The default is to use fast inline subword atomics
29594 that do not require libatomic.
29596 @opindex minline-strlen
29597 @item -minline-strlen
29598 @itemx -mno-inline-strlen
29599 Do or do not attempt to inline strlen calls if possible.
29600 Inlining will only be done if the string is properly aligned
29601 and instructions for accelerated processing are available.
29602 The default is to not inline strlen calls.
29604 @opindex minline-strcmp
29605 @item -minline-strcmp
29606 @itemx -mno-inline-strcmp
29607 Do or do not attempt to inline strcmp calls if possible.
29608 Inlining will only be done if the strings are properly aligned
29609 and instructions for accelerated processing are available.
29610 The default is to not inline strcmp calls.
29612 @opindex minline-strncmp
29613 @item -minline-strncmp
29614 @itemx -mno-inline-strncmp
29615 Do or do not attempt to inline strncmp calls if possible.
29616 Inlining will only be done if the strings are properly aligned
29617 and instructions for accelerated processing are available.
29618 The default is to not inline strncmp calls.
29620 @opindex mshorten-memrefs
29621 @item -mshorten-memrefs
29622 @itemx -mno-shorten-memrefs
29623 Do or do not attempt to make more use of compressed load/store instructions by
29624 replacing a load/store of 'base register + large offset' with a new load/store
29625 of 'new base + small offset'.  If the new base gets stored in a compressed
29626 register, then the new load/store can be compressed.  Currently targets 32-bit
29627 integer load/stores only.
29629 @opindex mstrict-align
29630 @item -mstrict-align
29631 @itemx -mno-strict-align
29632 Do not or do generate unaligned memory accesses.  The default is set depending
29633 on whether the processor we are optimizing for supports fast unaligned access
29634 or not.
29636 @opindex mcmodel=medlow
29637 @item -mcmodel=medlow
29638 Generate code for the medium-low code model. The program and its statically
29639 defined symbols must lie within a single 2 GiB address range and must lie
29640 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
29641 statically or dynamically linked. This is the default code model.
29643 @opindex mcmodel=medany
29644 @item -mcmodel=medany
29645 Generate code for the medium-any code model. The program and its statically
29646 defined symbols must be within any single 2 GiB address range. Programs can be
29647 statically or dynamically linked.
29649 The code generated by the medium-any code model is position-independent, but is
29650 not guaranteed to function correctly when linked into position-independent
29651 executables or libraries.
29653 @item -mexplicit-relocs
29654 @itemx -mno-exlicit-relocs
29655 Use or do not use assembler relocation operators when dealing with symbolic
29656 addresses.  The alternative is to use assembler macros instead, which may
29657 limit optimization.
29659 @opindex mrelax
29660 @item -mrelax
29661 @itemx -mno-relax
29662 Take advantage of linker relaxations to reduce the number of instructions
29663 required to materialize symbol addresses. The default is to take advantage of
29664 linker relaxations.
29666 @opindex mriscv-attribute
29667 @item -mriscv-attribute
29668 @itemx -mno-riscv-attribute
29669 Emit (do not emit) RISC-V attribute to record extra information into ELF
29670 objects.  This feature requires at least binutils 2.32.
29672 @opindex mcsr-check
29673 @item -mcsr-check
29674 @itemx -mno-csr-check
29675 Enables or disables the CSR checking.
29677 @opindex malign-data
29678 @item -malign-data=@var{type}
29679 Control how GCC aligns variables and constants of array, structure, or union
29680 types.  Supported values for @var{type} are @samp{xlen} which uses x register
29681 width as the alignment value, and @samp{natural} which uses natural alignment.
29682 @samp{xlen} is the default.
29684 @opindex mbig-endian
29685 @item -mbig-endian
29686 Generate big-endian code.  This is the default when GCC is configured for a
29687 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
29689 @opindex mlittle-endian
29690 @item -mlittle-endian
29691 Generate little-endian code.  This is the default when GCC is configured for a
29692 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
29693 @samp{riscv32be-*-*} target.
29695 @opindex mstack-protector-guard
29696 @opindex mstack-protector-guard-reg
29697 @opindex mstack-protector-guard-offset
29698 @item -mstack-protector-guard=@var{guard}
29699 @itemx -mstack-protector-guard-reg=@var{reg}
29700 @itemx -mstack-protector-guard-offset=@var{offset}
29701 Generate stack protection code using canary at @var{guard}.  Supported
29702 locations are @samp{global} for a global canary or @samp{tls} for per-thread
29703 canary in the TLS block.
29705 With the latter choice the options
29706 @option{-mstack-protector-guard-reg=@var{reg}} and
29707 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29708 which register to use as base register for reading the canary,
29709 and from what offset from that base register. There is no default
29710 register or offset as this is entirely for use within the Linux
29711 kernel.
29712 @end table
29714 @node RL78 Options
29715 @subsection RL78 Options
29716 @cindex RL78 Options
29718 @table @gcctabopt
29720 @opindex msim
29721 @item -msim
29722 Links in additional target libraries to support operation within a
29723 simulator.
29725 @opindex mmul
29726 @item -mmul=none
29727 @itemx -mmul=g10
29728 @itemx -mmul=g13
29729 @itemx -mmul=g14
29730 @itemx -mmul=rl78
29731 Specifies the type of hardware multiplication and division support to
29732 be used.  The simplest is @code{none}, which uses software for both
29733 multiplication and division.  This is the default.  The @code{g13}
29734 value is for the hardware multiply/divide peripheral found on the
29735 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
29736 the multiplication and division instructions supported by the RL78/G14
29737 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
29738 the value @code{mg10} is an alias for @code{none}.
29740 In addition a C preprocessor macro is defined, based upon the setting
29741 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
29742 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
29744 @opindex mcpu
29745 @item -mcpu=g10
29746 @itemx -mcpu=g13
29747 @itemx -mcpu=g14
29748 @itemx -mcpu=rl78
29749 Specifies the RL78 core to target.  The default is the G14 core, also
29750 known as an S3 core or just RL78.  The G13 or S2 core does not have
29751 multiply or divide instructions, instead it uses a hardware peripheral
29752 for these operations.  The G10 or S1 core does not have register
29753 banks, so it uses a different calling convention.
29755 If this option is set it also selects the type of hardware multiply
29756 support to use, unless this is overridden by an explicit
29757 @option{-mmul=none} option on the command line.  Thus specifying
29758 @option{-mcpu=g13} enables the use of the G13 hardware multiply
29759 peripheral and specifying @option{-mcpu=g10} disables the use of
29760 hardware multiplications altogether.
29762 Note, although the RL78/G14 core is the default target, specifying
29763 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
29764 change the behavior of the toolchain since it also enables G14
29765 hardware multiply support.  If these options are not specified on the
29766 command line then software multiplication routines will be used even
29767 though the code targets the RL78 core.  This is for backwards
29768 compatibility with older toolchains which did not have hardware
29769 multiply and divide support.
29771 In addition a C preprocessor macro is defined, based upon the setting
29772 of this option.  Possible values are: @code{__RL78_G10__},
29773 @code{__RL78_G13__} or @code{__RL78_G14__}.
29775 @opindex mg10
29776 @opindex mg13
29777 @opindex mg14
29778 @opindex mrl78
29779 @item -mg10
29780 @itemx -mg13
29781 @itemx -mg14
29782 @itemx -mrl78
29783 These are aliases for the corresponding @option{-mcpu=} option.  They
29784 are provided for backwards compatibility.
29786 @opindex mallregs
29787 @item -mallregs
29788 Allow the compiler to use all of the available registers.  By default
29789 registers @code{r24..r31} are reserved for use in interrupt handlers.
29790 With this option enabled these registers can be used in ordinary
29791 functions as well.
29793 @opindex m64bit-doubles
29794 @opindex m32bit-doubles
29795 @item -m64bit-doubles
29796 @itemx -m32bit-doubles
29797 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29798 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
29799 @option{-m32bit-doubles}.
29801 @opindex msave-mduc-in-interrupts
29802 @opindex mno-save-mduc-in-interrupts
29803 @item -msave-mduc-in-interrupts
29804 @itemx -mno-save-mduc-in-interrupts
29805 Specifies that interrupt handler functions should preserve the
29806 MDUC registers.  This is only necessary if normal code might use
29807 the MDUC registers, for example because it performs multiplication
29808 and division operations.  The default is to ignore the MDUC registers
29809 as this makes the interrupt handlers faster.  The target option -mg13
29810 needs to be passed for this to work as this feature is only available
29811 on the G13 target (S2 core).  The MDUC registers will only be saved
29812 if the interrupt handler performs a multiplication or division
29813 operation or it calls another function.
29815 @end table
29817 @node RS/6000 and PowerPC Options
29818 @subsection IBM RS/6000 and PowerPC Options
29819 @cindex RS/6000 and PowerPC Options
29820 @cindex IBM RS/6000 and PowerPC Options
29822 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29823 @table @gcctabopt
29824 @item -mpowerpc-gpopt
29825 @itemx -mno-powerpc-gpopt
29826 @itemx -mpowerpc-gfxopt
29827 @itemx -mno-powerpc-gfxopt
29828 @need 800
29829 @itemx -mpowerpc64
29830 @itemx -mno-powerpc64
29831 @itemx -mmfcrf
29832 @itemx -mno-mfcrf
29833 @itemx -mpopcntb
29834 @itemx -mno-popcntb
29835 @itemx -mpopcntd
29836 @itemx -mno-popcntd
29837 @itemx -mfprnd
29838 @itemx -mno-fprnd
29839 @need 800
29840 @opindex mpowerpc-gpopt
29841 @opindex mno-powerpc-gpopt
29842 @opindex mpowerpc-gfxopt
29843 @opindex mno-powerpc-gfxopt
29844 @opindex mpowerpc64
29845 @opindex mno-powerpc64
29846 @opindex mmfcrf
29847 @opindex mno-mfcrf
29848 @opindex mpopcntb
29849 @opindex mno-popcntb
29850 @opindex mpopcntd
29851 @opindex mno-popcntd
29852 @opindex mfprnd
29853 @opindex mno-fprnd
29854 @opindex mcmpb
29855 @opindex mno-cmpb
29856 @opindex mhard-dfp
29857 @opindex mno-hard-dfp
29858 @itemx -mcmpb
29859 @itemx -mno-cmpb
29860 @itemx -mhard-dfp
29861 @itemx -mno-hard-dfp
29862 You use these options to specify which instructions are available on the
29863 processor you are using.  The default value of these options is
29864 determined when configuring GCC@.  Specifying the
29865 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29866 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
29867 rather than the options listed above.
29869 Specifying @option{-mpowerpc-gpopt} allows
29870 GCC to use the optional PowerPC architecture instructions in the
29871 General Purpose group, including floating-point square root.  Specifying
29872 @option{-mpowerpc-gfxopt} allows GCC to
29873 use the optional PowerPC architecture instructions in the Graphics
29874 group, including floating-point select.
29876 The @option{-mmfcrf} option allows GCC to generate the move from
29877 condition register field instruction implemented on the POWER4
29878 processor and other processors that support the PowerPC V2.01
29879 architecture.
29880 The @option{-mpopcntb} option allows GCC to generate the popcount and
29881 double-precision FP reciprocal estimate instruction implemented on the
29882 POWER5 processor and other processors that support the PowerPC V2.02
29883 architecture.
29884 The @option{-mpopcntd} option allows GCC to generate the popcount
29885 instruction implemented on the POWER7 processor and other processors
29886 that support the PowerPC V2.06 architecture.
29887 The @option{-mfprnd} option allows GCC to generate the FP round to
29888 integer instructions implemented on the POWER5+ processor and other
29889 processors that support the PowerPC V2.03 architecture.
29890 The @option{-mcmpb} option allows GCC to generate the compare bytes
29891 instruction implemented on the POWER6 processor and other processors
29892 that support the PowerPC V2.05 architecture.
29893 The @option{-mhard-dfp} option allows GCC to generate the decimal
29894 floating-point instructions implemented on some POWER processors.
29896 The @option{-mpowerpc64} option allows GCC to generate the additional
29897 64-bit instructions that are found in the full PowerPC64 architecture
29898 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
29899 @option{-mno-powerpc64}.
29901 @opindex mcpu
29902 @item -mcpu=@var{cpu_type}
29903 Set architecture type, register usage, and
29904 instruction scheduling parameters for machine type @var{cpu_type}.
29905 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29906 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29907 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29908 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29909 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29910 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29911 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29912 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29913 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29914 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29915 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29916 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29918 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29919 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29920 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29921 architecture machine types, with an appropriate, generic processor
29922 model assumed for scheduling purposes.
29924 Specifying @samp{native} as cpu type detects and selects the
29925 architecture option that corresponds to the host processor of the
29926 system performing the compilation.
29927 @option{-mcpu=native} has no effect if GCC does not recognize the
29928 processor.
29930 The other options specify a specific processor.  Code generated under
29931 those options runs best on that processor, and may not run at all on
29932 others.
29934 The @option{-mcpu} options automatically enable or disable the
29935 following options:
29937 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
29938 -mpopcntb  -mpopcntd  -mpowerpc64
29939 -mpowerpc-gpopt  -mpowerpc-gfxopt
29940 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
29941 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector
29942 -mquad-memory  -mquad-memory-atomic  -mfloat128
29943 -mfloat128-hardware -mprefixed -mpcrel -mmma
29944 -mrop-protect}
29946 The particular options set for any particular CPU varies between
29947 compiler versions, depending on what setting seems to produce optimal
29948 code for that CPU; it doesn't necessarily reflect the actual hardware's
29949 capabilities.  If you wish to set an individual option to a particular
29950 value, you may specify it after the @option{-mcpu} option, like
29951 @option{-mcpu=970 -mno-altivec}.
29953 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29954 not enabled or disabled by the @option{-mcpu} option at present because
29955 AIX does not have full support for these options.  You may still
29956 enable or disable them individually if you're sure it'll work in your
29957 environment.
29959 @opindex mtune
29960 @item -mtune=@var{cpu_type}
29961 Set the instruction scheduling parameters for machine type
29962 @var{cpu_type}, but do not set the architecture type or register usage,
29963 as @option{-mcpu=@var{cpu_type}} does.  The same
29964 values for @var{cpu_type} are used for @option{-mtune} as for
29965 @option{-mcpu}.  If both are specified, the code generated uses the
29966 architecture and registers set by @option{-mcpu}, but the
29967 scheduling parameters set by @option{-mtune}.
29969 @opindex mcmodel=small
29970 @item -mcmodel=small
29971 Generate PowerPC64 code for the small model: The TOC is limited to
29972 64k.
29974 @opindex mcmodel=medium
29975 @item -mcmodel=medium
29976 Generate PowerPC64 code for the medium model: The TOC and other static
29977 data may be up to a total of 4G in size.  This is the default for 64-bit
29978 Linux.
29980 @opindex mcmodel=large
29981 @item -mcmodel=large
29982 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29983 in size.  Other data and code is only limited by the 64-bit address
29984 space.
29986 @opindex maltivec
29987 @opindex mno-altivec
29988 @item -maltivec
29989 @itemx -mno-altivec
29990 Generate code that uses (does not use) AltiVec instructions, and also
29991 enable the use of built-in functions that allow more direct access to
29992 the AltiVec instruction set.  You may also need to set
29993 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29994 enhancements.
29996 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29997 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
29998 match array element order corresponding to the endianness of the
29999 target.  That is, element zero identifies the leftmost element in a
30000 vector register when targeting a big-endian platform, and identifies
30001 the rightmost element in a vector register when targeting a
30002 little-endian platform.
30004 @opindex mvrsave
30005 @opindex mno-vrsave
30006 @item -mvrsave
30007 @itemx -mno-vrsave
30008 Generate VRSAVE instructions when generating AltiVec code.
30010 @opindex msecure-plt
30011 @item -msecure-plt
30012 Generate code that allows @command{ld} and @command{ld.so}
30013 to build executables and shared
30014 libraries with non-executable @code{.plt} and @code{.got} sections.
30015 This is a PowerPC
30016 32-bit SYSV ABI option.
30018 @opindex mbss-plt
30019 @item -mbss-plt
30020 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
30021 fills in, and
30022 requires @code{.plt} and @code{.got}
30023 sections that are both writable and executable.
30024 This is a PowerPC 32-bit SYSV ABI option.
30026 @opindex misel
30027 @opindex mno-isel
30028 @item -misel
30029 @itemx -mno-isel
30030 This switch enables or disables the generation of ISEL instructions.
30032 @opindex mvsx
30033 @opindex mno-vsx
30034 @item -mvsx
30035 @itemx -mno-vsx
30036 Generate code that uses (does not use) vector/scalar (VSX)
30037 instructions, and also enable the use of built-in functions that allow
30038 more direct access to the VSX instruction set.
30040 @opindex mcrypto
30041 @opindex mno-crypto
30042 @item -mcrypto
30043 @itemx -mno-crypto
30044 Enable the use (disable) of the built-in functions that allow direct
30045 access to the cryptographic instructions that were added in version
30046 2.07 of the PowerPC ISA.
30048 @opindex mhtm
30049 @opindex mno-htm
30050 @item -mhtm
30051 @itemx -mno-htm
30052 Enable (disable) the use of the built-in functions that allow direct
30053 access to the Hardware Transactional Memory (HTM) instructions that
30054 were added in version 2.07 of the PowerPC ISA.
30056 @opindex mpower8-fusion
30057 @opindex mno-power8-fusion
30058 @item -mpower8-fusion
30059 @itemx -mno-power8-fusion
30060 Generate code that keeps (does not keeps) some integer operations
30061 adjacent so that the instructions can be fused together on power8 and
30062 later processors.
30064 @opindex mpower8-vector
30065 @opindex mno-power8-vector
30066 @item -mpower8-vector
30067 @itemx -mno-power8-vector
30068 Generate code that uses (does not use) the vector and scalar
30069 instructions that were added in version 2.07 of the PowerPC ISA.  Also
30070 enable the use of built-in functions that allow more direct access to
30071 the vector instructions.
30073 @opindex mquad-memory
30074 @opindex mno-quad-memory
30075 @item -mquad-memory
30076 @itemx -mno-quad-memory
30077 Generate code that uses (does not use) the non-atomic quad word memory
30078 instructions.  The @option{-mquad-memory} option requires use of
30079 64-bit mode.
30081 @opindex mquad-memory-atomic
30082 @opindex mno-quad-memory-atomic
30083 @item -mquad-memory-atomic
30084 @itemx -mno-quad-memory-atomic
30085 Generate code that uses (does not use) the atomic quad word memory
30086 instructions.  The @option{-mquad-memory-atomic} option requires use of
30087 64-bit mode.
30089 @opindex mfloat128
30090 @opindex mno-float128
30091 @item -mfloat128
30092 @itemx -mno-float128
30093 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
30094 and use either software emulation for IEEE 128-bit floating point or
30095 hardware instructions.
30097 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
30098 128-bit floating point support.  The IEEE 128-bit floating point is only
30099 supported on Linux.
30101 The default for @option{-mfloat128} is enabled on PowerPC Linux
30102 systems using the VSX instruction set, and disabled on other systems.
30104 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
30105 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
30106 point support will also enable the generation of ISA 3.0 IEEE 128-bit
30107 floating point instructions.  Otherwise, if you do not specify to
30108 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
30109 system, IEEE 128-bit floating point will be done with software
30110 emulation.
30112 @opindex mfloat128-hardware
30113 @opindex mno-float128-hardware
30114 @item -mfloat128-hardware
30115 @itemx -mno-float128-hardware
30116 Enable/disable using ISA 3.0 hardware instructions to support the
30117 @var{__float128} data type.
30119 The default for @option{-mfloat128-hardware} is enabled on PowerPC
30120 Linux systems using the ISA 3.0 instruction set, and disabled on other
30121 systems.
30123 @opindex m32
30124 @opindex m64
30125 @item -m32
30126 @itemx -m64
30127 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
30128 targets (including GNU/Linux).  The 32-bit environment sets int, long
30129 and pointer to 32 bits and generates code that runs on any PowerPC
30130 variant.  The 64-bit environment sets int to 32 bits and long and
30131 pointer to 64 bits, and generates code for PowerPC64, as for
30132 @option{-mpowerpc64}.
30134 @opindex mfull-toc
30135 @opindex mno-fp-in-toc
30136 @opindex mno-sum-in-toc
30137 @opindex mminimal-toc
30138 @item -mfull-toc
30139 @itemx -mno-fp-in-toc
30140 @itemx -mno-sum-in-toc
30141 @itemx -mminimal-toc
30142 Modify generation of the TOC (Table Of Contents), which is created for
30143 every executable file.  The @option{-mfull-toc} option is selected by
30144 default.  In that case, GCC allocates at least one TOC entry for
30145 each unique non-automatic variable reference in your program.  GCC
30146 also places floating-point constants in the TOC@.  However, only
30147 16,384 entries are available in the TOC@.
30149 If you receive a linker error message that saying you have overflowed
30150 the available TOC space, you can reduce the amount of TOC space used
30151 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
30152 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
30153 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
30154 generate code to calculate the sum of an address and a constant at
30155 run time instead of putting that sum into the TOC@.  You may specify one
30156 or both of these options.  Each causes GCC to produce very slightly
30157 slower and larger code at the expense of conserving TOC space.
30159 If you still run out of space in the TOC even when you specify both of
30160 these options, specify @option{-mminimal-toc} instead.  This option causes
30161 GCC to make only one TOC entry for every file.  When you specify this
30162 option, GCC produces code that is slower and larger but which
30163 uses extremely little TOC space.  You may wish to use this option
30164 only on files that contain less frequently-executed code.
30166 @opindex maix64
30167 @opindex maix32
30168 @item -maix64
30169 @itemx -maix32
30170 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
30171 @code{long} type, and the infrastructure needed to support them.
30172 Specifying @option{-maix64} implies @option{-mpowerpc64},
30173 while @option{-maix32} disables the 64-bit ABI and
30174 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
30176 @opindex mxl-compat
30177 @opindex mno-xl-compat
30178 @item -mxl-compat
30179 @itemx -mno-xl-compat
30180 Produce code that conforms more closely to IBM XL compiler semantics
30181 when using AIX-compatible ABI@.  Pass floating-point arguments to
30182 prototyped functions beyond the register save area (RSA) on the stack
30183 in addition to argument FPRs.  Do not assume that most significant
30184 double in 128-bit long double value is properly rounded when comparing
30185 values and converting to double.  Use XL symbol names for long double
30186 support routines.
30188 The AIX calling convention was extended but not initially documented to
30189 handle an obscure K&R C case of calling a function that takes the
30190 address of its arguments with fewer arguments than declared.  IBM XL
30191 compilers access floating-point arguments that do not fit in the
30192 RSA from the stack when a subroutine is compiled without
30193 optimization.  Because always storing floating-point arguments on the
30194 stack is inefficient and rarely needed, this option is not enabled by
30195 default and only is necessary when calling subroutines compiled by IBM
30196 XL compilers without optimization.
30198 @opindex mpe
30199 @item -mpe
30200 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
30201 application written to use message passing with special startup code to
30202 enable the application to run.  The system must have PE installed in the
30203 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
30204 must be overridden with the @option{-specs=} option to specify the
30205 appropriate directory location.  The Parallel Environment does not
30206 support threads, so the @option{-mpe} option and the @option{-pthread}
30207 option are incompatible.
30209 @opindex malign-natural
30210 @opindex malign-power
30211 @item -malign-natural
30212 @itemx -malign-power
30213 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
30214 @option{-malign-natural} overrides the ABI-defined alignment of larger
30215 types, such as floating-point doubles, on their natural size-based boundary.
30216 The option @option{-malign-power} instructs GCC to follow the ABI-specified
30217 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
30219 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
30220 is not supported.
30222 @opindex msoft-float
30223 @opindex mhard-float
30224 @item -msoft-float
30225 @itemx -mhard-float
30226 Generate code that does not use (uses) the floating-point register set.
30227 Software floating-point emulation is provided if you use the
30228 @option{-msoft-float} option, and pass the option to GCC when linking.
30230 @opindex mmultiple
30231 @opindex mno-multiple
30232 @item -mmultiple
30233 @itemx -mno-multiple
30234 Generate code that uses (does not use) the load multiple word
30235 instructions and the store multiple word instructions.  These
30236 instructions are generated by default on POWER systems, and not
30237 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
30238 PowerPC systems, since those instructions do not work when the
30239 processor is in little-endian mode.  The exceptions are PPC740 and
30240 PPC750 which permit these instructions in little-endian mode.
30242 @opindex mupdate
30243 @opindex mno-update
30244 @item -mupdate
30245 @itemx -mno-update
30246 Generate code that uses (does not use) the load or store instructions
30247 that update the base register to the address of the calculated memory
30248 location.  These instructions are generated by default.  If you use
30249 @option{-mno-update}, there is a small window between the time that the
30250 stack pointer is updated and the address of the previous frame is
30251 stored, which means code that walks the stack frame across interrupts or
30252 signals may get corrupted data.
30254 @opindex mavoid-indexed-addresses
30255 @opindex mno-avoid-indexed-addresses
30256 @item -mavoid-indexed-addresses
30257 @itemx -mno-avoid-indexed-addresses
30258 Generate code that tries to avoid (not avoid) the use of indexed load
30259 or store instructions. These instructions can incur a performance
30260 penalty on Power6 processors in certain situations, such as when
30261 stepping through large arrays that cross a 16M boundary.  This option
30262 is enabled by default when targeting Power6 and disabled otherwise.
30264 @opindex mfused-madd
30265 @opindex mno-fused-madd
30266 @item -mfused-madd
30267 @itemx -mno-fused-madd
30268 Generate code that uses (does not use) the floating-point multiply and
30269 accumulate instructions.  These instructions are generated by default
30270 if hardware floating point is used.  The machine-dependent
30271 @option{-mfused-madd} option is now mapped to the machine-independent
30272 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
30273 mapped to @option{-ffp-contract=off}.
30275 @opindex mmulhw
30276 @opindex mno-mulhw
30277 @item -mmulhw
30278 @itemx -mno-mulhw
30279 Generate code that uses (does not use) the half-word multiply and
30280 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
30281 These instructions are generated by default when targeting those
30282 processors.
30284 @opindex mdlmzb
30285 @opindex mno-dlmzb
30286 @item -mdlmzb
30287 @itemx -mno-dlmzb
30288 Generate code that uses (does not use) the string-search @samp{dlmzb}
30289 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
30290 generated by default when targeting those processors.
30292 @opindex mno-bit-align
30293 @opindex mbit-align
30294 @item -mno-bit-align
30295 @itemx -mbit-align
30296 On System V.4 and embedded PowerPC systems do not (do) force structures
30297 and unions that contain bit-fields to be aligned to the base type of the
30298 bit-field.
30300 For example, by default a structure containing nothing but 8
30301 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
30302 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
30303 the structure is aligned to a 1-byte boundary and is 1 byte in
30304 size.
30306 @opindex mno-strict-align
30307 @opindex mstrict-align
30308 @item -mno-strict-align
30309 @itemx -mstrict-align
30310 On System V.4 and embedded PowerPC systems do not (do) assume that
30311 unaligned memory references are handled by the system.
30313 @opindex mrelocatable
30314 @opindex mno-relocatable
30315 @item -mrelocatable
30316 @itemx -mno-relocatable
30317 Generate code that allows (does not allow) a static executable to be
30318 relocated to a different address at run time.  A simple embedded
30319 PowerPC system loader should relocate the entire contents of
30320 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
30321 a table of 32-bit addresses generated by this option.  For this to
30322 work, all objects linked together must be compiled with
30323 @option{-mrelocatable} or @option{-mrelocatable-lib}.
30324 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
30326 @opindex mrelocatable-lib
30327 @opindex mno-relocatable-lib
30328 @item -mrelocatable-lib
30329 @itemx -mno-relocatable-lib
30330 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
30331 @code{.fixup} section to allow static executables to be relocated at
30332 run time, but @option{-mrelocatable-lib} does not use the smaller stack
30333 alignment of @option{-mrelocatable}.  Objects compiled with
30334 @option{-mrelocatable-lib} may be linked with objects compiled with
30335 any combination of the @option{-mrelocatable} options.
30337 @opindex mno-toc
30338 @opindex mtoc
30339 @item -mno-toc
30340 @itemx -mtoc
30341 On System V.4 and embedded PowerPC systems do not (do) assume that
30342 register 2 contains a pointer to a global area pointing to the addresses
30343 used in the program.
30345 @opindex mlittle
30346 @opindex mlittle-endian
30347 @item -mlittle
30348 @itemx -mlittle-endian
30349 On System V.4 and embedded PowerPC systems compile code for the
30350 processor in little-endian mode.  The @option{-mlittle-endian} option is
30351 the same as @option{-mlittle}.
30353 @opindex mbig
30354 @opindex mbig-endian
30355 @item -mbig
30356 @itemx -mbig-endian
30357 On System V.4 and embedded PowerPC systems compile code for the
30358 processor in big-endian mode.  The @option{-mbig-endian} option is
30359 the same as @option{-mbig}.
30361 @opindex mdynamic-no-pic
30362 @item -mdynamic-no-pic
30363 On Darwin / macOS systems, compile code so that it is not
30364 relocatable, but that its external references are relocatable.  The
30365 resulting code is suitable for applications, but not shared
30366 libraries.
30368 @opindex msingle-pic-base
30369 @item -msingle-pic-base
30370 Treat the register used for PIC addressing as read-only, rather than
30371 loading it in the prologue for each function.  The runtime system is
30372 responsible for initializing this register with an appropriate value
30373 before execution begins.
30375 @opindex mprioritize-restricted-insns
30376 @item -mprioritize-restricted-insns=@var{priority}
30377 This option controls the priority that is assigned to
30378 dispatch-slot restricted instructions during the second scheduling
30379 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
30380 or @samp{2} to assign no, highest, or second-highest (respectively) 
30381 priority to dispatch-slot restricted
30382 instructions.
30384 @opindex msched-costly-dep
30385 @item -msched-costly-dep=@var{dependence_type}
30386 This option controls which dependences are considered costly
30387 by the target during instruction scheduling.  The argument
30388 @var{dependence_type} takes one of the following values:
30390 @table @asis
30391 @item @samp{no}
30392 No dependence is costly.
30394 @item @samp{all}
30395 All dependences are costly.
30397 @item @samp{true_store_to_load}
30398 A true dependence from store to load is costly.
30400 @item @samp{store_to_load}
30401 Any dependence from store to load is costly.
30403 @item @var{number}
30404 Any dependence for which the latency is greater than or equal to 
30405 @var{number} is costly.
30406 @end table
30408 @opindex minsert-sched-nops
30409 @item -minsert-sched-nops=@var{scheme}
30410 This option controls which NOP insertion scheme is used during
30411 the second scheduling pass.  The argument @var{scheme} takes one of the
30412 following values:
30414 @table @asis
30415 @item @samp{no}
30416 Don't insert NOPs.
30418 @item @samp{pad}
30419 Pad with NOPs any dispatch group that has vacant issue slots,
30420 according to the scheduler's grouping.
30422 @item @samp{regroup_exact}
30423 Insert NOPs to force costly dependent insns into
30424 separate groups.  Insert exactly as many NOPs as needed to force an insn
30425 to a new group, according to the estimated processor grouping.
30427 @item @var{number}
30428 Insert NOPs to force costly dependent insns into
30429 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
30430 @end table
30432 @opindex mcall-sysv
30433 @item -mcall-sysv
30434 On System V.4 and embedded PowerPC systems compile code using calling
30435 conventions that adhere to the March 1995 draft of the System V
30436 Application Binary Interface, PowerPC processor supplement.  This is the
30437 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
30439 @opindex mcall-sysv-eabi
30440 @opindex mcall-eabi
30441 @item -mcall-sysv-eabi
30442 @itemx -mcall-eabi
30443 Specify both @option{-mcall-sysv} and @option{-meabi} options.
30445 @opindex mcall-sysv-noeabi
30446 @item -mcall-sysv-noeabi
30447 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
30449 @opindex mcall-aixdesc
30450 @item -mcall-aixdesc
30451 On System V.4 and embedded PowerPC systems compile code for the AIX
30452 operating system.
30454 @opindex mcall-linux
30455 @item -mcall-linux
30456 On System V.4 and embedded PowerPC systems compile code for the
30457 Linux-based GNU system.
30459 @opindex mcall-freebsd
30460 @item -mcall-freebsd
30461 On System V.4 and embedded PowerPC systems compile code for the
30462 FreeBSD operating system.
30464 @opindex mcall-netbsd
30465 @item -mcall-netbsd
30466 On System V.4 and embedded PowerPC systems compile code for the
30467 NetBSD operating system.
30469 @opindex mcall-openbsd
30470 @item -mcall-openbsd
30471 On System V.4 and embedded PowerPC systems compile code for the
30472 OpenBSD operating system.
30474 @opindex mtraceback
30475 @item -mtraceback=@var{traceback_type}
30476 Select the type of traceback table. Valid values for @var{traceback_type}
30477 are @samp{full}, @samp{part}, and @samp{no}.
30479 @opindex maix-struct-return
30480 @item -maix-struct-return
30481 Return all structures in memory (as specified by the AIX ABI)@.
30483 @opindex msvr4-struct-return
30484 @item -msvr4-struct-return
30485 Return structures smaller than 8 bytes in registers (as specified by the
30486 SVR4 ABI)@.
30488 @opindex mabi
30489 @item -mabi=@var{abi-type}
30490 Extend the current ABI with a particular extension, or remove such extension.
30491 Valid values are: @samp{altivec}, @samp{no-altivec},
30492 @samp{ibmlongdouble}, @samp{ieeelongdouble},
30493 @samp{elfv1}, @samp{elfv2},
30494 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
30496 @opindex mabi=ibmlongdouble
30497 @item -mabi=ibmlongdouble
30498 Change the current ABI to use IBM extended-precision long double.
30499 This is not likely to work if your system defaults to using IEEE
30500 extended-precision long double.  If you change the long double type
30501 from IEEE extended-precision, the compiler will issue a warning unless
30502 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30503 to be enabled.
30505 @opindex mabi=ieeelongdouble
30506 @item -mabi=ieeelongdouble
30507 Change the current ABI to use IEEE extended-precision long double.
30508 This is not likely to work if your system defaults to using IBM
30509 extended-precision long double.  If you change the long double type
30510 from IBM extended-precision, the compiler will issue a warning unless
30511 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30512 to be enabled.
30514 @opindex mabi=elfv1
30515 @item -mabi=elfv1
30516 Change the current ABI to use the ELFv1 ABI.
30517 This is the default ABI for big-endian PowerPC 64-bit Linux.
30518 Overriding the default ABI requires special system support and is
30519 likely to fail in spectacular ways.
30521 @opindex mabi=elfv2
30522 @item -mabi=elfv2
30523 Change the current ABI to use the ELFv2 ABI.
30524 This is the default ABI for little-endian PowerPC 64-bit Linux.
30525 Overriding the default ABI requires special system support and is
30526 likely to fail in spectacular ways.
30528 @opindex mgnu-attribute
30529 @opindex mno-gnu-attribute
30530 @item -mgnu-attribute
30531 @itemx -mno-gnu-attribute
30532 Emit .gnu_attribute assembly directives to set tag/value pairs in a
30533 .gnu.attributes section that specify ABI variations in function
30534 parameters or return values.
30536 @opindex mprototype
30537 @opindex mno-prototype
30538 @item -mprototype
30539 @itemx -mno-prototype
30540 On System V.4 and embedded PowerPC systems assume that all calls to
30541 variable argument functions are properly prototyped.  Otherwise, the
30542 compiler must insert an instruction before every non-prototyped call to
30543 set or clear bit 6 of the condition code register (@code{CR}) to
30544 indicate whether floating-point values are passed in the floating-point
30545 registers in case the function takes variable arguments.  With
30546 @option{-mprototype}, only calls to prototyped variable argument functions
30547 set or clear the bit.
30549 @opindex msim
30550 @item -msim
30551 On embedded PowerPC systems, assume that the startup module is called
30552 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
30553 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
30554 configurations.
30556 @opindex mmvme
30557 @item -mmvme
30558 On embedded PowerPC systems, assume that the startup module is called
30559 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
30560 @file{libc.a}.
30562 @opindex mads
30563 @item -mads
30564 On embedded PowerPC systems, assume that the startup module is called
30565 @file{crt0.o} and the standard C libraries are @file{libads.a} and
30566 @file{libc.a}.
30568 @opindex myellowknife
30569 @item -myellowknife
30570 On embedded PowerPC systems, assume that the startup module is called
30571 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
30572 @file{libc.a}.
30574 @opindex mvxworks
30575 @item -mvxworks
30576 On System V.4 and embedded PowerPC systems, specify that you are
30577 compiling for a VxWorks system.
30579 @opindex memb
30580 @item -memb
30581 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
30582 header to indicate that @samp{eabi} extended relocations are used.
30584 @opindex meabi
30585 @opindex mno-eabi
30586 @item -meabi
30587 @itemx -mno-eabi
30588 On System V.4 and embedded PowerPC systems do (do not) adhere to the
30589 Embedded Applications Binary Interface (EABI), which is a set of
30590 modifications to the System V.4 specifications.  Selecting @option{-meabi}
30591 means that the stack is aligned to an 8-byte boundary, a function
30592 @code{__eabi} is called from @code{main} to set up the EABI
30593 environment, and the @option{-msdata} option can use both @code{r2} and
30594 @code{r13} to point to two separate small data areas.  Selecting
30595 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
30596 no EABI initialization function is called from @code{main}, and the
30597 @option{-msdata} option only uses @code{r13} to point to a single
30598 small data area.  The @option{-meabi} option is on by default if you
30599 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
30601 @opindex msdata=eabi
30602 @item -msdata=eabi
30603 On System V.4 and embedded PowerPC systems, put small initialized
30604 @code{const} global and static data in the @code{.sdata2} section, which
30605 is pointed to by register @code{r2}.  Put small initialized
30606 non-@code{const} global and static data in the @code{.sdata} section,
30607 which is pointed to by register @code{r13}.  Put small uninitialized
30608 global and static data in the @code{.sbss} section, which is adjacent to
30609 the @code{.sdata} section.  The @option{-msdata=eabi} option is
30610 incompatible with the @option{-mrelocatable} option.  The
30611 @option{-msdata=eabi} option also sets the @option{-memb} option.
30613 @opindex msdata=sysv
30614 @item -msdata=sysv
30615 On System V.4 and embedded PowerPC systems, put small global and static
30616 data in the @code{.sdata} section, which is pointed to by register
30617 @code{r13}.  Put small uninitialized global and static data in the
30618 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
30619 The @option{-msdata=sysv} option is incompatible with the
30620 @option{-mrelocatable} option.
30622 @opindex msdata=default
30623 @opindex msdata
30624 @item -msdata=default
30625 @itemx -msdata
30626 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
30627 compile code the same as @option{-msdata=eabi}, otherwise compile code the
30628 same as @option{-msdata=sysv}.
30630 @opindex msdata=data
30631 @item -msdata=data
30632 On System V.4 and embedded PowerPC systems, put small global
30633 data in the @code{.sdata} section.  Put small uninitialized global
30634 data in the @code{.sbss} section.  Do not use register @code{r13}
30635 to address small data however.  This is the default behavior unless
30636 other @option{-msdata} options are used.
30638 @opindex msdata=none
30639 @opindex mno-sdata
30640 @item -msdata=none
30641 @itemx -mno-sdata
30642 On embedded PowerPC systems, put all initialized global and static data
30643 in the @code{.data} section, and all uninitialized data in the
30644 @code{.bss} section.
30646 @opindex mreadonly-in-sdata
30647 @opindex mno-readonly-in-sdata
30648 @item -mreadonly-in-sdata
30649 Put read-only objects in the @code{.sdata} section as well.  This is the
30650 default.
30652 @opindex mblock-move-inline-limit
30653 @item -mblock-move-inline-limit=@var{num}
30654 Inline all block moves (such as calls to @code{memcpy} or structure
30655 copies) less than or equal to @var{num} bytes.  The minimum value for
30656 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
30657 targets.  The default value is target-specific.
30659 @opindex mblock-compare-inline-limit
30660 @item -mblock-compare-inline-limit=@var{num}
30661 Generate non-looping inline code for all block compares (such as calls
30662 to @code{memcmp} or structure compares) less than or equal to @var{num}
30663 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
30664 block compare is disabled. The default value is target-specific.
30666 @opindex mblock-compare-inline-loop-limit
30667 @item -mblock-compare-inline-loop-limit=@var{num}
30668 Generate an inline expansion using loop code for all block compares that
30669 are less than or equal to @var{num} bytes, but greater than the limit
30670 for non-loop inline block compare expansion. If the block length is not
30671 constant, at most @var{num} bytes will be compared before @code{memcmp}
30672 is called to compare the remainder of the block. The default value is
30673 target-specific.
30675 @opindex mstring-compare-inline-limit
30676 @item -mstring-compare-inline-limit=@var{num}
30677 Compare at most @var{num} string bytes with inline code.
30678 If the difference or end of string is not found at the
30679 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
30680 take care of the rest of the comparison. The default is 64 bytes.
30682 @opindex G
30683 @cindex smaller data references (PowerPC)
30684 @cindex .sdata/.sdata2 references (PowerPC)
30685 @item -G @var{num}
30686 On embedded PowerPC systems, put global and static items less than or
30687 equal to @var{num} bytes into the small data or BSS sections instead of
30688 the normal data or BSS section.  By default, @var{num} is 8.  The
30689 @option{-G @var{num}} switch is also passed to the linker.
30690 All modules should be compiled with the same @option{-G @var{num}} value.
30692 @opindex mregnames
30693 @opindex mno-regnames
30694 @item -mregnames
30695 @itemx -mno-regnames
30696 On System V.4 and embedded PowerPC systems do (do not) emit register
30697 names in the assembly language output using symbolic forms.
30699 @opindex mlongcall
30700 @opindex mno-longcall
30701 @item -mlongcall
30702 @itemx -mno-longcall
30703 By default assume that all calls are far away so that a longer and more
30704 expensive calling sequence is required.  This is required for calls
30705 farther than 32 megabytes (33,554,432 bytes) from the current location.
30706 A short call is generated if the compiler knows
30707 the call cannot be that far away.  This setting can be overridden by
30708 the @code{shortcall} function attribute, or by @code{#pragma
30709 longcall(0)}.
30711 Some linkers are capable of detecting out-of-range calls and generating
30712 glue code on the fly.  On these systems, long calls are unnecessary and
30713 generate slower code.  As of this writing, the AIX linker can do this,
30714 as can the GNU linker for PowerPC/64.  It is planned to add this feature
30715 to the GNU linker for 32-bit PowerPC systems as well.
30717 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
30718 GCC can generate long calls using an inline PLT call sequence (see
30719 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
30720 ELFv1 (big-endian) do not support inline PLT calls.
30722 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
30723 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
30724 addresses represent the callee and the branch island.  The
30725 Darwin/PPC linker prefers the first address and generates a @code{bl
30726 callee} if the PPC @code{bl} instruction reaches the callee directly;
30727 otherwise, the linker generates @code{bl L42} to call the branch
30728 island.  The branch island is appended to the body of the
30729 calling function; it computes the full 32-bit address of the callee
30730 and jumps to it.
30732 On Mach-O (Darwin) systems, this option directs the compiler emit to
30733 the glue for every direct call, and the Darwin linker decides whether
30734 to use or discard it.
30736 In the future, GCC may ignore all longcall specifications
30737 when the linker is known to generate glue.
30739 @opindex mpltseq
30740 @opindex mno-pltseq
30741 @item -mpltseq
30742 @itemx -mno-pltseq
30743 Implement (do not implement) -fno-plt and long calls using an inline
30744 PLT call sequence that supports lazy linking and long calls to
30745 functions in dlopen'd shared libraries.  Inline PLT calls are only
30746 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
30747 linkers, and are enabled by default if the support is detected when
30748 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
30749 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
30750 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
30751 linked together.
30753 @opindex mtls-markers
30754 @opindex mno-tls-markers
30755 @item -mtls-markers
30756 @itemx -mno-tls-markers
30757 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
30758 specifying the function argument.  The relocation allows the linker to
30759 reliably associate function call with argument setup instructions for
30760 TLS optimization, which in turn allows GCC to better schedule the
30761 sequence.
30763 @opindex mrecip
30764 @item -mrecip
30765 @itemx -mno-recip
30766 This option enables use of the reciprocal estimate and
30767 reciprocal square root estimate instructions with additional
30768 Newton-Raphson steps to increase precision instead of doing a divide or
30769 square root and divide for floating-point arguments.  You should use
30770 the @option{-ffast-math} option when using @option{-mrecip} (or at
30771 least @option{-funsafe-math-optimizations},
30772 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30773 @option{-fno-trapping-math}).  Note that while the throughput of the
30774 sequence is generally higher than the throughput of the non-reciprocal
30775 instruction, the precision of the sequence can be decreased by up to 2
30776 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30777 roots.
30779 @opindex mrecip=opt
30780 @item -mrecip=@var{opt}
30781 This option controls which reciprocal estimate instructions
30782 may be used.  @var{opt} is a comma-separated list of options, which may
30783 be preceded by a @code{!} to invert the option:
30785 @table @samp
30787 @item all
30788 Enable all estimate instructions.
30790 @item default 
30791 Enable the default instructions, equivalent to @option{-mrecip}.
30793 @item none 
30794 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30796 @item div 
30797 Enable the reciprocal approximation instructions for both 
30798 single and double precision.
30800 @item divf 
30801 Enable the single-precision reciprocal approximation instructions.
30803 @item divd 
30804 Enable the double-precision reciprocal approximation instructions.
30806 @item rsqrt 
30807 Enable the reciprocal square root approximation instructions for both
30808 single and double precision.
30810 @item rsqrtf 
30811 Enable the single-precision reciprocal square root approximation instructions.
30813 @item rsqrtd 
30814 Enable the double-precision reciprocal square root approximation instructions.
30816 @end table
30818 So, for example, @option{-mrecip=all,!rsqrtd} enables
30819 all of the reciprocal estimate instructions, except for the
30820 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30821 which handle the double-precision reciprocal square root calculations.
30823 @opindex mrecip-precision
30824 @item -mrecip-precision
30825 @itemx -mno-recip-precision
30826 Assume (do not assume) that the reciprocal estimate instructions
30827 provide higher-precision estimates than is mandated by the PowerPC
30828 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30829 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30830 The double-precision square root estimate instructions are not generated by
30831 default on low-precision machines, since they do not provide an
30832 estimate that converges after three steps.
30834 @opindex mveclibabi
30835 @item -mveclibabi=@var{type}
30836 Specifies the ABI type to use for vectorizing intrinsics using an
30837 external library.  The only type supported at present is @samp{mass},
30838 which specifies to use IBM's Mathematical Acceleration Subsystem
30839 (MASS) libraries for vectorizing intrinsics using external libraries.
30840 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30841 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30842 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30843 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30844 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30845 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30846 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30847 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30848 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30849 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30850 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30851 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30852 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30853 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30854 for power7.  Both @option{-ftree-vectorize} and
30855 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
30856 libraries must be specified at link time.
30858 @opindex mfriz
30859 @item -mfriz
30860 @itemx -mno-friz
30861 Generate (do not generate) the @code{friz} instruction when the
30862 @option{-funsafe-math-optimizations} option is used to optimize
30863 rounding of floating-point values to 64-bit integer and back to floating
30864 point.  The @code{friz} instruction does not return the same value if
30865 the floating-point number is too large to fit in an integer.
30867 @opindex mpointers-to-nested-functions
30868 @item -mpointers-to-nested-functions
30869 @itemx -mno-pointers-to-nested-functions
30870 Generate (do not generate) code to load up the static chain register
30871 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30872 systems where a function pointer points to a 3-word descriptor giving
30873 the function address, TOC value to be loaded in register @code{r2}, and
30874 static chain value to be loaded in register @code{r11}.  The
30875 @option{-mpointers-to-nested-functions} is on by default.  You cannot
30876 call through pointers to nested functions or pointers
30877 to functions compiled in other languages that use the static chain if
30878 you use @option{-mno-pointers-to-nested-functions}.
30880 @opindex msave-toc-indirect
30881 @item -msave-toc-indirect
30882 @itemx -mno-save-toc-indirect
30883 Generate (do not generate) code to save the TOC value in the reserved
30884 stack location in the function prologue if the function calls through
30885 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
30886 saved in the prologue, it is saved just before the call through the
30887 pointer.  The @option{-mno-save-toc-indirect} option is the default.
30889 @opindex mcompat-align-parm
30890 @item -mcompat-align-parm
30891 @itemx -mno-compat-align-parm
30892 Generate (do not generate) code to pass structure parameters with a
30893 maximum alignment of 64 bits, for compatibility with older versions
30894 of GCC.
30896 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30897 structure parameter on a 128-bit boundary when that structure contained
30898 a member requiring 128-bit alignment.  This is corrected in more
30899 recent versions of GCC.  This option may be used to generate code
30900 that is compatible with functions compiled with older versions of
30901 GCC.
30903 The @option{-mno-compat-align-parm} option is the default.
30905 @opindex mstack-protector-guard
30906 @opindex mstack-protector-guard-reg
30907 @opindex mstack-protector-guard-offset
30908 @opindex mstack-protector-guard-symbol
30909 @item -mstack-protector-guard=@var{guard}
30910 @itemx -mstack-protector-guard-reg=@var{reg}
30911 @itemx -mstack-protector-guard-offset=@var{offset}
30912 @itemx -mstack-protector-guard-symbol=@var{symbol}
30913 Generate stack protection code using canary at @var{guard}.  Supported
30914 locations are @samp{global} for global canary or @samp{tls} for per-thread
30915 canary in the TLS block (the default with GNU libc version 2.4 or later).
30917 With the latter choice the options
30918 @option{-mstack-protector-guard-reg=@var{reg}} and
30919 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30920 which register to use as base register for reading the canary, and from what
30921 offset from that base register. The default for those is as specified in the
30922 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30923 the offset with a symbol reference to a canary in the TLS block.
30925 @opindex mpcrel
30926 @opindex mno-pcrel
30927 @item -mpcrel
30928 @itemx -mno-pcrel
30929 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
30930 option requires that the medium code model (@option{-mcmodel=medium})
30931 and prefixed addressing (@option{-mprefixed}) options are enabled.
30933 @opindex mprefixed
30934 @opindex mno-prefixed
30935 @item -mprefixed
30936 @itemx -mno-prefixed
30937 Generate (do not generate) addressing modes using prefixed load and
30938 store instructions.  The @option{-mprefixed} option requires that
30939 the option @option{-mcpu=power10} (or later) is enabled.
30941 @opindex mmma
30942 @opindex mno-mma
30943 @item -mmma
30944 @itemx -mno-mma
30945 Generate (do not generate) the MMA instructions.  The @option{-mma}
30946 option requires that the option @option{-mcpu=power10} (or later)
30947 is enabled.
30949 @opindex mrop-protect
30950 @opindex mno-rop-protect
30951 @item -mrop-protect
30952 @itemx -mno-rop-protect
30953 Generate (do not generate) ROP protection instructions when the target
30954 processor supports them.  Currently this option disables the shrink-wrap
30955 optimization (@option{-fshrink-wrap}).
30957 @opindex mprivileged
30958 @opindex mno-privileged
30959 @item -mprivileged
30960 @itemx -mno-privileged
30961 Generate (do not generate) code that will run in privileged state.
30963 @opindex block-ops-unaligned-vsx
30964 @opindex no-block-ops-unaligned-vsx
30965 @item -mblock-ops-unaligned-vsx
30966 @itemx -mno-block-ops-unaligned-vsx
30967 Generate (do not generate) unaligned vsx loads and stores for
30968 inline expansion of @code{memcpy} and @code{memmove}.
30970 @item --param rs6000-vect-unroll-limit=
30971 The vectorizer will check with target information to determine whether it
30972 would be beneficial to unroll the main vectorized loop and by how much.  This
30973 parameter sets the upper bound of how much the vectorizer will unroll the main
30974 loop.  The default value is four.
30976 @end table
30978 @node RX Options
30979 @subsection RX Options
30980 @cindex RX Options
30982 These command-line options are defined for RX targets:
30984 @table @gcctabopt
30985 @opindex m64bit-doubles
30986 @opindex m32bit-doubles
30987 @item -m64bit-doubles
30988 @itemx -m32bit-doubles
30989 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30990 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
30991 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
30992 works on 32-bit values, which is why the default is
30993 @option{-m32bit-doubles}.
30995 @opindex fpu
30996 @opindex nofpu
30997 @item -fpu
30998 @itemx -nofpu
30999 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
31000 floating-point hardware.  The default is enabled for the RX600
31001 series and disabled for the RX200 series.
31003 Floating-point instructions are only generated for 32-bit floating-point 
31004 values, however, so the FPU hardware is not used for doubles if the
31005 @option{-m64bit-doubles} option is used.
31007 @emph{Note} If the @option{-fpu} option is enabled then
31008 @option{-funsafe-math-optimizations} is also enabled automatically.
31009 This is because the RX FPU instructions are themselves unsafe.
31011 @opindex mcpu
31012 @item -mcpu=@var{name}
31013 Selects the type of RX CPU to be targeted.  Currently three types are
31014 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
31015 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
31017 The only difference between @samp{RX600} and @samp{RX610} is that the
31018 @samp{RX610} does not support the @code{MVTIPL} instruction.
31020 The @samp{RX200} series does not have a hardware floating-point unit
31021 and so @option{-nofpu} is enabled by default when this type is
31022 selected.
31024 @opindex mbig-endian-data
31025 @opindex mlittle-endian-data
31026 @item -mbig-endian-data
31027 @itemx -mlittle-endian-data
31028 Store data (but not code) in the big-endian format.  The default is
31029 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
31030 format.
31032 @opindex msmall-data-limit
31033 @item -msmall-data-limit=@var{N}
31034 Specifies the maximum size in bytes of global and static variables
31035 which can be placed into the small data area.  Using the small data
31036 area can lead to smaller and faster code, but the size of area is
31037 limited and it is up to the programmer to ensure that the area does
31038 not overflow.  Also when the small data area is used one of the RX's
31039 registers (usually @code{r13}) is reserved for use pointing to this
31040 area, so it is no longer available for use by the compiler.  This
31041 could result in slower and/or larger code if variables are pushed onto
31042 the stack instead of being held in this register.
31044 Note, common variables (variables that have not been initialized) and
31045 constants are not placed into the small data area as they are assigned
31046 to other sections in the output executable.
31048 The default value is zero, which disables this feature.  Note, this
31049 feature is not enabled by default with higher optimization levels
31050 (@option{-O2} etc) because of the potentially detrimental effects of
31051 reserving a register.  It is up to the programmer to experiment and
31052 discover whether this feature is of benefit to their program.  See the
31053 description of the @option{-mpid} option for a description of how the
31054 actual register to hold the small data area pointer is chosen.
31056 @opindex msim
31057 @opindex mno-sim
31058 @item -msim
31059 @itemx -mno-sim
31060 Use the simulator runtime.  The default is to use the libgloss
31061 board-specific runtime.
31063 @opindex mas100-syntax
31064 @opindex mno-as100-syntax
31065 @item -mas100-syntax
31066 @itemx -mno-as100-syntax
31067 When generating assembler output use a syntax that is compatible with
31068 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
31069 assembler, but it has some restrictions so it is not generated by default.
31071 @opindex mmax-constant-size
31072 @item -mmax-constant-size=@var{N}
31073 Specifies the maximum size, in bytes, of a constant that can be used as
31074 an operand in a RX instruction.  Although the RX instruction set does
31075 allow constants of up to 4 bytes in length to be used in instructions,
31076 a longer value equates to a longer instruction.  Thus in some
31077 circumstances it can be beneficial to restrict the size of constants
31078 that are used in instructions.  Constants that are too big are instead
31079 placed into a constant pool and referenced via register indirection.
31081 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
31082 or 4 means that constants of any size are allowed.
31084 @opindex mrelax
31085 @item -mrelax
31086 Enable linker relaxation.  Linker relaxation is a process whereby the
31087 linker attempts to reduce the size of a program by finding shorter
31088 versions of various instructions.  Disabled by default.
31090 @opindex mint-register
31091 @item -mint-register=@var{N}
31092 Specify the number of registers to reserve for fast interrupt handler
31093 functions.  The value @var{N} can be between 0 and 4.  A value of 1
31094 means that register @code{r13} is reserved for the exclusive use
31095 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
31096 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
31097 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
31098 A value of 0, the default, does not reserve any registers.
31100 @opindex msave-acc-in-interrupts
31101 @item -msave-acc-in-interrupts
31102 Specifies that interrupt handler functions should preserve the
31103 accumulator register.  This is only necessary if normal code might use
31104 the accumulator register, for example because it performs 64-bit
31105 multiplications.  The default is to ignore the accumulator as this
31106 makes the interrupt handlers faster.
31108 @opindex mpid
31109 @opindex mno-pid
31110 @item -mpid
31111 @itemx -mno-pid
31112 Enables the generation of position independent data.  When enabled any
31113 access to constant data is done via an offset from a base address
31114 held in a register.  This allows the location of constant data to be
31115 determined at run time without requiring the executable to be
31116 relocated, which is a benefit to embedded applications with tight
31117 memory constraints.  Data that can be modified is not affected by this
31118 option.
31120 Note, using this feature reserves a register, usually @code{r13}, for
31121 the constant data base address.  This can result in slower and/or
31122 larger code, especially in complicated functions.
31124 The actual register chosen to hold the constant data base address
31125 depends upon whether the @option{-msmall-data-limit} and/or the
31126 @option{-mint-register} command-line options are enabled.  Starting
31127 with register @code{r13} and proceeding downwards, registers are
31128 allocated first to satisfy the requirements of @option{-mint-register},
31129 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
31130 is possible for the small data area register to be @code{r8} if both
31131 @option{-mint-register=4} and @option{-mpid} are specified on the
31132 command line.
31134 By default this feature is not enabled.  The default can be restored
31135 via the @option{-mno-pid} command-line option.
31137 @opindex mno-warn-multiple-fast-interrupts
31138 @opindex mwarn-multiple-fast-interrupts
31139 @item -mno-warn-multiple-fast-interrupts
31140 @itemx -mwarn-multiple-fast-interrupts
31141 Prevents GCC from issuing a warning message if it finds more than one
31142 fast interrupt handler when it is compiling a file.  The default is to
31143 issue a warning for each extra fast interrupt handler found, as the RX
31144 only supports one such interrupt.
31146 @opindex mallow-string-insns
31147 @opindex mno-allow-string-insns
31148 @item -mallow-string-insns
31149 @itemx -mno-allow-string-insns
31150 Enables or disables the use of the string manipulation instructions
31151 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
31152 @code{SWHILE} and also the @code{RMPA} instruction.  These
31153 instructions may prefetch data, which is not safe to do if accessing
31154 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
31155 for more information).
31157 The default is to allow these instructions, but it is not possible for
31158 GCC to reliably detect all circumstances where a string instruction
31159 might be used to access an I/O register, so their use cannot be
31160 disabled automatically.  Instead it is reliant upon the programmer to
31161 use the @option{-mno-allow-string-insns} option if their program
31162 accesses I/O space.
31164 When the instructions are enabled GCC defines the C preprocessor
31165 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
31166 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
31168 @opindex mjsr
31169 @opindex mno-jsr
31170 @item -mjsr
31171 @itemx -mno-jsr
31172 Use only (or not only) @code{JSR} instructions to access functions.
31173 This option can be used when code size exceeds the range of @code{BSR}
31174 instructions.  Note that @option{-mno-jsr} does not mean to not use
31175 @code{JSR} but instead means that any type of branch may be used.
31176 @end table
31178 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
31179 has special significance to the RX port when used with the
31180 @code{interrupt} function attribute.  This attribute indicates a
31181 function intended to process fast interrupts.  GCC ensures
31182 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
31183 and/or @code{r13} and only provided that the normal use of the
31184 corresponding registers have been restricted via the
31185 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
31186 options.
31188 @node S/390 and zSeries Options
31189 @subsection S/390 and zSeries Options
31190 @cindex S/390 and zSeries Options
31192 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
31194 @table @gcctabopt
31195 @opindex mhard-float
31196 @opindex msoft-float
31197 @item -mhard-float
31198 @itemx -msoft-float
31199 Use (do not use) the hardware floating-point instructions and registers
31200 for floating-point operations.  When @option{-msoft-float} is specified,
31201 functions in @file{libgcc.a} are used to perform floating-point
31202 operations.  When @option{-mhard-float} is specified, the compiler
31203 generates IEEE floating-point instructions.  This is the default.
31205 @opindex mhard-dfp
31206 @opindex mno-hard-dfp
31207 @item -mhard-dfp
31208 @itemx -mno-hard-dfp
31209 Use (do not use) the hardware decimal-floating-point instructions for
31210 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
31211 specified, functions in @file{libgcc.a} are used to perform
31212 decimal-floating-point operations.  When @option{-mhard-dfp} is
31213 specified, the compiler generates decimal-floating-point hardware
31214 instructions.  This is the default for @option{-march=z9-ec} or higher.
31216 @opindex mlong-double-64
31217 @opindex mlong-double-128
31218 @item -mlong-double-64
31219 @itemx -mlong-double-128
31220 These switches control the size of @code{long double} type. A size
31221 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31222 type. This is the default.
31224 @opindex mbackchain
31225 @opindex mno-backchain
31226 @item -mbackchain
31227 @itemx -mno-backchain
31228 Store (do not store) the address of the caller's frame as backchain pointer
31229 into the callee's stack frame.
31230 A backchain may be needed to allow debugging using tools that do not understand
31231 DWARF call frame information.
31232 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
31233 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
31234 the backchain is placed into the topmost word of the 96/160 byte register
31235 save area.
31237 In general, code compiled with @option{-mbackchain} is call-compatible with
31238 code compiled with @option{-mno-backchain}; however, use of the backchain
31239 for debugging purposes usually requires that the whole binary is built with
31240 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
31241 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31242 to build a linux kernel use @option{-msoft-float}.
31244 The default is to not maintain the backchain.
31246 @opindex mpacked-stack
31247 @opindex mno-packed-stack
31248 @item -mpacked-stack
31249 @itemx -mno-packed-stack
31250 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
31251 specified, the compiler uses the all fields of the 96/160 byte register save
31252 area only for their default purpose; unused fields still take up stack space.
31253 When @option{-mpacked-stack} is specified, register save slots are densely
31254 packed at the top of the register save area; unused space is reused for other
31255 purposes, allowing for more efficient use of the available stack space.
31256 However, when @option{-mbackchain} is also in effect, the topmost word of
31257 the save area is always used to store the backchain, and the return address
31258 register is always saved two words below the backchain.
31260 As long as the stack frame backchain is not used, code generated with
31261 @option{-mpacked-stack} is call-compatible with code generated with
31262 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
31263 S/390 or zSeries generated code that uses the stack frame backchain at run
31264 time, not just for debugging purposes.  Such code is not call-compatible
31265 with code compiled with @option{-mpacked-stack}.  Also, note that the
31266 combination of @option{-mbackchain},
31267 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31268 to build a linux kernel use @option{-msoft-float}.
31270 The default is to not use the packed stack layout.
31272 @opindex msmall-exec
31273 @opindex mno-small-exec
31274 @item -msmall-exec
31275 @itemx -mno-small-exec
31276 Generate (or do not generate) code using the @code{bras} instruction
31277 to do subroutine calls.
31278 This only works reliably if the total executable size does not
31279 exceed 64k.  The default is to use the @code{basr} instruction instead,
31280 which does not have this limitation.
31282 @opindex m64
31283 @opindex m31
31284 @item -m64
31285 @itemx -m31
31286 When @option{-m31} is specified, generate code compliant to the
31287 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
31288 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
31289 particular to generate 64-bit instructions.  For the @samp{s390}
31290 targets, the default is @option{-m31}, while the @samp{s390x}
31291 targets default to @option{-m64}.
31293 @opindex mzarch
31294 @opindex mesa
31295 @item -mzarch
31296 @itemx -mesa
31297 When @option{-mzarch} is specified, generate code using the
31298 instructions available on z/Architecture.
31299 When @option{-mesa} is specified, generate code using the
31300 instructions available on ESA/390.  Note that @option{-mesa} is
31301 not possible with @option{-m64}.
31302 When generating code compliant to the GNU/Linux for S/390 ABI,
31303 the default is @option{-mesa}.  When generating code compliant
31304 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
31306 @opindex mhtm
31307 @opindex mno-htm
31308 @item -mhtm
31309 @itemx -mno-htm
31310 The @option{-mhtm} option enables a set of builtins making use of
31311 instructions available with the transactional execution facility
31312 introduced with the IBM zEnterprise EC12 machine generation
31313 @ref{S/390 System z Built-in Functions}.
31314 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
31316 @opindex mvx
31317 @opindex mno-vx
31318 @item -mvx
31319 @itemx -mno-vx
31320 When @option{-mvx} is specified, generate code using the instructions
31321 available with the vector extension facility introduced with the IBM
31322 z13 machine generation.
31323 This option changes the ABI for some vector type values with regard to
31324 alignment and calling conventions.  In case vector type values are
31325 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
31326 command will be added to mark the resulting binary with the ABI used.
31327 @option{-mvx} is enabled by default when using @option{-march=z13}.
31329 @opindex mzvector
31330 @opindex mno-zvector
31331 @item -mzvector
31332 @itemx -mno-zvector
31333 The @option{-mzvector} option enables vector language extensions and
31334 builtins using instructions available with the vector extension
31335 facility introduced with the IBM z13 machine generation.
31336 This option adds support for @samp{vector} to be used as a keyword to
31337 define vector type variables and arguments.  @samp{vector} is only
31338 available when GNU extensions are enabled.  It will not be expanded
31339 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
31340 In addition to the GCC low-level builtins @option{-mzvector} enables
31341 a set of builtins added for compatibility with AltiVec-style
31342 implementations like Power and Cell.  In order to make use of these
31343 builtins the header file @file{vecintrin.h} needs to be included.
31344 @option{-mzvector} is disabled by default.
31346 @opindex mmvcle
31347 @opindex mno-mvcle
31348 @item -mmvcle
31349 @itemx -mno-mvcle
31350 Generate (or do not generate) code using the @code{mvcle} instruction
31351 to perform block moves.  When @option{-mno-mvcle} is specified,
31352 use a @code{mvc} loop instead.  This is the default unless optimizing for
31353 size.
31355 @opindex mdebug
31356 @opindex mno-debug
31357 @item -mdebug
31358 @itemx -mno-debug
31359 Print (or do not print) additional debug information when compiling.
31360 The default is to not print debug information.
31362 @opindex march
31363 @item -march=@var{cpu-type}
31364 Generate code that runs on @var{cpu-type}, which is the name of a
31365 system representing a certain processor type.  Possible values for
31366 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
31367 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
31368 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
31369 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
31370 @samp{z16}/@samp{arch14}, and @samp{native}.
31372 The default is @option{-march=z900}.
31374 Specifying @samp{native} as cpu type can be used to select the best
31375 architecture option for the host processor.
31376 @option{-march=native} has no effect if GCC does not recognize the
31377 processor.
31379 @opindex mtune
31380 @item -mtune=@var{cpu-type}
31381 Tune to @var{cpu-type} everything applicable about the generated code,
31382 except for the ABI and the set of available instructions.
31383 The list of @var{cpu-type} values is the same as for @option{-march}.
31384 The default is the value used for @option{-march}.
31386 @opindex mtpf-trace
31387 @opindex mno-tpf-trace
31388 @item -mtpf-trace
31389 @itemx -mno-tpf-trace
31390 Generate code that adds (does not add) in TPF OS specific branches to trace
31391 routines in the operating system.  This option is off by default, even
31392 when compiling for the TPF OS@.
31394 @opindex mtpf-trace-skip
31395 @opindex mno-tpf-trace-skip
31396 @item -mtpf-trace-skip
31397 @itemx -mno-tpf-trace-skip
31398 Generate code that changes (does not change) the default branch
31399 targets enabled by @option{-mtpf-trace} to point to specialized trace
31400 routines providing the ability of selectively skipping function trace
31401 entries for the TPF OS.  This option is off by default, even when
31402 compiling for the TPF OS and specifying @option{-mtpf-trace}.
31404 @opindex mfused-madd
31405 @opindex mno-fused-madd
31406 @item -mfused-madd
31407 @itemx -mno-fused-madd
31408 Generate code that uses (does not use) the floating-point multiply and
31409 accumulate instructions.  These instructions are generated by default if
31410 hardware floating point is used.
31412 @opindex mwarn-framesize
31413 @item -mwarn-framesize=@var{framesize}
31414 Emit a warning if the current function exceeds the given frame size.  Because
31415 this is a compile-time check it doesn't need to be a real problem when the program
31416 runs.  It is intended to identify functions that most probably cause
31417 a stack overflow.  It is useful to be used in an environment with limited stack
31418 size e.g.@: the linux kernel.
31420 @opindex mwarn-dynamicstack
31421 @item -mwarn-dynamicstack
31422 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
31423 arrays.  This is generally a bad idea with a limited stack size.
31425 @opindex mstack-guard
31426 @opindex mstack-size
31427 @item -mstack-guard=@var{stack-guard}
31428 @itemx -mstack-size=@var{stack-size}
31429 If these options are provided the S/390 back end emits additional instructions in
31430 the function prologue that trigger a trap if the stack size is @var{stack-guard}
31431 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
31432 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
31433 the frame size of the compiled function is chosen.
31434 These options are intended to be used to help debugging stack overflow problems.
31435 The additionally emitted code causes only little overhead and hence can also be
31436 used in production-like systems without greater performance degradation.  The given
31437 values have to be exact powers of 2 and @var{stack-size} has to be greater than
31438 @var{stack-guard} without exceeding 64k.
31439 In order to be efficient the extra code makes the assumption that the stack starts
31440 at an address aligned to the value given by @var{stack-size}.
31441 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
31443 @opindex mhotpatch
31444 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
31445 If the hotpatch option is enabled, a ``hot-patching'' function
31446 prologue is generated for all functions in the compilation unit.
31447 The funtion label is prepended with the given number of two-byte
31448 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
31449 the label, 2 * @var{post-halfwords} bytes are appended, using the
31450 largest NOP like instructions the architecture allows (maximum
31451 1000000).
31453 If both arguments are zero, hotpatching is disabled.
31455 This option can be overridden for individual functions with the
31456 @code{hotpatch} attribute.
31457 @end table
31459 @node SH Options
31460 @subsection SH Options
31462 These @samp{-m} options are defined for the SH implementations:
31464 @table @gcctabopt
31465 @opindex m1
31466 @item -m1
31467 Generate code for the SH1.
31469 @opindex m2
31470 @item -m2
31471 Generate code for the SH2.
31473 @item -m2e
31474 Generate code for the SH2e.
31476 @opindex m2a-nofpu
31477 @item -m2a-nofpu
31478 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
31479 that the floating-point unit is not used.
31481 @opindex m2a-single-only
31482 @item -m2a-single-only
31483 Generate code for the SH2a-FPU, in such a way that no double-precision
31484 floating-point operations are used.
31486 @opindex m2a-single
31487 @item -m2a-single
31488 Generate code for the SH2a-FPU assuming the floating-point unit is in
31489 single-precision mode by default.
31491 @opindex m2a
31492 @item -m2a
31493 Generate code for the SH2a-FPU assuming the floating-point unit is in
31494 double-precision mode by default.
31496 @opindex m3
31497 @item -m3
31498 Generate code for the SH3.
31500 @opindex m3e
31501 @item -m3e
31502 Generate code for the SH3e.
31504 @opindex m4-nofpu
31505 @item -m4-nofpu
31506 Generate code for the SH4 without a floating-point unit.
31508 @opindex m4-single-only
31509 @item -m4-single-only
31510 Generate code for the SH4 with a floating-point unit that only
31511 supports single-precision arithmetic.
31513 @opindex m4-single
31514 @item -m4-single
31515 Generate code for the SH4 assuming the floating-point unit is in
31516 single-precision mode by default.
31518 @opindex m4
31519 @item -m4
31520 Generate code for the SH4.
31522 @opindex m4-100
31523 @item -m4-100
31524 Generate code for SH4-100.
31526 @opindex m4-100-nofpu
31527 @item -m4-100-nofpu
31528 Generate code for SH4-100 in such a way that the
31529 floating-point unit is not used.
31531 @opindex m4-100-single
31532 @item -m4-100-single
31533 Generate code for SH4-100 assuming the floating-point unit is in
31534 single-precision mode by default.
31536 @opindex m4-100-single-only
31537 @item -m4-100-single-only
31538 Generate code for SH4-100 in such a way that no double-precision
31539 floating-point operations are used.
31541 @opindex m4-200
31542 @item -m4-200
31543 Generate code for SH4-200.
31545 @opindex m4-200-nofpu
31546 @item -m4-200-nofpu
31547 Generate code for SH4-200 without in such a way that the
31548 floating-point unit is not used.
31550 @opindex m4-200-single
31551 @item -m4-200-single
31552 Generate code for SH4-200 assuming the floating-point unit is in
31553 single-precision mode by default.
31555 @opindex m4-200-single-only
31556 @item -m4-200-single-only
31557 Generate code for SH4-200 in such a way that no double-precision
31558 floating-point operations are used.
31560 @opindex m4-300
31561 @item -m4-300
31562 Generate code for SH4-300.
31564 @opindex m4-300-nofpu
31565 @item -m4-300-nofpu
31566 Generate code for SH4-300 without in such a way that the
31567 floating-point unit is not used.
31569 @opindex m4-300-single
31570 @item -m4-300-single
31571 Generate code for SH4-300 in such a way that no double-precision
31572 floating-point operations are used.
31574 @opindex m4-300-single-only
31575 @item -m4-300-single-only
31576 Generate code for SH4-300 in such a way that no double-precision
31577 floating-point operations are used.
31579 @opindex m4-340
31580 @item -m4-340
31581 Generate code for SH4-340 (no MMU, no FPU).
31583 @opindex m4-500
31584 @item -m4-500
31585 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
31586 assembler.
31588 @opindex m4a-nofpu
31589 @item -m4a-nofpu
31590 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
31591 floating-point unit is not used.
31593 @opindex m4a-single-only
31594 @item -m4a-single-only
31595 Generate code for the SH4a, in such a way that no double-precision
31596 floating-point operations are used.
31598 @opindex m4a-single
31599 @item -m4a-single
31600 Generate code for the SH4a assuming the floating-point unit is in
31601 single-precision mode by default.
31603 @opindex m4a
31604 @item -m4a
31605 Generate code for the SH4a.
31607 @opindex m4al
31608 @item -m4al
31609 Same as @option{-m4a-nofpu}, except that it implicitly passes
31610 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
31611 instructions at the moment.
31613 @opindex mb
31614 @item -mb
31615 Compile code for the processor in big-endian mode.
31617 @opindex ml
31618 @item -ml
31619 Compile code for the processor in little-endian mode.
31621 @opindex mdalign
31622 @item -mdalign
31623 Align doubles at 64-bit boundaries.  Note that this changes the calling
31624 conventions, and thus some functions from the standard C library do
31625 not work unless you recompile it first with @option{-mdalign}.
31627 @opindex mrelax
31628 @item -mrelax
31629 Shorten some address references at link time, when possible; uses the
31630 linker option @option{-relax}.
31632 @opindex mbigtable
31633 @item -mbigtable
31634 Use 32-bit offsets in @code{switch} tables.  The default is to use
31635 16-bit offsets.
31637 @opindex mbitops
31638 @item -mbitops
31639 Enable the use of bit manipulation instructions on SH2A.
31641 @opindex mfmovd
31642 @item -mfmovd
31643 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
31644 alignment constraints.
31646 @opindex mrenesas
31647 @item -mrenesas
31648 Comply with the calling conventions defined by Renesas.
31650 @opindex mno-renesas
31651 @item -mno-renesas
31652 Comply with the calling conventions defined for GCC before the Renesas
31653 conventions were available.  This option is the default for all
31654 targets of the SH toolchain.
31656 @opindex mnomacsave
31657 @item -mnomacsave
31658 Mark the @code{MAC} register as call-clobbered, even if
31659 @option{-mrenesas} is given.
31661 @opindex mieee
31662 @opindex mno-ieee
31663 @item -mieee
31664 @itemx -mno-ieee
31665 Control the IEEE compliance of floating-point comparisons, which affects the
31666 handling of cases where the result of a comparison is unordered.  By default
31667 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
31668 enabled @option{-mno-ieee} is implicitly set, which results in faster
31669 floating-point greater-equal and less-equal comparisons.  The implicit settings
31670 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
31672 @opindex minline-ic_invalidate
31673 @item -minline-ic_invalidate
31674 Inline code to invalidate instruction cache entries after setting up
31675 nested function trampolines.
31676 This option has no effect if @option{-musermode} is in effect and the selected
31677 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
31678 instruction.
31679 If the selected code generation option does not allow the use of the @code{icbi}
31680 instruction, and @option{-musermode} is not in effect, the inlined code
31681 manipulates the instruction cache address array directly with an associative
31682 write.  This not only requires privileged mode at run time, but it also
31683 fails if the cache line had been mapped via the TLB and has become unmapped.
31685 @opindex misize
31686 @item -misize
31687 Dump instruction size and location in the assembly code.
31689 @opindex mpadstruct
31690 @item -mpadstruct
31691 This option is deprecated.  It pads structures to multiple of 4 bytes,
31692 which is incompatible with the SH ABI@.
31694 @opindex matomic-model=@var{model}
31695 @item -matomic-model=@var{model}
31696 Sets the model of atomic operations and additional parameters as a comma
31697 separated list.  For details on the atomic built-in functions see
31698 @ref{__atomic Builtins}.  The following models and parameters are supported:
31700 @table @samp
31702 @item none
31703 Disable compiler generated atomic sequences and emit library calls for atomic
31704 operations.  This is the default if the target is not @code{sh*-*-linux*}.
31706 @item soft-gusa
31707 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
31708 built-in functions.  The generated atomic sequences require additional support
31709 from the interrupt/exception handling code of the system and are only suitable
31710 for SH3* and SH4* single-core systems.  This option is enabled by default when
31711 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
31712 this option also partially utilizes the hardware atomic instructions
31713 @code{movli.l} and @code{movco.l} to create more efficient code, unless
31714 @samp{strict} is specified.  
31716 @item soft-tcb
31717 Generate software atomic sequences that use a variable in the thread control
31718 block.  This is a variation of the gUSA sequences which can also be used on
31719 SH1* and SH2* targets.  The generated atomic sequences require additional
31720 support from the interrupt/exception handling code of the system and are only
31721 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
31722 parameter has to be specified as well.
31724 @item soft-imask
31725 Generate software atomic sequences that temporarily disable interrupts by
31726 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
31727 in privileged mode and is only suitable for single-core systems.  Additional
31728 support from the interrupt/exception handling code of the system is not
31729 required.  This model is enabled by default when the target is
31730 @code{sh*-*-linux*} and SH1* or SH2*.
31732 @item hard-llcs
31733 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
31734 instructions only.  This is only available on SH4A and is suitable for
31735 multi-core systems.  Since the hardware instructions support only 32 bit atomic
31736 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
31737 Code compiled with this option is also compatible with other software
31738 atomic model interrupt/exception handling systems if executed on an SH4A
31739 system.  Additional support from the interrupt/exception handling code of the
31740 system is not required for this model.
31742 @item gbr-offset=
31743 This parameter specifies the offset in bytes of the variable in the thread
31744 control block structure that should be used by the generated atomic sequences
31745 when the @samp{soft-tcb} model has been selected.  For other models this
31746 parameter is ignored.  The specified value must be an integer multiple of four
31747 and in the range 0-1020.
31749 @item strict
31750 This parameter prevents mixed usage of multiple atomic models, even if they
31751 are compatible, and makes the compiler generate atomic sequences of the
31752 specified model only.
31754 @end table
31756 @opindex mtas
31757 @item -mtas
31758 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
31759 Notice that depending on the particular hardware and software configuration
31760 this can degrade overall performance due to the operand cache line flushes
31761 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
31762 processors the @code{tas.b} instruction must be used with caution since it
31763 can result in data corruption for certain cache configurations.
31765 @opindex mprefergot
31766 @item -mprefergot
31767 When generating position-independent code, emit function calls using
31768 the Global Offset Table instead of the Procedure Linkage Table.
31770 @opindex musermode
31771 @opindex mno-usermode
31772 @item -musermode
31773 @itemx -mno-usermode
31774 Don't allow (allow) the compiler generating privileged mode code.  Specifying
31775 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31776 inlined code would not work in user mode.  @option{-musermode} is the default
31777 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
31778 @option{-musermode} has no effect, since there is no user mode.
31780 @opindex multcost=@var{number}
31781 @item -multcost=@var{number}
31782 Set the cost to assume for a multiply insn.
31784 @opindex mdiv=@var{strategy}
31785 @item -mdiv=@var{strategy}
31786 Set the division strategy to be used for integer division operations.
31787 @var{strategy} can be one of: 
31789 @table @samp
31791 @item call-div1
31792 Calls a library function that uses the single-step division instruction
31793 @code{div1} to perform the operation.  Division by zero calculates an
31794 unspecified result and does not trap.  This is the default except for SH4,
31795 SH2A and SHcompact.
31797 @item call-fp
31798 Calls a library function that performs the operation in double precision
31799 floating point.  Division by zero causes a floating-point exception.  This is
31800 the default for SHcompact with FPU.  Specifying this for targets that do not
31801 have a double precision FPU defaults to @code{call-div1}.
31803 @item call-table
31804 Calls a library function that uses a lookup table for small divisors and
31805 the @code{div1} instruction with case distinction for larger divisors.  Division
31806 by zero calculates an unspecified result and does not trap.  This is the default
31807 for SH4.  Specifying this for targets that do not have dynamic shift
31808 instructions defaults to @code{call-div1}.
31810 @end table
31812 When a division strategy has not been specified the default strategy is
31813 selected based on the current target.  For SH2A the default strategy is to
31814 use the @code{divs} and @code{divu} instructions instead of library function
31815 calls.
31817 @opindex maccumulate-outgoing-args
31818 @item -maccumulate-outgoing-args
31819 Reserve space once for outgoing arguments in the function prologue rather
31820 than around each call.  Generally beneficial for performance and size.  Also
31821 needed for unwinding to avoid changing the stack frame around conditional code.
31823 @opindex mdivsi3_libfunc=@var{name}
31824 @item -mdivsi3_libfunc=@var{name}
31825 Set the name of the library function used for 32-bit signed division to
31826 @var{name}.
31827 This only affects the name used in the @samp{call} division strategies, and
31828 the compiler still expects the same sets of input/output/clobbered registers as
31829 if this option were not present.
31831 @opindex mfixed-range
31832 @item -mfixed-range=@var{register-range}
31833 Generate code treating the given register range as fixed registers.
31834 A fixed register is one that the register allocator cannot use.  This is
31835 useful when compiling kernel code.  A register range is specified as
31836 two registers separated by a dash.  Multiple register ranges can be
31837 specified separated by a comma.
31839 @opindex mbranch-cost=@var{num}
31840 @item -mbranch-cost=@var{num}
31841 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
31842 make the compiler try to generate more branch-free code if possible.  
31843 If not specified the value is selected depending on the processor type that
31844 is being compiled for.
31846 @opindex mzdcbranch
31847 @opindex mno-zdcbranch
31848 @item -mzdcbranch
31849 @itemx -mno-zdcbranch
31850 Assume (do not assume) that zero displacement conditional branch instructions
31851 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
31852 compiler prefers zero displacement branch code sequences.  This is
31853 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
31854 disabled by specifying @option{-mno-zdcbranch}.
31856 @opindex mcbranch-force-delay-slot
31857 @item -mcbranch-force-delay-slot
31858 Force the usage of delay slots for conditional branches, which stuffs the delay
31859 slot with a @code{nop} if a suitable instruction cannot be found.  By default
31860 this option is disabled.  It can be enabled to work around hardware bugs as
31861 found in the original SH7055.
31863 @opindex mfused-madd
31864 @opindex mno-fused-madd
31865 @item -mfused-madd
31866 @itemx -mno-fused-madd
31867 Generate code that uses (does not use) the floating-point multiply and
31868 accumulate instructions.  These instructions are generated by default
31869 if hardware floating point is used.  The machine-dependent
31870 @option{-mfused-madd} option is now mapped to the machine-independent
31871 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31872 mapped to @option{-ffp-contract=off}.
31874 @opindex mfsca
31875 @opindex mno-fsca
31876 @item -mfsca
31877 @itemx -mno-fsca
31878 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31879 and cosine approximations.  The option @option{-mfsca} must be used in
31880 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
31881 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
31882 approximations even if @option{-funsafe-math-optimizations} is in effect.
31884 @opindex mfsrra
31885 @opindex mno-fsrra
31886 @item -mfsrra
31887 @itemx -mno-fsrra
31888 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31889 reciprocal square root approximations.  The option @option{-mfsrra} must be used
31890 in combination with @option{-funsafe-math-optimizations} and
31891 @option{-ffinite-math-only}.  It is enabled by default when generating code for
31892 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
31893 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31894 in effect.
31896 @opindex mpretend-cmove
31897 @item -mpretend-cmove
31898 Prefer zero-displacement conditional branches for conditional move instruction
31899 patterns.  This can result in faster code on the SH4 processor.
31901 @opindex fdpic
31902 @item -mfdpic
31903 Generate code using the FDPIC ABI.
31905 @end table
31907 @node Solaris 2 Options
31908 @subsection Solaris 2 Options
31909 @cindex Solaris 2 options
31911 These @samp{-m} options are supported on Solaris 2:
31913 @table @gcctabopt
31914 @opindex mclear-hwcap
31915 @item -mclear-hwcap
31916 @option{-mclear-hwcap} tells the compiler to remove the hardware
31917 capabilities generated by the Solaris assembler.  This is only necessary
31918 when object files use ISA extensions not supported by the current
31919 machine, but check at runtime whether or not to use them.
31921 @opindex mimpure-text
31922 @item -mimpure-text
31923 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31924 the compiler to not pass @option{-z text} to the linker when linking a
31925 shared object.  Using this option, you can link position-dependent
31926 code into a shared object.
31928 @option{-mimpure-text} suppresses the ``relocations remain against
31929 allocatable but non-writable sections'' linker error message.
31930 However, the necessary relocations trigger copy-on-write, and the
31931 shared object is not actually shared across processes.  Instead of
31932 using @option{-mimpure-text}, you should compile all source code with
31933 @option{-fpic} or @option{-fPIC}.
31935 @end table
31937 These switches are supported in addition to the above on Solaris 2:
31939 @table @gcctabopt
31940 @opindex pthreads
31941 @item -pthreads
31942 This is a synonym for @option{-pthread}.
31943 @end table
31945 @node SPARC Options
31946 @subsection SPARC Options
31947 @cindex SPARC options
31949 These @samp{-m} options are supported on the SPARC:
31951 @table @gcctabopt
31952 @opindex mno-app-regs
31953 @opindex mapp-regs
31954 @item -mno-app-regs
31955 @itemx -mapp-regs
31956 Specify @option{-mapp-regs} to generate output using the global registers
31957 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
31958 global register 1, each global register 2 through 4 is then treated as an
31959 allocable register that is clobbered by function calls.  This is the default.
31961 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31962 specify @option{-mno-app-regs}.  You should compile libraries and system
31963 software with this option.
31965 @opindex mflat
31966 @opindex mno-flat
31967 @item -mflat
31968 @itemx -mno-flat
31969 With @option{-mflat}, the compiler does not generate save/restore instructions
31970 and uses a ``flat'' or single register window model.  This model is compatible
31971 with the regular register window model.  The local registers and the input
31972 registers (0--5) are still treated as ``call-saved'' registers and are
31973 saved on the stack as needed.
31975 With @option{-mno-flat} (the default), the compiler generates save/restore
31976 instructions (except for leaf functions).  This is the normal operating mode.
31978 @opindex mfpu
31979 @opindex mhard-float
31980 @item -mfpu
31981 @itemx -mhard-float
31982 Generate output containing floating-point instructions.  This is the
31983 default.
31985 @opindex mno-fpu
31986 @opindex msoft-float
31987 @item -mno-fpu
31988 @itemx -msoft-float
31989 Generate output containing library calls for floating point.
31990 @strong{Warning:} the requisite libraries are not available for all SPARC
31991 targets.  Normally the facilities of the machine's usual C compiler are
31992 used, but this cannot be done directly in cross-compilation.  You must make
31993 your own arrangements to provide suitable library functions for
31994 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
31995 @samp{sparclite-*-*} do provide software floating-point support.
31997 @option{-msoft-float} changes the calling convention in the output file;
31998 therefore, it is only useful if you compile @emph{all} of a program with
31999 this option.  In particular, you need to compile @file{libgcc.a}, the
32000 library that comes with GCC, with @option{-msoft-float} in order for
32001 this to work.
32003 @opindex mhard-quad-float
32004 @item -mhard-quad-float
32005 Generate output containing quad-word (long double) floating-point
32006 instructions.
32008 @opindex msoft-quad-float
32009 @item -msoft-quad-float
32010 Generate output containing library calls for quad-word (long double)
32011 floating-point instructions.  The functions called are those specified
32012 in the SPARC ABI@.  This is the default.
32014 As of this writing, there are no SPARC implementations that have hardware
32015 support for the quad-word floating-point instructions.  They all invoke
32016 a trap handler for one of these instructions, and then the trap handler
32017 emulates the effect of the instruction.  Because of the trap handler overhead,
32018 this is much slower than calling the ABI library routines.  Thus the
32019 @option{-msoft-quad-float} option is the default.
32021 @opindex mno-unaligned-doubles
32022 @opindex munaligned-doubles
32023 @item -mno-unaligned-doubles
32024 @itemx -munaligned-doubles
32025 Assume that doubles have 8-byte alignment.  This is the default.
32027 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
32028 alignment only if they are contained in another type, or if they have an
32029 absolute address.  Otherwise, it assumes they have 4-byte alignment.
32030 Specifying this option avoids some rare compatibility problems with code
32031 generated by other compilers.  It is not the default because it results
32032 in a performance loss, especially for floating-point code.
32034 @opindex muser-mode
32035 @opindex mno-user-mode
32036 @item -muser-mode
32037 @itemx -mno-user-mode
32038 Do not generate code that can only run in supervisor mode.  This is relevant
32039 only for the @code{casa} instruction emitted for the LEON3 processor.  This
32040 is the default.
32042 @opindex mfaster-structs
32043 @opindex mno-faster-structs
32044 @item -mfaster-structs
32045 @itemx -mno-faster-structs
32046 With @option{-mfaster-structs}, the compiler assumes that structures
32047 should have 8-byte alignment.  This enables the use of pairs of
32048 @code{ldd} and @code{std} instructions for copies in structure
32049 assignment, in place of twice as many @code{ld} and @code{st} pairs.
32050 However, the use of this changed alignment directly violates the SPARC
32051 ABI@.  Thus, it's intended only for use on targets where the developer
32052 acknowledges that their resulting code is not directly in line with
32053 the rules of the ABI@.
32055 @opindex mstd-struct-return
32056 @opindex mno-std-struct-return
32057 @item -mstd-struct-return
32058 @itemx -mno-std-struct-return
32059 With @option{-mstd-struct-return}, the compiler generates checking code
32060 in functions returning structures or unions to detect size mismatches
32061 between the two sides of function calls, as per the 32-bit ABI@.
32063 The default is @option{-mno-std-struct-return}.  This option has no effect
32064 in 64-bit mode.
32066 @opindex mlra
32067 @opindex mno-lra
32068 @item -mlra
32069 @itemx -mno-lra
32070 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
32071 so @option{-mno-lra} needs to be passed to get old Reload.
32073 @opindex mcpu
32074 @item -mcpu=@var{cpu_type}
32075 Set the instruction set, register set, and instruction scheduling parameters
32076 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32077 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
32078 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
32079 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
32080 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
32081 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
32082 @samp{m8}.
32084 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
32085 which selects the best architecture option for the host processor.
32086 @option{-mcpu=native} has no effect if GCC does not recognize
32087 the processor.
32089 Default instruction scheduling parameters are used for values that select
32090 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
32091 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
32093 Here is a list of each supported architecture and their supported
32094 implementations.
32096 @table @asis
32097 @item v7
32098 cypress, leon3v7
32100 @item v8
32101 supersparc, hypersparc, leon, leon3, leon5
32103 @item sparclite
32104 f930, f934, sparclite86x
32106 @item sparclet
32107 tsc701
32109 @item v9
32110 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
32111 niagara7, m8
32112 @end table
32114 By default (unless configured otherwise), GCC generates code for the V7
32115 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
32116 additionally optimizes it for the Cypress CY7C602 chip, as used in the
32117 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
32118 SPARCStation 1, 2, IPX etc.
32120 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
32121 architecture.  The only difference from V7 code is that the compiler emits
32122 the integer multiply and integer divide instructions which exist in SPARC-V8
32123 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
32124 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
32125 2000 series.
32127 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
32128 the SPARC architecture.  This adds the integer multiply, integer divide step
32129 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
32130 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
32131 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
32132 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
32133 MB86934 chip, which is the more recent SPARClite with FPU@.
32135 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
32136 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
32137 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
32138 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
32139 optimizes it for the TEMIC SPARClet chip.
32141 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
32142 architecture.  This adds 64-bit integer and floating-point move instructions,
32143 3 additional floating-point condition code registers and conditional move
32144 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
32145 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
32146 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
32147 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
32148 @option{-mcpu=niagara}, the compiler additionally optimizes it for
32149 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
32150 additionally optimizes it for Sun UltraSPARC T2 chips. With
32151 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
32152 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
32153 additionally optimizes it for Sun UltraSPARC T4 chips.  With
32154 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
32155 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
32156 additionally optimizes it for Oracle M8 chips.
32158 @opindex mtune
32159 @item -mtune=@var{cpu_type}
32160 Set the instruction scheduling parameters for machine type
32161 @var{cpu_type}, but do not set the instruction set or register set that the
32162 option @option{-mcpu=@var{cpu_type}} does.
32164 The same values for @option{-mcpu=@var{cpu_type}} can be used for
32165 @option{-mtune=@var{cpu_type}}, but the only useful values are those
32166 that select a particular CPU implementation.  Those are
32167 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
32168 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
32169 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
32170 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
32171 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
32172 and GNU/Linux toolchains, @samp{native} can also be used.
32174 @opindex mv8plus
32175 @opindex mno-v8plus
32176 @item -mv8plus
32177 @itemx -mno-v8plus
32178 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
32179 difference from the V8 ABI is that the global and out registers are
32180 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
32181 mode for all SPARC-V9 processors.
32183 @opindex mvis
32184 @opindex mno-vis
32185 @item -mvis
32186 @itemx -mno-vis
32187 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
32188 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
32190 @opindex mvis2
32191 @opindex mno-vis2
32192 @item -mvis2
32193 @itemx -mno-vis2
32194 With @option{-mvis2}, GCC generates code that takes advantage of
32195 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
32196 default is @option{-mvis2} when targeting a cpu that supports such
32197 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
32198 also sets @option{-mvis}.
32200 @opindex mvis3
32201 @opindex mno-vis3
32202 @item -mvis3
32203 @itemx -mno-vis3
32204 With @option{-mvis3}, GCC generates code that takes advantage of
32205 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
32206 default is @option{-mvis3} when targeting a cpu that supports such
32207 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
32208 also sets @option{-mvis2} and @option{-mvis}.
32210 @opindex mvis4
32211 @opindex mno-vis4
32212 @item -mvis4
32213 @itemx -mno-vis4
32214 With @option{-mvis4}, GCC generates code that takes advantage of
32215 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
32216 default is @option{-mvis4} when targeting a cpu that supports such
32217 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
32218 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
32220 @opindex mvis4b
32221 @opindex mno-vis4b
32222 @item -mvis4b
32223 @itemx -mno-vis4b
32224 With @option{-mvis4b}, GCC generates code that takes advantage of
32225 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
32226 the additional VIS instructions introduced in the Oracle SPARC
32227 Architecture 2017.  The default is @option{-mvis4b} when targeting a
32228 cpu that supports such instructions, such as m8 and later.  Setting
32229 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
32230 @option{-mvis2} and @option{-mvis}.
32232 @opindex mcbcond
32233 @opindex mno-cbcond
32234 @item -mcbcond
32235 @itemx -mno-cbcond
32236 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
32237 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
32238 when targeting a CPU that supports such instructions, such as Niagara-4 and
32239 later.
32241 @opindex mfmaf
32242 @opindex mno-fmaf
32243 @item -mfmaf
32244 @itemx -mno-fmaf
32245 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
32246 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
32247 when targeting a CPU that supports such instructions, such as Niagara-3 and
32248 later.
32250 @opindex mfsmuld
32251 @opindex mno-fsmuld
32252 @item -mfsmuld
32253 @itemx -mno-fsmuld
32254 With @option{-mfsmuld}, GCC generates code that takes advantage of the
32255 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
32256 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
32257 or V9 with FPU except @option{-mcpu=leon}.
32259 @opindex mpopc
32260 @opindex mno-popc
32261 @item -mpopc
32262 @itemx -mno-popc
32263 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
32264 Population Count instruction.  The default is @option{-mpopc}
32265 when targeting a CPU that supports such an instruction, such as Niagara-2 and
32266 later.
32268 @opindex msubxc
32269 @opindex mno-subxc
32270 @item -msubxc
32271 @itemx -mno-subxc
32272 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
32273 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
32274 when targeting a CPU that supports such an instruction, such as Niagara-7 and
32275 later.
32277 @opindex mfix-at697f
32278 @item -mfix-at697f
32279 Enable the documented workaround for the single erratum of the Atmel AT697F
32280 processor (which corresponds to erratum #13 of the AT697E processor).
32282 @opindex mfix-ut699
32283 @item -mfix-ut699
32284 Enable the documented workarounds for the floating-point errata and the data
32285 cache nullify errata of the UT699 processor.
32287 @opindex mfix-ut700
32288 @item -mfix-ut700
32289 Enable the documented workaround for the back-to-back store errata of
32290 the UT699E/UT700 processor.
32292 @opindex mfix-gr712rc
32293 @item -mfix-gr712rc
32294 Enable the documented workaround for the back-to-back store errata of
32295 the GR712RC processor.
32296 @end table
32298 These @samp{-m} options are supported in addition to the above
32299 on SPARC-V9 processors in 64-bit environments:
32301 @table @gcctabopt
32302 @opindex m32
32303 @opindex m64
32304 @item -m32
32305 @itemx -m64
32306 Generate code for a 32-bit or 64-bit environment.
32307 The 32-bit environment sets int, long and pointer to 32 bits.
32308 The 64-bit environment sets int to 32 bits and long and pointer
32309 to 64 bits.
32311 @opindex mcmodel
32312 @item -mcmodel=@var{which}
32313 Set the code model to one of
32315 @table @samp
32316 @item medlow
32317 The Medium/Low code model: 64-bit addresses, programs
32318 must be linked in the low 32 bits of memory.  Programs can be statically
32319 or dynamically linked.
32321 @item medmid
32322 The Medium/Middle code model: 64-bit addresses, programs
32323 must be linked in the low 44 bits of memory, the text and data segments must
32324 be less than 2GB in size and the data segment must be located within 2GB of
32325 the text segment.
32327 @item medany
32328 The Medium/Anywhere code model: 64-bit addresses, programs
32329 may be linked anywhere in memory, the text and data segments must be less
32330 than 2GB in size and the data segment must be located within 2GB of the
32331 text segment.
32333 @item embmedany
32334 The Medium/Anywhere code model for embedded systems:
32335 64-bit addresses, the text and data segments must be less than 2GB in
32336 size, both starting anywhere in memory (determined at link time).  The
32337 global register %g4 points to the base of the data segment.  Programs
32338 are statically linked and PIC is not supported.
32339 @end table
32341 @opindex mmemory-model
32342 @item -mmemory-model=@var{mem-model}
32343 Set the memory model in force on the processor to one of
32345 @table @samp
32346 @item default
32347 The default memory model for the processor and operating system.
32349 @item rmo
32350 Relaxed Memory Order
32352 @item pso
32353 Partial Store Order
32355 @item tso
32356 Total Store Order
32358 @item sc
32359 Sequential Consistency
32360 @end table
32362 These memory models are formally defined in Appendix D of the SPARC-V9
32363 architecture manual, as set in the processor's @code{PSTATE.MM} field.
32365 @opindex mstack-bias
32366 @opindex mno-stack-bias
32367 @item -mstack-bias
32368 @itemx -mno-stack-bias
32369 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
32370 frame pointer if present, are offset by @minus{}2047 which must be added back
32371 when making stack frame references.  This is the default in 64-bit mode.
32372 Otherwise, assume no such offset is present.
32373 @end table
32375 @node System V Options
32376 @subsection Options for System V
32378 These additional options are available on System V Release 4 for
32379 compatibility with other compilers on those systems:
32381 @table @gcctabopt
32382 @opindex G
32383 @item -G
32384 Create a shared object.
32385 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
32387 @opindex Qy
32388 @item -Qy
32389 Identify the versions of each tool used by the compiler, in a
32390 @code{.ident} assembler directive in the output.
32392 @opindex Qn
32393 @item -Qn
32394 Refrain from adding @code{.ident} directives to the output file (this is
32395 the default).
32397 @opindex YP
32398 @item -YP,@var{dirs}
32399 Search the directories @var{dirs}, and no others, for libraries
32400 specified with @option{-l}.
32402 @opindex Ym
32403 @item -Ym,@var{dir}
32404 Look in the directory @var{dir} to find the M4 preprocessor.
32405 The assembler uses this option.
32406 @c This is supposed to go with a -Yd for predefined M4 macro files, but
32407 @c the generic assembler that comes with Solaris takes just -Ym.
32408 @end table
32410 @node V850 Options
32411 @subsection V850 Options
32412 @cindex V850 Options
32414 These @samp{-m} options are defined for V850 implementations:
32416 @table @gcctabopt
32417 @opindex mlong-calls
32418 @opindex mno-long-calls
32419 @item -mlong-calls
32420 @itemx -mno-long-calls
32421 Treat all calls as being far away (near).  If calls are assumed to be
32422 far away, the compiler always loads the function's address into a
32423 register, and calls indirect through the pointer.
32425 @opindex mno-ep
32426 @opindex mep
32427 @item -mno-ep
32428 @itemx -mep
32429 Do not optimize (do optimize) basic blocks that use the same index
32430 pointer 4 or more times to copy pointer into the @code{ep} register, and
32431 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
32432 option is on by default if you optimize.
32434 @opindex mno-prolog-function
32435 @opindex mprolog-function
32436 @item -mno-prolog-function
32437 @itemx -mprolog-function
32438 Do not use (do use) external functions to save and restore registers
32439 at the prologue and epilogue of a function.  The external functions
32440 are slower, but use less code space if more than one function saves
32441 the same number of registers.  The @option{-mprolog-function} option
32442 is on by default if you optimize.
32444 @opindex mspace
32445 @item -mspace
32446 Try to make the code as small as possible.  At present, this just turns
32447 on the @option{-mep} and @option{-mprolog-function} options.
32449 @opindex mtda
32450 @item -mtda=@var{n}
32451 Put static or global variables whose size is @var{n} bytes or less into
32452 the tiny data area that register @code{ep} points to.  The tiny data
32453 area can hold up to 256 bytes in total (128 bytes for byte references).
32455 @opindex msda
32456 @item -msda=@var{n}
32457 Put static or global variables whose size is @var{n} bytes or less into
32458 the small data area that register @code{gp} points to.  The small data
32459 area can hold up to 64 kilobytes.
32461 @opindex mzda
32462 @item -mzda=@var{n}
32463 Put static or global variables whose size is @var{n} bytes or less into
32464 the first 32 kilobytes of memory.
32466 @opindex mv850
32467 @item -mv850
32468 Specify that the target processor is the V850.
32470 @opindex mv850e3v5
32471 @item -mv850e3v5
32472 Specify that the target processor is the V850E3V5.  The preprocessor
32473 constant @code{__v850e3v5__} is defined if this option is used.
32475 @opindex mv850e2v4
32476 @item -mv850e2v4
32477 Specify that the target processor is the V850E3V5.  This is an alias for
32478 the @option{-mv850e3v5} option.
32480 @opindex mv850e2v3
32481 @item -mv850e2v3
32482 Specify that the target processor is the V850E2V3.  The preprocessor
32483 constant @code{__v850e2v3__} is defined if this option is used.
32485 @opindex mv850e2
32486 @item -mv850e2
32487 Specify that the target processor is the V850E2.  The preprocessor
32488 constant @code{__v850e2__} is defined if this option is used.
32490 @opindex mv850e1
32491 @item -mv850e1
32492 Specify that the target processor is the V850E1.  The preprocessor
32493 constants @code{__v850e1__} and @code{__v850e__} are defined if
32494 this option is used.
32496 @opindex mv850es
32497 @item -mv850es
32498 Specify that the target processor is the V850ES.  This is an alias for
32499 the @option{-mv850e1} option.
32501 @opindex mv850e
32502 @item -mv850e
32503 Specify that the target processor is the V850E@.  The preprocessor
32504 constant @code{__v850e__} is defined if this option is used.
32506 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
32507 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
32508 are defined then a default target processor is chosen and the
32509 relevant @samp{__v850*__} preprocessor constant is defined.
32511 The preprocessor constants @code{__v850} and @code{__v851__} are always
32512 defined, regardless of which processor variant is the target.
32514 @opindex mdisable-callt
32515 @opindex mno-disable-callt
32516 @item -mdisable-callt
32517 @itemx -mno-disable-callt
32518 This option suppresses generation of the @code{CALLT} instruction for the
32519 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
32520 architecture.
32522 This option is enabled by default when the RH850 ABI is
32523 in use (see @option{-mrh850-abi}), and disabled by default when the
32524 GCC ABI is in use.  If @code{CALLT} instructions are being generated
32525 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
32527 @opindex mrelax
32528 @opindex mno-relax
32529 @item -mrelax
32530 @itemx -mno-relax
32531 Pass on (or do not pass on) the @option{-mrelax} command-line option
32532 to the assembler.
32534 @opindex mlong-jumps
32535 @opindex mno-long-jumps
32536 @item -mlong-jumps
32537 @itemx -mno-long-jumps
32538 Disable (or re-enable) the generation of PC-relative jump instructions.
32540 @opindex msoft-float
32541 @opindex mhard-float
32542 @item -msoft-float
32543 @itemx -mhard-float
32544 Disable (or re-enable) the generation of hardware floating point
32545 instructions.  This option is only significant when the target
32546 architecture is @samp{V850E2V3} or higher.  If hardware floating point
32547 instructions are being generated then the C preprocessor symbol
32548 @code{__FPU_OK__} is defined, otherwise the symbol
32549 @code{__NO_FPU__} is defined.
32551 @opindex mloop
32552 @item -mloop
32553 Enables the use of the e3v5 LOOP instruction.  The use of this
32554 instruction is not enabled by default when the e3v5 architecture is
32555 selected because its use is still experimental.
32557 @opindex mrh850-abi
32558 @opindex mghs
32559 @item -mrh850-abi
32560 @itemx -mghs
32561 Enables support for the RH850 version of the V850 ABI.  This is the
32562 default.  With this version of the ABI the following rules apply:
32564 @itemize
32565 @item
32566 Integer sized structures and unions are returned via a memory pointer
32567 rather than a register.
32569 @item
32570 Large structures and unions (more than 8 bytes in size) are passed by
32571 value.
32573 @item
32574 Functions are aligned to 16-bit boundaries.
32576 @item
32577 The @option{-m8byte-align} command-line option is supported.
32579 @item
32580 The @option{-mdisable-callt} command-line option is enabled by
32581 default.  The @option{-mno-disable-callt} command-line option is not
32582 supported.
32583 @end itemize
32585 When this version of the ABI is enabled the C preprocessor symbol
32586 @code{__V850_RH850_ABI__} is defined.
32588 @opindex mgcc-abi
32589 @item -mgcc-abi
32590 Enables support for the old GCC version of the V850 ABI.  With this
32591 version of the ABI the following rules apply:
32593 @itemize
32594 @item
32595 Integer sized structures and unions are returned in register @code{r10}.
32597 @item
32598 Large structures and unions (more than 8 bytes in size) are passed by
32599 reference.
32601 @item
32602 Functions are aligned to 32-bit boundaries, unless optimizing for
32603 size.
32605 @item
32606 The @option{-m8byte-align} command-line option is not supported.
32608 @item
32609 The @option{-mdisable-callt} command-line option is supported but not
32610 enabled by default.
32611 @end itemize
32613 When this version of the ABI is enabled the C preprocessor symbol
32614 @code{__V850_GCC_ABI__} is defined.
32616 @opindex m8byte-align
32617 @opindex mno-8byte-align
32618 @item -m8byte-align
32619 @itemx -mno-8byte-align
32620 Enables support for @code{double} and @code{long long} types to be
32621 aligned on 8-byte boundaries.  The default is to restrict the
32622 alignment of all objects to at most 4-bytes.  When
32623 @option{-m8byte-align} is in effect the C preprocessor symbol
32624 @code{__V850_8BYTE_ALIGN__} is defined.
32626 @opindex mbig-switch
32627 @item -mbig-switch
32628 Generate code suitable for big switch tables.  Use this option only if
32629 the assembler/linker complain about out of range branches within a switch
32630 table.
32632 @opindex mapp-regs
32633 @item -mapp-regs
32634 This option causes r2 and r5 to be used in the code generated by
32635 the compiler.  This setting is the default.
32637 @opindex mno-app-regs
32638 @item -mno-app-regs
32639 This option causes r2 and r5 to be treated as fixed registers.
32641 @end table
32643 @node VAX Options
32644 @subsection VAX Options
32645 @cindex VAX options
32647 These @samp{-m} options are defined for the VAX:
32649 @table @gcctabopt
32650 @opindex munix
32651 @item -munix
32652 Do not output certain jump instructions (@code{aobleq} and so on)
32653 that the Unix assembler for the VAX cannot handle across long
32654 ranges.
32656 @opindex mgnu
32657 @item -mgnu
32658 Do output those jump instructions, on the assumption that the
32659 GNU assembler is being used.
32661 @opindex mg
32662 @item -mg
32663 Output code for G-format floating-point numbers instead of D-format.
32665 @opindex mlra
32666 @opindex mno-lra
32667 @item -mlra
32668 @itemx -mno-lra
32669 Enable Local Register Allocation.  This is still experimental for the VAX,
32670 so by default the compiler uses standard reload.
32671 @end table
32673 @node Visium Options
32674 @subsection Visium Options
32675 @cindex Visium options
32677 @table @gcctabopt
32679 @opindex mdebug
32680 @item -mdebug
32681 A program which performs file I/O and is destined to run on an MCM target
32682 should be linked with this option.  It causes the libraries libc.a and
32683 libdebug.a to be linked.  The program should be run on the target under
32684 the control of the GDB remote debugging stub.
32686 @opindex msim
32687 @item -msim
32688 A program which performs file I/O and is destined to run on the simulator
32689 should be linked with option.  This causes libraries libc.a and libsim.a to
32690 be linked.
32692 @opindex mfpu
32693 @opindex mhard-float
32694 @item -mfpu
32695 @itemx -mhard-float
32696 Generate code containing floating-point instructions.  This is the
32697 default.
32699 @opindex mno-fpu
32700 @opindex msoft-float
32701 @item -mno-fpu
32702 @itemx -msoft-float
32703 Generate code containing library calls for floating-point.
32705 @option{-msoft-float} changes the calling convention in the output file;
32706 therefore, it is only useful if you compile @emph{all} of a program with
32707 this option.  In particular, you need to compile @file{libgcc.a}, the
32708 library that comes with GCC, with @option{-msoft-float} in order for
32709 this to work.
32711 @opindex mcpu
32712 @item -mcpu=@var{cpu_type}
32713 Set the instruction set, register set, and instruction scheduling parameters
32714 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32715 @samp{mcm}, @samp{gr5} and @samp{gr6}.
32717 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
32719 By default (unless configured otherwise), GCC generates code for the GR5
32720 variant of the Visium architecture.  
32722 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
32723 architecture.  The only difference from GR5 code is that the compiler will
32724 generate block move instructions.
32726 @opindex mtune
32727 @item -mtune=@var{cpu_type}
32728 Set the instruction scheduling parameters for machine type @var{cpu_type},
32729 but do not set the instruction set or register set that the option
32730 @option{-mcpu=@var{cpu_type}} would.
32732 @opindex msv-mode
32733 @item -msv-mode
32734 Generate code for the supervisor mode, where there are no restrictions on
32735 the access to general registers.  This is the default.
32737 @opindex muser-mode
32738 @item -muser-mode
32739 Generate code for the user mode, where the access to some general registers
32740 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
32741 mode; on the GR6, only registers r29 to r31 are affected.
32742 @end table
32744 @node VMS Options
32745 @subsection VMS Options
32747 These @samp{-m} options are defined for the VMS implementations:
32749 @table @gcctabopt
32750 @opindex mvms-return-codes
32751 @item -mvms-return-codes
32752 Return VMS condition codes from @code{main}. The default is to return POSIX-style
32753 condition (e.g.@: error) codes.
32755 @opindex mdebug-main=@var{prefix}
32756 @item -mdebug-main=@var{prefix}
32757 Flag the first routine whose name starts with @var{prefix} as the main
32758 routine for the debugger.
32760 @opindex mmalloc64
32761 @item -mmalloc64
32762 Default to 64-bit memory allocation routines.
32764 @opindex mpointer-size=@var{size}
32765 @item -mpointer-size=@var{size}
32766 Set the default size of pointers. Possible options for @var{size} are
32767 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
32768 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
32769 The later option disables @code{pragma pointer_size}.
32770 @end table
32772 @node VxWorks Options
32773 @subsection VxWorks Options
32774 @cindex VxWorks Options
32776 The options in this section are defined for all VxWorks targets.
32777 Options specific to the target hardware are listed with the other
32778 options for that target.
32780 @table @gcctabopt
32781 @opindex mrtp
32782 @item -mrtp
32783 GCC can generate code for both VxWorks kernels and real time processes
32784 (RTPs).  This option switches from the former to the latter.  It also
32785 defines the preprocessor macro @code{__RTP__}.
32787 @opindex msmp
32788 @item -msmp
32789 Select SMP runtimes for linking.  Not available on architectures other
32790 than PowerPC, nor on VxWorks version 7 or later, in which the selection
32791 is part of the VxWorks build configuration and the library paths are the
32792 same for either choice.
32794 @opindex non-static
32795 @item -non-static
32796 Link an RTP executable against shared libraries rather than static
32797 libraries.  The options @option{-static} and @option{-shared} can
32798 also be used for RTPs (@pxref{Link Options}); @option{-static}
32799 is the default.
32801 @opindex Bstatic
32802 @opindex Bdynamic
32803 @item -Bstatic
32804 @itemx -Bdynamic
32805 These options are passed down to the linker.  They are defined for
32806 compatibility with Diab.
32808 @opindex Xbind-lazy
32809 @item -Xbind-lazy
32810 Enable lazy binding of function calls.  This option is equivalent to
32811 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32813 @opindex Xbind-now
32814 @item -Xbind-now
32815 Disable lazy binding of function calls.  This option is the default and
32816 is defined for compatibility with Diab.
32817 @end table
32819 @node x86 Options
32820 @subsection x86 Options
32821 @cindex x86 Options
32823 These @samp{-m} options are defined for the x86 family of computers.
32825 @table @gcctabopt
32827 @opindex march
32828 @item -march=@var{cpu-type}
32829 Generate instructions for the machine type @var{cpu-type}.  In contrast to
32830 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
32831 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32832 to generate code that may not run at all on processors other than the one
32833 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
32834 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32836 The choices for @var{cpu-type} are:
32838 @table @samp
32839 @item native
32840 This selects the CPU to generate code for at compilation time by determining
32841 the processor type of the compiling machine.  Using @option{-march=native}
32842 enables all instruction subsets supported by the local machine (hence
32843 the result might not run on different machines).  Using @option{-mtune=native}
32844 produces code optimized for the local machine under the constraints
32845 of the selected instruction set.  
32847 @item x86-64
32848 A generic CPU with 64-bit extensions.
32850 @item x86-64-v2
32851 @itemx x86-64-v3
32852 @itemx x86-64-v4
32853 These choices for @var{cpu-type} select the corresponding
32854 micro-architecture level from the x86-64 psABI.  On ABIs other than
32855 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32856 documents for the particular micro-architecture level.
32858 Since these @var{cpu-type} values do not have a corresponding
32859 @option{-mtune} setting, using @option{-march} with these values enables
32860 generic tuning.  Specific tuning can be enabled using the
32861 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32862 @var{other-cpu-type} value.
32864 @item i386
32865 Original Intel i386 CPU@.
32867 @item i486
32868 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
32870 @item i586
32871 @itemx pentium
32872 Intel Pentium CPU with no MMX support.
32874 @item lakemont
32875 Intel Lakemont MCU, based on Intel Pentium CPU.
32877 @item pentium-mmx
32878 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32880 @item pentiumpro
32881 Intel Pentium Pro CPU@.
32883 @item i686
32884 When used with @option{-march}, the Pentium Pro
32885 instruction set is used, so the code runs on all i686 family chips.
32886 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32888 @item pentium2
32889 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32890 set support.
32892 @item pentium3
32893 @itemx pentium3m
32894 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32895 instruction set support.
32897 @item pentium-m
32898 Intel Pentium M; low-power version of Intel Pentium III CPU
32899 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
32900 notebooks.
32902 @item pentium4
32903 @itemx pentium4m
32904 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32906 @item prescott
32907 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32908 instruction set support.
32910 @item nocona
32911 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32912 SSE2, SSE3 and FXSR instruction set support.
32914 @item core2
32915 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32916 SAHF and FXSR instruction set support.
32918 @item nehalem
32919 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32920 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32922 @item westmere
32923 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32924 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32926 @item sandybridge
32927 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32928 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32929 support.
32931 @item ivybridge
32932 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32933 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32934 and F16C instruction set support.
32936 @item haswell
32937 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32938 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32939 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32941 @item broadwell
32942 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32943 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32944 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32945 instruction set support.
32947 @item skylake
32948 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32949 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32950 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32951 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32953 @item bonnell
32954 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32955 instruction set support.
32957 @item silvermont
32958 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32959 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32960 instruction set support.
32962 @item goldmont
32963 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32964 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32965 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32966 set support.
32968 @item goldmont-plus
32969 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32970 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32971 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32972 RDPID and SGX instruction set support.
32974 @item tremont
32975 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32976 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32977 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32978 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32979 support.
32981 @item sierraforest
32982 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32983 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32984 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32985 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32986 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32987 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
32988 support.
32990 @item grandridge
32991 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32992 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32993 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32994 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32995 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32996 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD, UINTR and RAOINT
32997 instruction set support.
32999 @item clearwaterforest
33000 Intel Clearwater Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
33001 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE,
33002 XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
33003 MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
33004 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33005 ENQCMD, UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16,
33006 SHA512, SM3, SM4, USER_MSR and PREFETCHI instruction set support.
33008 @item knl
33009 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33010 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33011 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33012 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
33014 @item knm
33015 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33016 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33017 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33018 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
33019 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
33021 @item skylake-avx512
33022 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33023 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33024 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33025 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
33026 AVX512DQ and AVX512CD instruction set support.
33028 @item cannonlake
33029 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
33030 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
33031 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
33032 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
33033 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
33034 support.
33036 @item icelake-client
33037 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33038 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33039 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33040 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33041 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
33042 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
33044 @item icelake-server
33045 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33046 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33047 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33048 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33049 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
33050 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
33051 instruction set support.
33053 @item cascadelake
33054 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33055 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33056 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33057 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
33058 AVX512CD and AVX512VNNI instruction set support.
33060 @item cooperlake
33061 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33062 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33063 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33064 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
33065 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
33067 @item tigerlake
33068 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33069 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33070 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33071 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
33072 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33073 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
33074 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
33076 @item sapphirerapids
33077 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33078 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33079 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33080 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33081 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33082 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33083 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33084 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
33085 instruction set support.
33087 @item alderlake
33088 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33089 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
33090 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
33091 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
33092 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
33093 support.
33095 @item rocketlake
33096 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
33097 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33098 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33099 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
33100 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33101 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
33103 @item graniterapids
33104 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33105 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33106 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33107 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33108 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33109 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33110 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33111 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
33112 and PREFETCHI instruction set support.
33114 @item graniterapids-d
33115 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33116 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33117 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33118 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33119 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33120 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33121 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33122 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
33123 PREFETCHI and AMX-COMPLEX instruction set support.
33125 @item arrowlake
33126 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33127 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33128 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33129 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33130 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33131 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set
33132 support.
33134 @item arrowlake-s
33135 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33136 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33137 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33138 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33139 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33140 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
33141 SM3 and SM4 instruction set support.
33143 @item pantherlake
33144 Intel Panther Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33145 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33146 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33147 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33148 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33149 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
33150 SM3, SM4 and PREFETCHI instruction set support.
33152 @item k6
33153 AMD K6 CPU with MMX instruction set support.
33155 @item k6-2
33156 @itemx k6-3
33157 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
33159 @item athlon
33160 @itemx athlon-tbird
33161 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
33162 support.
33164 @item athlon-4
33165 @itemx athlon-xp
33166 @itemx athlon-mp
33167 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
33168 instruction set support.
33170 @item k8
33171 @itemx opteron
33172 @itemx athlon64
33173 @itemx athlon-fx
33174 Processors based on the AMD K8 core with x86-64 instruction set support,
33175 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
33176 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
33177 instruction set extensions.)
33179 @item k8-sse3
33180 @itemx opteron-sse3
33181 @itemx athlon64-sse3
33182 Improved versions of AMD K8 cores with SSE3 instruction set support.
33184 @item amdfam10
33185 @itemx barcelona
33186 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
33187 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
33188 instruction set extensions.)
33190 @item bdver1
33191 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
33192 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
33193 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
33195 @item bdver2
33196 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33197 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
33198 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
33199 extensions.)
33201 @item bdver3
33202 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33203 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
33204 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
33205 64-bit instruction set extensions.)
33207 @item bdver4
33208 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33209 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
33210 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
33211 SSE4.2, ABM and 64-bit instruction set extensions.)
33213 @item znver1
33214 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
33215 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
33216 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
33217 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
33218 instruction set extensions.)
33220 @item znver2
33221 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
33222 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33223 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33224 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33225 WBNOINVD, and 64-bit instruction set extensions.)
33227 @item znver3
33228 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33229 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33230 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33231 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33232 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
33234 @item znver4
33235 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33236 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33237 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33238 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33239 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
33240 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
33241 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
33243 @item btver1
33244 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
33245 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
33246 instruction set extensions.)
33248 @item btver2
33249 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
33250 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
33251 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
33253 @item winchip-c6
33254 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
33255 set support.
33257 @item winchip2
33258 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
33259 instruction set support.
33261 @item c3
33262 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
33263 (No scheduling is implemented for this chip.)
33265 @item c3-2
33266 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
33267 (No scheduling is implemented for this chip.)
33269 @item c7
33270 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33271 (No scheduling is implemented for this chip.)
33273 @item samuel-2
33274 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
33275 (No scheduling is implemented for this chip.)
33277 @item nehemiah
33278 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
33279 (No scheduling is implemented for this chip.)
33281 @item esther
33282 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33283 (No scheduling is implemented for this chip.)
33285 @item eden-x2
33286 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
33287 (No scheduling is implemented for this chip.)
33289 @item eden-x4
33290 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
33291 AVX and AVX2 instruction set support.
33292 (No scheduling is implemented for this chip.)
33294 @item nano
33295 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33296 instruction set support.
33297 (No scheduling is implemented for this chip.)
33299 @item nano-1000
33300 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33301 instruction set support.
33302 (No scheduling is implemented for this chip.)
33304 @item nano-2000
33305 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33306 instruction set support.
33307 (No scheduling is implemented for this chip.)
33309 @item nano-3000
33310 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33311 instruction set support.
33312 (No scheduling is implemented for this chip.)
33314 @item nano-x2
33315 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33316 instruction set support.
33317 (No scheduling is implemented for this chip.)
33319 @item nano-x4
33320 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33321 instruction set support.
33322 (No scheduling is implemented for this chip.)
33324 @item lujiazui
33325 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33326 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33327 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
33329 @item yongfeng
33330 ZHAOXIN yongfeng CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33331 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33332 ABM, BMI, BMI2, F16C, FXSR, RDSEED, AVX2, FMA, SHA, LZCNT
33333 instruction set support.
33335 @item geode
33336 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
33337 @end table
33339 @opindex mtune
33340 @item -mtune=@var{cpu-type}
33341 Tune to @var{cpu-type} everything applicable about the generated code, except
33342 for the ABI and the set of available instructions.  
33343 While picking a specific @var{cpu-type} schedules things appropriately
33344 for that particular chip, the compiler does not generate any code that
33345 cannot run on the default machine type unless you use a
33346 @option{-march=@var{cpu-type}} option.
33347 For example, if GCC is configured for i686-pc-linux-gnu
33348 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
33349 but still runs on i686 machines.
33351 The choices for @var{cpu-type} are the same as for @option{-march}.
33352 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
33354 @table @samp
33355 @item generic
33356 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
33357 If you know the CPU on which your code will run, then you should use
33358 the corresponding @option{-mtune} or @option{-march} option instead of
33359 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
33360 of your application will have, then you should use this option.
33362 As new processors are deployed in the marketplace, the behavior of this
33363 option will change.  Therefore, if you upgrade to a newer version of
33364 GCC, code generation controlled by this option will change to reflect
33365 the processors
33366 that are most common at the time that version of GCC is released.
33368 There is no @option{-march=generic} option because @option{-march}
33369 indicates the instruction set the compiler can use, and there is no
33370 generic instruction set applicable to all processors.  In contrast,
33371 @option{-mtune} indicates the processor (or, in this case, collection of
33372 processors) for which the code is optimized.
33374 @item intel
33375 Produce code optimized for the most current Intel processors, which are
33376 Haswell and Silvermont for this version of GCC.  If you know the CPU
33377 on which your code will run, then you should use the corresponding
33378 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
33379 But, if you want your application performs better on both Haswell and
33380 Silvermont, then you should use this option.
33382 As new Intel processors are deployed in the marketplace, the behavior of
33383 this option will change.  Therefore, if you upgrade to a newer version of
33384 GCC, code generation controlled by this option will change to reflect
33385 the most current Intel processors at the time that version of GCC is
33386 released.
33388 There is no @option{-march=intel} option because @option{-march} indicates
33389 the instruction set the compiler can use, and there is no common
33390 instruction set applicable to all processors.  In contrast,
33391 @option{-mtune} indicates the processor (or, in this case, collection of
33392 processors) for which the code is optimized.
33393 @end table
33395 @opindex mcpu
33396 @item -mcpu=@var{cpu-type}
33397 A deprecated synonym for @option{-mtune}.
33399 @opindex mfpmath
33400 @item -mfpmath=@var{unit}
33401 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
33402 for @var{unit} are:
33404 @table @samp
33405 @item 387
33406 Use the standard 387 floating-point coprocessor present on the majority of chips and
33407 emulated otherwise.  Code compiled with this option runs almost everywhere.
33408 The temporary results are computed in 80-bit precision instead of the precision
33409 specified by the type, resulting in slightly different results compared to most
33410 of other chips.  See @option{-ffloat-store} for more detailed description.
33412 This is the default choice for non-Darwin x86-32 targets.
33414 @item sse
33415 Use scalar floating-point instructions present in the SSE instruction set.
33416 This instruction set is supported by Pentium III and newer chips,
33417 and in the AMD line
33418 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
33419 instruction set supports only single-precision arithmetic, thus the double and
33420 extended-precision arithmetic are still done using 387.  A later version, present
33421 only in Pentium 4 and AMD x86-64 chips, supports double-precision
33422 arithmetic too.
33424 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
33425 or @option{-msse2} switches to enable SSE extensions and make this option
33426 effective.  For the x86-64 compiler, these extensions are enabled by default.
33428 The resulting code should be considerably faster in the majority of cases and avoid
33429 the numerical instability problems of 387 code, but may break some existing
33430 code that expects temporaries to be 80 bits.
33432 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
33433 and the default choice for x86-32 targets with the SSE2 instruction set
33434 when @option{-ffast-math} is enabled.
33436 @item sse,387
33437 @itemx sse+387
33438 @itemx both
33439 Attempt to utilize both instruction sets at once.  This effectively doubles the
33440 amount of available registers, and on chips with separate execution units for
33441 387 and SSE the execution resources too.  Use this option with care, as it is
33442 still experimental, because the GCC register allocator does not model separate
33443 functional units well, resulting in unstable performance.
33444 @end table
33446 @opindex masm=@var{dialect}
33447 @item -masm=@var{dialect}
33448 Output assembly instructions using selected @var{dialect}.  Also affects
33449 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
33450 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
33451 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
33452 not support @samp{intel}.
33454 @opindex mieee-fp
33455 @opindex mno-ieee-fp
33456 @item -mieee-fp
33457 @itemx -mno-ieee-fp
33458 Control whether or not the compiler uses IEEE floating-point
33459 comparisons.  These correctly handle the case where the result of a
33460 comparison is unordered.
33462 @opindex m80387
33463 @opindex mhard-float
33464 @item -m80387
33465 @itemx -mhard-float
33466 Generate output containing 80387 instructions for floating point.
33468 @opindex no-80387
33469 @opindex msoft-float
33470 @item -mno-80387
33471 @itemx -msoft-float
33472 Generate output containing library calls for floating point.
33474 @strong{Warning:} the requisite libraries are not part of GCC@.
33475 Normally the facilities of the machine's usual C compiler are used, but
33476 this cannot be done directly in cross-compilation.  You must make your
33477 own arrangements to provide suitable library functions for
33478 cross-compilation.
33480 On machines where a function returns floating-point results in the 80387
33481 register stack, some floating-point opcodes may be emitted even if
33482 @option{-msoft-float} is used.
33484 @opindex mno-fp-ret-in-387
33485 @opindex mfp-ret-in-387
33486 @item -mno-fp-ret-in-387
33487 Do not use the FPU registers for return values of functions.
33489 The usual calling convention has functions return values of types
33490 @code{float} and @code{double} in an FPU register, even if there
33491 is no FPU@.  The idea is that the operating system should emulate
33492 an FPU@.
33494 The option @option{-mno-fp-ret-in-387} causes such values to be returned
33495 in ordinary CPU registers instead.
33497 @opindex mno-fancy-math-387
33498 @opindex mfancy-math-387
33499 @item -mno-fancy-math-387
33500 Some 387 emulators do not support the @code{sin}, @code{cos} and
33501 @code{sqrt} instructions for the 387.  Specify this option to avoid
33502 generating those instructions.
33503 This option is overridden when @option{-march}
33504 indicates that the target CPU always has an FPU and so the
33505 instruction does not need emulation.  These
33506 instructions are not generated unless you also use the
33507 @option{-funsafe-math-optimizations} switch.
33509 @opindex malign-double
33510 @opindex mno-align-double
33511 @item -malign-double
33512 @itemx -mno-align-double
33513 Control whether GCC aligns @code{double}, @code{long double}, and
33514 @code{long long} variables on a two-word boundary or a one-word
33515 boundary.  Aligning @code{double} variables on a two-word boundary
33516 produces code that runs somewhat faster on a Pentium at the
33517 expense of more memory.
33519 On x86-64, @option{-malign-double} is enabled by default.
33521 @strong{Warning:} if you use the @option{-malign-double} switch,
33522 structures containing the above types are aligned differently than
33523 the published application binary interface specifications for the x86-32
33524 and are not binary compatible with structures in code compiled
33525 without that switch.
33527 @opindex m96bit-long-double
33528 @opindex m128bit-long-double
33529 @item -m96bit-long-double
33530 @itemx -m128bit-long-double
33531 These switches control the size of @code{long double} type.  The x86-32
33532 application binary interface specifies the size to be 96 bits,
33533 so @option{-m96bit-long-double} is the default in 32-bit mode.
33535 Modern architectures (Pentium and newer) prefer @code{long double}
33536 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
33537 conforming to the ABI, this is not possible.  So specifying
33538 @option{-m128bit-long-double} aligns @code{long double}
33539 to a 16-byte boundary by padding the @code{long double} with an additional
33540 32-bit zero.
33542 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
33543 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
33545 Notice that neither of these options enable any extra precision over the x87
33546 standard of 80 bits for a @code{long double}.
33548 @strong{Warning:} if you override the default value for your target ABI, this
33549 changes the size of 
33550 structures and arrays containing @code{long double} variables,
33551 as well as modifying the function calling convention for functions taking
33552 @code{long double}.  Hence they are not binary-compatible
33553 with code compiled without that switch.
33555 @opindex mlong-double-64
33556 @opindex mlong-double-80
33557 @opindex mlong-double-128
33558 @item -mlong-double-64
33559 @itemx -mlong-double-80
33560 @itemx -mlong-double-128
33561 These switches control the size of @code{long double} type. A size
33562 of 64 bits makes the @code{long double} type equivalent to the @code{double}
33563 type. This is the default for 32-bit Bionic C library.  A size
33564 of 128 bits makes the @code{long double} type equivalent to the
33565 @code{__float128} type. This is the default for 64-bit Bionic C library.
33567 @strong{Warning:} if you override the default value for your target ABI, this
33568 changes the size of
33569 structures and arrays containing @code{long double} variables,
33570 as well as modifying the function calling convention for functions taking
33571 @code{long double}.  Hence they are not binary-compatible
33572 with code compiled without that switch.
33574 @opindex malign-data
33575 @item -malign-data=@var{type}
33576 Control how GCC aligns variables.  Supported values for @var{type} are
33577 @samp{compat} uses increased alignment value compatible uses GCC 4.8
33578 and earlier, @samp{abi} uses alignment value as specified by the
33579 psABI, and @samp{cacheline} uses increased alignment value to match
33580 the cache line size.  @samp{compat} is the default.
33582 @opindex mlarge-data-threshold
33583 @item -mlarge-data-threshold=@var{threshold}
33584 When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
33585 objects larger than @var{threshold} are placed in large data sections.  The
33586 default is 65535.
33588 @opindex mrtd
33589 @item -mrtd
33590 Use a different function-calling convention, in which functions that
33591 take a fixed number of arguments return with the @code{ret @var{num}}
33592 instruction, which pops their arguments while returning.  This saves one
33593 instruction in the caller since there is no need to pop the arguments
33594 there.
33596 You can specify that an individual function is called with this calling
33597 sequence with the function attribute @code{stdcall}.  You can also
33598 override the @option{-mrtd} option by using the function attribute
33599 @code{cdecl}.  @xref{Function Attributes}.
33601 @strong{Warning:} this calling convention is incompatible with the one
33602 normally used on Unix, so you cannot use it if you need to call
33603 libraries compiled with the Unix compiler.
33605 Also, you must provide function prototypes for all functions that
33606 take variable numbers of arguments (including @code{printf});
33607 otherwise incorrect code is generated for calls to those
33608 functions.
33610 In addition, seriously incorrect code results if you call a
33611 function with too many arguments.  (Normally, extra arguments are
33612 harmlessly ignored.)
33614 @opindex mregparm
33615 @item -mregparm=@var{num}
33616 Control how many registers are used to pass integer arguments.  By
33617 default, no registers are used to pass arguments, and at most 3
33618 registers can be used.  You can control this behavior for a specific
33619 function by using the function attribute @code{regparm}.
33620 @xref{Function Attributes}.
33622 @strong{Warning:} if you use this switch, and
33623 @var{num} is nonzero, then you must build all modules with the same
33624 value, including any libraries.  This includes the system libraries and
33625 startup modules.
33627 @opindex msseregparm
33628 @item -msseregparm
33629 Use SSE register passing conventions for float and double arguments
33630 and return values.  You can control this behavior for a specific
33631 function by using the function attribute @code{sseregparm}.
33632 @xref{Function Attributes}.
33634 @strong{Warning:} if you use this switch then you must build all
33635 modules with the same value, including any libraries.  This includes
33636 the system libraries and startup modules.
33638 @opindex mvect8-ret-in-mem
33639 @item -mvect8-ret-in-mem
33640 Return 8-byte vectors in memory instead of MMX registers.  This is the
33641 default on VxWorks to match the ABI of the Sun Studio compilers until
33642 version 12.  @emph{Only} use this option if you need to remain
33643 compatible with existing code produced by those previous compiler
33644 versions or older versions of GCC@.
33646 @opindex mpc32
33647 @opindex mpc64
33648 @opindex mpc80
33649 @item -mpc32
33650 @itemx -mpc64
33651 @itemx -mpc80
33653 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
33654 is specified, the significands of results of floating-point operations are
33655 rounded to 24 bits (single precision); @option{-mpc64} rounds the
33656 significands of results of floating-point operations to 53 bits (double
33657 precision) and @option{-mpc80} rounds the significands of results of
33658 floating-point operations to 64 bits (extended double precision), which is
33659 the default.  When this option is used, floating-point operations in higher
33660 precisions are not available to the programmer without setting the FPU
33661 control word explicitly.
33663 Setting the rounding of floating-point operations to less than the default
33664 80 bits can speed some programs by 2% or more.  Note that some mathematical
33665 libraries assume that extended-precision (80-bit) floating-point operations
33666 are enabled by default; routines in such libraries could suffer significant
33667 loss of accuracy, typically through so-called ``catastrophic cancellation'',
33668 when this option is used to set the precision to less than extended precision.
33670 @opindex mdaz-ftz
33671 @item -mdaz-ftz
33673 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
33674 are used to control floating-point calculations.SSE and AVX instructions
33675 including scalar and vector instructions could benefit from enabling the FTZ
33676 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
33677 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
33678 will set FTZ/DAZ flags even with @option{-shared}.
33680 @opindex mstackrealign
33681 @item -mstackrealign
33682 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
33683 option generates an alternate prologue and epilogue that realigns the
33684 run-time stack if necessary.  This supports mixing legacy codes that keep
33685 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
33686 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
33687 applicable to individual functions.
33689 @opindex mpreferred-stack-boundary
33690 @item -mpreferred-stack-boundary=@var{num}
33691 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
33692 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
33693 the default is 4 (16 bytes or 128 bits).
33695 @strong{Warning:} When generating code for the x86-64 architecture with
33696 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
33697 used to keep the stack boundary aligned to 8 byte boundary.  Since
33698 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
33699 intended to be used in controlled environment where stack space is
33700 important limitation.  This option leads to wrong code when functions
33701 compiled with 16 byte stack alignment (such as functions from a standard
33702 library) are called with misaligned stack.  In this case, SSE
33703 instructions may lead to misaligned memory access traps.  In addition,
33704 variable arguments are handled incorrectly for 16 byte aligned
33705 objects (including x87 long double and __int128), leading to wrong
33706 results.  You must build all modules with
33707 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
33708 includes the system libraries and startup modules.
33710 @opindex mincoming-stack-boundary
33711 @item -mincoming-stack-boundary=@var{num}
33712 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
33713 boundary.  If @option{-mincoming-stack-boundary} is not specified,
33714 the one specified by @option{-mpreferred-stack-boundary} is used.
33716 On Pentium and Pentium Pro, @code{double} and @code{long double} values
33717 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
33718 suffer significant run time performance penalties.  On Pentium III, the
33719 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
33720 properly if it is not 16-byte aligned.
33722 To ensure proper alignment of this values on the stack, the stack boundary
33723 must be as aligned as that required by any value stored on the stack.
33724 Further, every function must be generated such that it keeps the stack
33725 aligned.  Thus calling a function compiled with a higher preferred
33726 stack boundary from a function compiled with a lower preferred stack
33727 boundary most likely misaligns the stack.  It is recommended that
33728 libraries that use callbacks always use the default setting.
33730 This extra alignment does consume extra stack space, and generally
33731 increases code size.  Code that is sensitive to stack space usage, such
33732 as embedded systems and operating system kernels, may want to reduce the
33733 preferred alignment to @option{-mpreferred-stack-boundary=2}.
33735 @need 200
33736 @opindex mmmx
33737 @item -mmmx
33738 @need 200
33739 @opindex msse
33740 @itemx -msse
33741 @need 200
33742 @opindex msse2
33743 @itemx -msse2
33744 @need 200
33745 @opindex msse3
33746 @itemx -msse3
33747 @need 200
33748 @opindex mssse3
33749 @itemx -mssse3
33750 @need 200
33751 @opindex msse4
33752 @itemx -msse4
33753 @need 200
33754 @opindex msse4a
33755 @itemx -msse4a
33756 @need 200
33757 @opindex msse4.1
33758 @itemx -msse4.1
33759 @need 200
33760 @opindex msse4.2
33761 @itemx -msse4.2
33762 @need 200
33763 @opindex mavx
33764 @itemx -mavx
33765 @need 200
33766 @opindex mavx2
33767 @itemx -mavx2
33768 @need 200
33769 @opindex mavx512f
33770 @itemx -mavx512f
33771 @need 200
33772 @opindex mavx512pf
33773 @itemx -mavx512pf
33774 @need 200
33775 @opindex mavx512er
33776 @itemx -mavx512er
33777 @need 200
33778 @opindex mavx512cd
33779 @itemx -mavx512cd
33780 @need 200
33781 @opindex mavx512vl
33782 @itemx -mavx512vl
33783 @need 200
33784 @opindex mavx512bw
33785 @itemx -mavx512bw
33786 @need 200
33787 @opindex mavx512dq
33788 @itemx -mavx512dq
33789 @need 200
33790 @opindex mavx512ifma
33791 @itemx -mavx512ifma
33792 @need 200
33793 @opindex mavx512vbmi
33794 @itemx -mavx512vbmi
33795 @need 200
33796 @opindex msha
33797 @itemx -msha
33798 @need 200
33799 @opindex maes
33800 @itemx -maes
33801 @need 200
33802 @opindex mpclmul
33803 @itemx -mpclmul
33804 @need 200
33805 @opindex mclflushopt
33806 @itemx -mclflushopt
33807 @need 200
33808 @opindex mclwb
33809 @itemx -mclwb
33810 @need 200
33811 @opindex mfsgsbase
33812 @itemx -mfsgsbase
33813 @need 200
33814 @opindex mptwrite
33815 @itemx -mptwrite
33816 @need 200
33817 @opindex mrdrnd
33818 @itemx -mrdrnd
33819 @need 200
33820 @opindex mf16c
33821 @itemx -mf16c
33822 @need 200
33823 @opindex mfma
33824 @itemx -mfma
33825 @need 200
33826 @opindex mpconfig
33827 @itemx -mpconfig
33828 @need 200
33829 @opindex mwbnoinvd
33830 @itemx -mwbnoinvd
33831 @need 200
33832 @opindex mfma4
33833 @itemx -mfma4
33834 @need 200
33835 @opindex mprfchw
33836 @itemx -mprfchw
33837 @need 200
33838 @opindex mrdpid
33839 @itemx -mrdpid
33840 @need 200
33841 @opindex mprefetchwt1
33842 @itemx -mprefetchwt1
33843 @need 200
33844 @opindex mrdseed
33845 @itemx -mrdseed
33846 @need 200
33847 @opindex msgx
33848 @itemx -msgx
33849 @need 200
33850 @opindex mxop
33851 @itemx -mxop
33852 @need 200
33853 @opindex mlwp
33854 @itemx -mlwp
33855 @need 200
33856 @opindex m3dnow
33857 @itemx -m3dnow
33858 @need 200
33859 @opindex m3dnowa
33860 @itemx -m3dnowa
33861 @need 200
33862 @opindex mpopcnt
33863 @itemx -mpopcnt
33864 @need 200
33865 @opindex mabm
33866 @itemx -mabm
33867 @need 200
33868 @opindex madx
33869 @itemx -madx
33870 @need 200
33871 @opindex mbmi
33872 @itemx -mbmi
33873 @need 200
33874 @opindex mbmi2
33875 @itemx -mbmi2
33876 @need 200
33877 @opindex mlzcnt
33878 @itemx -mlzcnt
33879 @need 200
33880 @opindex mfxsr
33881 @itemx -mfxsr
33882 @need 200
33883 @opindex mxsave
33884 @itemx -mxsave
33885 @need 200
33886 @opindex mxsaveopt
33887 @itemx -mxsaveopt
33888 @need 200
33889 @opindex mxsavec
33890 @itemx -mxsavec
33891 @need 200
33892 @opindex mxsaves
33893 @itemx -mxsaves
33894 @need 200
33895 @opindex mrtm
33896 @itemx -mrtm
33897 @need 200
33898 @opindex mhle
33899 @itemx -mhle
33900 @need 200
33901 @opindex mtbm
33902 @itemx -mtbm
33903 @need 200
33904 @opindex mmwaitx
33905 @itemx -mmwaitx
33906 @need 200
33907 @opindex mclzero
33908 @itemx -mclzero
33909 @need 200
33910 @opindex mpku
33911 @itemx -mpku
33912 @need 200
33913 @opindex mavx512vbmi2
33914 @itemx -mavx512vbmi2
33915 @need 200
33916 @opindex mavx512bf16
33917 @itemx -mavx512bf16
33918 @need 200
33919 @opindex mavx512fp16
33920 @itemx -mavx512fp16
33921 @need 200
33922 @opindex mgfni
33923 @itemx -mgfni
33924 @need 200
33925 @opindex mvaes
33926 @itemx -mvaes
33927 @need 200
33928 @opindex mwaitpkg
33929 @itemx -mwaitpkg
33930 @need 200
33931 @opindex mvpclmulqdq
33932 @itemx -mvpclmulqdq
33933 @need 200
33934 @opindex mavx512bitalg
33935 @itemx -mavx512bitalg
33936 @need 200
33937 @opindex mmovdiri
33938 @itemx -mmovdiri
33939 @need 200
33940 @opindex mmovdir64b
33941 @itemx -mmovdir64b
33942 @need 200
33943 @opindex menqcmd
33944 @opindex muintr
33945 @itemx -menqcmd
33946 @itemx -muintr
33947 @need 200
33948 @opindex mtsxldtrk
33949 @itemx -mtsxldtrk
33950 @need 200
33951 @opindex mavx512vpopcntdq
33952 @itemx -mavx512vpopcntdq
33953 @need 200
33954 @opindex mavx512vp2intersect
33955 @itemx -mavx512vp2intersect
33956 @need 200
33957 @opindex mavx5124fmaps
33958 @itemx -mavx5124fmaps
33959 @need 200
33960 @opindex mavx512vnni
33961 @itemx -mavx512vnni
33962 @need 200
33963 @opindex mavxvnni
33964 @itemx -mavxvnni
33965 @need 200
33966 @opindex mavx5124vnniw
33967 @itemx -mavx5124vnniw
33968 @need 200
33969 @opindex mcldemote
33970 @itemx -mcldemote
33971 @need 200
33972 @opindex mserialize
33973 @itemx -mserialize
33974 @need 200
33975 @opindex mamx-tile
33976 @itemx -mamx-tile
33977 @need 200
33978 @opindex mamx-int8
33979 @itemx -mamx-int8
33980 @need 200
33981 @opindex mamx-bf16
33982 @itemx -mamx-bf16
33983 @need 200
33984 @opindex mhreset
33985 @opindex mkl
33986 @itemx -mhreset
33987 @itemx -mkl
33988 @need 200
33989 @opindex mwidekl
33990 @itemx -mwidekl
33991 @need 200
33992 @opindex mavxifma
33993 @itemx -mavxifma
33994 @need 200
33995 @opindex mavxvnniint8
33996 @itemx -mavxvnniint8
33997 @need 200
33998 @opindex mavxneconvert
33999 @itemx -mavxneconvert
34000 @need 200
34001 @opindex mcmpccxadd
34002 @itemx -mcmpccxadd
34003 @need 200
34004 @opindex mamx-fp16
34005 @itemx -mamx-fp16
34006 @need 200
34007 @opindex mprefetchi
34008 @itemx -mprefetchi
34009 @need 200
34010 @opindex mraoint
34011 @itemx -mraoint
34012 @need 200
34013 @opindex mamx-complex
34014 @itemx -mamx-complex
34015 @need 200
34016 @opindex mavxvnniint16
34017 @itemx -mavxvnniint16
34018 @need 200
34019 @opindex msm3
34020 @itemx -msm3
34021 @need 200
34022 @opindex msha512
34023 @itemx -msha512
34024 @need 200
34025 @opindex msm4
34026 @itemx -msm4
34027 @need 200
34028 @opindex mapxf
34029 @itemx -mapxf
34030 @need 200
34031 @opindex musermsr
34032 @itemx -musermsr
34033 These switches enable the use of instructions in the MMX, SSE,
34034 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
34035 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
34036 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
34037 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
34038 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
34039 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
34040 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
34041 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
34042 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
34043 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4, APX_F, USER_MSR or CLDEMOTE
34044 extended instruction sets.  Each has a corresponding @option{-mno-} option
34045 to disable use of these instructions.
34047 These extensions are also available as built-in functions: see
34048 @ref{x86 Built-in Functions}, for details of the functions enabled and
34049 disabled by these switches.
34051 To generate SSE/SSE2 instructions automatically from floating-point
34052 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
34054 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
34055 generates new AVX instructions or AVX equivalence for all SSEx instructions
34056 when needed.
34058 These options enable GCC to use these extended instructions in
34059 generated code, even without @option{-mfpmath=sse}.  Applications that
34060 perform run-time CPU detection must compile separate files for each
34061 supported architecture, using the appropriate flags.  In particular,
34062 the file containing the CPU detection code should be compiled without
34063 these options.
34065 @opindex mdump-tune-features
34066 @item -mdump-tune-features
34067 This option instructs GCC to dump the names of the x86 performance 
34068 tuning features and default settings. The names can be used in 
34069 @option{-mtune-ctrl=@var{feature-list}}.
34071 @opindex mtune-ctrl=@var{feature-list}
34072 @item -mtune-ctrl=@var{feature-list}
34073 This option is used to do fine grain control of x86 code generation features.
34074 @var{feature-list} is a comma separated list of @var{feature} names. See also
34075 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
34076 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
34077 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
34078 developers. Using it may lead to code paths not covered by testing and can
34079 potentially result in compiler ICEs or runtime errors.
34081 @opindex mno-default
34082 @item -mno-default
34083 This option instructs GCC to turn off all tunable features. See also 
34084 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
34086 @opindex mcld
34087 @item -mcld
34088 This option instructs GCC to emit a @code{cld} instruction in the prologue
34089 of functions that use string instructions.  String instructions depend on
34090 the DF flag to select between autoincrement or autodecrement mode.  While the
34091 ABI specifies the DF flag to be cleared on function entry, some operating
34092 systems violate this specification by not clearing the DF flag in their
34093 exception dispatchers.  The exception handler can be invoked with the DF flag
34094 set, which leads to wrong direction mode when string instructions are used.
34095 This option can be enabled by default on 32-bit x86 targets by configuring
34096 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
34097 instructions can be suppressed with the @option{-mno-cld} compiler option
34098 in this case.
34100 @opindex mvzeroupper
34101 @item -mvzeroupper
34102 This option instructs GCC to emit a @code{vzeroupper} instruction
34103 before a transfer of control flow out of the function to minimize
34104 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
34105 intrinsics.
34107 @opindex mprefer-avx128
34108 @item -mprefer-avx128
34109 This option instructs GCC to use 128-bit AVX instructions instead of
34110 256-bit AVX instructions in the auto-vectorizer.
34112 @opindex mprefer-vector-width
34113 @item -mprefer-vector-width=@var{opt}
34114 This option instructs GCC to use @var{opt}-bit vector width in instructions
34115 instead of default on the selected platform.
34117 @opindex mpartial-vector-fp-math
34118 @item -mpartial-vector-fp-math
34119 This option enables GCC to generate floating-point operations that might
34120 affect the set of floating-point status flags on partial vectors, where
34121 vector elements reside in the low part of the 128-bit SSE register.  Unless
34122 @option{-fno-trapping-math} is specified, the compiler guarantees correct
34123 behavior by sanitizing all input operands to have zeroes in the unused
34124 upper part of the vector register.  Note that by using built-in functions
34125 or inline assembly with partial vector arguments, NaNs, denormal or invalid
34126 values can leak into the upper part of the vector, causing possible
34127 performance issues when @option{-fno-trapping-math} is in effect.  These
34128 issues can be mitigated by manually sanitizing the upper part of the partial
34129 vector argument register or by using @option{-mdaz-ftz} to set
34130 denormals-are-zero (DAZ) flag in the MXCSR register.
34132 This option is enabled by default.
34134 @opindex mmove-max
34135 @item -mmove-max=@var{bits}
34136 This option instructs GCC to set the maximum number of bits can be
34137 moved from memory to memory efficiently to @var{bits}.  The valid
34138 @var{bits} are 128, 256 and 512.
34140 @opindex mstore-max
34141 @item -mstore-max=@var{bits}
34142 This option instructs GCC to set the maximum number of bits can be
34143 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
34144 128, 256 and 512.
34146 @table @samp
34147 @item none
34148 No extra limitations applied to GCC other than defined by the selected platform.
34150 @item 128
34151 Prefer 128-bit vector width for instructions.
34153 @item 256
34154 Prefer 256-bit vector width for instructions.
34156 @item 512
34157 Prefer 512-bit vector width for instructions.
34158 @end table
34160 @opindex mcx16
34161 @item -mcx16
34162 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
34163 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
34164 objects.  This is useful for atomic updates of data structures exceeding one
34165 machine word in size.  The compiler uses this instruction to implement
34166 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
34167 128-bit integers, a library call is always used.
34169 @opindex msahf
34170 @item -msahf
34171 This option enables generation of @code{SAHF} instructions in 64-bit code.
34172 Early Intel Pentium 4 CPUs with Intel 64 support,
34173 prior to the introduction of Pentium 4 G1 step in December 2005,
34174 lacked the @code{LAHF} and @code{SAHF} instructions
34175 which are supported by AMD64.
34176 These are load and store instructions, respectively, for certain status flags.
34177 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
34178 @code{drem}, and @code{remainder} built-in functions;
34179 see @ref{Other Builtins} for details.
34181 @opindex mmovbe
34182 @item -mmovbe
34183 This option enables use of the @code{movbe} instruction to implement
34184 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
34186 @opindex mshstk
34187 @item -mshstk
34188 The @option{-mshstk} option enables shadow stack built-in functions
34189 from x86 Control-flow Enforcement Technology (CET).
34191 @opindex mcrc32
34192 @item -mcrc32
34193 This option enables built-in functions @code{__builtin_ia32_crc32qi},
34194 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
34195 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
34197 @opindex mmwait
34198 @item -mmwait
34199 This option enables built-in functions @code{__builtin_ia32_monitor},
34200 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
34201 @code{mwait} machine instructions.
34203 @opindex mrecip
34204 @item -mrecip
34205 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
34206 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
34207 with an additional Newton-Raphson step
34208 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
34209 (and their vectorized
34210 variants) for single-precision floating-point arguments.  These instructions
34211 are generated only when @option{-funsafe-math-optimizations} is enabled
34212 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
34213 Note that while the throughput of the sequence is higher than the throughput
34214 of the non-reciprocal instruction, the precision of the sequence can be
34215 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
34217 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
34218 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
34219 combination), and doesn't need @option{-mrecip}.
34221 Also note that GCC emits the above sequence with additional Newton-Raphson step
34222 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
34223 already with @option{-ffast-math} (or the above option combination), and
34224 doesn't need @option{-mrecip}.
34226 @opindex mrecip=opt
34227 @item -mrecip=@var{opt}
34228 This option controls which reciprocal estimate instructions
34229 may be used.  @var{opt} is a comma-separated list of options, which may
34230 be preceded by a @samp{!} to invert the option:
34232 @table @samp
34233 @item all
34234 Enable all estimate instructions.
34236 @item default
34237 Enable the default instructions, equivalent to @option{-mrecip}.
34239 @item none
34240 Disable all estimate instructions, equivalent to @option{-mno-recip}.
34242 @item div
34243 Enable the approximation for scalar division.
34245 @item vec-div
34246 Enable the approximation for vectorized division.
34248 @item sqrt
34249 Enable the approximation for scalar square root.
34251 @item vec-sqrt
34252 Enable the approximation for vectorized square root.
34253 @end table
34255 So, for example, @option{-mrecip=all,!sqrt} enables
34256 all of the reciprocal approximations, except for square root.
34258 @opindex mveclibabi
34259 @item -mveclibabi=@var{type}
34260 Specifies the ABI type to use for vectorizing intrinsics using an
34261 external library.  Supported values for @var{type} are @samp{svml} 
34262 for the Intel short
34263 vector math library and @samp{acml} for the AMD math core library.
34264 To use this option, both @option{-ftree-vectorize} and
34265 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
34266 ABI-compatible library must be specified at link time.
34268 GCC currently emits calls to @code{vmldExp2},
34269 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
34270 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
34271 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
34272 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
34273 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
34274 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
34275 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
34276 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
34277 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
34278 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
34279 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
34280 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
34281 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
34282 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
34283 when @option{-mveclibabi=acml} is used.  
34285 @opindex mabi
34286 @item -mabi=@var{name}
34287 Generate code for the specified calling convention.  Permissible values
34288 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
34289 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
34290 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
34291 You can control this behavior for specific functions by
34292 using the function attributes @code{ms_abi} and @code{sysv_abi}.
34293 @xref{Function Attributes}.
34295 @opindex mforce-indirect-call
34296 @item -mforce-indirect-call
34297 Force all calls to functions to be indirect. This is useful
34298 when using Intel Processor Trace where it generates more precise timing
34299 information for function calls.
34301 @opindex mmanual-endbr
34302 @item -mmanual-endbr
34303 Insert ENDBR instruction at function entry only via the @code{cf_check}
34304 function attribute. This is useful when used with the option
34305 @option{-fcf-protection=branch} to control ENDBR insertion at the
34306 function entry.
34308 @opindex mcet-switch
34309 @item -mcet-switch
34310 By default, CET instrumentation is turned off on switch statements that
34311 use a jump table and indirect branch track is disabled.  Since jump
34312 tables are stored in read-only memory, this does not result in a direct
34313 loss of hardening.  But if the jump table index is attacker-controlled,
34314 the indirect jump may not be constrained by CET.  This option turns on
34315 CET instrumentation to enable indirect branch track for switch statements
34316 with jump tables which leads to the jump targets reachable via any indirect
34317 jumps.
34319 @opindex mcall-ms2sysv-xlogues
34320 @opindex mno-call-ms2sysv-xlogues
34321 @item -mcall-ms2sysv-xlogues
34322 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
34323 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
34324 default, the code for saving and restoring these registers is emitted inline,
34325 resulting in fairly lengthy prologues and epilogues.  Using
34326 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
34327 use stubs in the static portion of libgcc to perform these saves and restores,
34328 thus reducing function size at the cost of a few extra instructions.
34330 @opindex mtls-dialect
34331 @item -mtls-dialect=@var{type}
34332 Generate code to access thread-local storage using the @samp{gnu} or
34333 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
34334 @samp{gnu2} is more efficient, but it may add compile- and run-time
34335 requirements that cannot be satisfied on all systems.
34337 @opindex mpush-args
34338 @opindex mno-push-args
34339 @item -mpush-args
34340 @itemx -mno-push-args
34341 Use PUSH operations to store outgoing parameters.  This method is shorter
34342 and usually equally fast as method using SUB/MOV operations and is enabled
34343 by default.  In some cases disabling it may improve performance because of
34344 improved scheduling and reduced dependencies.
34346 @opindex maccumulate-outgoing-args
34347 @item -maccumulate-outgoing-args
34348 If enabled, the maximum amount of space required for outgoing arguments is
34349 computed in the function prologue.  This is faster on most modern CPUs
34350 because of reduced dependencies, improved scheduling and reduced stack usage
34351 when the preferred stack boundary is not equal to 2.  The drawback is a notable
34352 increase in code size.  This switch implies @option{-mno-push-args}.
34354 @opindex mthreads
34355 @item -mthreads
34356 Support thread-safe exception handling on MinGW.  Programs that rely
34357 on thread-safe exception handling must compile and link all code with the
34358 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
34359 @option{-D_MT}; when linking, it links in a special thread helper library
34360 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
34362 @opindex mms-bitfields
34363 @opindex mno-ms-bitfields
34364 @item -mms-bitfields
34365 @itemx -mno-ms-bitfields
34367 Enable/disable bit-field layout compatible with the native Microsoft
34368 Windows compiler.  
34370 If @code{packed} is used on a structure, or if bit-fields are used,
34371 it may be that the Microsoft ABI lays out the structure differently
34372 than the way GCC normally does.  Particularly when moving packed
34373 data between functions compiled with GCC and the native Microsoft compiler
34374 (either via function call or as data in a file), it may be necessary to access
34375 either format.
34377 This option is enabled by default for Microsoft Windows
34378 targets.  This behavior can also be controlled locally by use of variable
34379 or type attributes.  For more information, see @ref{x86 Variable Attributes}
34380 and @ref{x86 Type Attributes}.
34382 The Microsoft structure layout algorithm is fairly simple with the exception
34383 of the bit-field packing.  
34384 The padding and alignment of members of structures and whether a bit-field 
34385 can straddle a storage-unit boundary are determine by these rules:
34387 @enumerate
34388 @item Structure members are stored sequentially in the order in which they are
34389 declared: the first member has the lowest memory address and the last member
34390 the highest.
34392 @item Every data object has an alignment requirement.  The alignment requirement
34393 for all data except structures, unions, and arrays is either the size of the
34394 object or the current packing size (specified with either the
34395 @code{aligned} attribute or the @code{pack} pragma),
34396 whichever is less.  For structures, unions, and arrays,
34397 the alignment requirement is the largest alignment requirement of its members.
34398 Every object is allocated an offset so that:
34400 @smallexample
34401 offset % alignment_requirement == 0
34402 @end smallexample
34404 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
34405 unit if the integral types are the same size and if the next bit-field fits
34406 into the current allocation unit without crossing the boundary imposed by the
34407 common alignment requirements of the bit-fields.
34408 @end enumerate
34410 MSVC interprets zero-length bit-fields in the following ways:
34412 @enumerate
34413 @item If a zero-length bit-field is inserted between two bit-fields that
34414 are normally coalesced, the bit-fields are not coalesced.
34416 For example:
34418 @smallexample
34419 struct
34420  @{
34421    unsigned long bf_1 : 12;
34422    unsigned long : 0;
34423    unsigned long bf_2 : 12;
34424  @} t1;
34425 @end smallexample
34427 @noindent
34428 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
34429 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
34431 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
34432 alignment of the zero-length bit-field is greater than the member that follows it,
34433 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
34435 For example:
34437 @smallexample
34438 struct
34439  @{
34440    char foo : 4;
34441    short : 0;
34442    char bar;
34443  @} t2;
34445 struct
34446  @{
34447    char foo : 4;
34448    short : 0;
34449    double bar;
34450  @} t3;
34451 @end smallexample
34453 @noindent
34454 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
34455 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
34456 bit-field does not affect the alignment of @code{bar} or, as a result, the size
34457 of the structure.
34459 Taking this into account, it is important to note the following:
34461 @enumerate
34462 @item If a zero-length bit-field follows a normal bit-field, the type of the
34463 zero-length bit-field may affect the alignment of the structure as whole. For
34464 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
34465 normal bit-field, and is of type short.
34467 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
34468 still affect the alignment of the structure:
34470 @smallexample
34471 struct
34472  @{
34473    char foo : 6;
34474    long : 0;
34475  @} t4;
34476 @end smallexample
34478 @noindent
34479 Here, @code{t4} takes up 4 bytes.
34480 @end enumerate
34482 @item Zero-length bit-fields following non-bit-field members are ignored:
34484 @smallexample
34485 struct
34486  @{
34487    char foo;
34488    long : 0;
34489    char bar;
34490  @} t5;
34491 @end smallexample
34493 @noindent
34494 Here, @code{t5} takes up 2 bytes.
34495 @end enumerate
34498 @opindex mno-align-stringops
34499 @opindex malign-stringops
34500 @item -mno-align-stringops
34501 Do not align the destination of inlined string operations.  This switch reduces
34502 code size and improves performance in case the destination is already aligned,
34503 but GCC doesn't know about it.
34505 @opindex minline-all-stringops
34506 @item -minline-all-stringops
34507 By default GCC inlines string operations only when the destination is 
34508 known to be aligned to least a 4-byte boundary.  
34509 This enables more inlining and increases code
34510 size, but may improve performance of code that depends on fast
34511 @code{memcpy} and @code{memset} for short lengths.
34512 The option enables inline expansion of @code{strlen} for all
34513 pointer alignments.
34515 @opindex minline-stringops-dynamically
34516 @item -minline-stringops-dynamically
34517 For string operations of unknown size, use run-time checks with
34518 inline code for small blocks and a library call for large blocks.
34520 @opindex mstringop-strategy=@var{alg}
34521 @item -mstringop-strategy=@var{alg}
34522 Override the internal decision heuristic for the particular algorithm to use
34523 for inlining string operations.  The allowed values for @var{alg} are:
34525 @table @samp
34526 @item rep_byte
34527 @itemx rep_4byte
34528 @itemx rep_8byte
34529 Expand using i386 @code{rep} prefix of the specified size.
34531 @item byte_loop
34532 @itemx loop
34533 @itemx unrolled_loop
34534 Expand into an inline loop.
34536 @item libcall
34537 Always use a library call.
34538 @end table
34540 @opindex mmemcpy-strategy=@var{strategy}
34541 @item -mmemcpy-strategy=@var{strategy}
34542 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
34543 should be inlined and what inline algorithm to use when the expected size
34544 of the copy operation is known. @var{strategy} 
34545 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
34546 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
34547 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
34548 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
34549 in the list must be specified in increasing order.  The minimal byte size for 
34550 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
34551 preceding range.
34553 @opindex mmemset-strategy=@var{strategy}
34554 @item -mmemset-strategy=@var{strategy}
34555 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
34556 @code{__builtin_memset} expansion.
34558 @opindex momit-leaf-frame-pointer
34559 @item -momit-leaf-frame-pointer
34560 Don't keep the frame pointer in a register for leaf functions.  This
34561 avoids the instructions to save, set up, and restore frame pointers and
34562 makes an extra register available in leaf functions.  The option
34563 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
34564 which might make debugging harder.
34566 @opindex mtls-direct-seg-refs
34567 @item -mtls-direct-seg-refs
34568 @itemx -mno-tls-direct-seg-refs
34569 Controls whether TLS variables may be accessed with offsets from the
34570 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
34571 or whether the thread base pointer must be added.  Whether or not this
34572 is valid depends on the operating system, and whether it maps the
34573 segment to cover the entire TLS area.
34575 For systems that use the GNU C Library, the default is on.
34577 @opindex msse2avx
34578 @item -msse2avx
34579 @itemx -mno-sse2avx
34580 Specify that the assembler should encode SSE instructions with VEX
34581 prefix.  The option @option{-mavx} turns this on by default.
34583 @opindex mfentry
34584 @item -mfentry
34585 @itemx -mno-fentry
34586 If profiling is active (@option{-pg}), put the profiling
34587 counter call before the prologue.
34588 Note: On x86 architectures the attribute @code{ms_hook_prologue}
34589 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
34591 @opindex mrecord-mcount
34592 @item -mrecord-mcount
34593 @itemx -mno-record-mcount
34594 If profiling is active (@option{-pg}), generate a __mcount_loc section
34595 that contains pointers to each profiling call. This is useful for
34596 automatically patching and out calls.
34598 @opindex mnop-mcount
34599 @item -mnop-mcount
34600 @itemx -mno-nop-mcount
34601 If profiling is active (@option{-pg}), generate the calls to
34602 the profiling functions as NOPs. This is useful when they
34603 should be patched in later dynamically. This is likely only
34604 useful together with @option{-mrecord-mcount}.
34606 @opindex minstrument-return
34607 @item -minstrument-return=@var{type}
34608 Instrument function exit in -pg -mfentry instrumented functions with
34609 call to specified function. This only instruments true returns ending
34610 with ret, but not sibling calls ending with jump. Valid types
34611 are @var{none} to not instrument, @var{call} to generate a call to __return__,
34612 or @var{nop5} to generate a 5 byte nop.
34614 @opindex mrecord-return
34615 @item -mrecord-return
34616 @itemx -mno-record-return
34617 Generate a __return_loc section pointing to all return instrumentation code.
34619 @opindex mfentry-name
34620 @item -mfentry-name=@var{name}
34621 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
34623 @opindex mfentry-section
34624 @item -mfentry-section=@var{name}
34625 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
34627 @opindex mskip-rax-setup
34628 @item -mskip-rax-setup
34629 @itemx -mno-skip-rax-setup
34630 When generating code for the x86-64 architecture with SSE extensions
34631 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
34632 register when there are no variable arguments passed in vector registers.
34634 @strong{Warning:} Since RAX register is used to avoid unnecessarily
34635 saving vector registers on stack when passing variable arguments, the
34636 impacts of this option are callees may waste some stack space,
34637 misbehave or jump to a random location.  GCC 4.4 or newer don't have
34638 those issues, regardless the RAX register value.
34640 @opindex m8bit-idiv
34641 @item -m8bit-idiv
34642 @itemx -mno-8bit-idiv
34643 On some processors, like Intel Atom, 8-bit unsigned integer divide is
34644 much faster than 32-bit/64-bit integer divide.  This option generates a
34645 run-time check.  If both dividend and divisor are within range of 0
34646 to 255, 8-bit unsigned integer divide is used instead of
34647 32-bit/64-bit integer divide.
34649 @opindex mavx256-split-unaligned-load
34650 @opindex mavx256-split-unaligned-store
34651 @item -mavx256-split-unaligned-load
34652 @itemx -mavx256-split-unaligned-store
34653 Split 32-byte AVX unaligned load and store.
34655 @opindex mstack-protector-guard
34656 @opindex mstack-protector-guard-reg
34657 @opindex mstack-protector-guard-offset
34658 @item -mstack-protector-guard=@var{guard}
34659 @itemx -mstack-protector-guard-reg=@var{reg}
34660 @itemx -mstack-protector-guard-offset=@var{offset}
34661 Generate stack protection code using canary at @var{guard}.  Supported
34662 locations are @samp{global} for global canary or @samp{tls} for per-thread
34663 canary in the TLS block (the default).  This option has effect only when
34664 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
34666 With the latter choice the options
34667 @option{-mstack-protector-guard-reg=@var{reg}} and
34668 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
34669 which segment register (@code{%fs} or @code{%gs}) to use as base register
34670 for reading the canary, and from what offset from that base register.
34671 The default for those is as specified in the relevant ABI.
34673 @opindex mgeneral-regs-only
34674 @item -mgeneral-regs-only
34675 Generate code that uses only the general-purpose registers.  This
34676 prevents the compiler from using floating-point, vector, mask and bound
34677 registers.
34679 @opindex mrelax-cmpxchg-loop
34680 @item -mrelax-cmpxchg-loop
34681 When emitting a compare-and-swap loop for @ref{__sync Builtins}
34682 and @ref{__atomic Builtins} lacking a native instruction, optimize
34683 for the highly contended case by issuing an atomic load before the
34684 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
34685 to save CPU power when restarting the loop.
34687 @opindex mindirect-branch
34688 @item -mindirect-branch=@var{choice}
34689 Convert indirect call and jump with @var{choice}.  The default is
34690 @samp{keep}, which keeps indirect call and jump unmodified.
34691 @samp{thunk} converts indirect call and jump to call and return thunk.
34692 @samp{thunk-inline} converts indirect call and jump to inlined call
34693 and return thunk.  @samp{thunk-extern} converts indirect call and jump
34694 to external call and return thunk provided in a separate object file.
34695 You can control this behavior for a specific function by using the
34696 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
34698 Note that @option{-mcmodel=large} is incompatible with
34699 @option{-mindirect-branch=thunk} and
34700 @option{-mindirect-branch=thunk-extern} since the thunk function may
34701 not be reachable in the large code model.
34703 Note that @option{-mindirect-branch=thunk-extern} is compatible with
34704 @option{-fcf-protection=branch} since the external thunk can be made
34705 to enable control-flow check.
34707 @opindex mfunction-return
34708 @item -mfunction-return=@var{choice}
34709 Convert function return with @var{choice}.  The default is @samp{keep},
34710 which keeps function return unmodified.  @samp{thunk} converts function
34711 return to call and return thunk.  @samp{thunk-inline} converts function
34712 return to inlined call and return thunk.  @samp{thunk-extern} converts
34713 function return to external call and return thunk provided in a separate
34714 object file.  You can control this behavior for a specific function by
34715 using the function attribute @code{function_return}.
34716 @xref{Function Attributes}.
34718 Note that @option{-mindirect-return=thunk-extern} is compatible with
34719 @option{-fcf-protection=branch} since the external thunk can be made
34720 to enable control-flow check.
34722 Note that @option{-mcmodel=large} is incompatible with
34723 @option{-mfunction-return=thunk} and
34724 @option{-mfunction-return=thunk-extern} since the thunk function may
34725 not be reachable in the large code model.
34728 @opindex mindirect-branch-register
34729 @item -mindirect-branch-register
34730 Force indirect call and jump via register.
34732 @opindex mharden-sls
34733 @item -mharden-sls=@var{choice}
34734 Generate code to mitigate against straight line speculation (SLS) with
34735 @var{choice}.  The default is @samp{none} which disables all SLS
34736 hardening.  @samp{return} enables SLS hardening for function returns.
34737 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
34738 @samp{all} enables all SLS hardening.
34740 @opindex mindirect-branch-cs-prefix
34741 @item -mindirect-branch-cs-prefix
34742 Add CS prefix to call and jmp to indirect thunk with branch target in
34743 r8-r15 registers so that the call and jmp instruction length is 6 bytes
34744 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
34745 @samp{lfence; jmp *%r8-r15} at run-time.
34747 @end table
34749 These @samp{-m} switches are supported in addition to the above
34750 on x86-64 processors in 64-bit environments.
34752 @table @gcctabopt
34753 @opindex m32
34754 @opindex m64
34755 @opindex mx32
34756 @opindex m16
34757 @opindex miamcu
34758 @item -m32
34759 @itemx -m64
34760 @itemx -mx32
34761 @itemx -m16
34762 @itemx -miamcu
34763 Generate code for a 16-bit, 32-bit or 64-bit environment.
34764 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
34765 to 32 bits, and
34766 generates code that runs in 32-bit mode.
34768 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
34769 types to 64 bits, and generates code for the x86-64 architecture.
34770 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
34771 and @option{-mdynamic-no-pic} options.
34773 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
34774 to 32 bits, and
34775 generates code for the x86-64 architecture.
34777 The @option{-m16} option is the same as @option{-m32}, except for that
34778 it outputs the @code{.code16gcc} assembly directive at the beginning of
34779 the assembly output so that the binary can run in 16-bit mode.
34781 The @option{-miamcu} option generates code which conforms to Intel MCU
34782 psABI.  It requires the @option{-m32} option to be turned on.
34784 @opindex mno-red-zone
34785 @opindex mred-zone
34786 @item -mno-red-zone
34787 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
34788 by the x86-64 ABI; it is a 128-byte area beyond the location of the
34789 stack pointer that is not modified by signal or interrupt handlers
34790 and therefore can be used for temporary data without adjusting the stack
34791 pointer.  The flag @option{-mno-red-zone} disables this red zone.
34793 @opindex mcmodel=small
34794 @item -mcmodel=small
34795 Generate code for the small code model: the program and its symbols must
34796 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
34797 Programs can be statically or dynamically linked.  This is the default
34798 code model.
34800 @opindex mcmodel=kernel
34801 @item -mcmodel=kernel
34802 Generate code for the kernel code model.  The kernel runs in the
34803 negative 2 GB of the address space.
34804 This model has to be used for Linux kernel code.
34806 @opindex mcmodel=medium
34807 @item -mcmodel=medium
34808 Generate code for the medium model: the program is linked in the lower 2
34809 GB of the address space.  Small symbols are also placed there.  Symbols
34810 with sizes larger than @option{-mlarge-data-threshold} are put into
34811 large data or BSS sections and can be located above 2GB.  Programs can
34812 be statically or dynamically linked.
34814 @opindex mcmodel=large
34815 @item -mcmodel=large
34816 Generate code for the large model.  This model makes no assumptions
34817 about addresses and sizes of sections.
34819 @opindex maddress-mode=long
34820 @item -maddress-mode=long
34821 Generate code for long address mode.  This is only supported for 64-bit
34822 and x32 environments.  It is the default address mode for 64-bit
34823 environments.
34825 @opindex maddress-mode=short
34826 @item -maddress-mode=short
34827 Generate code for short address mode.  This is only supported for 32-bit
34828 and x32 environments.  It is the default address mode for 32-bit and
34829 x32 environments.
34831 @opindex mneeded
34832 @item -mneeded
34833 @itemx -mno-needed
34834 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
34835 indicate the micro-architecture ISA level required to execute the binary.
34837 @opindex mno-direct-extern-access
34838 @opindex mdirect-extern-access
34839 @item -mno-direct-extern-access
34840 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
34841 to access external symbols.  With @option{-fpic} or @option{-fPIC},
34842 treat access to protected symbols as local symbols.  The default is
34843 @option{-mdirect-extern-access}.
34845 @strong{Warning:} shared libraries compiled with
34846 @option{-mno-direct-extern-access} and executable compiled with
34847 @option{-mdirect-extern-access} may not be binary compatible if
34848 protected symbols are used in shared libraries and executable.
34850 @opindex munroll-only-small-loops
34851 @opindex mno-unroll-only-small-loops
34852 @item -munroll-only-small-loops
34853 Controls conservative small loop unrolling. It is default enabled by
34854 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
34855 -f[no-]unroll-[all-]loops would disable this flag to avoid any
34856 unintended unrolling behavior that user does not want.
34858 @opindex mlam
34859 @item -mlam=@var{choice}
34860 LAM(linear-address masking) allows special bits in the pointer to be used
34861 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
34862 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
34863 positions 62:57 can be used for metadata.
34864 @end table
34866 @node x86 Windows Options
34867 @subsection x86 Windows Options
34868 @cindex x86 Windows Options
34869 @cindex Windows Options for x86
34871 These additional options are available for Microsoft Windows targets:
34873 @table @gcctabopt
34874 @opindex mconsole
34875 @item -mconsole
34876 This option
34877 specifies that a console application is to be generated, by
34878 instructing the linker to set the PE header subsystem type
34879 required for console applications.
34880 This option is available for Cygwin and MinGW targets and is
34881 enabled by default on those targets.
34883 @opindex mcrtdll
34884 @item -mcrtdll=@var{library}
34885 Preprocess, compile or link with specified C RunTime DLL @var{library}.
34886 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
34887 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
34888 start file for CRT @var{library} and link with CRT @var{library}.
34889 Recognized CRT library names for proprocessor are:
34890 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
34891 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
34892 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
34893 If this options is not specified then the default MinGW import library
34894 @code{msvcrt} is used for linking and no other adjustment for
34895 preprocessor is done. MinGW import library @code{msvcrt} is just a
34896 symlink to (or a copy of) another MinGW CRT import library
34897 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
34898 is for Windows system CRT DLL library @code{msvcrt.dll} and
34899 in most cases is the default MinGW import library.
34900 Generally speaking, changing the CRT DLL requires recompiling
34901 the entire MinGW CRT. This option is for experimental and testing
34902 purposes only.
34903 This option is available for MinGW targets.
34905 @opindex mdll
34906 @item -mdll
34907 This option is available for Cygwin and MinGW targets.  It
34908 specifies that a DLL---a dynamic link library---is to be
34909 generated, enabling the selection of the required runtime
34910 startup object and entry point.
34912 @opindex mnop-fun-dllimport
34913 @item -mnop-fun-dllimport
34914 This option is available for Cygwin and MinGW targets.  It
34915 specifies that the @code{dllimport} attribute should be ignored.
34917 @opindex mthreads
34918 @item -mthreads
34919 This option is available for MinGW targets. It specifies
34920 that MinGW-specific thread support is to be used.
34922 @opindex municode
34923 @item -municode
34924 This option is available for MinGW-w64 targets.  It causes
34925 the @code{UNICODE} preprocessor macro to be predefined, and
34926 chooses Unicode-capable runtime startup code.
34928 @opindex mwin32
34929 @item -mwin32
34930 This option is available for Cygwin and MinGW targets.  It
34931 specifies that the typical Microsoft Windows predefined macros are to
34932 be set in the pre-processor, but does not influence the choice
34933 of runtime library/startup code.
34935 @opindex mwindows
34936 @item -mwindows
34937 This option is available for Cygwin and MinGW targets.  It
34938 specifies that a GUI application is to be generated by
34939 instructing the linker to set the PE header subsystem type
34940 appropriately.
34942 @opindex fno-set-stack-executable
34943 @opindex fset-stack-executable
34944 @item -fno-set-stack-executable
34945 This option is available for MinGW targets. It specifies that
34946 the executable flag for the stack used by nested functions isn't
34947 set. This is necessary for binaries running in kernel mode of
34948 Microsoft Windows, as there the User32 API, which is used to set executable
34949 privileges, isn't available.
34951 @opindex fno-writable-relocated-rdata
34952 @opindex fwritable-relocated-rdata
34953 @item -fwritable-relocated-rdata
34954 This option is available for MinGW and Cygwin targets.  It specifies
34955 that relocated-data in read-only section is put into the @code{.data}
34956 section.  This is a necessary for older runtimes not supporting
34957 modification of @code{.rdata} sections for pseudo-relocation.
34959 @opindex mpe-aligned-commons
34960 @item -mpe-aligned-commons
34961 This option is available for Cygwin and MinGW targets.  It
34962 specifies that the GNU extension to the PE file format that
34963 permits the correct alignment of COMMON variables should be
34964 used when generating code.  It is enabled by default if
34965 GCC detects that the target assembler found during configuration
34966 supports the feature.
34967 @end table
34969 See also under @ref{x86 Options} for standard options.
34971 @node Xstormy16 Options
34972 @subsection Xstormy16 Options
34973 @cindex Xstormy16 Options
34975 These options are defined for Xstormy16:
34977 @table @gcctabopt
34978 @opindex msim
34979 @item -msim
34980 Choose startup files and linker script suitable for the simulator.
34981 @end table
34983 @node Xtensa Options
34984 @subsection Xtensa Options
34985 @cindex Xtensa Options
34987 These options are supported for Xtensa targets:
34989 @table @gcctabopt
34990 @opindex mconst16
34991 @opindex mno-const16
34992 @item -mconst16
34993 @itemx -mno-const16
34994 Enable or disable use of @code{CONST16} instructions for loading
34995 constant values.  The @code{CONST16} instruction is currently not a
34996 standard option from Tensilica.  When enabled, @code{CONST16}
34997 instructions are always used in place of the standard @code{L32R}
34998 instructions.  The use of @code{CONST16} is enabled by default only if
34999 the @code{L32R} instruction is not available.
35001 @opindex mfused-madd
35002 @opindex mno-fused-madd
35003 @item -mfused-madd
35004 @itemx -mno-fused-madd
35005 Enable or disable use of fused multiply/add and multiply/subtract
35006 instructions in the floating-point option.  This has no effect if the
35007 floating-point option is not also enabled.  Disabling fused multiply/add
35008 and multiply/subtract instructions forces the compiler to use separate
35009 instructions for the multiply and add/subtract operations.  This may be
35010 desirable in some cases where strict IEEE 754-compliant results are
35011 required: the fused multiply add/subtract instructions do not round the
35012 intermediate result, thereby producing results with @emph{more} bits of
35013 precision than specified by the IEEE standard.  Disabling fused multiply
35014 add/subtract instructions also ensures that the program output is not
35015 sensitive to the compiler's ability to combine multiply and add/subtract
35016 operations.
35018 @opindex mserialize-volatile
35019 @opindex mno-serialize-volatile
35020 @item -mserialize-volatile
35021 @itemx -mno-serialize-volatile
35022 When this option is enabled, GCC inserts @code{MEMW} instructions before
35023 @code{volatile} memory references to guarantee sequential consistency.
35024 The default is @option{-mserialize-volatile}.  Use
35025 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
35027 @opindex mforce-no-pic
35028 @item -mforce-no-pic
35029 For targets, like GNU/Linux, where all user-mode Xtensa code must be
35030 position-independent code (PIC), this option disables PIC for compiling
35031 kernel code.
35033 @opindex mtext-section-literals
35034 @opindex mno-text-section-literals
35035 @item -mtext-section-literals
35036 @itemx -mno-text-section-literals
35037 These options control the treatment of literal pools.  The default is
35038 @option{-mno-text-section-literals}, which places literals in a separate
35039 section in the output file.  This allows the literal pool to be placed
35040 in a data RAM/ROM, and it also allows the linker to combine literal
35041 pools from separate object files to remove redundant literals and
35042 improve code size.  With @option{-mtext-section-literals}, the literals
35043 are interspersed in the text section in order to keep them as close as
35044 possible to their references.  This may be necessary for large assembly
35045 files.  Literals for each function are placed right before that function.
35047 @opindex mauto-litpools
35048 @opindex mno-auto-litpools
35049 @item -mauto-litpools
35050 @itemx -mno-auto-litpools
35051 These options control the treatment of literal pools.  The default is
35052 @option{-mno-auto-litpools}, which places literals in a separate
35053 section in the output file unless @option{-mtext-section-literals} is
35054 used.  With @option{-mauto-litpools} the literals are interspersed in
35055 the text section by the assembler.  Compiler does not produce explicit
35056 @code{.literal} directives and loads literals into registers with
35057 @code{MOVI} instructions instead of @code{L32R} to let the assembler
35058 do relaxation and place literals as necessary.  This option allows
35059 assembler to create several literal pools per function and assemble
35060 very big functions, which may not be possible with
35061 @option{-mtext-section-literals}.
35063 @opindex mtarget-align
35064 @opindex mno-target-align
35065 @item -mtarget-align
35066 @itemx -mno-target-align
35067 When this option is enabled, GCC instructs the assembler to
35068 automatically align instructions to reduce branch penalties at the
35069 expense of some code density.  The assembler attempts to widen density
35070 instructions to align branch targets and the instructions following call
35071 instructions.  If there are not enough preceding safe density
35072 instructions to align a target, no widening is performed.  The
35073 default is @option{-mtarget-align}.  These options do not affect the
35074 treatment of auto-aligned instructions like @code{LOOP}, which the
35075 assembler always aligns, either by widening density instructions or
35076 by inserting NOP instructions.
35078 @opindex mlongcalls
35079 @opindex mno-longcalls
35080 @item -mlongcalls
35081 @itemx -mno-longcalls
35082 When this option is enabled, GCC instructs the assembler to translate
35083 direct calls to indirect calls unless it can determine that the target
35084 of a direct call is in the range allowed by the call instruction.  This
35085 translation typically occurs for calls to functions in other source
35086 files.  Specifically, the assembler translates a direct @code{CALL}
35087 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
35088 The default is @option{-mno-longcalls}.  This option should be used in
35089 programs where the call target can potentially be out of range.  This
35090 option is implemented in the assembler, not the compiler, so the
35091 assembly code generated by GCC still shows direct call
35092 instructions---look at the disassembled object code to see the actual
35093 instructions.  Note that the assembler uses an indirect call for
35094 every cross-file call, not just those that really are out of range.
35096 @opindex mabi
35097 @item -mabi=@var{name}
35098 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
35099 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
35101 @opindex mabi=call0
35102 @item -mabi=call0
35103 When this option is enabled function parameters are passed in registers
35104 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
35105 caller-saved, and register @code{a15} may be used as a frame pointer.
35106 When this version of the ABI is enabled the C preprocessor symbol
35107 @code{__XTENSA_CALL0_ABI__} is defined.
35109 @opindex mabi=windowed
35110 @item -mabi=windowed
35111 When this option is enabled function parameters are passed in registers
35112 @code{a10} through @code{a15}, and called function rotates register window
35113 by 8 registers on entry so that its arguments are found in registers
35114 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
35115 pointer.  Register window is rotated 8 registers back upon return.
35116 When this version of the ABI is enabled the C preprocessor symbol
35117 @code{__XTENSA_WINDOWED_ABI__} is defined.
35119 @opindex mextra-l32r-costs
35120 @item -mextra-l32r-costs=@var{n}
35121 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
35122 instructions, in clock cycles.  This affects, when optimizing for speed,
35123 whether loading a constant from literal pool using @code{L32R} or
35124 synthesizing the constant from a small one with a couple of arithmetic
35125 instructions.  The default value is 0.
35127 @opindex mstrict-align
35128 @opindex mno-strict-align
35129 @item -mstrict-align
35130 @itemx -mno-strict-align
35131 Avoid or allow generating memory accesses that may not be aligned on a natural
35132 object boundary as described in the architecture specification.
35133 The default is @option{-mno-strict-align} for cores that support both
35134 unaligned loads and stores in hardware and @option{-mstrict-align} for all
35135 other cores.
35137 @end table
35139 @node zSeries Options
35140 @subsection zSeries Options
35141 @cindex zSeries options
35143 These are listed under @xref{S/390 and zSeries Options}.
35146 @c man end
35148 @node Spec Files
35149 @section Specifying Subprocesses and the Switches to Pass to Them
35150 @cindex Spec Files
35152 @command{gcc} is a driver program.  It performs its job by invoking a
35153 sequence of other programs to do the work of compiling, assembling and
35154 linking.  GCC interprets its command-line parameters and uses these to
35155 deduce which programs it should invoke, and which command-line options
35156 it ought to place on their command lines.  This behavior is controlled
35157 by @dfn{spec strings}.  In most cases there is one spec string for each
35158 program that GCC can invoke, but a few programs have multiple spec
35159 strings to control their behavior.  The spec strings built into GCC can
35160 be overridden by using the @option{-specs=} command-line switch to specify
35161 a spec file.
35163 @dfn{Spec files} are plain-text files that are used to construct spec
35164 strings.  They consist of a sequence of directives separated by blank
35165 lines.  The type of directive is determined by the first non-whitespace
35166 character on the line, which can be one of the following:
35168 @table @code
35169 @item %@var{command}
35170 Issues a @var{command} to the spec file processor.  The commands that can
35171 appear here are:
35173 @table @code
35174 @cindex @code{%include}
35175 @item %include <@var{file}>
35176 Search for @var{file} and insert its text at the current point in the
35177 specs file.
35179 @cindex @code{%include_noerr}
35180 @item %include_noerr <@var{file}>
35181 Just like @samp{%include}, but do not generate an error message if the include
35182 file cannot be found.
35184 @cindex @code{%rename}
35185 @item %rename @var{old_name} @var{new_name}
35186 Rename the spec string @var{old_name} to @var{new_name}.
35188 @end table
35190 @item *[@var{spec_name}]:
35191 This tells the compiler to create, override or delete the named spec
35192 string.  All lines after this directive up to the next directive or
35193 blank line are considered to be the text for the spec string.  If this
35194 results in an empty string then the spec is deleted.  (Or, if the
35195 spec did not exist, then nothing happens.)  Otherwise, if the spec
35196 does not currently exist a new spec is created.  If the spec does
35197 exist then its contents are overridden by the text of this
35198 directive, unless the first character of that text is the @samp{+}
35199 character, in which case the text is appended to the spec.
35201 @item [@var{suffix}]:
35202 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
35203 and up to the next directive or blank line are considered to make up the
35204 spec string for the indicated suffix.  When the compiler encounters an
35205 input file with the named suffix, it processes the spec string in
35206 order to work out how to compile that file.  For example:
35208 @smallexample
35209 .ZZ:
35210 z-compile -input %i
35211 @end smallexample
35213 This says that any input file whose name ends in @samp{.ZZ} should be
35214 passed to the program @samp{z-compile}, which should be invoked with the
35215 command-line switch @option{-input} and with the result of performing the
35216 @samp{%i} substitution.  (See below.)
35218 As an alternative to providing a spec string, the text following a
35219 suffix directive can be one of the following:
35221 @table @code
35222 @item @@@var{language}
35223 This says that the suffix is an alias for a known @var{language}.  This is
35224 similar to using the @option{-x} command-line switch to GCC to specify a
35225 language explicitly.  For example:
35227 @smallexample
35228 .ZZ:
35229 @@c++
35230 @end smallexample
35232 Says that .ZZ files are, in fact, C++ source files.
35234 @item #@var{name}
35235 This causes an error messages saying:
35237 @smallexample
35238 @var{name} compiler not installed on this system.
35239 @end smallexample
35240 @end table
35242 GCC already has an extensive list of suffixes built into it.
35243 This directive adds an entry to the end of the list of suffixes, but
35244 since the list is searched from the end backwards, it is effectively
35245 possible to override earlier entries using this technique.
35247 @end table
35249 GCC has the following spec strings built into it.  Spec files can
35250 override these strings or create their own.  Note that individual
35251 targets can also add their own spec strings to this list.
35253 @smallexample
35254 asm          Options to pass to the assembler
35255 asm_final    Options to pass to the assembler post-processor
35256 cpp          Options to pass to the C preprocessor
35257 cc1          Options to pass to the C compiler
35258 cc1plus      Options to pass to the C++ compiler
35259 endfile      Object files to include at the end of the link
35260 link         Options to pass to the linker
35261 lib          Libraries to include on the command line to the linker
35262 libgcc       Decides which GCC support library to pass to the linker
35263 linker       Sets the name of the linker
35264 predefines   Defines to be passed to the C preprocessor
35265 signed_char  Defines to pass to CPP to say whether @code{char} is signed
35266              by default
35267 startfile    Object files to include at the start of the link
35268 @end smallexample
35270 Here is a small example of a spec file:
35272 @smallexample
35273 %rename lib                 old_lib
35275 *lib:
35276 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
35277 @end smallexample
35279 This example renames the spec called @samp{lib} to @samp{old_lib} and
35280 then overrides the previous definition of @samp{lib} with a new one.
35281 The new definition adds in some extra command-line options before
35282 including the text of the old definition.
35284 @dfn{Spec strings} are a list of command-line options to be passed to their
35285 corresponding program.  In addition, the spec strings can contain
35286 @samp{%}-prefixed sequences to substitute variable text or to
35287 conditionally insert text into the command line.  Using these constructs
35288 it is possible to generate quite complex command lines.
35290 Here is a table of all defined @samp{%}-sequences for spec
35291 strings.  Note that spaces are not generated automatically around the
35292 results of expanding these sequences.  Therefore you can concatenate them
35293 together or combine them with constant text in a single argument.
35295 @table @code
35296 @item %%
35297 Substitute one @samp{%} into the program name or argument.
35299 @item %"
35300 Substitute an empty argument.
35302 @item %i
35303 Substitute the name of the input file being processed.
35305 @item %b
35306 Substitute the basename for outputs related with the input file being
35307 processed.  This is often the substring up to (and not including) the
35308 last period and not including the directory but, unless %w is active, it
35309 expands to the basename for auxiliary outputs, which may be influenced
35310 by an explicit output name, and by various other options that control
35311 how auxiliary outputs are named.
35313 @item %B
35314 This is the same as @samp{%b}, but include the file suffix (text after
35315 the last period).  Without %w, it expands to the basename for dump
35316 outputs.
35318 @item %d
35319 Marks the argument containing or following the @samp{%d} as a
35320 temporary file name, so that that file is deleted if GCC exits
35321 successfully.  Unlike @samp{%g}, this contributes no text to the
35322 argument.
35324 @item %g@var{suffix}
35325 Substitute a file name that has suffix @var{suffix} and is chosen
35326 once per compilation, and mark the argument in the same way as
35327 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
35328 name is now chosen in a way that is hard to predict even when previously
35329 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
35330 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
35331 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
35332 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
35333 was simply substituted with a file name chosen once per compilation,
35334 without regard to any appended suffix (which was therefore treated
35335 just like ordinary text), making such attacks more likely to succeed.
35337 @item %u@var{suffix}
35338 Like @samp{%g}, but generates a new temporary file name
35339 each time it appears instead of once per compilation.
35341 @item %U@var{suffix}
35342 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
35343 new one if there is no such last file name.  In the absence of any
35344 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
35345 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
35346 involves the generation of two distinct file names, one
35347 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
35348 simply substituted with a file name chosen for the previous @samp{%u},
35349 without regard to any appended suffix.
35351 @item %j@var{suffix}
35352 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
35353 writable, and if @option{-save-temps} is not used; 
35354 otherwise, substitute the name
35355 of a temporary file, just like @samp{%u}.  This temporary file is not
35356 meant for communication between processes, but rather as a junk
35357 disposal mechanism.
35359 @item %|@var{suffix}
35360 @itemx %m@var{suffix}
35361 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
35362 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
35363 all.  These are the two most common ways to instruct a program that it
35364 should read from standard input or write to standard output.  If you
35365 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
35366 construct: see for example @file{gcc/fortran/lang-specs.h}.
35368 @item %.@var{SUFFIX}
35369 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
35370 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
35371 terminated by the next space or %.
35373 @item %w
35374 Marks the argument containing or following the @samp{%w} as the
35375 designated output file of this compilation.  This puts the argument
35376 into the sequence of arguments that @samp{%o} substitutes.
35378 @item %V
35379 Indicates that this compilation produces no output file.
35381 @item %o
35382 Substitutes the names of all the output files, with spaces
35383 automatically placed around them.  You should write spaces
35384 around the @samp{%o} as well or the results are undefined.
35385 @samp{%o} is for use in the specs for running the linker.
35386 Input files whose names have no recognized suffix are not compiled
35387 at all, but they are included among the output files, so they are
35388 linked.
35390 @item %O
35391 Substitutes the suffix for object files.  Note that this is
35392 handled specially when it immediately follows @samp{%g, %u, or %U},
35393 because of the need for those to form complete file names.  The
35394 handling is such that @samp{%O} is treated exactly as if it had already
35395 been substituted, except that @samp{%g, %u, and %U} do not currently
35396 support additional @var{suffix} characters following @samp{%O} as they do
35397 following, for example, @samp{.o}.
35399 @item %I
35400 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
35401 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
35402 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
35403 and @option{-imultilib} as necessary.
35405 @item %s
35406 Current argument is the name of a library or startup file of some sort.
35407 Search for that file in a standard list of directories and substitute
35408 the full name found.  The current working directory is included in the
35409 list of directories scanned.
35411 @item %T
35412 Current argument is the name of a linker script.  Search for that file
35413 in the current list of directories to scan for libraries. If the file
35414 is located insert a @option{--script} option into the command line
35415 followed by the full path name found.  If the file is not found then
35416 generate an error message.  Note: the current working directory is not
35417 searched.
35419 @item %e@var{str}
35420 Print @var{str} as an error message.  @var{str} is terminated by a newline.
35421 Use this when inconsistent options are detected.
35423 @item %n@var{str}
35424 Print @var{str} as a notice.  @var{str} is terminated by a newline.
35426 @item %(@var{name})
35427 Substitute the contents of spec string @var{name} at this point.
35429 @item %x@{@var{option}@}
35430 Accumulate an option for @samp{%X}.
35432 @item %X
35433 Output the accumulated linker options specified by a @samp{%x} spec string.
35435 @item %Y
35436 Output the accumulated assembler options specified by @option{-Wa}.
35438 @item %Z
35439 Output the accumulated preprocessor options specified by @option{-Wp}.
35441 @item %M
35442 Output @code{multilib_os_dir}.
35444 @item %R
35445 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
35447 @item %a
35448 Process the @code{asm} spec.  This is used to compute the
35449 switches to be passed to the assembler.
35451 @item %A
35452 Process the @code{asm_final} spec.  This is a spec string for
35453 passing switches to an assembler post-processor, if such a program is
35454 needed.
35456 @item %l
35457 Process the @code{link} spec.  This is the spec for computing the
35458 command line passed to the linker.  Typically it makes use of the
35459 @samp{%L %G %S %D and %E} sequences.
35461 @item %D
35462 Dump out a @option{-L} option for each directory that GCC believes might
35463 contain startup files.  If the target supports multilibs then the
35464 current multilib directory is prepended to each of these paths.
35466 @item %L
35467 Process the @code{lib} spec.  This is a spec string for deciding which
35468 libraries are included on the command line to the linker.
35470 @item %G
35471 Process the @code{libgcc} spec.  This is a spec string for deciding
35472 which GCC support library is included on the command line to the linker.
35474 @item %S
35475 Process the @code{startfile} spec.  This is a spec for deciding which
35476 object files are the first ones passed to the linker.  Typically
35477 this might be a file named @file{crt0.o}.
35479 @item %E
35480 Process the @code{endfile} spec.  This is a spec string that specifies
35481 the last object files that are passed to the linker.
35483 @item %C
35484 Process the @code{cpp} spec.  This is used to construct the arguments
35485 to be passed to the C preprocessor.
35487 @item %1
35488 Process the @code{cc1} spec.  This is used to construct the options to be
35489 passed to the actual C compiler (@command{cc1}).
35491 @item %2
35492 Process the @code{cc1plus} spec.  This is used to construct the options to be
35493 passed to the actual C++ compiler (@command{cc1plus}).
35495 @item %*
35496 Substitute the variable part of a matched option.  See below.
35497 Note that each comma in the substituted string is replaced by
35498 a single space.
35500 @item %<S
35501 Remove all occurrences of @code{-S} from the command line.  Note---this
35502 command is position dependent.  @samp{%} commands in the spec string
35503 before this one see @code{-S}, @samp{%} commands in the spec string
35504 after this one do not.
35506 @item %<S*
35507 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
35509 @item %>S
35510 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
35512 @item %:@var{function}(@var{args})
35513 Call the named function @var{function}, passing it @var{args}.
35514 @var{args} is first processed as a nested spec string, then split
35515 into an argument vector in the usual fashion.  The function returns
35516 a string which is processed as if it had appeared literally as part
35517 of the current spec.
35519 The following built-in spec functions are provided:
35521 @table @code
35522 @item @code{getenv}
35523 The @code{getenv} spec function takes two arguments: an environment
35524 variable name and a string.  If the environment variable is not
35525 defined, a fatal error is issued.  Otherwise, the return value is the
35526 value of the environment variable concatenated with the string.  For
35527 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
35529 @smallexample
35530 %:getenv(TOPDIR /include)
35531 @end smallexample
35533 expands to @file{/path/to/top/include}.
35535 @item @code{if-exists}
35536 The @code{if-exists} spec function takes one argument, an absolute
35537 pathname to a file.  If the file exists, @code{if-exists} returns the
35538 pathname.  Here is a small example of its usage:
35540 @smallexample
35541 *startfile:
35542 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
35543 @end smallexample
35545 @item @code{if-exists-else}
35546 The @code{if-exists-else} spec function is similar to the @code{if-exists}
35547 spec function, except that it takes two arguments.  The first argument is
35548 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
35549 returns the pathname.  If it does not exist, it returns the second argument.
35550 This way, @code{if-exists-else} can be used to select one file or another,
35551 based on the existence of the first.  Here is a small example of its usage:
35553 @smallexample
35554 *startfile:
35555 crt0%O%s %:if-exists(crti%O%s) \
35556 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
35557 @end smallexample
35559 @item @code{if-exists-then-else}
35560 The @code{if-exists-then-else} spec function takes at least two arguments
35561 and an optional third one. The first argument is an absolute pathname to a
35562 file.  If the file exists, the function returns the second argument.
35563 If the file does not exist, the function returns the third argument if there
35564 is one, or NULL otherwise. This can be used to expand one text, or optionally
35565 another, based on the existence of a file.  Here is a small example of its
35566 usage:
35568 @smallexample
35569 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
35570 @end smallexample
35572 @item @code{sanitize}
35573 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
35574 any address, thread or undefined behavior sanitizers are active.
35576 @smallexample
35577 %@{%:sanitize(address):-funwind-tables@}
35578 @end smallexample
35580 @item @code{replace-outfile}
35581 The @code{replace-outfile} spec function takes two arguments.  It looks for the
35582 first argument in the outfiles array and replaces it with the second argument.  Here
35583 is a small example of its usage:
35585 @smallexample
35586 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
35587 @end smallexample
35589 @item @code{remove-outfile}
35590 The @code{remove-outfile} spec function takes one argument.  It looks for the
35591 first argument in the outfiles array and removes it.  Here is a small example
35592 its usage:
35594 @smallexample
35595 %:remove-outfile(-lm)
35596 @end smallexample
35598 @item @code{version-compare}
35599 The @code{version-compare} spec function takes four or five arguments of the following
35600 form:
35602 @smallexample
35603 <comparison-op> <arg1> [<arg2>] <switch> <result>
35604 @end smallexample
35606 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
35607 The supported @code{comparison-op} values are:
35609 @table @code
35610 @item >=
35611 True if @code{switch} is a later (or same) version than @code{arg1}
35613 @item !>
35614 Opposite of @code{>=}
35616 @item <
35617 True if @code{switch} is an earlier version than @code{arg1}
35619 @item !<
35620 Opposite of @code{<}
35622 @item ><
35623 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
35625 @item <>
35626 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
35627 @end table
35629 If the @code{switch} is not present at all, the condition is false unless the first character
35630 of the @code{comparison-op} is @code{!}.
35632 @smallexample
35633 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
35634 @end smallexample
35636 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
35637 passed.
35639 @item @code{include}
35640 The @code{include} spec function behaves much like @code{%include}, with the advantage
35641 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
35642 the filename, and looks for it in the startfile path.  It always returns NULL.
35644 @smallexample
35645 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
35646 @end smallexample
35648 @item @code{pass-through-libs}
35649 The @code{pass-through-libs} spec function takes any number of arguments.  It
35650 finds any @option{-l} options and any non-options ending in @file{.a} (which it
35651 assumes are the names of linker input library archive files) and returns a
35652 result containing all the found arguments each prepended by
35653 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
35654 intended to be passed to the LTO linker plugin.
35656 @smallexample
35657 %:pass-through-libs(%G %L %G)
35658 @end smallexample
35660 @item @code{print-asm-header}
35661 The @code{print-asm-header} function takes no arguments and simply
35662 prints a banner like:
35664 @smallexample
35665 Assembler options
35666 =================
35668 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
35669 @end smallexample
35671 It is used to separate compiler options from assembler options
35672 in the @option{--target-help} output.
35674 @item @code{gt}
35675 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
35676 empty string) if the second-to-last argument is greater than the last argument, and NULL
35677 otherwise.  The following example inserts the @code{link_gomp} spec if the last
35678 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
35680 @smallexample
35681 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
35682 @end smallexample
35684 @item @code{debug-level-gt}
35685 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
35686 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
35687 otherwise.
35689 @smallexample
35690 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
35691 @end smallexample
35692 @end table
35694 @item %@{S@}
35695 Substitutes the @code{-S} switch, if that switch is given to GCC@.
35696 If that switch is not specified, this substitutes nothing.  Note that
35697 the leading dash is omitted when specifying this option, and it is
35698 automatically inserted if the substitution is performed.  Thus the spec
35699 string @samp{%@{foo@}} matches the command-line option @option{-foo}
35700 and outputs the command-line option @option{-foo}.
35702 @item %W@{S@}
35703 Like %@{@code{S}@} but mark last argument supplied within as a file to be
35704 deleted on failure.
35706 @item %@@@{S@}
35707 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
35708 @code{@@FILE} if an @code{@@file} argument has been supplied.
35710 @item %@{S*@}
35711 Substitutes all the switches specified to GCC whose names start
35712 with @code{-S}, but which also take an argument.  This is used for
35713 switches like @option{-o}, @option{-D}, @option{-I}, etc.
35714 GCC considers @option{-o foo} as being
35715 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
35716 text, including the space.  Thus two arguments are generated.
35718 @item %@{S*&T*@}
35719 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
35720 (the order of @code{S} and @code{T} in the spec is not significant).
35721 There can be any number of ampersand-separated variables; for each the
35722 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
35724 @item %@{S:X@}
35725 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
35727 @item %@{!S:X@}
35728 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
35730 @item %@{S*:X@}
35731 Substitutes @code{X} if one or more switches whose names start with
35732 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
35733 once, no matter how many such switches appeared.  However, if @code{%*}
35734 appears somewhere in @code{X}, then @code{X} is substituted once
35735 for each matching switch, with the @code{%*} replaced by the part of
35736 that switch matching the @code{*}.
35738 If @code{%*} appears as the last part of a spec sequence then a space
35739 is added after the end of the last substitution.  If there is more
35740 text in the sequence, however, then a space is not generated.  This
35741 allows the @code{%*} substitution to be used as part of a larger
35742 string.  For example, a spec string like this:
35744 @smallexample
35745 %@{mcu=*:--script=%*/memory.ld@}
35746 @end smallexample
35748 @noindent
35749 when matching an option like @option{-mcu=newchip} produces:
35751 @smallexample
35752 --script=newchip/memory.ld
35753 @end smallexample
35755 @item %@{.S:X@}
35756 Substitutes @code{X}, if processing a file with suffix @code{S}.
35758 @item %@{!.S:X@}
35759 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
35761 @item %@{,S:X@}
35762 Substitutes @code{X}, if processing a file for language @code{S}.
35764 @item %@{!,S:X@}
35765 Substitutes @code{X}, if not processing a file for language @code{S}.
35767 @item %@{S|P:X@}
35768 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
35769 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
35770 @code{*} sequences as well, although they have a stronger binding than
35771 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
35772 alternatives must be starred, and only the first matching alternative
35773 is substituted.
35775 For example, a spec string like this:
35777 @smallexample
35778 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
35779 @end smallexample
35781 @noindent
35782 outputs the following command-line options from the following input
35783 command-line options:
35785 @smallexample
35786 fred.c        -foo -baz
35787 jim.d         -bar -boggle
35788 -d fred.c     -foo -baz -boggle
35789 -d jim.d      -bar -baz -boggle
35790 @end smallexample
35792 @item %@{%:@var{function}(@var{args}):X@}
35794 Call function named @var{function} with args @var{args}.  If the
35795 function returns non-NULL, then @code{X} is substituted, if it returns
35796 NULL, it isn't substituted.
35798 @item %@{S:X; T:Y; :D@}
35800 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
35801 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
35802 be as many clauses as you need.  This may be combined with @code{.},
35803 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
35806 @end table
35808 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
35809 or similar construct can use a backslash to ignore the special meaning
35810 of the character following it, thus allowing literal matching of a
35811 character that is otherwise specially treated.  For example,
35812 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
35813 @option{-std=iso9899:1999} option is given.
35815 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
35816 construct may contain other nested @samp{%} constructs or spaces, or
35817 even newlines.  They are processed as usual, as described above.
35818 Trailing white space in @code{X} is ignored.  White space may also
35819 appear anywhere on the left side of the colon in these constructs,
35820 except between @code{.} or @code{*} and the corresponding word.
35822 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
35823 handled specifically in these constructs.  If another value of
35824 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
35825 @option{-W} switch is found later in the command line, the earlier
35826 switch value is ignored, except with @{@code{S}*@} where @code{S} is
35827 just one letter, which passes all matching options.
35829 The character @samp{|} at the beginning of the predicate text is used to
35830 indicate that a command should be piped to the following command, but
35831 only if @option{-pipe} is specified.
35833 It is built into GCC which switches take arguments and which do not.
35834 (You might think it would be useful to generalize this to allow each
35835 compiler's spec to say which switches take arguments.  But this cannot
35836 be done in a consistent fashion.  GCC cannot even decide which input
35837 files have been specified without knowing which switches take arguments,
35838 and it must know which input files to compile in order to tell which
35839 compilers to run).
35841 GCC also knows implicitly that arguments starting in @option{-l} are to be
35842 treated as compiler output files, and passed to the linker in their
35843 proper position among the other output files.
35845 @node Environment Variables
35846 @section Environment Variables Affecting GCC
35847 @cindex environment variables
35849 @c man begin ENVIRONMENT
35850 This section describes several environment variables that affect how GCC
35851 operates.  Some of them work by specifying directories or prefixes to use
35852 when searching for various kinds of files.  Some are used to specify other
35853 aspects of the compilation environment.
35855 Note that you can also specify places to search using options such as
35856 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
35857 take precedence over places specified using environment variables, which
35858 in turn take precedence over those specified by the configuration of GCC@.
35859 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
35860 GNU Compiler Collection (GCC) Internals}.
35862 @table @env
35863 @vindex LANG
35864 @vindex LC_CTYPE
35865 @c @vindex LC_COLLATE
35866 @vindex LC_MESSAGES
35867 @c @vindex LC_MONETARY
35868 @c @vindex LC_NUMERIC
35869 @c @vindex LC_TIME
35870 @vindex LC_ALL
35871 @cindex locale
35872 @item LANG
35873 @itemx LC_CTYPE
35874 @c @itemx LC_COLLATE
35875 @itemx LC_MESSAGES
35876 @c @itemx LC_MONETARY
35877 @c @itemx LC_NUMERIC
35878 @c @itemx LC_TIME
35879 @itemx LC_ALL
35880 These environment variables control the way that GCC uses
35881 localization information which allows GCC to work with different
35882 national conventions.  GCC inspects the locale categories
35883 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
35884 so.  These locale categories can be set to any value supported by your
35885 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
35886 Kingdom encoded in UTF-8.
35888 The @env{LC_CTYPE} environment variable specifies character
35889 classification.  GCC uses it to determine the character boundaries in
35890 a string; this is needed for some multibyte encodings that contain quote
35891 and escape characters that are otherwise interpreted as a string
35892 end or escape.
35894 The @env{LC_MESSAGES} environment variable specifies the language to
35895 use in diagnostic messages.
35897 If the @env{LC_ALL} environment variable is set, it overrides the value
35898 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
35899 and @env{LC_MESSAGES} default to the value of the @env{LANG}
35900 environment variable.  If none of these variables are set, GCC
35901 defaults to traditional C English behavior.
35903 @vindex TMPDIR
35904 @item TMPDIR
35905 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35906 files.  GCC uses temporary files to hold the output of one stage of
35907 compilation which is to be used as input to the next stage: for example,
35908 the output of the preprocessor, which is the input to the compiler
35909 proper.
35911 @vindex GCC_COMPARE_DEBUG
35912 @item GCC_COMPARE_DEBUG
35913 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35914 @option{-fcompare-debug} to the compiler driver.  See the documentation
35915 of this option for more details.
35917 @vindex GCC_EXEC_PREFIX
35918 @item GCC_EXEC_PREFIX
35919 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35920 names of the subprograms executed by the compiler.  No slash is added
35921 when this prefix is combined with the name of a subprogram, but you can
35922 specify a prefix that ends with a slash if you wish.
35924 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
35925 an appropriate prefix to use based on the pathname it is invoked with.
35927 If GCC cannot find the subprogram using the specified prefix, it
35928 tries looking in the usual places for the subprogram.
35930 The default value of @env{GCC_EXEC_PREFIX} is
35931 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
35932 the installed compiler. In many cases @var{prefix} is the value
35933 of @code{prefix} when you ran the @file{configure} script.
35935 Other prefixes specified with @option{-B} take precedence over this prefix.
35937 This prefix is also used for finding files such as @file{crt0.o} that are
35938 used for linking.
35940 In addition, the prefix is used in an unusual way in finding the
35941 directories to search for header files.  For each of the standard
35942 directories whose name normally begins with @samp{/usr/local/lib/gcc}
35943 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
35944 replacing that beginning with the specified prefix to produce an
35945 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
35946 @file{foo/bar} just before it searches the standard directory 
35947 @file{/usr/local/lib/bar}.
35948 If a standard directory begins with the configured
35949 @var{prefix} then the value of @var{prefix} is replaced by
35950 @env{GCC_EXEC_PREFIX} when looking for header files.
35952 @vindex COMPILER_PATH
35953 @item COMPILER_PATH
35954 The value of @env{COMPILER_PATH} is a colon-separated list of
35955 directories, much like @env{PATH}.  GCC tries the directories thus
35956 specified when searching for subprograms, if it cannot find the
35957 subprograms using @env{GCC_EXEC_PREFIX}.
35959 @vindex LIBRARY_PATH
35960 @item LIBRARY_PATH
35961 The value of @env{LIBRARY_PATH} is a colon-separated list of
35962 directories, much like @env{PATH}.  When configured as a native compiler,
35963 GCC tries the directories thus specified when searching for special
35964 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
35965 using GCC also uses these directories when searching for ordinary
35966 libraries for the @option{-l} option (but directories specified with
35967 @option{-L} come first).
35969 @vindex LANG
35970 @cindex locale definition
35971 @item LANG
35972 This variable is used to pass locale information to the compiler.  One way in
35973 which this information is used is to determine the character set to be used
35974 when character literals, string literals and comments are parsed in C and C++.
35975 When the compiler is configured to allow multibyte characters,
35976 the following values for @env{LANG} are recognized:
35978 @table @samp
35979 @item C-JIS
35980 Recognize JIS characters.
35981 @item C-SJIS
35982 Recognize SJIS characters.
35983 @item C-EUCJP
35984 Recognize EUCJP characters.
35985 @end table
35987 If @env{LANG} is not defined, or if it has some other value, then the
35988 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
35989 recognize and translate multibyte characters.
35991 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
35992 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
35993 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
35994 then additional text will be emitted to stderr when fix-it hints are
35995 emitted.  @option{-fdiagnostics-parseable-fixits} and
35996 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35997 environment variable.
35999 @table @samp
36000 @item fixits-v1
36001 Emit parseable fix-it hints, equivalent to
36002 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
36003 expressed as a count of bytes, starting at byte 1 for the initial column.
36005 @item fixits-v2
36006 As @code{fixits-v1}, but columns are expressed as display columns,
36007 as per @option{-fdiagnostics-column-unit=display}.
36008 @end table
36010 @end table
36012 @noindent
36013 Some additional environment variables affect the behavior of the
36014 preprocessor.
36016 @include cppenv.texi
36018 @c man end
36020 @node Precompiled Headers
36021 @section Using Precompiled Headers
36022 @cindex precompiled headers
36023 @cindex speed of compilation
36025 Often large projects have many header files that are included in every
36026 source file.  The time the compiler takes to process these header files
36027 over and over again can account for nearly all of the time required to
36028 build the project.  To make builds faster, GCC allows you to
36029 @dfn{precompile} a header file.
36031 To create a precompiled header file, simply compile it as you would any
36032 other file, if necessary using the @option{-x} option to make the driver
36033 treat it as a C or C++ header file.  You may want to use a
36034 tool like @command{make} to keep the precompiled header up-to-date when
36035 the headers it contains change.
36037 A precompiled header file is searched for when @code{#include} is
36038 seen in the compilation.  As it searches for the included file
36039 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
36040 compiler looks for a precompiled header in each directory just before it
36041 looks for the include file in that directory.  The name searched for is
36042 the name specified in the @code{#include} with @samp{.gch} appended.  If
36043 the precompiled header file cannot be used, it is ignored.
36045 For instance, if you have @code{#include "all.h"}, and you have
36046 @file{all.h.gch} in the same directory as @file{all.h}, then the
36047 precompiled header file is used if possible, and the original
36048 header is used otherwise.
36050 Alternatively, you might decide to put the precompiled header file in a
36051 directory and use @option{-I} to ensure that directory is searched
36052 before (or instead of) the directory containing the original header.
36053 Then, if you want to check that the precompiled header file is always
36054 used, you can put a file of the same name as the original header in this
36055 directory containing an @code{#error} command.
36057 This also works with @option{-include}.  So yet another way to use
36058 precompiled headers, good for projects not designed with precompiled
36059 header files in mind, is to simply take most of the header files used by
36060 a project, include them from another header file, precompile that header
36061 file, and @option{-include} the precompiled header.  If the header files
36062 have guards against multiple inclusion, they are skipped because
36063 they've already been included (in the precompiled header).
36065 If you need to precompile the same header file for different
36066 languages, targets, or compiler options, you can instead make a
36067 @emph{directory} named like @file{all.h.gch}, and put each precompiled
36068 header in the directory, perhaps using @option{-o}.  It doesn't matter
36069 what you call the files in the directory; every precompiled header in
36070 the directory is considered.  The first precompiled header
36071 encountered in the directory that is valid for this compilation is
36072 used; they're searched in no particular order.
36074 There are many other possibilities, limited only by your imagination,
36075 good sense, and the constraints of your build system.
36077 A precompiled header file can be used only when these conditions apply:
36079 @itemize
36080 @item
36081 Only one precompiled header can be used in a particular compilation.
36083 @item
36084 A precompiled header cannot be used once the first C token is seen.  You
36085 can have preprocessor directives before a precompiled header; you cannot
36086 include a precompiled header from inside another header.
36088 @item
36089 The precompiled header file must be produced for the same language as
36090 the current compilation.  You cannot use a C precompiled header for a C++
36091 compilation.
36093 @item
36094 The precompiled header file must have been produced by the same compiler
36095 binary as the current compilation is using.
36097 @item
36098 Any macros defined before the precompiled header is included must
36099 either be defined in the same way as when the precompiled header was
36100 generated, or must not affect the precompiled header, which usually
36101 means that they don't appear in the precompiled header at all.
36103 The @option{-D} option is one way to define a macro before a
36104 precompiled header is included; using a @code{#define} can also do it.
36105 There are also some options that define macros implicitly, like
36106 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
36107 defined this way.
36109 @item If debugging information is output when using the precompiled
36110 header, using @option{-g} or similar, the same kind of debugging information
36111 must have been output when building the precompiled header.  However,
36112 a precompiled header built using @option{-g} can be used in a compilation
36113 when no debugging information is being output.
36115 @item The same @option{-m} options must generally be used when building
36116 and using the precompiled header.  @xref{Submodel Options},
36117 for any cases where this rule is relaxed.
36119 @item Each of the following options must be the same when building and using
36120 the precompiled header:
36122 @gccoptlist{-fexceptions}
36124 @item
36125 Some other command-line options starting with @option{-f},
36126 @option{-p}, or @option{-O} must be defined in the same way as when
36127 the precompiled header was generated.  At present, it's not clear
36128 which options are safe to change and which are not; the safest choice
36129 is to use exactly the same options when generating and using the
36130 precompiled header.  The following are known to be safe:
36132 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
36133 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
36134 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
36135 -pedantic-errors}
36137 @item Address space layout randomization (ASLR) can lead to not binary identical
36138 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
36139 PCH files.
36141 @end itemize
36143 For all of these except the last, the compiler automatically
36144 ignores the precompiled header if the conditions aren't met.  If you
36145 find an option combination that doesn't work and doesn't cause the
36146 precompiled header to be ignored, please consider filing a bug report,
36147 see @ref{Bugs}.
36149 If you do use differing options when generating and using the
36150 precompiled header, the actual behavior is a mixture of the
36151 behavior for the options.  For instance, if you use @option{-g} to
36152 generate the precompiled header but not when using it, you may or may
36153 not get debugging information for routines in the precompiled header.
36155 @node C++ Modules
36156 @section C++ Modules
36157 @cindex speed of compilation
36159 Modules are a C++20 language feature.  As the name suggests, they
36160 provides a modular compilation system, intending to provide both
36161 faster builds and better library isolation.  The ``Merging Modules''
36162 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
36163 of changes to the standard, although it does not capture later
36164 changes.
36166 @emph{G++'s modules support is not complete.}  Other than bugs, the
36167 known missing pieces are:
36169 @table @emph
36171 @item Private Module Fragment
36172 The Private Module Fragment is recognized, but an error is emitted.
36174 @item Partition definition visibility rules
36175 Entities may be defined in implementation partitions, and those
36176 definitions are not available outside of the module.  This is not
36177 implemented, and the definitions are available to extra-module use.
36179 @item Textual merging of reachable GM entities
36180 Entities may be multiply defined across different header-units.
36181 These must be de-duplicated, and this is implemented across imports,
36182 or when an import redefines a textually-defined entity.  However the
36183 reverse is not implemented---textually redefining an entity that has
36184 been defined in an imported header-unit.  A redefinition error is
36185 emitted.
36187 @item Translation-Unit local referencing rules
36188 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
36189 (@uref{https://wg21.link/p2003}) add limitations on which entities an
36190 exported region may reference (for instance, the entities an exported
36191 template definition may reference).  These are not fully implemented.
36193 @item Standard Library Header Units
36194 The Standard Library is not provided as importable header units.  If
36195 you want to import such units, you must explicitly build them first.
36196 If you do not do this with care, you may have multiple declarations,
36197 which the module machinery must merge---compiler resource usage can be
36198 affected by how you partition header files into header units.
36200 @end table
36202 Modular compilation is @emph{not} enabled with just the
36203 @option{-std=c++20} option.  You must explicitly enable it with the
36204 @option{-fmodules-ts} option.  It is independent of the language
36205 version selected, although in pre-C++20 versions, it is of course an
36206 extension.
36208 No new source file suffixes are required or supported.  If you wish to
36209 use a non-standard suffix (@pxref{Overall Options}), you also need
36210 to provide a @option{-x c++} option too.@footnote{Some users like to
36211 distinguish module interface files with a new suffix, such as naming
36212 the source @code{module.cppm}, which involves
36213 teaching all tools about the new suffix.  A different scheme, such as
36214 naming @code{module-m.cpp} would be less invasive.}
36216 Compiling a module interface unit produces an additional output (to
36217 the assembly or object file), called a Compiled Module Interface
36218 (CMI).  This encodes the exported declarations of the module.
36219 Importing a module reads in the CMI.  The import graph is a Directed
36220 Acyclic Graph (DAG).  You must build imports before the importer.
36222 Header files may themselves be compiled to header units, which are a
36223 transitional ability aiming at faster compilation.  The
36224 @option{-fmodule-header} option is used to enable this, and implies
36225 the @option{-fmodules-ts} option.  These CMIs are named by the fully
36226 resolved underlying header file, and thus may be a complete pathname
36227 containing subdirectories.  If the header file is found at an absolute
36228 pathname, the CMI location is still relative to a CMI root directory.
36230 As header files often have no suffix, you commonly have to specify a
36231 @option{-x} option to tell the compiler the source is a header file.
36232 You may use @option{-x c++-header}, @option{-x c++-user-header} or
36233 @option{-x c++-system-header}.  When used in conjunction with
36234 @option{-fmodules-ts}, these all imply an appropriate
36235 @option{-fmodule-header} option.  The latter two variants use the
36236 user or system include path to search for the file specified.  This
36237 allows you to, for instance, compile standard library header files as
36238 header units, without needing to know exactly where they are
36239 installed.  Specifying the language as one of these variants also
36240 inhibits output of the object file, as header files have no associated
36241 object file.
36243 The @option{-fmodule-only} option disables generation of the
36244 associated object file for compiling a module interface.  Only the CMI
36245 is generated.  This option is implied when using the
36246 @option{-fmodule-header} option.
36248 The @option{-flang-info-include-translate} and
36249 @option{-flang-info-include-translate-not} options notes whether
36250 include translation occurs or not.  With no argument, the first will
36251 note all include translation.  The second will note all
36252 non-translations of include files not known to intentionally be
36253 textual.  With an argument, queries about include translation of a
36254 header files with that particular trailing pathname are noted.  You
36255 may repeat this form to cover several different header files.  This
36256 option may be helpful in determining whether include translation is
36257 happening---if it is working correctly, it behaves as if it isn't
36258 there at all.
36260 The @option{-flang-info-module-cmi} option can be used to determine
36261 where the compiler is reading a CMI from.  Without the option, the
36262 compiler is silent when such a read is successful.  This option has an
36263 optional argument, which will restrict the notification to just the
36264 set of named modules or header units specified.
36266 The @option{-Winvalid-imported-macros} option causes all imported macros
36267 to be resolved at the end of compilation.  Without this, imported
36268 macros are only resolved when expanded or (re)defined.  This option
36269 detects conflicting import definitions for all macros.
36271 For details of the @option{-fmodule-mapper} family of options,
36272 @pxref{C++ Module Mapper}.
36274 @menu
36275 * C++ Module Mapper::       Module Mapper
36276 * C++ Module Preprocessing::  Module Preprocessing
36277 * C++ Compiled Module Interface:: Compiled Module Interface
36278 @end menu
36280 @node C++ Module Mapper
36281 @subsection Module Mapper
36282 @cindex C++ Module Mapper
36284 A module mapper provides a server or file that the compiler queries to
36285 determine the mapping between module names and CMI files.  It is also
36286 used to build CMIs on demand.  @emph{Mapper functionality is in its
36287 infancy and is intended for experimentation with build system
36288 interactions.}
36290 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
36291 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
36292 have one of the following forms:
36294 @table @gcctabopt
36296 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
36297 An optional hostname and a numeric port number to connect to.  If the
36298 hostname is omitted, the loopback address is used.  If the hostname
36299 corresponds to multiple IPV6 addresses, these are tried in turn, until
36300 one is successful.  If your host lacks IPv6, this form is
36301 non-functional.  If you must use IPv4 use
36302 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
36304 @item =@var{socket}@r{[}?@var{ident}@r{]}
36305 A local domain socket.  If your host lacks local domain sockets, this
36306 form is non-functional.
36308 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
36309 A program to spawn, and communicate with on its stdin/stdout streams.
36310 Your @var{PATH} environment variable is searched for the program.
36311 Arguments are separated by space characters, (it is not possible for
36312 one of the arguments delivered to the program to contain a space).  An
36313 exception is if @var{program} begins with @@.  In that case
36314 @var{program} (sans @@) is looked for in the compiler's internal
36315 binary directory.  Thus the sample mapper-server can be specified
36316 with @code{@@g++-mapper-server}.
36318 @item <>@r{[}?@var{ident}@r{]}
36319 @item <>@var{inout}@r{[}?@var{ident}@r{]}
36320 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
36321 Named pipes or file descriptors to communicate over.  The first form,
36322 @option{<>}, communicates over stdin and stdout.  The other forms
36323 allow you to specify a file descriptor or name a pipe.  A numeric value
36324 is interpreted as a file descriptor, otherwise named pipe is opened.
36325 The second form specifies a bidirectional pipe and the last form
36326 allows specifying two independent pipes.  Using file descriptors
36327 directly in this manner is fragile in general, as it can require the
36328 cooperation of intermediate processes.  In particular using stdin &
36329 stdout is fraught with danger as other compiler options might also
36330 cause the compiler to read stdin or write stdout, and it can have
36331 unfortunate interactions with signal delivery from the terminal.
36333 @item @var{file}@r{[}?@var{ident}@r{]}
36334 A mapping file consisting of space-separated module-name, filename
36335 pairs, one per line.  Only the mappings for the direct imports and any
36336 module export name need be provided.  If other mappings are provided,
36337 they override those stored in any imported CMI files.  A repository
36338 root may be specified in the mapping file by using @samp{$root} as the
36339 module name in the first active line.  Use of this option will disable
36340 any default module->CMI name mapping.
36342 @end table
36344 As shown, an optional @var{ident} may suffix the first word of the
36345 option, indicated by a @samp{?} prefix.  The value is used in the
36346 initial handshake with the module server, or to specify a prefix on
36347 mapping file lines.  In the server case, the main source file name is
36348 used if no @var{ident} is specified.  In the file case, all non-blank
36349 lines are significant, unless a value is specified, in which case only
36350 lines beginning with @var{ident} are significant.  The @var{ident}
36351 must be separated by whitespace from the module name.  Be aware that
36352 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
36353 significant to the shell, and therefore may need quoting.
36355 The mapper is connected to or loaded lazily, when the first module
36356 mapping is required.  The networking protocols are only supported on
36357 hosts that provide networking.  If no mapper is specified a default is
36358 provided.
36360 A project-specific mapper is expected to be provided by the build
36361 system that invokes the compiler.  It is not expected that a
36362 general-purpose server is provided for all compilations.  As such, the
36363 server will know the build configuration, the compiler it invoked, and
36364 the environment (such as working directory) in which that is
36365 operating.  As it may parallelize builds, several compilations may
36366 connect to the same socket.
36368 The default mapper generates CMI files in a @samp{gcm.cache}
36369 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
36370 is used directly to provide the basename.  Header units construct a
36371 relative path using the underlying header file name.  If the path is
36372 already relative, a @samp{,} directory is prepended.  Internal
36373 @samp{..} components are translated to @samp{,,}.  No attempt is made
36374 to canonicalize these filenames beyond that done by the preprocessor's
36375 include search algorithm, as in general it is ambiguous when symbolic
36376 links are present.
36378 The mapper protocol was published as ``A Module Mapper''
36379 @uref{https://wg21.link/p1184}.  The implementation is provided by
36380 @command{libcody}, @uref{https://github.com/urnathan/libcody},
36381 which specifies the canonical protocol definition.  A proof of concept
36382 server implementation embedded in @command{make} was described in
36383 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
36385 @node C++ Module Preprocessing
36386 @subsection Module Preprocessing
36387 @cindex C++ Module Preprocessing
36389 Modules affect preprocessing because of header units and include
36390 translation.  Some uses of the preprocessor as a separate step either
36391 do not produce a correct output, or require CMIs to be available.
36393 Header units import macros.  These macros can affect later conditional
36394 inclusion, which therefore can cascade to differing import sets.  When
36395 preprocessing, it is necessary to load the CMI.  If a header unit is
36396 unavailable, the preprocessor issues a warning and continue (when
36397 not just preprocessing, an error is emitted).  Detecting such imports
36398 requires preprocessor tokenization of the input stream to phase 4
36399 (macro expansion).
36401 Include translation converts @code{#include}, @code{#include_next} and
36402 @code{#import} directives to internal @code{import} declarations.
36403 Whether a particular directive is translated is controlled by the
36404 module mapper.  Header unit names are canonicalized during
36405 preprocessing.
36407 Dependency information can be emitted for macro import, extending the
36408 functionality of @option{-MD} and @option{-MMD} options.  Detection of
36409 import declarations also requires phase 4 preprocessing, and thus
36410 requires full preprocessing (or compilation).
36412 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
36413 preprocessing before phase 4.
36415 The @option{-save-temps} option uses @option{-fdirectives-only} for
36416 preprocessing, and preserve the macro definitions in the preprocessed
36417 output.  Usually you also want to use this option when explicitly
36418 preprocessing a header-unit, or consuming such preprocessed output:
36420 @smallexample
36421 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
36422 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
36423 @end smallexample
36425 @node C++ Compiled Module Interface
36426 @subsection Compiled Module Interface
36427 @cindex C++ Compiled Module Interface
36429 CMIs are an additional artifact when compiling named module
36430 interfaces, partitions or header units.  These are read when
36431 importing.  CMI contents are implementation-specific, and in GCC's
36432 case tied to the compiler version.  Consider them a rebuildable cache
36433 artifact, not a distributable object.
36435 When creating an output CMI, any missing directory components are
36436 created in a manner that is safe for concurrent builds creating
36437 multiple, different, CMIs within a common subdirectory tree.
36439 CMI contents are written to a temporary file, which is then atomically
36440 renamed.  Observers either see old contents (if there is an
36441 existing file), or complete new contents.  They do not observe the
36442 CMI during its creation.  This is unlike object file writing, which
36443 may be observed by an external process.
36445 CMIs are read in lazily, if the host OS provides @code{mmap}
36446 functionality.  Generally blocks are read when name lookup or template
36447 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
36448 option may be used.
36450 The @option{--param lazy-modules=@var{n}} parameter controls the limit
36451 on the number of concurrently open module files during lazy loading.
36452 Should more modules be imported, an LRU algorithm is used to determine
36453 which files to close---until that file is needed again.  This limit
36454 may be exceeded with deep module dependency hierarchies.  With large
36455 code bases there may be more imports than the process limit of file
36456 descriptors.  By default, the limit is a few less than the per-process
36457 file descriptor hard limit, if that is determinable.@footnote{Where
36458 applicable the soft limit is incremented as needed towards the hard limit.}
36460 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
36461 You may use @command{readelf} to inspect them, although section
36462 contents are largely undecipherable.  There is a section named
36463 @code{.gnu.c++.README}, which contains human-readable text.  Other
36464 than the first line, each line consists of @code{@var{tag}: @code{value}}
36465 tuples.
36467 @smallexample
36468 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
36470 String dump of section '.gnu.c++.README':
36471   [     0]  GNU C++ primary module interface
36472   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
36473   [    6f]  version: 2020/11/16-04:54
36474   [    89]  module: foo
36475   [    95]  source: c_b.ii
36476   [    a4]  dialect: C++20/coroutines
36477   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
36478   [    ee]  repository: gcm.cache
36479   [   104]  buildtime: 2020/11/16 15:03:21 UTC
36480   [   127]  localtime: 2020/11/16 07:03:21 PST
36481   [   14a]  export: foo:part1 foo-part1.gcm
36482 @end smallexample
36484 Amongst other things, this lists the source that was built, C++
36485 dialect used and imports of the module.@footnote{The precise contents
36486 of this output may change.} The timestamp is the same value as that
36487 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
36488 explicitly specified with the environment variable
36489 @code{SOURCE_DATE_EPOCH}.  For further details
36490 @pxref{Environment Variables}.
36492 A set of related CMIs may be copied, provided the relative pathnames
36493 are preserved.
36495 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
36496 it may be removed or altered.  The section numbering of the sections
36497 whose names do not begin with @code{.gnu.c++.}, or are not the string
36498 section is significant and must not be altered.