]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
rs6000: Enable REE pass by default
[gcc.git] / gcc / doc / invoke.texi
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.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2023 Free Software Foundation, Inc.
12
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.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
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{}
42
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
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
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}.
76
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.
81
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.
88
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.
101
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}}.
108
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.
116
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.
123
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.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
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
177
178 @c man begin OPTIONS
179
180 @node Option Summary
181 @section Option Summary
182
183 Here is a summary of all the options, grouped by type. Explanations are
184 in the following sections.
185
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}}
197
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}}
212
213 @item C++ Language Options
214 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
215 @gccoptlist{-fabi-version=@var{n} -fno-access-control
216 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new
217 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n}
218 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n}
219 -fno-elide-constructors
220 -fno-enforce-eh-specs
221 -fno-gnu-keywords
222 -fno-implicit-templates
223 -fno-implicit-inline-templates
224 -fno-implement-inlines
225 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts
226 -fmodule-implicit-inline
227 -fno-module-lazy
228 -fmodule-mapper=@var{specification}
229 -fmodule-version-ignore
230 -fms-extensions
231 -fnew-inheriting-ctors
232 -fnew-ttp-matching
233 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
234 -fno-optional-diags -fpermissive
235 -fno-pretty-templates
236 -fno-rtti -fsized-deallocation
237 -ftemplate-backtrace-limit=@var{n}
238 -ftemplate-depth=@var{n}
239 -fno-threadsafe-statics -fuse-cxa-atexit
240 -fno-weak -nostdinc++
241 -fvisibility-inlines-hidden
242 -fvisibility-ms-compat
243 -fext-numeric-literals
244 -flang-info-include-translate@r{[}=@var{header}@r{]}
245 -flang-info-include-translate-not
246 -flang-info-module-cmi@r{[}=@var{module}@r{]}
247 -stdlib=@var{libstdc++,libc++}
248 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n}
249 -Wno-class-conversion -Wclass-memaccess
250 -Wcomma-subscript -Wconditionally-supported
251 -Wno-conversion-null -Wctad-maybe-unsupported
252 -Wctor-dtor-privacy -Wdangling-reference
253 -Wno-delete-incomplete
254 -Wdelete-non-virtual-dtor -Wno-deprecated-array-compare
255 -Wdeprecated-copy -Wdeprecated-copy-dtor
256 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion
257 -Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base
258 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime
259 -Winvalid-constexpr -Winvalid-imported-macros
260 -Wno-invalid-offsetof -Wno-literal-suffix
261 -Wmismatched-new-delete -Wmismatched-tags
262 -Wmultiple-inheritance -Wnamespaces -Wnarrowing
263 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor
264 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n}
265 -Wrange-loop-construct -Wredundant-move -Wredundant-tags
266 -Wreorder -Wregister
267 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates
268 -Wno-non-template-friend -Wold-style-cast
269 -Woverloaded-virtual -Wno-pmf-conversions -Wself-move -Wsign-promo
270 -Wsized-deallocation -Wsuggest-final-methods
271 -Wsuggest-final-types -Wsuggest-override
272 -Wno-terminate -Wuseless-cast -Wno-vexing-parse
273 -Wvirtual-inheritance
274 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
275
276 @item Objective-C and Objective-C++ Language Options
277 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
278 Objective-C and Objective-C++ Dialects}.
279 @gccoptlist{-fconstant-string-class=@var{class-name}
280 -fgnu-runtime -fnext-runtime
281 -fno-nil-receivers
282 -fobjc-abi-version=@var{n}
283 -fobjc-call-cxx-cdtors
284 -fobjc-direct-dispatch
285 -fobjc-exceptions
286 -fobjc-gc
287 -fobjc-nilcheck
288 -fobjc-std=objc1
289 -fno-local-ivars
290 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
291 -freplace-objc-classes
292 -fzero-link
293 -gen-decls
294 -Wassign-intercept -Wno-property-assign-default
295 -Wno-protocol -Wobjc-root-class -Wselector
296 -Wstrict-selector-match
297 -Wundeclared-selector}
298
299 @item Diagnostic Message Formatting Options
300 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
301 @gccoptlist{-fmessage-length=@var{n}
302 -fdiagnostics-plain-output
303 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}
304 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}
305 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}
306 -fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]}
307 -fno-diagnostics-show-option -fno-diagnostics-show-caret
308 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers
309 -fno-diagnostics-show-cwe
310 -fno-diagnostics-show-rule
311 -fdiagnostics-minimum-margin-width=@var{width}
312 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
313 -fdiagnostics-show-template-tree -fno-elide-type
314 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]}
315 -fdiagnostics-show-path-depths
316 -fno-show-column
317 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]}
318 -fdiagnostics-column-origin=@var{origin}
319 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}}
320
321 @item Warning Options
322 @xref{Warning Options,,Options to Request or Suppress Warnings}.
323 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic
324 -pedantic-errors
325 -w -Wextra -Wall -Wabi=@var{n}
326 -Waddress -Wno-address-of-packed-member -Waggregate-return
327 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero
328 -Walloca -Walloca-larger-than=@var{byte-size}
329 -Wno-aggressive-loop-optimizations
330 -Warith-conversion
331 -Warray-bounds -Warray-bounds=@var{n} -Warray-compare
332 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias
333 -Wno-attribute-warning
334 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
335 -Wbool-compare -Wbool-operation
336 -Wno-builtin-declaration-mismatch
337 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
338 -Wc11-c2x-compat
339 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat
340 -Wc++20-compat
341 -Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions
342 -Wno-c++20-extensions -Wno-c++23-extensions
343 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual
344 -Wchar-subscripts
345 -Wclobbered -Wcomment
346 -Wno-complain-wrong-lang
347 -Wconversion -Wno-coverage-mismatch -Wno-cpp
348 -Wdangling-else -Wdangling-pointer -Wdangling-pointer=@var{n}
349 -Wdate-time
350 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init
351 -Wdisabled-optimization
352 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers
353 -Wno-div-by-zero -Wdouble-promotion
354 -Wduplicated-branches -Wduplicated-cond
355 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion
356 -Wenum-int-mismatch
357 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors
358 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2
359 -Wno-format-contains-nul -Wno-format-extra-args
360 -Wformat-nonliteral -Wformat-overflow=@var{n}
361 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n}
362 -Wformat-y2k -Wframe-address
363 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object
364 -Wno-if-not-aligned -Wno-ignored-attributes
365 -Wignored-qualifiers -Wno-incompatible-pointer-types
366 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n}
367 -Wno-implicit-function-declaration -Wno-implicit-int
368 -Winfinite-recursion
369 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context
370 -Wno-int-to-pointer-cast -Wno-invalid-memory-model
371 -Winvalid-pch -Winvalid-utf8 -Wno-unicode -Wjump-misses-init
372 -Wlarger-than=@var{byte-size} -Wlogical-not-parentheses -Wlogical-op
373 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
374 -Wmemset-elt-size -Wmemset-transposed-args
375 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
376 -Wmissing-field-initializers -Wmissing-format-attribute
377 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
378 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare
379 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
380 -Wnull-dereference -Wno-odr
381 -Wopenacc-parallelism
382 -Wopenmp-simd
383 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects
384 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
385 -Wparentheses -Wno-pedantic-ms-format
386 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
387 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls
388 -Wrestrict -Wno-return-local-addr -Wreturn-type
389 -Wno-scalar-storage-order -Wsequence-point
390 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local
391 -Wno-shadow-ivar
392 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value
393 -Wno-shift-overflow -Wshift-overflow=@var{n}
394 -Wsign-compare -Wsign-conversion
395 -Wno-sizeof-array-argument
396 -Wsizeof-array-div
397 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
398 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing
399 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n}
400 -Wstring-compare
401 -Wno-stringop-overflow -Wno-stringop-overread
402 -Wno-stringop-truncation -Wstrict-flex-arrays
403 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]}
404 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum
405 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
406 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs
407 -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef
408 -Wuninitialized -Wunknown-pragmas
409 -Wunsuffixed-float-constants -Wunused
410 -Wunused-but-set-parameter -Wunused-but-set-variable
411 -Wunused-const-variable -Wunused-const-variable=@var{n}
412 -Wunused-function -Wunused-label -Wunused-local-typedefs
413 -Wunused-macros
414 -Wunused-parameter -Wno-unused-result
415 -Wunused-value -Wunused-variable
416 -Wno-varargs -Wvariadic-macros
417 -Wvector-operation-performance
418 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than
419 -Wvolatile-register-var -Wwrite-strings
420 -Wxor-used-as-pow
421 -Wzero-length-bounds}
422
423 @item Static Analyzer Options
424 @gccoptlist{
425 -fanalyzer
426 -fanalyzer-call-summaries
427 -fanalyzer-checker=@var{name}
428 -fno-analyzer-feasibility
429 -fanalyzer-fine-grained
430 -fno-analyzer-state-merge
431 -fno-analyzer-state-purge
432 -fno-analyzer-suppress-followups
433 -fanalyzer-transitivity
434 -fno-analyzer-undo-inlining
435 -fanalyzer-verbose-edges
436 -fanalyzer-verbose-state-changes
437 -fanalyzer-verbosity=@var{level}
438 -fdump-analyzer
439 -fdump-analyzer-callgraph
440 -fdump-analyzer-exploded-graph
441 -fdump-analyzer-exploded-nodes
442 -fdump-analyzer-exploded-nodes-2
443 -fdump-analyzer-exploded-nodes-3
444 -fdump-analyzer-exploded-paths
445 -fdump-analyzer-feasibility
446 -fdump-analyzer-json
447 -fdump-analyzer-state-purge
448 -fdump-analyzer-stderr
449 -fdump-analyzer-supergraph
450 -fdump-analyzer-untracked
451 -Wno-analyzer-double-fclose
452 -Wno-analyzer-double-free
453 -Wno-analyzer-exposure-through-output-file
454 -Wno-analyzer-exposure-through-uninit-copy
455 -Wno-analyzer-fd-access-mode-mismatch
456 -Wno-analyzer-fd-double-close
457 -Wno-analyzer-fd-leak
458 -Wno-analyzer-fd-phase-mismatch
459 -Wno-analyzer-fd-type-mismatch
460 -Wno-analyzer-fd-use-after-close
461 -Wno-analyzer-fd-use-without-check
462 -Wno-analyzer-file-leak
463 -Wno-analyzer-free-of-non-heap
464 -Wno-analyzer-imprecise-fp-arithmetic
465 -Wno-analyzer-infinite-recursion
466 -Wno-analyzer-jump-through-null
467 -Wno-analyzer-malloc-leak
468 -Wno-analyzer-mismatching-deallocation
469 -Wno-analyzer-null-argument
470 -Wno-analyzer-null-dereference
471 -Wno-analyzer-out-of-bounds
472 -Wno-analyzer-possible-null-argument
473 -Wno-analyzer-possible-null-dereference
474 -Wno-analyzer-putenv-of-auto-var
475 -Wno-analyzer-shift-count-negative
476 -Wno-analyzer-shift-count-overflow
477 -Wno-analyzer-stale-setjmp-buffer
478 -Wno-analyzer-tainted-allocation-size
479 -Wno-analyzer-tainted-assertion
480 -Wno-analyzer-tainted-array-index
481 -Wno-analyzer-tainted-divisor
482 -Wno-analyzer-tainted-offset
483 -Wno-analyzer-tainted-size
484 -Wanalyzer-too-complex
485 -Wno-analyzer-unsafe-call-within-signal-handler
486 -Wno-analyzer-use-after-free
487 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
488 -Wno-analyzer-use-of-uninitialized-value
489 -Wno-analyzer-va-arg-type-mismatch
490 -Wno-analyzer-va-list-exhausted
491 -Wno-analyzer-va-list-leak
492 -Wno-analyzer-va-list-use-after-va-end
493 -Wno-analyzer-write-to-const
494 -Wno-analyzer-write-to-string-literal
495 }
496
497 @item C and Objective-C-only Warning Options
498 @gccoptlist{-Wbad-function-cast -Wmissing-declarations
499 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
500 -Wold-style-declaration -Wold-style-definition
501 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion
502 -Wdeclaration-after-statement -Wpointer-sign}
503
504 @item Debugging Options
505 @xref{Debugging Options,,Options for Debugging Your Program}.
506 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version}
507 -gbtf -gctf -gctf@var{level}
508 -ggdb -grecord-gcc-switches -gno-record-gcc-switches
509 -gstrict-dwarf -gno-strict-dwarf
510 -gas-loc-support -gno-as-loc-support
511 -gas-locview-support -gno-as-locview-support
512 -gcodeview
513 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64
514 -gstatement-frontiers -gno-statement-frontiers
515 -gvariable-location-views -gno-variable-location-views
516 -ginternal-reset-location-views -gno-internal-reset-location-views
517 -ginline-points -gno-inline-points
518 -gvms -gz@r{[}=@var{type}@r{]}
519 -gsplit-dwarf -gdescribe-dies -gno-describe-dies
520 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section
521 -fno-eliminate-unused-debug-types
522 -femit-struct-debug-baseonly -femit-struct-debug-reduced
523 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
524 -fno-eliminate-unused-debug-symbols -femit-class-debug-always
525 -fno-merge-debug-strings -fno-dwarf2-cfi-asm
526 -fvar-tracking -fvar-tracking-assignments}
527
528 @item Optimization Options
529 @xref{Optimize Options,,Options that Control Optimization}.
530 @gccoptlist{-faggressive-loop-optimizations
531 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
532 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
533 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
534 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
535 -fno-allocation-dce -fallow-store-data-races
536 -fassociative-math -fauto-profile -fauto-profile[=@var{path}]
537 -fauto-inc-dec -fbranch-probabilities
538 -fcaller-saves
539 -fcombine-stack-adjustments -fconserve-stack
540 -fcompare-elim -fcprop-registers -fcrossjumping
541 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
542 -fcx-limited-range
543 -fdata-sections -fdce -fdelayed-branch
544 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively
545 -fdevirtualize-at-ltrans -fdse
546 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects
547 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style}
548 -ffinite-loops
549 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections
550 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
551 -fgcse-sm -fhoist-adjacent-loads -fif-conversion
552 -fif-conversion2 -findirect-inlining
553 -finline-functions -finline-functions-called-once -finline-limit=@var{n}
554 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
555 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
556 -fipa-reference -fipa-reference-addressable
557 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm}
558 -flive-patching=@var{level}
559 -fira-region=@var{region} -fira-hoist-pressure
560 -fira-loop-pressure -fno-ira-share-save-slots
561 -fno-ira-share-spill-slots
562 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute
563 -fivopts -fkeep-inline-functions -fkeep-static-functions
564 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage
565 -floop-block -floop-interchange -floop-strip-mine
566 -floop-unroll-and-jam -floop-nest-optimize
567 -floop-parallelize-all -flra-remat -flto -flto-compression-level
568 -flto-partition=@var{alg} -fmerge-all-constants
569 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves
570 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg
571 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
572 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole
573 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock
574 -fno-sched-spec -fno-signed-zeros
575 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss
576 -fomit-frame-pointer -foptimize-sibling-calls
577 -fpartial-inlining -fpeel-loops -fpredictive-commoning
578 -fprefetch-loop-arrays
579 -fprofile-correction
580 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training
581 -fprofile-values -fprofile-reorder-functions
582 -freciprocal-math -free -frename-registers -freorder-blocks
583 -freorder-blocks-algorithm=@var{algorithm}
584 -freorder-blocks-and-partition -freorder-functions
585 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops
586 -frounding-math -fsave-optimization-record
587 -fsched2-use-superblocks -fsched-pressure
588 -fsched-spec-load -fsched-spec-load-dangerous
589 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}]
590 -fsched-group-heuristic -fsched-critical-path-heuristic
591 -fsched-spec-insn-heuristic -fsched-rank-heuristic
592 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
593 -fschedule-fusion
594 -fschedule-insns -fschedule-insns2 -fsection-anchors
595 -fselective-scheduling -fselective-scheduling2
596 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
597 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
598 -fsignaling-nans
599 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops
600 -fsplit-paths
601 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt
602 -fstdarg-opt -fstore-merging -fstrict-aliasing -fipa-strict-aliasing
603 -fthread-jumps -ftracer -ftree-bit-ccp
604 -ftree-builtin-call-dce -ftree-ccp -ftree-ch
605 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts
606 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting
607 -ftree-loop-if-convert -ftree-loop-im
608 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns
609 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize
610 -ftree-loop-vectorize
611 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta
612 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra
613 -ftree-switch-conversion -ftree-tail-merge
614 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init
615 -funconstrained-commons -funit-at-a-time -funroll-all-loops
616 -funroll-loops -funsafe-math-optimizations -funswitch-loops
617 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt
618 -fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs
619 --param @var{name}=@var{value}
620 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og -Oz}
621
622 @item Program Instrumentation Options
623 @xref{Instrumentation Options,,Program Instrumentation Options}.
624 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage
625 -fprofile-abs-path
626 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path}
627 -fprofile-info-section -fprofile-info-section=@var{name}
628 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
629 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
630 -fprofile-exclude-files=@var{regex}
631 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
632 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style}
633 -fsanitize-trap -fsanitize-trap=@var{style}
634 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},...
635 -fsanitize-undefined-trap-on-error -fbounds-check
636 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
637 -fharden-compares -fharden-conditional-branches
638 -fstack-protector -fstack-protector-all -fstack-protector-strong
639 -fstack-protector-explicit -fstack-check
640 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym}
641 -fno-stack-limit -fsplit-stack
642 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
643 -fvtv-counts -fvtv-debug
644 -finstrument-functions -finstrument-functions-once
645 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
646 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
647 -fprofile-prefix-map=@var{old}=@var{new}}
648
649 @item Preprocessor Options
650 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
651 @gccoptlist{-A@var{question}=@var{answer}
652 -A-@var{question}@r{[}=@var{answer}@r{]}
653 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]}
654 -dD -dI -dM -dN -dU
655 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers
656 -fexec-charset=@var{charset} -fextended-identifiers
657 -finput-charset=@var{charset} -flarge-source-files
658 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
659 -fno-canonical-system-headers -fpch-deps -fpch-preprocess
660 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion
661 -fwide-exec-charset=@var{charset} -fworking-directory
662 -H -imacros @var{file} -include @var{file}
663 -M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules
664 -no-integrated-cpp -P -pthread -remap
665 -traditional -traditional-cpp -trigraphs
666 -U@var{macro} -undef
667 -Wp,@var{option} -Xpreprocessor @var{option}}
668
669 @item Assembler Options
670 @xref{Assembler Options,,Passing Options to the Assembler}.
671 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
672
673 @item Linker Options
674 @xref{Link Options,,Options for Linking}.
675 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library}
676 -nostartfiles -nodefaultlibs -nolibc -nostdlib -nostdlib++
677 -e @var{entry} --entry=@var{entry}
678 -pie -pthread -r -rdynamic
679 -s -static -static-pie -static-libgcc -static-libstdc++
680 -static-libasan -static-libtsan -static-liblsan -static-libubsan
681 -shared -shared-libgcc -symbolic
682 -T @var{script} -Wl,@var{option} -Xlinker @var{option}
683 -u @var{symbol} -z @var{keyword}}
684
685 @item Directory Options
686 @xref{Directory Options,,Options for Directory Search}.
687 @gccoptlist{-B@var{prefix} -I@var{dir} -I-
688 -idirafter @var{dir}
689 -imacros @var{file} -imultilib @var{dir}
690 -iplugindir=@var{dir} -iprefix @var{file}
691 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir}
692 -iwithprefix @var{dir} -iwithprefixbefore @var{dir}
693 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix
694 -nostdinc -nostdinc++ --sysroot=@var{dir}}
695
696 @item Code Generation Options
697 @xref{Code Gen Options,,Options for Code Generation Conventions}.
698 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg}
699 -ffixed-@var{reg} -fexceptions
700 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
701 -fasynchronous-unwind-tables
702 -fno-gnu-unique
703 -finhibit-size-directive -fcommon -fno-ident
704 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt
705 -fno-jump-tables -fno-bit-tests
706 -frecord-gcc-switches
707 -freg-struct-return -fshort-enums -fshort-wchar
708 -fverbose-asm -fpack-struct[=@var{n}]
709 -fleading-underscore -ftls-model=@var{model}
710 -fstack-reuse=@var{reuse_level}
711 -ftrampolines -ftrapv -fwrapv
712 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
713 -fstrict-volatile-bitfields -fsync-libcalls}
714
715 @item Developer Options
716 @xref{Developer Options,,GCC Developer Options}.
717 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion
718 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
719 -fchecking -fchecking=@var{n}
720 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list}
721 -fdisable-ipa-@var{pass_name}
722 -fdisable-rtl-@var{pass_name}
723 -fdisable-rtl-@var{pass-name}=@var{range-list}
724 -fdisable-tree-@var{pass_name}
725 -fdisable-tree-@var{pass-name}=@var{range-list}
726 -fdump-debug -fdump-earlydebug
727 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links
728 -fdump-final-insns@r{[}=@var{file}@r{]}
729 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline
730 -fdump-lang-all
731 -fdump-lang-@var{switch}
732 -fdump-lang-@var{switch}-@var{options}
733 -fdump-lang-@var{switch}-@var{options}=@var{filename}
734 -fdump-passes
735 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename}
736 -fdump-statistics
737 -fdump-tree-all
738 -fdump-tree-@var{switch}
739 -fdump-tree-@var{switch}-@var{options}
740 -fdump-tree-@var{switch}-@var{options}=@var{filename}
741 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second
742 -fenable-@var{kind}-@var{pass}
743 -fenable-@var{kind}-@var{pass}=@var{range-list}
744 -fira-verbose=@var{n}
745 -flto-report -flto-report-wpa -fmem-report-wpa
746 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report
747 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]}
748 -fmultiflags -fprofile-report
749 -frandom-seed=@var{string} -fsched-verbose=@var{n}
750 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose
751 -fstats -fstack-usage -ftime-report -ftime-report-details
752 -fvar-tracking-assignments-toggle -gtoggle
753 -print-file-name=@var{library} -print-libgcc-file-name
754 -print-multi-directory -print-multi-lib -print-multi-os-directory
755 -print-prog-name=@var{program} -print-search-dirs -Q
756 -print-sysroot -print-sysroot-headers-suffix
757 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
758
759 @item Machine-Dependent Options
760 @xref{Submodel Options,,Machine-Dependent Options}.
761 @c This list is ordered alphanumerically by subsection name.
762 @c Try and put the significant identifier (CPU or system) first,
763 @c so users have a clue at guessing where the ones they want will be.
764
765 @emph{AArch64 Options}
766 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian
767 -mgeneral-regs-only
768 -mcmodel=tiny -mcmodel=small -mcmodel=large
769 -mstrict-align -mno-strict-align
770 -momit-leaf-frame-pointer
771 -mtls-dialect=desc -mtls-dialect=traditional
772 -mtls-size=@var{size}
773 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
774 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div
775 -mpc-relative-literal-loads
776 -msign-return-address=@var{scope}
777 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
778 +@var{b-key}]|@var{bti}
779 -mharden-sls=@var{opts}
780 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}
781 -moverride=@var{string} -mverbose-cost-dump
782 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
783 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
784 -moutline-atomics }
785
786 @emph{Adapteva Epiphany Options}
787 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs
788 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf
789 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num}
790 -mround-nearest -mlong-calls -mshort-calls -msmall16
791 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num}
792 -msplit-vecmove-early -m1reg-@var{reg}}
793
794 @emph{AMD GCN Options}
795 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
796
797 @emph{ARC Options}
798 @gccoptlist{-mbarrel-shifter -mjli-always
799 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700
800 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr
801 -mea -mno-mpy -mmul32x16 -mmul64 -matomic
802 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
803 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape
804 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof
805 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved
806 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num}
807 -mvolatile-cache -mtp-regno=@var{regno}
808 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc
809 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi
810 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none
811 -mlra-priority-compact -mlra-priority-noncompact -mmillicode
812 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level}
813 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame
814 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo}
815 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
816
817 @emph{ARM Options}
818 @gccoptlist{-mapcs-frame -mno-apcs-frame
819 -mabi=@var{name}
820 -mapcs-stack-check -mno-apcs-stack-check
821 -mapcs-reentrant -mno-apcs-reentrant
822 -mgeneral-regs-only
823 -msched-prolog -mno-sched-prolog
824 -mlittle-endian -mbig-endian
825 -mbe8 -mbe32
826 -mfloat-abi=@var{name}
827 -mfp16-format=@var{name}
828 -mthumb-interwork -mno-thumb-interwork
829 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name}
830 -mtune=@var{name} -mprint-tune-info
831 -mstructure-size-boundary=@var{n}
832 -mabort-on-noreturn
833 -mlong-calls -mno-long-calls
834 -msingle-pic-base -mno-single-pic-base
835 -mpic-register=@var{reg}
836 -mnop-fun-dllimport
837 -mpoke-function-name
838 -mthumb -marm -mflip-thumb
839 -mtpcs-frame -mtpcs-leaf-frame
840 -mcaller-super-interworking -mcallee-super-interworking
841 -mtp=@var{name} -mtls-dialect=@var{dialect}
842 -mword-relocations
843 -mfix-cortex-m3-ldrd
844 -mfix-cortex-a57-aes-1742098
845 -mfix-cortex-a72-aes-1655431
846 -munaligned-access
847 -mneon-for-64bits
848 -mslow-flash-data
849 -masm-syntax-unified
850 -mrestrict-it
851 -mverbose-cost-dump
852 -mpure-code
853 -mcmse
854 -mfix-cmse-cve-2021-35465
855 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
856 -mfdpic
857 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
858 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
859
860 @emph{AVR Options}
861 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args
862 -mbranch-cost=@var{cost}
863 -mcall-prologues -mgas-isr-prologues -mint8
864 -mdouble=@var{bits} -mlong-double=@var{bits}
865 -mn_flash=@var{size} -mno-interrupts
866 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
867 -mfract-convert-truncate
868 -mshort-calls -nodevicelib -nodevicespecs
869 -Waddr-space-convert -Wmisspelled-isr}
870
871 @emph{Blackfin Options}
872 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
873 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
874 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly
875 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library
876 -mno-id-shared-library -mshared-library-id=@var{n}
877 -mleaf-id-shared-library -mno-leaf-id-shared-library
878 -msep-data -mno-sep-data -mlong-calls -mno-long-calls
879 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram
880 -micplb}
881
882 @emph{C6X Options}
883 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu}
884 -msim -msdata=@var{sdata-type}}
885
886 @emph{CRIS Options}
887 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu}
888 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
889 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects
890 -mstack-align -mdata-align -mconst-align
891 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue
892 -melf -maout -sim -sim2
893 -mmul-bug-workaround -mno-mul-bug-workaround}
894
895 @emph{C-SKY Options}
896 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu}
897 -mbig-endian -EB -mlittle-endian -EL
898 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu
899 -mfloat-abi=@var{name}
900 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust
901 -mdsp -medsp -mvdsp
902 -mdiv -msmart -mhigh-registers -manchor
903 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt
904 -mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim}
905
906 @emph{Darwin Options}
907 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal
908 -arch_only -bind_at_load -bundle -bundle_loader
909 -client_name -compatibility_version -current_version
910 -dead_strip
911 -dependency-file -dylib_file -dylinker_install_name
912 -dynamic -dynamiclib -exported_symbols_list
913 -filelist -flat_namespace -force_cpusubtype_ALL
914 -force_flat_namespace -headerpad_max_install_names
915 -iframework
916 -image_base -init -install_name -keep_private_externs
917 -multi_module -multiply_defined -multiply_defined_unused
918 -noall_load -no_dead_strip_inits_and_terms
919 -nofixprebinding -nomultidefs -noprebind -noseglinkedit
920 -pagezero_size -prebind -prebind_all_twolevel_modules
921 -private_bundle -read_only_relocs -sectalign
922 -sectobjectsymbols -whyload -seg1addr
923 -sectcreate -sectobjectsymbols -sectorder
924 -segaddr -segs_read_only_addr -segs_read_write_addr
925 -seg_addr_table -seg_addr_table_filename -seglinkedit
926 -segprot -segs_read_only_addr -segs_read_write_addr
927 -single_module -static -sub_library -sub_umbrella
928 -twolevel_namespace -umbrella -undefined
929 -unexported_symbols_list -weak_reference_mismatches
930 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version}
931 -mkernel -mone-byte-bool}
932
933 @emph{DEC Alpha Options}
934 @gccoptlist{-mno-fp-regs -msoft-float
935 -mieee -mieee-with-inexact -mieee-conformant
936 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode}
937 -mtrap-precision=@var{mode} -mbuild-constants
938 -mcpu=@var{cpu-type} -mtune=@var{cpu-type}
939 -mbwx -mmax -mfix -mcix
940 -mfloat-vax -mfloat-ieee
941 -mexplicit-relocs -msmall-data -mlarge-data
942 -msmall-text -mlarge-text
943 -mmemory-latency=@var{time}}
944
945 @emph{eBPF Options}
946 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
947 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
948 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
949
950 @emph{FR30 Options}
951 @gccoptlist{-msmall-model -mno-lsim}
952
953 @emph{FT32 Options}
954 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
955
956 @emph{FRV Options}
957 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64
958 -mhard-float -msoft-float
959 -malloc-cc -mfixed-cc -mdword -mno-dword
960 -mdouble -mno-double
961 -mmedia -mno-media -mmuladd -mno-muladd
962 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic
963 -mlinked-fp -mlong-calls -malign-labels
964 -mlibrary-pic -macc-4 -macc-8
965 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move
966 -moptimize-membar -mno-optimize-membar
967 -mscc -mno-scc -mcond-exec -mno-cond-exec
968 -mvliw-branch -mno-vliw-branch
969 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
970 -mno-nested-cond-exec -mtomcat-stats
971 -mTLS -mtls
972 -mcpu=@var{cpu}}
973
974 @emph{GNU/Linux Options}
975 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid
976 -tno-android-cc -tno-android-ld}
977
978 @emph{H8/300 Options}
979 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
980
981 @emph{HPPA Options}
982 @gccoptlist{-march=@var{architecture-type}
983 -matomic-libcalls -mbig-switch
984 -mcaller-copies -mdisable-fpregs -mdisable-indexing
985 -mordered -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld
986 -mfixed-range=@var{register-range}
987 -mcoherent-ldcw -mjump-in-delay -mlinker-opt -mlong-calls
988 -mlong-load-store -mno-atomic-libcalls -mno-disable-fpregs
989 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
990 -mno-jump-in-delay -mno-long-load-store
991 -mno-portable-runtime -mno-soft-float
992 -mno-space-regs -msoft-float -mpa-risc-1-0
993 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime
994 -mschedule=@var{cpu-type} -mspace-regs -msoft-mult -msio -mwsio
995 -munix=@var{unix-std} -nolibdld -static -threads}
996
997 @emph{IA-64 Options}
998 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic
999 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
1000 -mconstant-gp -mauto-pic -mfused-madd
1001 -minline-float-divide-min-latency
1002 -minline-float-divide-max-throughput
1003 -mno-inline-float-divide
1004 -minline-int-divide-min-latency
1005 -minline-int-divide-max-throughput
1006 -mno-inline-int-divide
1007 -minline-sqrt-min-latency -minline-sqrt-max-throughput
1008 -mno-inline-sqrt
1009 -mdwarf2-asm -mearly-stop-bits
1010 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size}
1011 -mtune=@var{cpu-type} -milp32 -mlp64
1012 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec
1013 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec
1014 -msched-spec-ldc -msched-spec-control-ldc
1015 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns
1016 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path
1017 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
1018 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
1019
1020 @emph{LM32 Options}
1021 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled
1022 -msign-extend-enabled -muser-enabled}
1023
1024 @emph{LoongArch Options}
1025 @gccoptlist{-march=@var{cpu-type} -mtune=@var{cpu-type} -mabi=@var{base-abi-type}
1026 -mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float
1027 -mbranch-cost=@var{n} -mcheck-zero-division -mno-check-zero-division
1028 -mcond-move-int -mno-cond-move-int
1029 -mcond-move-float -mno-cond-move-float
1030 -memcpy -mno-memcpy -mstrict-align -mno-strict-align
1031 -mmax-inline-memcpy-size=@var{n}
1032 -mexplicit-relocs -mno-explicit-relocs
1033 -mdirect-extern-access -mno-direct-extern-access
1034 -mcmodel=@var{code-model}}
1035
1036 @emph{M32R/D Options}
1037 @gccoptlist{-m32r2 -m32rx -m32r
1038 -mdebug
1039 -malign-loops -mno-align-loops
1040 -missue-rate=@var{number}
1041 -mbranch-cost=@var{number}
1042 -mmodel=@var{code-size-model-type}
1043 -msdata=@var{sdata-type}
1044 -mno-flush-func -mflush-func=@var{name}
1045 -mno-flush-trap -mflush-trap=@var{number}
1046 -G @var{num}}
1047
1048 @emph{M32C Options}
1049 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
1050
1051 @emph{M680x0 Options}
1052 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
1053 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040
1054 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407
1055 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020
1056 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort
1057 -mno-short -mhard-float -m68881 -msoft-float -mpcrel
1058 -malign-int -mstrict-align -msep-data -mno-sep-data
1059 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
1060 -mxgot -mno-xgot -mlong-jump-table-offsets}
1061
1062 @emph{MCore Options}
1063 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates
1064 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields
1065 -m4byte-functions -mno-4byte-functions -mcallgraph-data
1066 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim
1067 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
1068
1069 @emph{MicroBlaze Options}
1070 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu}
1071 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
1072 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
1073 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
1074 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
1075 -mpic-data-is-text-relative}
1076
1077 @emph{MIPS Options}
1078 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch}
1079 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5
1080 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6
1081 -mips16 -mno-mips16 -mflip-mips16
1082 -minterlink-compressed -mno-interlink-compressed
1083 -minterlink-mips16 -mno-interlink-mips16
1084 -mabi=@var{abi} -mabicalls -mno-abicalls
1085 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot
1086 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float
1087 -mno-float -msingle-float -mdouble-float
1088 -modd-spreg -mno-odd-spreg
1089 -mabs=@var{mode} -mnan=@var{encoding}
1090 -mdsp -mno-dsp -mdspr2 -mno-dspr2
1091 -mmcu -mmno-mcu
1092 -meva -mno-eva
1093 -mvirt -mno-virt
1094 -mxpa -mno-xpa
1095 -mcrc -mno-crc
1096 -mginv -mno-ginv
1097 -mmicromips -mno-micromips
1098 -mmsa -mno-msa
1099 -mloongson-mmi -mno-loongson-mmi
1100 -mloongson-ext -mno-loongson-ext
1101 -mloongson-ext2 -mno-loongson-ext2
1102 -mfpu=@var{fpu-type}
1103 -msmartmips -mno-smartmips
1104 -mpaired-single -mno-paired-single -mdmx -mno-mdmx
1105 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc
1106 -mlong64 -mlong32 -msym32 -mno-sym32
1107 -G@var{num} -mlocal-sdata -mno-local-sdata
1108 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt
1109 -membedded-data -mno-embedded-data
1110 -muninit-const-in-rodata -mno-uninit-const-in-rodata
1111 -mcode-readable=@var{setting}
1112 -msplit-addresses -mno-split-addresses
1113 -mexplicit-relocs -mno-explicit-relocs
1114 -mcheck-zero-division -mno-check-zero-division
1115 -mdivide-traps -mdivide-breaks
1116 -mload-store-pairs -mno-load-store-pairs
1117 -munaligned-access -mno-unaligned-access
1118 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls
1119 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp
1120 -mfix-24k -mno-fix-24k
1121 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
1122 -mfix-r5900 -mno-fix-r5900
1123 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000
1124 -mfix-vr4120 -mno-fix-vr4120
1125 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
1126 -mflush-func=@var{func} -mno-flush-func
1127 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely
1128 -mcompact-branches=@var{policy}
1129 -mfp-exceptions -mno-fp-exceptions
1130 -mvr4130-align -mno-vr4130-align -msynci -mno-synci
1131 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4
1132 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
1133 -mframe-header-opt -mno-frame-header-opt}
1134
1135 @emph{MMIX Options}
1136 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu
1137 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols
1138 -melf -mbranch-predict -mno-branch-predict -mbase-addresses
1139 -mno-base-addresses -msingle-exit -mno-single-exit}
1140
1141 @emph{MN10300 Options}
1142 @gccoptlist{-mmult-bug -mno-mult-bug
1143 -mno-am33 -mam33 -mam33-2 -mam34
1144 -mtune=@var{cpu-type}
1145 -mreturn-pointer-on-d0
1146 -mno-crt0 -mrelax -mliw -msetlb}
1147
1148 @emph{Moxie Options}
1149 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1150
1151 @emph{MSP430 Options}
1152 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax
1153 -mwarn-mcu
1154 -mcode-region= -mdata-region=
1155 -msilicon-errata= -msilicon-errata-warn=
1156 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1157
1158 @emph{NDS32 Options}
1159 @gccoptlist{-mbig-endian -mlittle-endian
1160 -mreduced-regs -mfull-regs
1161 -mcmov -mno-cmov
1162 -mext-perf -mno-ext-perf
1163 -mext-perf2 -mno-ext-perf2
1164 -mext-string -mno-ext-string
1165 -mv3push -mno-v3push
1166 -m16bit -mno-16bit
1167 -misr-vector-size=@var{num}
1168 -mcache-block-size=@var{num}
1169 -march=@var{arch}
1170 -mcmodel=@var{code-model}
1171 -mctor-dtor -mrelax}
1172
1173 @emph{Nios II Options}
1174 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt
1175 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp}
1176 -mel -meb
1177 -mno-bypass-cache -mbypass-cache
1178 -mno-cache-volatile -mcache-volatile
1179 -mno-fast-sw-div -mfast-sw-div
1180 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div
1181 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn}
1182 -mcustom-fpu-cfg=@var{name}
1183 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}
1184 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1185
1186 @emph{Nvidia PTX Options}
1187 @gccoptlist{-m64 -mmainkernel -moptimize}
1188
1189 @emph{OpenRISC Options}
1190 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div
1191 -msoft-mul -msoft-div
1192 -msoft-float -mhard-float -mdouble-float -munordered-float
1193 -mcmov -mror -mrori -msext -msfimm -mshftimm
1194 -mcmodel=@var{code-model}}
1195
1196 @emph{PDP-11 Options}
1197 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10
1198 -mint32 -mno-int16 -mint16 -mno-int32
1199 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1200
1201 @emph{PowerPC Options}
1202 See RS/6000 and PowerPC Options.
1203
1204 @emph{PRU Options}
1205 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop
1206 -mabi=@var{variant}}
1207
1208 @emph{RISC-V Options}
1209 @gccoptlist{-mbranch-cost=@var{N-instruction}
1210 -mplt -mno-plt
1211 -mabi=@var{ABI-string}
1212 -mfdiv -mno-fdiv
1213 -mdiv -mno-div
1214 -misa-spec=@var{ISA-spec-string}
1215 -march=@var{ISA-string}
1216 -mtune=@var{processor-string}
1217 -mpreferred-stack-boundary=@var{num}
1218 -msmall-data-limit=@var{N-bytes}
1219 -msave-restore -mno-save-restore
1220 -mshorten-memrefs -mno-shorten-memrefs
1221 -mstrict-align -mno-strict-align
1222 -mcmodel=medlow -mcmodel=medany
1223 -mexplicit-relocs -mno-explicit-relocs
1224 -mrelax -mno-relax
1225 -mriscv-attribute -mno-riscv-attribute
1226 -malign-data=@var{type}
1227 -mbig-endian -mlittle-endian
1228 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1229 -mstack-protector-guard-offset=@var{offset}
1230 -mcsr-check -mno-csr-check
1231 -minline-atomics -mno-inline-atomics}
1232
1233 @emph{RL78 Options}
1234 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
1235 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
1236 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1237
1238 @emph{RS/6000 and PowerPC Options}
1239 @gccoptlist{-mcpu=@var{cpu-type}
1240 -mtune=@var{cpu-type}
1241 -mcmodel=@var{code-model}
1242 -mpowerpc64
1243 -maltivec -mno-altivec
1244 -mpowerpc-gpopt -mno-powerpc-gpopt
1245 -mpowerpc-gfxopt -mno-powerpc-gfxopt
1246 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd
1247 -mfprnd -mno-fprnd
1248 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp
1249 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc
1250 -m64 -m32 -mxl-compat -mno-xl-compat -mpe
1251 -malign-power -malign-natural
1252 -msoft-float -mhard-float -mmultiple -mno-multiple
1253 -mupdate -mno-update
1254 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
1255 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
1256 -mstrict-align -mno-strict-align -mrelocatable
1257 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib
1258 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian
1259 -mdynamic-no-pic -mswdiv -msingle-pic-base
1260 -mprioritize-restricted-insns=@var{priority}
1261 -msched-costly-dep=@var{dependence_type}
1262 -minsert-sched-nops=@var{scheme}
1263 -mcall-aixdesc -mcall-eabi -mcall-freebsd
1264 -mcall-linux -mcall-netbsd -mcall-openbsd
1265 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi
1266 -mtraceback=@var{traceback_type}
1267 -maix-struct-return -msvr4-struct-return
1268 -mabi=@var{abi-type} -msecure-plt -mbss-plt
1269 -mlongcall -mno-longcall -mpltseq -mno-pltseq
1270 -mblock-move-inline-limit=@var{num}
1271 -mblock-compare-inline-limit=@var{num}
1272 -mblock-compare-inline-loop-limit=@var{num}
1273 -mno-block-ops-unaligned-vsx
1274 -mstring-compare-inline-limit=@var{num}
1275 -misel -mno-isel
1276 -mvrsave -mno-vrsave
1277 -mmulhw -mno-mulhw
1278 -mdlmzb -mno-dlmzb
1279 -mprototype -mno-prototype
1280 -msim -mmvme -mads -myellowknife -memb -msdata
1281 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num}
1282 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision
1283 -mno-recip-precision
1284 -mveclibabi=@var{type} -mfriz -mno-friz
1285 -mpointers-to-nested-functions -mno-pointers-to-nested-functions
1286 -msave-toc-indirect -mno-save-toc-indirect
1287 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector
1288 -mcrypto -mno-crypto -mhtm -mno-htm
1289 -mquad-memory -mno-quad-memory
1290 -mquad-memory-atomic -mno-quad-memory-atomic
1291 -mcompat-align-parm -mno-compat-align-parm
1292 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware
1293 -mgnu-attribute -mno-gnu-attribute
1294 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1295 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1296 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1297 -mprivileged -mno-privileged}
1298
1299 @emph{RX Options}
1300 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu
1301 -mcpu=
1302 -mbig-endian-data -mlittle-endian-data
1303 -msmall-data
1304 -msim -mno-sim
1305 -mas100-syntax -mno-as100-syntax
1306 -mrelax
1307 -mmax-constant-size=
1308 -mint-register=
1309 -mpid
1310 -mallow-string-insns -mno-allow-string-insns
1311 -mjsr
1312 -mno-warn-multiple-fast-interrupts
1313 -msave-acc-in-interrupts}
1314
1315 @emph{S/390 and zSeries Options}
1316 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type}
1317 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
1318 -mlong-double-64 -mlong-double-128
1319 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack
1320 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle
1321 -m64 -m31 -mdebug -mno-debug -mesa -mzarch
1322 -mhtm -mvx -mzvector
1323 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip
1324 -mfused-madd -mno-fused-madd
1325 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
1326 -mhotpatch=@var{halfwords},@var{halfwords}}
1327
1328 @emph{SH Options}
1329 @gccoptlist{-m1 -m2 -m2e
1330 -m2a-nofpu -m2a-single-only -m2a-single -m2a
1331 -m3 -m3e
1332 -m4-nofpu -m4-single-only -m4-single -m4
1333 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al
1334 -mb -ml -mdalign -mrelax
1335 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave
1336 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct
1337 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy}
1338 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range}
1339 -maccumulate-outgoing-args
1340 -matomic-model=@var{atomic-model}
1341 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch
1342 -mcbranch-force-delay-slot
1343 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
1344 -mpretend-cmove -mtas}
1345
1346 @emph{Solaris 2 Options}
1347 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text
1348 -pthreads}
1349
1350 @emph{SPARC Options}
1351 @gccoptlist{-mcpu=@var{cpu-type}
1352 -mtune=@var{cpu-type}
1353 -mcmodel=@var{code-model}
1354 -mmemory-model=@var{mem-model}
1355 -m32 -m64 -mapp-regs -mno-app-regs
1356 -mfaster-structs -mno-faster-structs -mflat -mno-flat
1357 -mfpu -mno-fpu -mhard-float -msoft-float
1358 -mhard-quad-float -msoft-quad-float
1359 -mstack-bias -mno-stack-bias
1360 -mstd-struct-return -mno-std-struct-return
1361 -munaligned-doubles -mno-unaligned-doubles
1362 -muser-mode -mno-user-mode
1363 -mv8plus -mno-v8plus -mvis -mno-vis
1364 -mvis2 -mno-vis2 -mvis3 -mno-vis3
1365 -mvis4 -mno-vis4 -mvis4b -mno-vis4b
1366 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld
1367 -mpopc -mno-popc -msubxc -mno-subxc
1368 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc
1369 -mlra -mno-lra}
1370
1371 @emph{System V Options}
1372 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1373
1374 @emph{V850 Options}
1375 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep
1376 -mprolog-function -mno-prolog-function -mspace
1377 -mtda=@var{n} -msda=@var{n} -mzda=@var{n}
1378 -mapp-regs -mno-app-regs
1379 -mdisable-callt -mno-disable-callt
1380 -mv850e2v3 -mv850e2 -mv850e1 -mv850es
1381 -mv850e -mv850 -mv850e3v5
1382 -mloop
1383 -mrelax
1384 -mlong-jumps
1385 -msoft-float
1386 -mhard-float
1387 -mgcc-abi
1388 -mrh850-abi
1389 -mbig-switch}
1390
1391 @emph{VAX Options}
1392 @gccoptlist{-mg -mgnu -munix -mlra}
1393
1394 @emph{Visium Options}
1395 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float
1396 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1397
1398 @emph{VMS Options}
1399 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64
1400 -mpointer-size=@var{size}}
1401
1402 @emph{VxWorks Options}
1403 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic
1404 -Xbind-lazy -Xbind-now}
1405
1406 @emph{x86 Options}
1407 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type}
1408 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default
1409 -mfpmath=@var{unit}
1410 -masm=@var{dialect} -mno-fancy-math-387
1411 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float
1412 -mno-wide-multiply -mrtd -malign-double
1413 -mpreferred-stack-boundary=@var{num}
1414 -mincoming-stack-boundary=@var{num}
1415 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait
1416 -mrecip -mrecip=@var{opt}
1417 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt}
1418 -mmove-max=@var{bits} -mstore-max=@var{bits}
1419 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
1420 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
1421 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
1422 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
1423 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
1424 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
1425 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp
1426 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg
1427 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1428 -mavx512vbmi2 -mavx512bf16 -menqcmd
1429 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1430 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid
1431 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1432 -mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni
1433 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1434 -mprefetchi -mraoint -mamx-complex
1435 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops
1436 -minline-stringops-dynamically -mstringop-strategy=@var{alg}
1437 -mkl -mwidekl
1438 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy}
1439 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
1440 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128
1441 -mregparm=@var{num} -msseregparm
1442 -mveclibabi=@var{type} -mvect8-ret-in-mem
1443 -mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign
1444 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
1445 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode}
1446 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num}
1447 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
1448 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1449 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
1450 -malign-data=@var{type} -mstack-protector-guard=@var{guard}
1451 -mstack-protector-guard-reg=@var{reg}
1452 -mstack-protector-guard-offset=@var{offset}
1453 -mstack-protector-guard-symbol=@var{symbol}
1454 -mgeneral-regs-only -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1455 -mindirect-branch=@var{choice} -mfunction-return=@var{choice}
1456 -mindirect-branch-register -mharden-sls=@var{choice}
1457 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1458 -munroll-only-small-loops -mlam=@var{choice}}
1459
1460 @emph{x86 Windows Options}
1461 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
1462 -mnop-fun-dllimport -mthread
1463 -municode -mwin32 -mwindows -fno-set-stack-executable}
1464
1465 @emph{Xstormy16 Options}
1466 @gccoptlist{-msim}
1467
1468 @emph{Xtensa Options}
1469 @gccoptlist{-mconst16 -mno-const16
1470 -mfused-madd -mno-fused-madd
1471 -mforce-no-pic
1472 -mserialize-volatile -mno-serialize-volatile
1473 -mtext-section-literals -mno-text-section-literals
1474 -mauto-litpools -mno-auto-litpools
1475 -mtarget-align -mno-target-align
1476 -mlongcalls -mno-longcalls
1477 -mabi=@var{abi-type}
1478 -mextra-l32r-costs=@var{cycles}
1479 -mstrict-align -mno-strict-align}
1480
1481 @emph{zSeries Options}
1482 See S/390 and zSeries Options.
1483 @end table
1484
1485
1486 @node Overall Options
1487 @section Options Controlling the Kind of Output
1488
1489 Compilation can involve up to four stages: preprocessing, compilation
1490 proper, assembly and linking, always in that order. GCC is capable of
1491 preprocessing and compiling several files either into several
1492 assembler input files, or into one assembler input file; then each
1493 assembler input file produces an object file, and linking combines all
1494 the object files (those newly compiled, and those specified as input)
1495 into an executable file.
1496
1497 @cindex file name suffix
1498 For any given input file, the file name suffix determines what kind of
1499 compilation is done:
1500
1501 @table @gcctabopt
1502 @item @var{file}.c
1503 C source code that must be preprocessed.
1504
1505 @item @var{file}.i
1506 C source code that should not be preprocessed.
1507
1508 @item @var{file}.ii
1509 C++ source code that should not be preprocessed.
1510
1511 @item @var{file}.m
1512 Objective-C source code. Note that you must link with the @file{libobjc}
1513 library to make an Objective-C program work.
1514
1515 @item @var{file}.mi
1516 Objective-C source code that should not be preprocessed.
1517
1518 @item @var{file}.mm
1519 @itemx @var{file}.M
1520 Objective-C++ source code. Note that you must link with the @file{libobjc}
1521 library to make an Objective-C++ program work. Note that @samp{.M} refers
1522 to a literal capital M@.
1523
1524 @item @var{file}.mii
1525 Objective-C++ source code that should not be preprocessed.
1526
1527 @item @var{file}.h
1528 C, C++, Objective-C or Objective-C++ header file to be turned into a
1529 precompiled header (default), or C, C++ header file to be turned into an
1530 Ada spec (via the @option{-fdump-ada-spec} switch).
1531
1532 @item @var{file}.cc
1533 @itemx @var{file}.cp
1534 @itemx @var{file}.cxx
1535 @itemx @var{file}.cpp
1536 @itemx @var{file}.CPP
1537 @itemx @var{file}.c++
1538 @itemx @var{file}.C
1539 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1540 the last two letters must both be literally @samp{x}. Likewise,
1541 @samp{.C} refers to a literal capital C@.
1542
1543 @item @var{file}.mm
1544 @itemx @var{file}.M
1545 Objective-C++ source code that must be preprocessed.
1546
1547 @item @var{file}.mii
1548 Objective-C++ source code that should not be preprocessed.
1549
1550 @item @var{file}.hh
1551 @itemx @var{file}.H
1552 @itemx @var{file}.hp
1553 @itemx @var{file}.hxx
1554 @itemx @var{file}.hpp
1555 @itemx @var{file}.HPP
1556 @itemx @var{file}.h++
1557 @itemx @var{file}.tcc
1558 C++ header file to be turned into a precompiled header or Ada spec.
1559
1560 @item @var{file}.f
1561 @itemx @var{file}.for
1562 @itemx @var{file}.ftn
1563 Fixed form Fortran source code that should not be preprocessed.
1564
1565 @item @var{file}.F
1566 @itemx @var{file}.FOR
1567 @itemx @var{file}.fpp
1568 @itemx @var{file}.FPP
1569 @itemx @var{file}.FTN
1570 Fixed form Fortran source code that must be preprocessed (with the traditional
1571 preprocessor).
1572
1573 @item @var{file}.f90
1574 @itemx @var{file}.f95
1575 @itemx @var{file}.f03
1576 @itemx @var{file}.f08
1577 Free form Fortran source code that should not be preprocessed.
1578
1579 @item @var{file}.F90
1580 @itemx @var{file}.F95
1581 @itemx @var{file}.F03
1582 @itemx @var{file}.F08
1583 Free form Fortran source code that must be preprocessed (with the
1584 traditional preprocessor).
1585
1586 @item @var{file}.go
1587 Go source code.
1588
1589 @item @var{file}.d
1590 D source code.
1591
1592 @item @var{file}.di
1593 D interface file.
1594
1595 @item @var{file}.dd
1596 D documentation code (Ddoc).
1597
1598 @item @var{file}.ads
1599 Ada source code file that contains a library unit declaration (a
1600 declaration of a package, subprogram, or generic, or a generic
1601 instantiation), or a library unit renaming declaration (a package,
1602 generic, or subprogram renaming declaration). Such files are also
1603 called @dfn{specs}.
1604
1605 @item @var{file}.adb
1606 Ada source code file containing a library unit body (a subprogram or
1607 package body). Such files are also called @dfn{bodies}.
1608
1609 @c GCC also knows about some suffixes for languages not yet included:
1610 @c Ratfor:
1611 @c @var{file}.r
1612
1613 @item @var{file}.s
1614 Assembler code.
1615
1616 @item @var{file}.S
1617 @itemx @var{file}.sx
1618 Assembler code that must be preprocessed.
1619
1620 @item @var{other}
1621 An object file to be fed straight into linking.
1622 Any file name with no recognized suffix is treated this way.
1623 @end table
1624
1625 @opindex x
1626 You can specify the input language explicitly with the @option{-x} option:
1627
1628 @table @gcctabopt
1629 @item -x @var{language}
1630 Specify explicitly the @var{language} for the following input files
1631 (rather than letting the compiler choose a default based on the file
1632 name suffix). This option applies to all following input files until
1633 the next @option{-x} option. Possible values for @var{language} are:
1634 @smallexample
1635 c c-header cpp-output
1636 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1637 objective-c objective-c-header objective-c-cpp-output
1638 objective-c++ objective-c++-header objective-c++-cpp-output
1639 assembler assembler-with-cpp
1640 ada
1641 d
1642 f77 f77-cpp-input f95 f95-cpp-input
1643 go
1644 @end smallexample
1645
1646 @item -x none
1647 Turn off any specification of a language, so that subsequent files are
1648 handled according to their file name suffixes (as they are if @option{-x}
1649 has not been used at all).
1650 @end table
1651
1652 If you only want some of the stages of compilation, you can use
1653 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1654 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1655 @command{gcc} is to stop. Note that some combinations (for example,
1656 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1657
1658 @table @gcctabopt
1659 @opindex c
1660 @item -c
1661 Compile or assemble the source files, but do not link. The linking
1662 stage simply is not done. The ultimate output is in the form of an
1663 object file for each source file.
1664
1665 By default, the object file name for a source file is made by replacing
1666 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1667
1668 Unrecognized input files, not requiring compilation or assembly, are
1669 ignored.
1670
1671 @opindex S
1672 @item -S
1673 Stop after the stage of compilation proper; do not assemble. The output
1674 is in the form of an assembler code file for each non-assembler input
1675 file specified.
1676
1677 By default, the assembler file name for a source file is made by
1678 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1679
1680 Input files that don't require compilation are ignored.
1681
1682 @opindex E
1683 @item -E
1684 Stop after the preprocessing stage; do not run the compiler proper. The
1685 output is in the form of preprocessed source code, which is sent to the
1686 standard output.
1687
1688 Input files that don't require preprocessing are ignored.
1689
1690 @cindex output file option
1691 @opindex o
1692 @item -o @var{file}
1693 Place the primary output in file @var{file}. This applies to whatever
1694 sort of output is being produced, whether it be an executable file, an
1695 object file, an assembler file or preprocessed C code.
1696
1697 If @option{-o} is not specified, the default is to put an executable
1698 file in @file{a.out}, the object file for
1699 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1700 assembler file in @file{@var{source}.s}, a precompiled header file in
1701 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1702 standard output.
1703
1704 Though @option{-o} names only the primary output, it also affects the
1705 naming of auxiliary and dump outputs. See the examples below. Unless
1706 overridden, both auxiliary outputs and dump outputs are placed in the
1707 same directory as the primary output. In auxiliary outputs, the suffix
1708 of the input file is replaced with that of the auxiliary output file
1709 type; in dump outputs, the suffix of the dump file is appended to the
1710 input file suffix. In compilation commands, the base name of both
1711 auxiliary and dump outputs is that of the primary output; in compile and
1712 link commands, the primary output name, minus the executable suffix, is
1713 combined with the input file name. If both share the same base name,
1714 disregarding the suffix, the result of the combination is that base
1715 name, otherwise, they are concatenated, separated by a dash.
1716
1717 @smallexample
1718 gcc -c foo.c ...
1719 @end smallexample
1720
1721 will use @file{foo.o} as the primary output, and place aux outputs and
1722 dumps next to it, e.g., aux file @file{foo.dwo} for
1723 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1724 @option{-fdump-rtl-final}.
1725
1726 If a non-linker output file is explicitly specified, aux and dump files
1727 by default take the same base name:
1728
1729 @smallexample
1730 gcc -c foo.c -o dir/foobar.o ...
1731 @end smallexample
1732
1733 will name aux outputs @file{dir/foobar.*} and dump outputs
1734 @file{dir/foobar.c.*}.
1735
1736 A linker output will instead prefix aux and dump outputs:
1737
1738 @smallexample
1739 gcc foo.c bar.c -o dir/foobar ...
1740 @end smallexample
1741
1742 will generally name aux outputs @file{dir/foobar-foo.*} and
1743 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1744 @file{dir/foobar-bar.c.*}.
1745
1746 The one exception to the above is when the executable shares the base
1747 name with the single input:
1748
1749 @smallexample
1750 gcc foo.c -o dir/foo ...
1751 @end smallexample
1752
1753 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1754 named @file{dir/foo.c.*}.
1755
1756 The location and the names of auxiliary and dump outputs can be adjusted
1757 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1758 @option{-dumpdir}, @option{-save-temps=cwd}, and
1759 @option{-save-temps=obj}.
1760
1761
1762 @opindex dumpbase
1763 @item -dumpbase @var{dumpbase}
1764 This option sets the base name for auxiliary and dump output files. It
1765 does not affect the name of the primary output file. Intermediate
1766 outputs, when preserved, are not regarded as primary outputs, but as
1767 auxiliary outputs:
1768
1769 @smallexample
1770 gcc -save-temps -S foo.c
1771 @end smallexample
1772
1773 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1774 then compiles to the (implied) output file @file{foo.s}, whereas:
1775
1776 @smallexample
1777 gcc -save-temps -dumpbase save-foo -c foo.c
1778 @end smallexample
1779
1780 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1781 an intermediate, thus auxiliary output), and then assembles to the
1782 (implied) output file @file{foo.o}.
1783
1784 Absent this option, dump and aux files take their names from the input
1785 file, or from the (non-linker) output file, if one is explicitly
1786 specified: dump output files (e.g. those requested by @option{-fdump-*}
1787 options) with the input name suffix, and aux output files (those
1788 requested by other non-dump options, e.g. @code{-save-temps},
1789 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1790
1791 Similar suffix differentiation of dump and aux outputs can be attained
1792 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1793 @option{-dumpbase-ext .suf}.
1794
1795 If @var{dumpbase} is explicitly specified with any directory component,
1796 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1797 @option{-save-temps=*}) is ignored, and instead of appending to it,
1798 @var{dumpbase} fully overrides it:
1799
1800 @smallexample
1801 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1802 -dumpdir pfx- -save-temps=cwd ...
1803 @end smallexample
1804
1805 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1806 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1807 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1808
1809 When @option{-dumpbase} is specified in a command that compiles multiple
1810 inputs, or that compiles and then links, it may be combined with
1811 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1812 file is compiled using the combined @var{dumppfx}, and default values
1813 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1814 file:
1815
1816 @smallexample
1817 gcc foo.c bar.c -c -dumpbase main ...
1818 @end smallexample
1819
1820 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1821 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1822 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1823 and @file{main-bar.*}.
1824
1825 An empty string specified as @var{dumpbase} avoids the influence of the
1826 output basename in the naming of auxiliary and dump outputs during
1827 compilation, computing default values :
1828
1829 @smallexample
1830 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1831 @end smallexample
1832
1833 will name aux outputs @file{dir/foo.*} and dump outputs
1834 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1835 name, but the directory still defaults to that of the output.
1836
1837 The empty-string dumpbase does not prevent the use of the output
1838 basename for outputs during linking:
1839
1840 @smallexample
1841 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1842 @end smallexample
1843
1844 The compilation of the source files will name auxiliary outputs
1845 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1846 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1847 linking will use @file{dir/foobar.} as the prefix for dumps and
1848 auxiliary files.
1849
1850
1851 @opindex dumpbase-ext
1852 @item -dumpbase-ext @var{auxdropsuf}
1853 When forming the name of an auxiliary (but not a dump) output file, drop
1854 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1855 suffixes. If not specified, this option defaults to the suffix of a
1856 default @var{dumpbase}, i.e., the suffix of the input file when
1857 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1858 is combined with @var{dumppfx}.
1859
1860 @smallexample
1861 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1862 @end smallexample
1863
1864 creates @file{dir/foo.o} as the main output, and generates auxiliary
1865 outputs in @file{dir/x-foo.*}, taking the location of the primary
1866 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1867 outputs retain the suffix: @file{dir/x-foo.c.*}.
1868
1869 This option is disregarded if it does not match the suffix of a
1870 specified @var{dumpbase}, except as an alternative to the executable
1871 suffix when appending the linker output base name to @var{dumppfx}, as
1872 specified below:
1873
1874 @smallexample
1875 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1876 @end smallexample
1877
1878 creates @file{main.out} as the primary output, and avoids overwriting
1879 the auxiliary and dump outputs by using the executable name minus
1880 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1881 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1882 @file{main-foo.c.*} and @file{main-bar.c.*}.
1883
1884
1885 @opindex dumpdir
1886 @item -dumpdir @var{dumppfx}
1887 When forming the name of an auxiliary or dump output file, use
1888 @var{dumppfx} as a prefix:
1889
1890 @smallexample
1891 gcc -dumpdir pfx- -c foo.c ...
1892 @end smallexample
1893
1894 creates @file{foo.o} as the primary output, and auxiliary outputs named
1895 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1896 @var{dumpbase} derived from the default primary output, derived in turn
1897 from the input name. Dump outputs also take the input name suffix:
1898 @file{pfx-foo.c.*}.
1899
1900 If @var{dumppfx} is to be used as a directory name, it must end with a
1901 directory separator:
1902
1903 @smallexample
1904 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1905 @end smallexample
1906
1907 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1908 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1909 default @var{dumpbase} derived from the primary output name. Dump
1910 outputs also take the input name suffix: @file{dir/bar.c.*}.
1911
1912 It defaults to the location of the output file, unless the output
1913 file is a special file like @code{/dev/null}. Options
1914 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1915 default, just like an explicit @option{-dumpdir} option. In case
1916 multiple such options are given, the last one prevails:
1917
1918 @smallexample
1919 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1920 @end smallexample
1921
1922 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1923 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1924 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1925 default for @option{-save-temps}, nor that the output directory is
1926 implicitly the current directory. Dump outputs are named
1927 @file{foo.c.*}.
1928
1929 When compiling from multiple input files, if @option{-dumpbase} is
1930 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1931 are appended to (or override, if containing any directory components) an
1932 explicit or defaulted @var{dumppfx}, so that each of the multiple
1933 compilations gets differently-named aux and dump outputs.
1934
1935 @smallexample
1936 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1937 @end smallexample
1938
1939 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1940 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1941 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1942 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1943 single-input compilation:
1944
1945 @smallexample
1946 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1947 @end smallexample
1948
1949 that, applying @option{-dumpbase} to a single source, does not compute
1950 and append a separate @var{dumpbase} per input file. Its auxiliary and
1951 dump outputs go in @file{dir/pfx-main.*}.
1952
1953 When compiling and then linking from multiple input files, a defaulted
1954 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1955 transformation above (e.g. the compilation of @file{foo.c} and
1956 @file{bar.c} above, but without @option{-c}). If neither
1957 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1958 base name, minus @var{auxdropsuf}, if specified, or the executable
1959 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1960 instead. Note, however, that unlike earlier cases of linking:
1961
1962 @smallexample
1963 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1964 @end smallexample
1965
1966 does not append the output name @file{main} to @var{dumppfx}, because
1967 @option{-dumpdir} is explicitly specified. The goal is that the
1968 explicitly-specified @var{dumppfx} may contain the specified output name
1969 as part of the prefix, if desired; only an explicitly-specified
1970 @option{-dumpbase} would be combined with it, in order to avoid simply
1971 discarding a meaningful option.
1972
1973 When compiling and then linking from a single input file, the linker
1974 output base name will only be appended to the default @var{dumppfx} as
1975 above if it does not share the base name with the single input file
1976 name. This has been covered in single-input linking cases above, but
1977 not with an explicit @option{-dumpdir} that inhibits the combination,
1978 even if overridden by @option{-save-temps=*}:
1979
1980 @smallexample
1981 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1982 @end smallexample
1983
1984 Auxiliary outputs are named @file{foo.*}, and dump outputs
1985 @file{foo.c.*}, in the current working directory as ultimately requested
1986 by @option{-save-temps=cwd}.
1987
1988 Summing it all up for an intuitive though slightly imprecise data flow:
1989 the primary output name is broken into a directory part and a basename
1990 part; @var{dumppfx} is set to the former, unless overridden by
1991 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1992 to the latter, unless overriden by @option{-dumpbase}. If there are
1993 multiple inputs or linking, this @var{dumpbase} may be combined with
1994 @var{dumppfx} and taken from each input file. Auxiliary output names
1995 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1996 minus suffix, and the auxiliary output suffix; dump output names are
1997 only different in that the suffix from @var{dumpbase} is retained.
1998
1999 When it comes to auxiliary and dump outputs created during LTO
2000 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2001 given or as derived from the linker output name but not from inputs,
2002 even in cases in which this combination would not otherwise be used as
2003 such, is passed down with a trailing period replacing the compiler-added
2004 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2005 being involved in linking, this program does not normally get any
2006 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2007
2008 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2009 names to the received @var{dumppfx}, ensures it contains a directory
2010 component so that it overrides any @option{-dumpdir}, and passes that as
2011 @option{-dumpbase} to sub-compilers.
2012
2013 @opindex v
2014 @item -v
2015 Print (on standard error output) the commands executed to run the stages
2016 of compilation. Also print the version number of the compiler driver
2017 program and of the preprocessor and the compiler proper.
2018
2019 @opindex ###
2020 @item -###
2021 Like @option{-v} except the commands are not executed and arguments
2022 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2023 This is useful for shell scripts to capture the driver-generated command lines.
2024
2025 @opindex help
2026 @item --help
2027 Print (on the standard output) a description of the command-line options
2028 understood by @command{gcc}. If the @option{-v} option is also specified
2029 then @option{--help} is also passed on to the various processes
2030 invoked by @command{gcc}, so that they can display the command-line options
2031 they accept. If the @option{-Wextra} option has also been specified
2032 (prior to the @option{--help} option), then command-line options that
2033 have no documentation associated with them are also displayed.
2034
2035 @opindex target-help
2036 @item --target-help
2037 Print (on the standard output) a description of target-specific command-line
2038 options for each tool. For some targets extra target-specific
2039 information may also be printed.
2040
2041 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2042 Print (on the standard output) a description of the command-line
2043 options understood by the compiler that fit into all specified classes
2044 and qualifiers. These are the supported classes:
2045
2046 @table @asis
2047 @item @samp{optimizers}
2048 Display all of the optimization options supported by the
2049 compiler.
2050
2051 @item @samp{warnings}
2052 Display all of the options controlling warning messages
2053 produced by the compiler.
2054
2055 @item @samp{target}
2056 Display target-specific options. Unlike the
2057 @option{--target-help} option however, target-specific options of the
2058 linker and assembler are not displayed. This is because those
2059 tools do not currently support the extended @option{--help=} syntax.
2060
2061 @item @samp{params}
2062 Display the values recognized by the @option{--param}
2063 option.
2064
2065 @item @var{language}
2066 Display the options supported for @var{language}, where
2067 @var{language} is the name of one of the languages supported in this
2068 version of GCC@. If an option is supported by all languages, one needs
2069 to select @samp{common} class.
2070
2071 @item @samp{common}
2072 Display the options that are common to all languages.
2073 @end table
2074
2075 These are the supported qualifiers:
2076
2077 @table @asis
2078 @item @samp{undocumented}
2079 Display only those options that are undocumented.
2080
2081 @item @samp{joined}
2082 Display options taking an argument that appears after an equal
2083 sign in the same continuous piece of text, such as:
2084 @samp{--help=target}.
2085
2086 @item @samp{separate}
2087 Display options taking an argument that appears as a separate word
2088 following the original option, such as: @samp{-o output-file}.
2089 @end table
2090
2091 Thus for example to display all the undocumented target-specific
2092 switches supported by the compiler, use:
2093
2094 @smallexample
2095 --help=target,undocumented
2096 @end smallexample
2097
2098 The sense of a qualifier can be inverted by prefixing it with the
2099 @samp{^} character, so for example to display all binary warning
2100 options (i.e., ones that are either on or off and that do not take an
2101 argument) that have a description, use:
2102
2103 @smallexample
2104 --help=warnings,^joined,^undocumented
2105 @end smallexample
2106
2107 The argument to @option{--help=} should not consist solely of inverted
2108 qualifiers.
2109
2110 Combining several classes is possible, although this usually
2111 restricts the output so much that there is nothing to display. One
2112 case where it does work, however, is when one of the classes is
2113 @var{target}. For example, to display all the target-specific
2114 optimization options, use:
2115
2116 @smallexample
2117 --help=target,optimizers
2118 @end smallexample
2119
2120 The @option{--help=} option can be repeated on the command line. Each
2121 successive use displays its requested class of options, skipping
2122 those that have already been displayed. If @option{--help} is also
2123 specified anywhere on the command line then this takes precedence
2124 over any @option{--help=} option.
2125
2126 If the @option{-Q} option appears on the command line before the
2127 @option{--help=} option, then the descriptive text displayed by
2128 @option{--help=} is changed. Instead of describing the displayed
2129 options, an indication is given as to whether the option is enabled,
2130 disabled or set to a specific value (assuming that the compiler
2131 knows this at the point where the @option{--help=} option is used).
2132
2133 Here is a truncated example from the ARM port of @command{gcc}:
2134
2135 @smallexample
2136 % gcc -Q -mabi=2 --help=target -c
2137 The following options are target specific:
2138 -mabi= 2
2139 -mabort-on-noreturn [disabled]
2140 -mapcs [disabled]
2141 @end smallexample
2142
2143 The output is sensitive to the effects of previous command-line
2144 options, so for example it is possible to find out which optimizations
2145 are enabled at @option{-O2} by using:
2146
2147 @smallexample
2148 -Q -O2 --help=optimizers
2149 @end smallexample
2150
2151 Alternatively you can discover which binary optimizations are enabled
2152 by @option{-O3} by using:
2153
2154 @smallexample
2155 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2156 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2157 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2158 @end smallexample
2159
2160 @opindex version
2161 @item --version
2162 Display the version number and copyrights of the invoked GCC@.
2163
2164 @opindex pass-exit-codes
2165 @item -pass-exit-codes
2166 Normally the @command{gcc} program exits with the code of 1 if any
2167 phase of the compiler returns a non-success return code. If you specify
2168 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2169 the numerically highest error produced by any phase returning an error
2170 indication. The C, C++, and Fortran front ends return 4 if an internal
2171 compiler error is encountered.
2172
2173 @opindex pipe
2174 @item -pipe
2175 Use pipes rather than temporary files for communication between the
2176 various stages of compilation. This fails to work on some systems where
2177 the assembler is unable to read from a pipe; but the GNU assembler has
2178 no trouble.
2179
2180 @opindex specs
2181 @item -specs=@var{file}
2182 Process @var{file} after the compiler reads in the standard @file{specs}
2183 file, in order to override the defaults which the @command{gcc} driver
2184 program uses when determining what switches to pass to @command{cc1},
2185 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2186 @option{-specs=@var{file}} can be specified on the command line, and they
2187 are processed in order, from left to right. @xref{Spec Files}, for
2188 information about the format of the @var{file}.
2189
2190 @opindex wrapper
2191 @item -wrapper
2192 Invoke all subcommands under a wrapper program. The name of the
2193 wrapper program and its parameters are passed as a comma separated
2194 list.
2195
2196 @smallexample
2197 gcc -c t.c -wrapper gdb,--args
2198 @end smallexample
2199
2200 @noindent
2201 This invokes all subprograms of @command{gcc} under
2202 @samp{gdb --args}, thus the invocation of @command{cc1} is
2203 @samp{gdb --args cc1 @dots{}}.
2204
2205 @opindex ffile-prefix-map
2206 @item -ffile-prefix-map=@var{old}=@var{new}
2207 When compiling files residing in directory @file{@var{old}}, record
2208 any references to them in the result of the compilation as if the
2209 files resided in directory @file{@var{new}} instead. Specifying this
2210 option is equivalent to specifying all the individual
2211 @option{-f*-prefix-map} options. This can be used to make reproducible
2212 builds that are location independent. Directories referenced by
2213 directives are not affected by these options. See also
2214 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2215 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2216
2217 @opindex fcanon-prefix-map
2218 @item -fcanon-prefix-map
2219 For the @option{-f*-prefix-map} options normally comparison
2220 of @file{@var{old}} prefix against the filename that would be normally
2221 referenced in the result of the compilation is done using textual
2222 comparison of the prefixes, or ignoring character case for case insensitive
2223 filesystems and considering slashes and backslashes as equal on DOS based
2224 filesystems. The @option{-fcanon-prefix-map} causes such comparisons
2225 to be done on canonicalized paths of @file{@var{old}}
2226 and the referenced filename.
2227
2228 @opindex fplugin
2229 @item -fplugin=@var{name}.so
2230 Load the plugin code in file @var{name}.so, assumed to be a
2231 shared object to be dlopen'd by the compiler. The base name of
2232 the shared object file is used to identify the plugin for the
2233 purposes of argument parsing (See
2234 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2235 Each plugin should define the callback functions specified in the
2236 Plugins API.
2237
2238 @opindex fplugin-arg
2239 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2240 Define an argument called @var{key} with a value of @var{value}
2241 for the plugin called @var{name}.
2242
2243 @opindex fdump-ada-spec
2244 @item -fdump-ada-spec@r{[}-slim@r{]}
2245 For C and C++ source and include files, generate corresponding Ada specs.
2246 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2247 GNAT User's Guide}, which provides detailed documentation on this feature.
2248
2249 @opindex fada-spec-parent
2250 @item -fada-spec-parent=@var{unit}
2251 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2252 Ada specs as child units of parent @var{unit}.
2253
2254 @opindex fdump-go-spec
2255 @item -fdump-go-spec=@var{file}
2256 For input files in any language, generate corresponding Go
2257 declarations in @var{file}. This generates Go @code{const},
2258 @code{type}, @code{var}, and @code{func} declarations which may be a
2259 useful way to start writing a Go interface to code written in some
2260 other language.
2261
2262 @include @value{srcdir}/../libiberty/at-file.texi
2263 @end table
2264
2265 @node Invoking G++
2266 @section Compiling C++ Programs
2267
2268 @cindex suffixes for C++ source
2269 @cindex C++ source file suffixes
2270 C++ source files conventionally use one of the suffixes @samp{.C},
2271 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2272 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2273 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2274 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2275 files with these names and compiles them as C++ programs even if you
2276 call the compiler the same way as for compiling C programs (usually
2277 with the name @command{gcc}).
2278
2279 @findex g++
2280 @findex c++
2281 However, the use of @command{gcc} does not add the C++ library.
2282 @command{g++} is a program that calls GCC and automatically specifies linking
2283 against the C++ library. It treats @samp{.c},
2284 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2285 files unless @option{-x} is used. This program is also useful when
2286 precompiling a C header file with a @samp{.h} extension for use in C++
2287 compilations. On many systems, @command{g++} is also installed with
2288 the name @command{c++}.
2289
2290 @cindex invoking @command{g++}
2291 When you compile C++ programs, you may specify many of the same
2292 command-line options that you use for compiling programs in any
2293 language; or command-line options meaningful for C and related
2294 languages; or options that are meaningful only for C++ programs.
2295 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2296 explanations of options for languages related to C@.
2297 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2298 explanations of options that are meaningful only for C++ programs.
2299
2300 @node C Dialect Options
2301 @section Options Controlling C Dialect
2302 @cindex dialect options
2303 @cindex language dialect options
2304 @cindex options, dialect
2305
2306 The following options control the dialect of C (or languages derived
2307 from C, such as C++, Objective-C and Objective-C++) that the compiler
2308 accepts:
2309
2310 @table @gcctabopt
2311 @cindex ANSI support
2312 @cindex ISO support
2313 @opindex ansi
2314 @item -ansi
2315 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2316 equivalent to @option{-std=c++98}.
2317
2318 This turns off certain features of GCC that are incompatible with ISO
2319 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2320 such as the @code{asm} and @code{typeof} keywords, and
2321 predefined macros such as @code{unix} and @code{vax} that identify the
2322 type of system you are using. It also enables the undesirable and
2323 rarely used ISO trigraph feature. For the C compiler,
2324 it disables recognition of C++ style @samp{//} comments as well as
2325 the @code{inline} keyword.
2326
2327 The alternate keywords @code{__asm__}, @code{__extension__},
2328 @code{__inline__} and @code{__typeof__} continue to work despite
2329 @option{-ansi}. You would not want to use them in an ISO C program, of
2330 course, but it is useful to put them in header files that might be included
2331 in compilations done with @option{-ansi}. Alternate predefined macros
2332 such as @code{__unix__} and @code{__vax__} are also available, with or
2333 without @option{-ansi}.
2334
2335 The @option{-ansi} option does not cause non-ISO programs to be
2336 rejected gratuitously. For that, @option{-Wpedantic} is required in
2337 addition to @option{-ansi}. @xref{Warning Options}.
2338
2339 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2340 option is used. Some header files may notice this macro and refrain
2341 from declaring certain functions or defining certain macros that the
2342 ISO standard doesn't call for; this is to avoid interfering with any
2343 programs that might use these names for other things.
2344
2345 Functions that are normally built in but do not have semantics
2346 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2347 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2348 built-in functions provided by GCC}, for details of the functions
2349 affected.
2350
2351 @opindex std
2352 @item -std=
2353 Determine the language standard. @xref{Standards,,Language Standards
2354 Supported by GCC}, for details of these standard versions. This option
2355 is currently only supported when compiling C or C++.
2356
2357 The compiler can accept several base standards, such as @samp{c90} or
2358 @samp{c++98}, and GNU dialects of those standards, such as
2359 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2360 compiler accepts all programs following that standard plus those
2361 using GNU extensions that do not contradict it. For example,
2362 @option{-std=c90} turns off certain features of GCC that are
2363 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2364 keywords, but not other GNU extensions that do not have a meaning in
2365 ISO C90, such as omitting the middle term of a @code{?:}
2366 expression. On the other hand, when a GNU dialect of a standard is
2367 specified, all features supported by the compiler are enabled, even when
2368 those features change the meaning of the base standard. As a result, some
2369 strict-conforming programs may be rejected. The particular standard
2370 is used by @option{-Wpedantic} to identify which features are GNU
2371 extensions given that version of the standard. For example
2372 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2373 comments, while @option{-std=gnu99 -Wpedantic} does not.
2374
2375 A value for this option must be provided; possible values are
2376
2377 @table @samp
2378 @item c90
2379 @itemx c89
2380 @itemx iso9899:1990
2381 Support all ISO C90 programs (certain GNU extensions that conflict
2382 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2383
2384 @item iso9899:199409
2385 ISO C90 as modified in amendment 1.
2386
2387 @item c99
2388 @itemx c9x
2389 @itemx iso9899:1999
2390 @itemx iso9899:199x
2391 ISO C99. This standard is substantially completely supported, modulo
2392 bugs and floating-point issues
2393 (mainly but not entirely relating to optional C99 features from
2394 Annexes F and G). See
2395 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information. The
2396 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2397
2398 @item c11
2399 @itemx c1x
2400 @itemx iso9899:2011
2401 ISO C11, the 2011 revision of the ISO C standard. This standard is
2402 substantially completely supported, modulo bugs, floating-point issues
2403 (mainly but not entirely relating to optional C11 features from
2404 Annexes F and G) and the optional Annexes K (Bounds-checking
2405 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2406
2407 @item c17
2408 @itemx c18
2409 @itemx iso9899:2017
2410 @itemx iso9899:2018
2411 ISO C17, the 2017 revision of the ISO C standard
2412 (published in 2018). This standard is
2413 same as C11 except for corrections of defects (all of which are also
2414 applied with @option{-std=c11}) and a new value of
2415 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2416
2417 @item c2x
2418 The next version of the ISO C standard, still under development. The
2419 support for this version is experimental and incomplete.
2420
2421 @item gnu90
2422 @itemx gnu89
2423 GNU dialect of ISO C90 (including some C99 features).
2424
2425 @item gnu99
2426 @itemx gnu9x
2427 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2428
2429 @item gnu11
2430 @itemx gnu1x
2431 GNU dialect of ISO C11.
2432 The name @samp{gnu1x} is deprecated.
2433
2434 @item gnu17
2435 @itemx gnu18
2436 GNU dialect of ISO C17. This is the default for C code.
2437
2438 @item gnu2x
2439 The next version of the ISO C standard, still under development, plus
2440 GNU extensions. The support for this version is experimental and
2441 incomplete.
2442
2443 @item c++98
2444 @itemx c++03
2445 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2446 additional defect reports. Same as @option{-ansi} for C++ code.
2447
2448 @item gnu++98
2449 @itemx gnu++03
2450 GNU dialect of @option{-std=c++98}.
2451
2452 @item c++11
2453 @itemx c++0x
2454 The 2011 ISO C++ standard plus amendments.
2455 The name @samp{c++0x} is deprecated.
2456
2457 @item gnu++11
2458 @itemx gnu++0x
2459 GNU dialect of @option{-std=c++11}.
2460 The name @samp{gnu++0x} is deprecated.
2461
2462 @item c++14
2463 @itemx c++1y
2464 The 2014 ISO C++ standard plus amendments.
2465 The name @samp{c++1y} is deprecated.
2466
2467 @item gnu++14
2468 @itemx gnu++1y
2469 GNU dialect of @option{-std=c++14}.
2470 The name @samp{gnu++1y} is deprecated.
2471
2472 @item c++17
2473 @itemx c++1z
2474 The 2017 ISO C++ standard plus amendments.
2475 The name @samp{c++1z} is deprecated.
2476
2477 @item gnu++17
2478 @itemx gnu++1z
2479 GNU dialect of @option{-std=c++17}.
2480 This is the default for C++ code.
2481 The name @samp{gnu++1z} is deprecated.
2482
2483 @item c++20
2484 @itemx c++2a
2485 The 2020 ISO C++ standard plus amendments.
2486 Support is experimental, and could change in incompatible ways in
2487 future releases.
2488 The name @samp{c++2a} is deprecated.
2489
2490 @item gnu++20
2491 @itemx gnu++2a
2492 GNU dialect of @option{-std=c++20}.
2493 Support is experimental, and could change in incompatible ways in
2494 future releases.
2495 The name @samp{gnu++2a} is deprecated.
2496
2497 @item c++2b
2498 @itemx c++23
2499 The next revision of the ISO C++ standard, planned for
2500 2023. Support is highly experimental, and will almost certainly
2501 change in incompatible ways in future releases.
2502
2503 @item gnu++2b
2504 @itemx gnu++23
2505 GNU dialect of @option{-std=c++2b}. Support is highly experimental,
2506 and will almost certainly change in incompatible ways in future
2507 releases.
2508 @end table
2509
2510 @opindex aux-info
2511 @item -aux-info @var{filename}
2512 Output to the given filename prototyped declarations for all functions
2513 declared and/or defined in a translation unit, including those in header
2514 files. This option is silently ignored in any language other than C@.
2515
2516 Besides declarations, the file indicates, in comments, the origin of
2517 each declaration (source file and line), whether the declaration was
2518 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2519 @samp{O} for old, respectively, in the first character after the line
2520 number and the colon), and whether it came from a declaration or a
2521 definition (@samp{C} or @samp{F}, respectively, in the following
2522 character). In the case of function definitions, a K&R-style list of
2523 arguments followed by their declarations is also provided, inside
2524 comments, after the declaration.
2525
2526 @opindex fno-asm
2527 @opindex fasm
2528 @item -fno-asm
2529 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2530 keyword, so that code can use these words as identifiers. You can use
2531 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2532 instead. In C, @option{-ansi} implies @option{-fno-asm}.
2533
2534 In C++, @code{inline} is a standard keyword and is not affected by
2535 this switch. You may want to use the @option{-fno-gnu-keywords} flag
2536 instead, which disables @code{typeof} but not @code{asm} and
2537 @code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2538 this switch only affects the @code{asm} and @code{typeof} keywords,
2539 since @code{inline} is a standard keyword in ISO C99. In C2X mode
2540 (@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
2541 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2542 ISO C2X.
2543
2544 @opindex fno-builtin
2545 @opindex fbuiltin
2546 @cindex built-in functions
2547 @item -fno-builtin
2548 @itemx -fno-builtin-@var{function}
2549 Don't recognize built-in functions that do not begin with
2550 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2551 functions provided by GCC}, for details of the functions affected,
2552 including those which are not built-in functions when @option{-ansi} or
2553 @option{-std} options for strict ISO C conformance are used because they
2554 do not have an ISO standard meaning.
2555
2556 GCC normally generates special code to handle certain built-in functions
2557 more efficiently; for instance, calls to @code{alloca} may become single
2558 instructions which adjust the stack directly, and calls to @code{memcpy}
2559 may become inline copy loops. The resulting code is often both smaller
2560 and faster, but since the function calls no longer appear as such, you
2561 cannot set a breakpoint on those calls, nor can you change the behavior
2562 of the functions by linking with a different library. In addition,
2563 when a function is recognized as a built-in function, GCC may use
2564 information about that function to warn about problems with calls to
2565 that function, or to generate more efficient code, even if the
2566 resulting code still contains calls to that function. For example,
2567 warnings are given with @option{-Wformat} for bad calls to
2568 @code{printf} when @code{printf} is built in and @code{strlen} is
2569 known not to modify global memory.
2570
2571 With the @option{-fno-builtin-@var{function}} option
2572 only the built-in function @var{function} is
2573 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2574 function is named that is not built-in in this version of GCC, this
2575 option is ignored. There is no corresponding
2576 @option{-fbuiltin-@var{function}} option; if you wish to enable
2577 built-in functions selectively when using @option{-fno-builtin} or
2578 @option{-ffreestanding}, you may define macros such as:
2579
2580 @smallexample
2581 #define abs(n) __builtin_abs ((n))
2582 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2583 @end smallexample
2584
2585 @opindex fcond-mismatch
2586 @item -fcond-mismatch
2587 Allow conditional expressions with mismatched types in the second and
2588 third arguments. The value of such an expression is void. This option
2589 is not supported for C++.
2590
2591 @opindex ffreestanding
2592 @cindex hosted environment
2593 @item -ffreestanding
2594
2595 Assert that compilation targets a freestanding environment. This
2596 implies @option{-fno-builtin}. A freestanding environment
2597 is one in which the standard library may not exist, and program startup may
2598 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2599 This is equivalent to @option{-fno-hosted}.
2600
2601 @xref{Standards,,Language Standards Supported by GCC}, for details of
2602 freestanding and hosted environments.
2603
2604 @opindex fgimple
2605 @item -fgimple
2606
2607 Enable parsing of function definitions marked with @code{__GIMPLE}.
2608 This is an experimental feature that allows unit testing of GIMPLE
2609 passes.
2610
2611 @opindex fgnu-tm
2612 @item -fgnu-tm
2613 When the option @option{-fgnu-tm} is specified, the compiler
2614 generates code for the Linux variant of Intel's current Transactional
2615 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2616 an experimental feature whose interface may change in future versions
2617 of GCC, as the official specification changes. Please note that not
2618 all architectures are supported for this feature.
2619
2620 For more information on GCC's support for transactional memory,
2621 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2622 Transactional Memory Library}.
2623
2624 Note that the transactional memory feature is not supported with
2625 non-call exceptions (@option{-fnon-call-exceptions}).
2626
2627 @opindex fgnu89-inline
2628 @item -fgnu89-inline
2629 The option @option{-fgnu89-inline} tells GCC to use the traditional
2630 GNU semantics for @code{inline} functions when in C99 mode.
2631 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2632 Using this option is roughly equivalent to adding the
2633 @code{gnu_inline} function attribute to all inline functions
2634 (@pxref{Function Attributes}).
2635
2636 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2637 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2638 specifies the default behavior).
2639 This option is not supported in @option{-std=c90} or
2640 @option{-std=gnu90} mode.
2641
2642 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2643 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2644 in effect for @code{inline} functions. @xref{Common Predefined
2645 Macros,,,cpp,The C Preprocessor}.
2646
2647 @opindex fhosted
2648 @cindex hosted environment
2649 @item -fhosted
2650
2651 Assert that compilation targets a hosted environment. This implies
2652 @option{-fbuiltin}. A hosted environment is one in which the
2653 entire standard library is available, and in which @code{main} has a return
2654 type of @code{int}. Examples are nearly everything except a kernel.
2655 This is equivalent to @option{-fno-freestanding}.
2656
2657 @opindex flax-vector-conversions
2658 @item -flax-vector-conversions
2659 Allow implicit conversions between vectors with differing numbers of
2660 elements and/or incompatible element types. This option should not be
2661 used for new code.
2662
2663 @opindex fms-extensions
2664 @item -fms-extensions
2665 Accept some non-standard constructs used in Microsoft header files.
2666
2667 In C++ code, this allows member names in structures to be similar
2668 to previous types declarations.
2669
2670 @smallexample
2671 typedef int UOW;
2672 struct ABC @{
2673 UOW UOW;
2674 @};
2675 @end smallexample
2676
2677 Some cases of unnamed fields in structures and unions are only
2678 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2679 fields within structs/unions}, for details.
2680
2681 Note that this option is off for all targets except for x86
2682 targets using ms-abi.
2683
2684 @opindex foffload
2685 @cindex Offloading targets
2686 @cindex OpenACC offloading targets
2687 @cindex OpenMP offloading targets
2688 @item -foffload=disable
2689 @itemx -foffload=default
2690 @itemx -foffload=@var{target-list}
2691 Specify for which OpenMP and OpenACC offload targets code should be generated.
2692 The default behavior, equivalent to @option{-foffload=default}, is to generate
2693 code for all supported offload targets. The @option{-foffload=disable} form
2694 generates code only for the host fallback, while
2695 @option{-foffload=@var{target-list}} generates code only for the specified
2696 comma-separated list of offload targets.
2697
2698 Offload targets are specified in GCC's internal target-triplet format. You can
2699 run the compiler with @option{-v} to show the list of configured offload targets
2700 under @code{OFFLOAD_TARGET_NAMES}.
2701
2702 @opindex foffload-options
2703 @cindex Offloading options
2704 @cindex OpenACC offloading options
2705 @cindex OpenMP offloading options
2706 @item -foffload-options=@var{options}
2707 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2708
2709 With @option{-foffload-options=@var{options}}, GCC passes the specified
2710 @var{options} to the compilers for all enabled offloading targets. You can
2711 specify options that apply only to a specific target or targets by using
2712 the @option{-foffload-options=@var{target-list}=@var{options}} form. The
2713 @var{target-list} is a comma-separated list in the same format as for the
2714 @option{-foffload=} option.
2715
2716 Typical command lines are
2717
2718 @smallexample
2719 -foffload-options=-lgfortran -foffload-options=-lm
2720 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2721 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2722 @end smallexample
2723
2724 @opindex fopenacc
2725 @cindex OpenACC accelerator programming
2726 @item -fopenacc
2727 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2728 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2729 compiler generates accelerated code according to the OpenACC Application
2730 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2731 implies @option{-pthread}, and thus is only supported on targets that
2732 have support for @option{-pthread}.
2733
2734 @opindex fopenacc-dim
2735 @cindex OpenACC accelerator programming
2736 @item -fopenacc-dim=@var{geom}
2737 Specify default compute dimensions for parallel offload regions that do
2738 not explicitly specify. The @var{geom} value is a triple of
2739 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2740 can be omitted, to use a target-specific default value.
2741
2742 @opindex fopenmp
2743 @cindex OpenMP parallel
2744 @item -fopenmp
2745 Enable handling of OpenMP directives @code{#pragma omp} in C/C++,
2746 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and
2747 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2748 compiler generates parallel code according to the OpenMP Application
2749 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2750 implies @option{-pthread}, and thus is only supported on targets that
2751 have support for @option{-pthread}. @option{-fopenmp} implies
2752 @option{-fopenmp-simd}.
2753
2754 @opindex fopenmp-simd
2755 @cindex OpenMP SIMD
2756 @cindex SIMD
2757 @item -fopenmp-simd
2758 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2759 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan},
2760 @code{loop} directives and combined or composite directives with
2761 @code{simd} as constituent with @code{#pragma omp} in C/C++,
2762 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++
2763 and @code{!$omp} in Fortran. Other OpenMP directives are ignored.
2764
2765 @opindex fopenmp-target-simd-clone
2766 @cindex OpenMP target SIMD clone
2767 @item -fopenmp-target-simd-clone
2768 @item -fopenmp-target-simd-clone=@var{device-type}
2769 In addition to generating SIMD clones for functions marked with the
2770 @code{declare simd} directive, GCC also generates clones
2771 for functions marked with the OpenMP @code{declare target} directive
2772 that are suitable for vectorization when this option is in effect. The
2773 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2774 and @code{any}, which correspond to keywords for the @code{device_type}
2775 clause of the @code{declare target} directive; clones are generated for
2776 the intersection of devices specified.
2777 @option{-fopenmp-target-simd-clone} is equivalent to
2778 @option{-fopenmp-target-simd-clone=any} and
2779 @option{-fno-openmp-target-simd-clone} is equivalent to
2780 @option{-fopenmp-target-simd-clone=none}.
2781
2782 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2783 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2784 it is disabled by default.
2785
2786 @opindex fpermitted-flt-eval-methods
2787 @opindex fpermitted-flt-eval-methods=c11
2788 @opindex fpermitted-flt-eval-methods=ts-18661-3
2789 @item -fpermitted-flt-eval-methods=@var{style}
2790 ISO/IEC TS 18661-3 defines new permissible values for
2791 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2792 a semantic type that is an interchange or extended format should be
2793 evaluated to the precision and range of that type. These new values are
2794 a superset of those permitted under C99/C11, which does not specify the
2795 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2796 conforming to C11 may not have been written expecting the possibility of
2797 the new values.
2798
2799 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2800 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2801 or the extended set of values specified in ISO/IEC TS 18661-3.
2802
2803 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2804
2805 The default when in a standards compliant mode (@option{-std=c11} or similar)
2806 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2807 dialect (@option{-std=gnu11} or similar) is
2808 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2809
2810 @opindex fplan9-extensions
2811 @item -fplan9-extensions
2812 Accept some non-standard constructs used in Plan 9 code.
2813
2814 This enables @option{-fms-extensions}, permits passing pointers to
2815 structures with anonymous fields to functions that expect pointers to
2816 elements of the type of the field, and permits referring to anonymous
2817 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2818 struct/union fields within structs/unions}, for details. This is only
2819 supported for C, not C++.
2820
2821 @opindex fsigned-bitfields
2822 @opindex funsigned-bitfields
2823 @opindex fno-signed-bitfields
2824 @opindex fno-unsigned-bitfields
2825 @item -fsigned-bitfields
2826 @itemx -funsigned-bitfields
2827 @itemx -fno-signed-bitfields
2828 @itemx -fno-unsigned-bitfields
2829 These options control whether a bit-field is signed or unsigned, when the
2830 declaration does not use either @code{signed} or @code{unsigned}. By
2831 default, such a bit-field is signed, because this is consistent: the
2832 basic integer types such as @code{int} are signed types.
2833
2834 @opindex fsigned-char
2835 @item -fsigned-char
2836 Let the type @code{char} be signed, like @code{signed char}.
2837
2838 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2839 the negative form of @option{-funsigned-char}. Likewise, the option
2840 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2841
2842 @opindex funsigned-char
2843 @item -funsigned-char
2844 Let the type @code{char} be unsigned, like @code{unsigned char}.
2845
2846 Each kind of machine has a default for what @code{char} should
2847 be. It is either like @code{unsigned char} by default or like
2848 @code{signed char} by default.
2849
2850 Ideally, a portable program should always use @code{signed char} or
2851 @code{unsigned char} when it depends on the signedness of an object.
2852 But many programs have been written to use plain @code{char} and
2853 expect it to be signed, or expect it to be unsigned, depending on the
2854 machines they were written for. This option, and its inverse, let you
2855 make such a program work with the opposite default.
2856
2857 The type @code{char} is always a distinct type from each of
2858 @code{signed char} or @code{unsigned char}, even though its behavior
2859 is always just like one of those two.
2860
2861 @opindex fstrict-flex-arrays
2862 @opindex fno-strict-flex-arrays
2863 @item -fstrict-flex-arrays
2864 Control when to treat the trailing array of a structure as a flexible array
2865 member for the purpose of accessing the elements of such an array.
2866 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2867 strictest. A trailing array is treated as a flexible array member only when it
2868 is declared as a flexible array member per C99 standard onwards.
2869 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2870 least strict. All trailing arrays of structures are treated as flexible array
2871 members.
2872
2873 @opindex fstrict-flex-arrays=@var{level}
2874 @item -fstrict-flex-arrays=@var{level}
2875 Control when to treat the trailing array of a structure as a flexible array
2876 member for the purpose of accessing the elements of such an array. The value
2877 of @var{level} controls the level of strictness.
2878
2879 The possible values of @var{level} are the same as for the
2880 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2881
2882 You can control this behavior for a specific trailing array field of a
2883 structure by using the variable attribute @code{strict_flex_array} attribute
2884 (@pxref{Variable Attributes}).
2885
2886 @opindex fsso-struct
2887 @item -fsso-struct=@var{endianness}
2888 Set the default scalar storage order of structures and unions to the
2889 specified endianness. The accepted values are @samp{big-endian},
2890 @samp{little-endian} and @samp{native} for the native endianness of
2891 the target (the default). This option is not supported for C++.
2892
2893 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2894 code that is not binary compatible with code generated without it if the
2895 specified endianness is not the native endianness of the target.
2896 @end table
2897
2898 @node C++ Dialect Options
2899 @section Options Controlling C++ Dialect
2900
2901 @cindex compiler options, C++
2902 @cindex C++ options, command-line
2903 @cindex options, C++
2904 This section describes the command-line options that are only meaningful
2905 for C++ programs. You can also use most of the GNU compiler options
2906 regardless of what language your program is in. For example, you
2907 might compile a file @file{firstClass.C} like this:
2908
2909 @smallexample
2910 g++ -g -fstrict-enums -O -c firstClass.C
2911 @end smallexample
2912
2913 @noindent
2914 In this example, only @option{-fstrict-enums} is an option meant
2915 only for C++ programs; you can use the other options with any
2916 language supported by GCC@.
2917
2918 Some options for compiling C programs, such as @option{-std}, are also
2919 relevant for C++ programs.
2920 @xref{C Dialect Options,,Options Controlling C Dialect}.
2921
2922 Here is a list of options that are @emph{only} for compiling C++ programs:
2923
2924 @table @gcctabopt
2925
2926 @opindex fabi-version
2927 @item -fabi-version=@var{n}
2928 Use version @var{n} of the C++ ABI@. The default is version 0.
2929
2930 Version 0 refers to the version conforming most closely to
2931 the C++ ABI specification. Therefore, the ABI obtained using version 0
2932 will change in different versions of G++ as ABI bugs are fixed.
2933
2934 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2935
2936 Version 2 is the version of the C++ ABI that first appeared in G++
2937 3.4, and was the default through G++ 4.9.
2938
2939 Version 3 corrects an error in mangling a constant address as a
2940 template argument.
2941
2942 Version 4, which first appeared in G++ 4.5, implements a standard
2943 mangling for vector types.
2944
2945 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2946 attribute const/volatile on function pointer types, decltype of a
2947 plain decl, and use of a function parameter in the declaration of
2948 another parameter.
2949
2950 Version 6, which first appeared in G++ 4.7, corrects the promotion
2951 behavior of C++11 scoped enums and the mangling of template argument
2952 packs, const/static_cast, prefix ++ and --, and a class scope function
2953 used as a template argument.
2954
2955 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2956 builtin type and corrects the mangling of lambdas in default argument
2957 scope.
2958
2959 Version 8, which first appeared in G++ 4.9, corrects the substitution
2960 behavior of function types with function-cv-qualifiers.
2961
2962 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2963 @code{nullptr_t}.
2964
2965 Version 10, which first appeared in G++ 6.1, adds mangling of
2966 attributes that affect type identity, such as ia32 calling convention
2967 attributes (e.g.@: @samp{stdcall}).
2968
2969 Version 11, which first appeared in G++ 7, corrects the mangling of
2970 sizeof... expressions and operator names. For multiple entities with
2971 the same name within a function, that are declared in different scopes,
2972 the mangling now changes starting with the twelfth occurrence. It also
2973 implies @option{-fnew-inheriting-ctors}.
2974
2975 Version 12, which first appeared in G++ 8, corrects the calling
2976 conventions for empty classes on the x86_64 target and for classes
2977 with only deleted copy/move constructors. It accidentally changes the
2978 calling convention for classes with a deleted copy constructor and a
2979 trivial move constructor.
2980
2981 Version 13, which first appeared in G++ 8.2, fixes the accidental
2982 change in version 12.
2983
2984 Version 14, which first appeared in G++ 10, corrects the mangling of
2985 the nullptr expression.
2986
2987 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2988 tag regression.
2989
2990 Version 16, which first appeared in G++ 11, changes the mangling of
2991 @code{__alignof__} to be distinct from that of @code{alignof}, and
2992 dependent operator names.
2993
2994 Version 17, which first appeared in G++ 12, fixes layout of classes
2995 that inherit from aggregate classes with default member initializers
2996 in C++14 and up.
2997
2998 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
2999 that have additional context.
3000
3001 See also @option{-Wabi}.
3002
3003 @opindex fabi-compat-version
3004 @item -fabi-compat-version=@var{n}
3005 On targets that support strong aliases, G++
3006 works around mangling changes by creating an alias with the correct
3007 mangled name when defining a symbol with an incorrect mangled name.
3008 This switch specifies which ABI version to use for the alias.
3009
3010 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3011 compatibility). If another ABI version is explicitly selected, this
3012 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
3013 use @option{-fabi-compat-version=2}.
3014
3015 If this option is not provided but @option{-Wabi=@var{n}} is, that
3016 version is used for compatibility aliases. If this option is provided
3017 along with @option{-Wabi} (without the version), the version from this
3018 option is used for the warning.
3019
3020 @opindex fno-access-control
3021 @opindex faccess-control
3022 @item -fno-access-control
3023 Turn off all access checking. This switch is mainly useful for working
3024 around bugs in the access control code.
3025
3026 @opindex faligned-new
3027 @item -faligned-new
3028 Enable support for C++17 @code{new} of types that require more
3029 alignment than @code{void* ::operator new(std::size_t)} provides. A
3030 numeric argument such as @code{-faligned-new=32} can be used to
3031 specify how much alignment (in bytes) is provided by that function,
3032 but few users will need to override the default of
3033 @code{alignof(std::max_align_t)}.
3034
3035 This flag is enabled by default for @option{-std=c++17}.
3036
3037 @opindex fchar8_t
3038 @opindex fno-char8_t
3039 @item -fchar8_t
3040 @itemx -fno-char8_t
3041 Enable support for @code{char8_t} as adopted for C++20. This includes
3042 the addition of a new @code{char8_t} fundamental type, changes to the
3043 types of UTF-8 string and character literals, new signatures for
3044 user-defined literals, associated standard library updates, and new
3045 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3046
3047 This option enables functions to be overloaded for ordinary and UTF-8
3048 strings:
3049
3050 @smallexample
3051 int f(const char *); // #1
3052 int f(const char8_t *); // #2
3053 int v1 = f("text"); // Calls #1
3054 int v2 = f(u8"text"); // Calls #2
3055 @end smallexample
3056
3057 @noindent
3058 and introduces new signatures for user-defined literals:
3059
3060 @smallexample
3061 int operator""_udl1(char8_t);
3062 int v3 = u8'x'_udl1;
3063 int operator""_udl2(const char8_t*, std::size_t);
3064 int v4 = u8"text"_udl2;
3065 template<typename T, T...> int operator""_udl3();
3066 int v5 = u8"text"_udl3;
3067 @end smallexample
3068
3069 @noindent
3070 The change to the types of UTF-8 string and character literals introduces
3071 incompatibilities with ISO C++11 and later standards. For example, the
3072 following code is well-formed under ISO C++11, but is ill-formed when
3073 @option{-fchar8_t} is specified.
3074
3075 @smallexample
3076 const char *cp = u8"xx";// error: invalid conversion from
3077 // `const char8_t*' to `const char*'
3078 int f(const char*);
3079 auto v = f(u8"xx"); // error: invalid conversion from
3080 // `const char8_t*' to `const char*'
3081 std::string s@{u8"xx"@}; // error: no matching function for call to
3082 // `std::basic_string<char>::basic_string()'
3083 using namespace std::literals;
3084 s = u8"xx"s; // error: conversion from
3085 // `basic_string<char8_t>' to non-scalar
3086 // type `basic_string<char>' requested
3087 @end smallexample
3088
3089 @opindex fcheck-new
3090 @item -fcheck-new
3091 Check that the pointer returned by @code{operator new} is non-null
3092 before attempting to modify the storage allocated. This check is
3093 normally unnecessary because the C++ standard specifies that
3094 @code{operator new} only returns @code{0} if it is declared
3095 @code{throw()}, in which case the compiler always checks the
3096 return value even without this option. In all other cases, when
3097 @code{operator new} has a non-empty exception specification, memory
3098 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
3099 @samp{new (nothrow)}.
3100
3101 @opindex fconcepts
3102 @opindex fconcepts-ts
3103 @item -fconcepts
3104 @itemx -fconcepts-ts
3105 Enable support for the C++ Concepts feature for constraining template
3106 arguments. With @option{-std=c++20} and above, Concepts are part of
3107 the language standard, so @option{-fconcepts} defaults to on.
3108
3109 Some constructs that were allowed by the earlier C++ Extensions for
3110 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3111 into the standard, can additionally be enabled by
3112 @option{-fconcepts-ts}.
3113
3114 @opindex fconstexpr-depth
3115 @item -fconstexpr-depth=@var{n}
3116 Set the maximum nested evaluation depth for C++11 constexpr functions
3117 to @var{n}. A limit is needed to detect endless recursion during
3118 constant expression evaluation. The minimum specified by the standard
3119 is 512.
3120
3121 @opindex fconstexpr-cache-depth
3122 @item -fconstexpr-cache-depth=@var{n}
3123 Set the maximum level of nested evaluation depth for C++11 constexpr
3124 functions that will be cached to @var{n}. This is a heuristic that
3125 trades off compilation speed (when the cache avoids repeated
3126 calculations) against memory consumption (when the cache grows very
3127 large from highly recursive evaluations). The default is 8. Very few
3128 users are likely to want to adjust it, but if your code does heavy
3129 constexpr calculations you might want to experiment to find which
3130 value works best for you.
3131
3132 @opindex fconstexpr-fp-except
3133 @item -fconstexpr-fp-except
3134 Annex F of the C standard specifies that IEC559 floating point
3135 exceptions encountered at compile time should not stop compilation.
3136 C++ compilers have historically not followed this guidance, instead
3137 treating floating point division by zero as non-constant even though
3138 it has a well defined value. This flag tells the compiler to give
3139 Annex F priority over other rules saying that a particular operation
3140 is undefined.
3141
3142 @smallexample
3143 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3144 @end smallexample
3145
3146 @opindex fconstexpr-loop-limit
3147 @item -fconstexpr-loop-limit=@var{n}
3148 Set the maximum number of iterations for a loop in C++14 constexpr functions
3149 to @var{n}. A limit is needed to detect infinite loops during
3150 constant expression evaluation. The default is 262144 (1<<18).
3151
3152 @opindex fconstexpr-ops-limit
3153 @item -fconstexpr-ops-limit=@var{n}
3154 Set the maximum number of operations during a single constexpr evaluation.
3155 Even when number of iterations of a single loop is limited with the above limit,
3156 if there are several nested loops and each of them has many iterations but still
3157 smaller than the above limit, or if in a body of some loop or even outside
3158 of a loop too many expressions need to be evaluated, the resulting constexpr
3159 evaluation might take too long.
3160 The default is 33554432 (1<<25).
3161
3162 @opindex fcontracts
3163 @item -fcontracts
3164 Enable experimental support for the C++ Contracts feature, as briefly
3165 added to and then removed from the C++20 working paper (N4820). The
3166 implementation also includes proposed enhancements from papers P1290,
3167 P1332, and P1429. This functionality is intended mostly for those
3168 interested in experimentation towards refining the feature to get it
3169 into shape for a future C++ standard.
3170
3171 On violation of a checked contract, the violation handler is called.
3172 Users can replace the violation handler by defining
3173 @smallexample
3174 void
3175 handle_contract_violation (const std::experimental::contract_violation&);
3176 @end smallexample
3177
3178 There are different sets of additional flags that can be used together
3179 to specify which contracts will be checked and how, for N4820
3180 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3181 used together.
3182
3183 @table @gcctabopt
3184 @opindex fcontract-mode
3185 @item -fcontract-mode=[on|off]
3186 Control whether any contracts have any semantics at all. Defaults to on.
3187
3188 @opindex fcontract-assumption-mode
3189 @item -fcontract-assumption-mode=[on|off]
3190 [N4820] Control whether contracts with level @samp{axiom}
3191 should have the assume semantic. Defaults to on.
3192
3193 @opindex fcontract-build-level
3194 @item -fcontract-build-level=[off|default|audit]
3195 [N4820] Specify which level of contracts to generate checks
3196 for. Defaults to @samp{default}.
3197
3198 @opindex fcontract-continuation-mode
3199 @item -fcontract-continuation-mode=[on|off]
3200 [N4820] Control whether to allow the program to continue executing
3201 after a contract violation. That is, do checked contracts have the
3202 @samp{maybe} semantic described below rather than the @samp{never}
3203 semantic. Defaults to off.
3204
3205 @opindex fcontract-role
3206 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3207 [P1332] Specify the concrete semantics for each contract level
3208 of a particular contract role.
3209
3210 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3211 [P1429] Specify the concrete semantic for a particular
3212 contract level.
3213
3214 @opindex fcontract-strict-declarations
3215 @item -fcontract-strict-declarations=[on|off]
3216 Control whether to reject adding contracts to a function after its
3217 first declaration. Defaults to off.
3218 @end table
3219
3220 The possible concrete semantics for that can be specified with
3221 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3222
3223 @table @code
3224 @item ignore
3225 This contract has no effect.
3226
3227 @item assume
3228 This contract is treated like C++23 @code{[[assume]]}.
3229
3230 @item check_never_continue
3231 @itemx never
3232 @itemx abort
3233 This contract is checked. If it fails, the violation handler is
3234 called. If the handler returns, @code{std::terminate} is called.
3235
3236 @item check_maybe_continue
3237 @itemx maybe
3238 This contract is checked. If it fails, the violation handler is
3239 called. If the handler returns, execution continues normally.
3240 @end table
3241
3242 @opindex fcoroutines
3243 @item -fcoroutines
3244 Enable support for the C++ coroutines extension (experimental).
3245
3246 @opindex fno-elide-constructors
3247 @opindex felide-constructors
3248 @item -fno-elide-constructors
3249 The C++ standard allows an implementation to omit creating a temporary
3250 that is only used to initialize another object of the same type.
3251 Specifying this option disables that optimization, and forces G++ to
3252 call the copy constructor in all cases. This option also causes G++
3253 to call trivial member functions which otherwise would be expanded inline.
3254
3255 In C++17, the compiler is required to omit these temporaries, but this
3256 option still affects trivial member functions.
3257
3258 @opindex fno-enforce-eh-specs
3259 @opindex fenforce-eh-specs
3260 @item -fno-enforce-eh-specs
3261 Don't generate code to check for violation of exception specifications
3262 at run time. This option violates the C++ standard, but may be useful
3263 for reducing code size in production builds, much like defining
3264 @code{NDEBUG}. This does not give user code permission to throw
3265 exceptions in violation of the exception specifications; the compiler
3266 still optimizes based on the specifications, so throwing an
3267 unexpected exception results in undefined behavior at run time.
3268
3269 @opindex fextern-tls-init
3270 @opindex fno-extern-tls-init
3271 @item -fextern-tls-init
3272 @itemx -fno-extern-tls-init
3273 The C++11 and OpenMP standards allow @code{thread_local} and
3274 @code{threadprivate} variables to have dynamic (runtime)
3275 initialization. To support this, any use of such a variable goes
3276 through a wrapper function that performs any necessary initialization.
3277 When the use and definition of the variable are in the same
3278 translation unit, this overhead can be optimized away, but when the
3279 use is in a different translation unit there is significant overhead
3280 even if the variable doesn't actually need dynamic initialization. If
3281 the programmer can be sure that no use of the variable in a
3282 non-defining TU needs to trigger dynamic initialization (either
3283 because the variable is statically initialized, or a use of the
3284 variable in the defining TU will be executed before any uses in
3285 another TU), they can avoid this overhead with the
3286 @option{-fno-extern-tls-init} option.
3287
3288 On targets that support symbol aliases, the default is
3289 @option{-fextern-tls-init}. On targets that do not support symbol
3290 aliases, the default is @option{-fno-extern-tls-init}.
3291
3292 @opindex ffold-simple-inlines
3293 @opindex fno-fold-simple-inlines
3294 @item -ffold-simple-inlines
3295 @itemx -fno-fold-simple-inlines
3296 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3297 @code{std::addressof} and @code{std::as_const}. In contrast to inlining, this
3298 means no debug information will be generated for such calls. Since these
3299 functions are rarely interesting to debug, this flag is enabled by default
3300 unless @option{-fno-inline} is active.
3301
3302 @opindex fno-gnu-keywords
3303 @opindex fgnu-keywords
3304 @item -fno-gnu-keywords
3305 Do not recognize @code{typeof} as a keyword, so that code can use this
3306 word as an identifier. You can use the keyword @code{__typeof__} instead.
3307 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3308 @option{-std=c++98}, @option{-std=c++11}, etc.
3309
3310 @opindex fimplicit-constexpr
3311 @item -fimplicit-constexpr
3312 Make inline functions implicitly constexpr, if they satisfy the
3313 requirements for a constexpr function. This option can be used in
3314 C++14 mode or later. This can result in initialization changing from
3315 dynamic to static and other optimizations.
3316
3317 @opindex fno-implicit-templates
3318 @opindex fimplicit-templates
3319 @item -fno-implicit-templates
3320 Never emit code for non-inline templates that are instantiated
3321 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3322 If you use this option, you must take care to structure your code to
3323 include all the necessary explicit instantiations to avoid getting
3324 undefined symbols at link time.
3325 @xref{Template Instantiation}, for more information.
3326
3327 @opindex fno-implicit-inline-templates
3328 @opindex fimplicit-inline-templates
3329 @item -fno-implicit-inline-templates
3330 Don't emit code for implicit instantiations of inline templates, either.
3331 The default is to handle inlines differently so that compiles with and
3332 without optimization need the same set of explicit instantiations.
3333
3334 @opindex fno-implement-inlines
3335 @opindex fimplement-inlines
3336 @item -fno-implement-inlines
3337 To save space, do not emit out-of-line copies of inline functions
3338 controlled by @code{#pragma implementation}. This causes linker
3339 errors if these functions are not inlined everywhere they are called.
3340
3341 @opindex fmodules-ts
3342 @opindex fno-modules-ts
3343 @item -fmodules-ts
3344 @itemx -fno-modules-ts
3345 Enable support for C++20 modules (@pxref{C++ Modules}). The
3346 @option{-fno-modules-ts} is usually not needed, as that is the
3347 default. Even though this is a C++20 feature, it is not currently
3348 implicitly enabled by selecting that standard version.
3349
3350 @opindex fmodule-header
3351 @item -fmodule-header
3352 @itemx -fmodule-header=user
3353 @itemx -fmodule-header=system
3354 Compile a header file to create an importable header unit.
3355
3356 @opindex fmodule-implicit-inline
3357 @item -fmodule-implicit-inline
3358 Member functions defined in their class definitions are not implicitly
3359 inline for modular code. This is different to traditional C++
3360 behavior, for good reasons. However, it may result in a difficulty
3361 during code porting. This option makes such function definitions
3362 implicitly inline. It does however generate an ABI incompatibility,
3363 so you must use it everywhere or nowhere. (Such definitions outside
3364 of a named module remain implicitly inline, regardless.)
3365
3366 @opindex fno-module-lazy
3367 @opindex fmodule-lazy
3368 @item -fno-module-lazy
3369 Disable lazy module importing and module mapper creation.
3370
3371 @vindex CXX_MODULE_MAPPER @r{environment variable}
3372 @opindex fmodule-mapper
3373 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3374 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3375 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3376 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3377 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3378 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3379 An oracle to query for module name to filename mappings. If
3380 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3381 and if that is unset, an in-process default is provided.
3382
3383 @opindex fmodule-only
3384 @item -fmodule-only
3385 Only emit the Compiled Module Interface, inhibiting any object file.
3386
3387 @opindex fms-extensions
3388 @item -fms-extensions
3389 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3390 int and getting a pointer to member function via non-standard syntax.
3391
3392 @opindex fnew-inheriting-ctors
3393 @item -fnew-inheriting-ctors
3394 Enable the P0136 adjustment to the semantics of C++11 constructor
3395 inheritance. This is part of C++17 but also considered to be a Defect
3396 Report against C++11 and C++14. This flag is enabled by default
3397 unless @option{-fabi-version=10} or lower is specified.
3398
3399 @opindex fnew-ttp-matching
3400 @item -fnew-ttp-matching
3401 Enable the P0522 resolution to Core issue 150, template template
3402 parameters and default arguments: this allows a template with default
3403 template arguments as an argument for a template template parameter
3404 with fewer template parameters. This flag is enabled by default for
3405 @option{-std=c++17}.
3406
3407 @opindex fno-nonansi-builtins
3408 @opindex fnonansi-builtins
3409 @item -fno-nonansi-builtins
3410 Disable built-in declarations of functions that are not mandated by
3411 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3412 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3413
3414 @opindex fnothrow-opt
3415 @item -fnothrow-opt
3416 Treat a @code{throw()} exception specification as if it were a
3417 @code{noexcept} specification to reduce or eliminate the text size
3418 overhead relative to a function with no exception specification. If
3419 the function has local variables of types with non-trivial
3420 destructors, the exception specification actually makes the
3421 function smaller because the EH cleanups for those variables can be
3422 optimized away. The semantic effect is that an exception thrown out of
3423 a function with such an exception specification results in a call
3424 to @code{terminate} rather than @code{unexpected}.
3425
3426 @opindex fno-operator-names
3427 @opindex foperator-names
3428 @item -fno-operator-names
3429 Do not treat the operator name keywords @code{and}, @code{bitand},
3430 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3431 synonyms as keywords.
3432
3433 @opindex fno-optional-diags
3434 @opindex foptional-diags
3435 @item -fno-optional-diags
3436 Disable diagnostics that the standard says a compiler does not need to
3437 issue. Currently, the only such diagnostic issued by G++ is the one for
3438 a name having multiple meanings within a class.
3439
3440 @opindex fpermissive
3441 @item -fpermissive
3442 Downgrade some diagnostics about nonconformant code from errors to
3443 warnings. Thus, using @option{-fpermissive} allows some
3444 nonconforming code to compile.
3445
3446 @opindex fno-pretty-templates
3447 @opindex fpretty-templates
3448 @item -fno-pretty-templates
3449 When an error message refers to a specialization of a function
3450 template, the compiler normally prints the signature of the
3451 template followed by the template arguments and any typedefs or
3452 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3453 rather than @code{void f(int)}) so that it's clear which template is
3454 involved. When an error message refers to a specialization of a class
3455 template, the compiler omits any template arguments that match
3456 the default template arguments for that template. If either of these
3457 behaviors make it harder to understand the error message rather than
3458 easier, you can use @option{-fno-pretty-templates} to disable them.
3459
3460 @opindex fno-rtti
3461 @opindex frtti
3462 @item -fno-rtti
3463 Disable generation of information about every class with virtual
3464 functions for use by the C++ run-time type identification features
3465 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3466 of the language, you can save some space by using this flag. Note that
3467 exception handling uses the same information, but G++ generates it as
3468 needed. The @code{dynamic_cast} operator can still be used for casts that
3469 do not require run-time type information, i.e.@: casts to @code{void *} or to
3470 unambiguous base classes.
3471
3472 Mixing code compiled with @option{-frtti} with that compiled with
3473 @option{-fno-rtti} may not work. For example, programs may
3474 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3475 for a class compiled with @option{-frtti}.
3476
3477 @opindex fsized-deallocation
3478 @item -fsized-deallocation
3479 Enable the built-in global declarations
3480 @smallexample
3481 void operator delete (void *, std::size_t) noexcept;
3482 void operator delete[] (void *, std::size_t) noexcept;
3483 @end smallexample
3484 as introduced in C++14. This is useful for user-defined replacement
3485 deallocation functions that, for example, use the size of the object
3486 to make deallocation faster. Enabled by default under
3487 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3488 warns about places that might want to add a definition.
3489
3490 @opindex fstrict-enums
3491 @item -fstrict-enums
3492 Allow the compiler to optimize using the assumption that a value of
3493 enumerated type can only be one of the values of the enumeration (as
3494 defined in the C++ standard; basically, a value that can be
3495 represented in the minimum number of bits needed to represent all the
3496 enumerators). This assumption may not be valid if the program uses a
3497 cast to convert an arbitrary integer value to the enumerated type.
3498
3499 @opindex fstrong-eval-order
3500 @item -fstrong-eval-order
3501 Evaluate member access, array subscripting, and shift expressions in
3502 left-to-right order, and evaluate assignment in right-to-left order,
3503 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3504 @option{-fstrong-eval-order=some} enables just the ordering of member
3505 access and shift expressions, and is the default without
3506 @option{-std=c++17}.
3507
3508 @opindex ftemplate-backtrace-limit
3509 @item -ftemplate-backtrace-limit=@var{n}
3510 Set the maximum number of template instantiation notes for a single
3511 warning or error to @var{n}. The default value is 10.
3512
3513 @opindex ftemplate-depth
3514 @item -ftemplate-depth=@var{n}
3515 Set the maximum instantiation depth for template classes to @var{n}.
3516 A limit on the template instantiation depth is needed to detect
3517 endless recursions during template class instantiation. ANSI/ISO C++
3518 conforming programs must not rely on a maximum depth greater than 17
3519 (changed to 1024 in C++11). The default value is 900, as the compiler
3520 can run out of stack space before hitting 1024 in some situations.
3521
3522 @opindex fno-threadsafe-statics
3523 @opindex fthreadsafe-statics
3524 @item -fno-threadsafe-statics
3525 Do not emit the extra code to use the routines specified in the C++
3526 ABI for thread-safe initialization of local statics. You can use this
3527 option to reduce code size slightly in code that doesn't need to be
3528 thread-safe.
3529
3530 @opindex fuse-cxa-atexit
3531 @item -fuse-cxa-atexit
3532 Register destructors for objects with static storage duration with the
3533 @code{__cxa_atexit} function rather than the @code{atexit} function.
3534 This option is required for fully standards-compliant handling of static
3535 destructors, but only works if your C library supports
3536 @code{__cxa_atexit}.
3537
3538 @opindex fno-use-cxa-get-exception-ptr
3539 @opindex fuse-cxa-get-exception-ptr
3540 @item -fno-use-cxa-get-exception-ptr
3541 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3542 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3543 if the runtime routine is not available.
3544
3545 @opindex fvisibility-inlines-hidden
3546 @item -fvisibility-inlines-hidden
3547 This switch declares that the user does not attempt to compare
3548 pointers to inline functions or methods where the addresses of the two functions
3549 are taken in different shared objects.
3550
3551 The effect of this is that GCC may, effectively, mark inline methods with
3552 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3553 appear in the export table of a DSO and do not require a PLT indirection
3554 when used within the DSO@. Enabling this option can have a dramatic effect
3555 on load and link times of a DSO as it massively reduces the size of the
3556 dynamic export table when the library makes heavy use of templates.
3557
3558 The behavior of this switch is not quite the same as marking the
3559 methods as hidden directly, because it does not affect static variables
3560 local to the function or cause the compiler to deduce that
3561 the function is defined in only one shared object.
3562
3563 You may mark a method as having a visibility explicitly to negate the
3564 effect of the switch for that method. For example, if you do want to
3565 compare pointers to a particular inline method, you might mark it as
3566 having default visibility. Marking the enclosing class with explicit
3567 visibility has no effect.
3568
3569 Explicitly instantiated inline methods are unaffected by this option
3570 as their linkage might otherwise cross a shared library boundary.
3571 @xref{Template Instantiation}.
3572
3573 @opindex fvisibility-ms-compat
3574 @item -fvisibility-ms-compat
3575 This flag attempts to use visibility settings to make GCC's C++
3576 linkage model compatible with that of Microsoft Visual Studio.
3577
3578 The flag makes these changes to GCC's linkage model:
3579
3580 @enumerate
3581 @item
3582 It sets the default visibility to @code{hidden}, like
3583 @option{-fvisibility=hidden}.
3584
3585 @item
3586 Types, but not their members, are not hidden by default.
3587
3588 @item
3589 The One Definition Rule is relaxed for types without explicit
3590 visibility specifications that are defined in more than one
3591 shared object: those declarations are permitted if they are
3592 permitted when this option is not used.
3593 @end enumerate
3594
3595 In new code it is better to use @option{-fvisibility=hidden} and
3596 export those classes that are intended to be externally visible.
3597 Unfortunately it is possible for code to rely, perhaps accidentally,
3598 on the Visual Studio behavior.
3599
3600 Among the consequences of these changes are that static data members
3601 of the same type with the same name but defined in different shared
3602 objects are different, so changing one does not change the other;
3603 and that pointers to function members defined in different shared
3604 objects may not compare equal. When this flag is given, it is a
3605 violation of the ODR to define types with the same name differently.
3606
3607 @opindex fno-weak
3608 @opindex fweak
3609 @item -fno-weak
3610 Do not use weak symbol support, even if it is provided by the linker.
3611 By default, G++ uses weak symbols if they are available. This
3612 option exists only for testing, and should not be used by end-users;
3613 it results in inferior code and has no benefits. This option may
3614 be removed in a future release of G++.
3615
3616 @opindex fext-numeric-literals
3617 @opindex fno-ext-numeric-literals
3618 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3619 Accept imaginary, fixed-point, or machine-defined
3620 literal number suffixes as GNU extensions.
3621 When this option is turned off these suffixes are treated
3622 as C++11 user-defined literal numeric suffixes.
3623 This is on by default for all pre-C++11 dialects and all GNU dialects:
3624 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3625 @option{-std=gnu++14}.
3626 This option is off by default
3627 for ISO C++11 onwards (@option{-std=c++11}, ...).
3628
3629 @opindex nostdinc++
3630 @item -nostdinc++
3631 Do not search for header files in the standard directories specific to
3632 C++, but do still search the other standard directories. (This option
3633 is used when building the C++ library.)
3634
3635 @opindex flang-info-include-translate
3636 @opindex flang-info-include-translate-not
3637 @item -flang-info-include-translate
3638 @itemx -flang-info-include-translate-not
3639 @itemx -flang-info-include-translate=@var{header}
3640 Inform of include translation events. The first will note accepted
3641 include translations, the second will note declined include
3642 translations. The @var{header} form will inform of include
3643 translations relating to that specific header. If @var{header} is of
3644 the form @code{"user"} or @code{<system>} it will be resolved to a
3645 specific user or system header using the include path.
3646
3647 @opindex flang-info-module-cmi
3648 @item -flang-info-module-cmi
3649 @itemx -flang-info-module-cmi=@var{module}
3650 Inform of Compiled Module Interface pathnames. The first will note
3651 all read CMI pathnames. The @var{module} form will not reading a
3652 specific module's CMI. @var{module} may be a named module or a
3653 header-unit (the latter indicated by either being a pathname containing
3654 directory separators or enclosed in @code{<>} or @code{""}).
3655
3656 @opindex stdlib
3657 @item -stdlib=@var{libstdc++,libc++}
3658 When G++ is configured to support this option, it allows specification of
3659 alternate C++ runtime libraries. Two options are available: @var{libstdc++}
3660 (the default, native C++ runtime for G++) and @var{libc++} which is the
3661 C++ runtime installed on some operating systems (e.g. Darwin versions from
3662 Darwin11 onwards). The option switches G++ to use the headers from the
3663 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3664 when a C++ runtime is required for linking.
3665 @end table
3666
3667 In addition, these warning options have meanings only for C++ programs:
3668
3669 @table @gcctabopt
3670 @opindex Wabi-tag
3671 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3672 Warn when a type with an ABI tag is used in a context that does not
3673 have that ABI tag. See @ref{C++ Attributes} for more information
3674 about ABI tags.
3675
3676 @opindex Wcomma-subscript
3677 @opindex Wno-comma-subscript
3678 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3679 Warn about uses of a comma expression within a subscripting expression.
3680 This usage was deprecated in C++20 and is going to be removed in C++23.
3681 However, a comma expression wrapped in @code{( )} is not deprecated. Example:
3682
3683 @smallexample
3684 @group
3685 void f(int *a, int b, int c) @{
3686 a[b,c]; // deprecated in C++20, invalid in C++23
3687 a[(b,c)]; // OK
3688 @}
3689 @end group
3690 @end smallexample
3691
3692 In C++23 it is valid to have comma separated expressions in a subscript
3693 when an overloaded subscript operator is found and supports the right
3694 number and types of arguments. G++ will accept the formerly valid syntax
3695 for code that is not valid in C++23 but used to be valid but deprecated
3696 in C++20 with a pedantic warning that can be disabled with
3697 @option{-Wno-comma-subscript}.
3698
3699 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3700 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3701
3702 @opindex Wctad-maybe-unsupported
3703 @opindex Wno-ctad-maybe-unsupported
3704 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3705 Warn when performing class template argument deduction (CTAD) on a type with
3706 no explicitly written deduction guides. This warning will point out cases
3707 where CTAD succeeded only because the compiler synthesized the implicit
3708 deduction guides, which might not be what the programmer intended. Certain
3709 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3710 types that are designed to support CTAD. This warning can be suppressed with
3711 the following pattern:
3712
3713 @smallexample
3714 struct allow_ctad_t; // any name works
3715 template <typename T> struct S @{
3716 S(T) @{ @}
3717 @};
3718 // Guide with incomplete parameter type will never be considered.
3719 S(allow_ctad_t) -> S<void>;
3720 @end smallexample
3721
3722 @opindex Wctor-dtor-privacy
3723 @opindex Wno-ctor-dtor-privacy
3724 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3725 Warn when a class seems unusable because all the constructors or
3726 destructors in that class are private, and it has neither friends nor
3727 public static member functions. Also warn if there are no non-private
3728 methods, and there's at least one private member function that isn't
3729 a constructor or destructor.
3730
3731 @opindex Wdangling-reference
3732 @opindex Wno-dangling-reference
3733 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3734 Warn when a reference is bound to a temporary whose lifetime has ended.
3735 For example:
3736
3737 @smallexample
3738 int n = 1;
3739 const int& r = std::max(n - 1, n + 1); // r is dangling
3740 @end smallexample
3741
3742 In the example above, two temporaries are created, one for each
3743 argument, and a reference to one of the temporaries is returned.
3744 However, both temporaries are destroyed at the end of the full
3745 expression, so the reference @code{r} is dangling. This warning
3746 also detects dangling references in member initializer lists:
3747
3748 @smallexample
3749 const int& f(const int& i) @{ return i; @}
3750 struct S @{
3751 const int &r; // r is dangling
3752 S() : r(f(10)) @{ @}
3753 @};
3754 @end smallexample
3755
3756 Member functions are checked as well, but only their object argument:
3757
3758 @smallexample
3759 struct S @{
3760 const S& self () @{ return *this; @}
3761 @};
3762 const S& s = S().self(); // s is dangling
3763 @end smallexample
3764
3765 Certain functions are safe in this respect, for example @code{std::use_facet}:
3766 they take and return a reference, but they don't return one of its arguments,
3767 which can fool the warning. Such functions can be excluded from the warning
3768 by wrapping them in a @code{#pragma}:
3769
3770 @smallexample
3771 #pragma GCC diagnostic push
3772 #pragma GCC diagnostic ignored "-Wdangling-reference"
3773 const T& foo (const T&) @{ @dots{} @}
3774 #pragma GCC diagnostic pop
3775 @end smallexample
3776
3777 @option{-Wdangling-reference} also warns about code like
3778
3779 @smallexample
3780 auto p = std::minmax(1, 2);
3781 @end smallexample
3782
3783 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3784 both references dangle after the end of the full expression that contains
3785 the call to @code{std::minmax}.
3786
3787 This warning is enabled by @option{-Wall}.
3788
3789 @opindex Wdelete-non-virtual-dtor
3790 @opindex Wno-delete-non-virtual-dtor
3791 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3792 Warn when @code{delete} is used to destroy an instance of a class that
3793 has virtual functions and non-virtual destructor. It is unsafe to delete
3794 an instance of a derived class through a pointer to a base class if the
3795 base class does not have a virtual destructor. This warning is enabled
3796 by @option{-Wall}.
3797
3798 @opindex Wdeprecated-copy
3799 @opindex Wno-deprecated-copy
3800 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3801 Warn that the implicit declaration of a copy constructor or copy
3802 assignment operator is deprecated if the class has a user-provided
3803 copy constructor or copy assignment operator, in C++11 and up. This
3804 warning is enabled by @option{-Wextra}. With
3805 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3806 user-provided destructor.
3807
3808 @opindex Wdeprecated-enum-enum-conversion
3809 @opindex Wno-deprecated-enum-enum-conversion
3810 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3811 Disable the warning about the case when the usual arithmetic conversions
3812 are applied on operands where one is of enumeration type and the other is
3813 of a different enumeration type. This conversion was deprecated in C++20.
3814 For example:
3815
3816 @smallexample
3817 enum E1 @{ e @};
3818 enum E2 @{ f @};
3819 int k = f - e;
3820 @end smallexample
3821
3822 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3823 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3824 by @option{-Wenum-conversion}.
3825
3826 @opindex Wdeprecated-enum-float-conversion
3827 @opindex Wno-deprecated-enum-float-conversion
3828 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3829 Disable the warning about the case when the usual arithmetic conversions
3830 are applied on operands where one is of enumeration type and the other is
3831 of a floating-point type. This conversion was deprecated in C++20. For
3832 example:
3833
3834 @smallexample
3835 enum E1 @{ e @};
3836 enum E2 @{ f @};
3837 bool b = e <= 3.7;
3838 @end smallexample
3839
3840 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3841 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3842 by @option{-Wenum-conversion}.
3843
3844 @opindex Winit-list-lifetime
3845 @opindex Wno-init-list-lifetime
3846 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3847 Do not warn about uses of @code{std::initializer_list} that are likely
3848 to result in dangling pointers. Since the underlying array for an
3849 @code{initializer_list} is handled like a normal C++ temporary object,
3850 it is easy to inadvertently keep a pointer to the array past the end
3851 of the array's lifetime. For example:
3852
3853 @itemize @bullet
3854 @item
3855 If a function returns a temporary @code{initializer_list}, or a local
3856 @code{initializer_list} variable, the array's lifetime ends at the end
3857 of the return statement, so the value returned has a dangling pointer.
3858
3859 @item
3860 If a new-expression creates an @code{initializer_list}, the array only
3861 lives until the end of the enclosing full-expression, so the
3862 @code{initializer_list} in the heap has a dangling pointer.
3863
3864 @item
3865 When an @code{initializer_list} variable is assigned from a
3866 brace-enclosed initializer list, the temporary array created for the
3867 right side of the assignment only lives until the end of the
3868 full-expression, so at the next statement the @code{initializer_list}
3869 variable has a dangling pointer.
3870
3871 @smallexample
3872 // li's initial underlying array lives as long as li
3873 std::initializer_list<int> li = @{ 1,2,3 @};
3874 // assignment changes li to point to a temporary array
3875 li = @{ 4, 5 @};
3876 // now the temporary is gone and li has a dangling pointer
3877 int i = li.begin()[0] // undefined behavior
3878 @end smallexample
3879
3880 @item
3881 When a list constructor stores the @code{begin} pointer from the
3882 @code{initializer_list} argument, this doesn't extend the lifetime of
3883 the array, so if a class variable is constructed from a temporary
3884 @code{initializer_list}, the pointer is left dangling by the end of
3885 the variable declaration statement.
3886
3887 @end itemize
3888
3889 @opindex Winvalid-constexpr
3890 @opindex Wno-invalid-constexpr
3891 @item -Winvalid-constexpr
3892
3893 Warn when a function never produces a constant expression. In C++20
3894 and earlier, for every @code{constexpr} function and function template,
3895 there must be at least one set of function arguments in at least one
3896 instantiation such that an invocation of the function or constructor
3897 could be an evaluated subexpression of a core constant expression.
3898 C++23 removed this restriction, so it's possible to have a function
3899 or a function template marked @code{constexpr} for which no invocation
3900 satisfies the requirements of a core constant expression.
3901
3902 This warning is enabled as a pedantic warning by default in C++20 and
3903 earlier. In C++23, @option{-Winvalid-constexpr} can be turned on, in
3904 which case it will be an ordinary warning. For example:
3905
3906 @smallexample
3907 void f (int& i);
3908 constexpr void
3909 g (int& i)
3910 @{
3911 // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3912 f(i);
3913 @}
3914 @end smallexample
3915
3916 @opindex Winvalid-imported-macros
3917 @opindex Wno-invalid-imported-macros
3918 @item -Winvalid-imported-macros
3919 Verify all imported macro definitions are valid at the end of
3920 compilation. This is not enabled by default, as it requires
3921 additional processing to determine. It may be useful when preparing
3922 sets of header-units to ensure consistent macros.
3923
3924 @opindex Wliteral-suffix
3925 @opindex Wno-literal-suffix
3926 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3927 Do not warn when a string or character literal is followed by a
3928 ud-suffix which does not begin with an underscore. As a conforming
3929 extension, GCC treats such suffixes as separate preprocessing tokens
3930 in order to maintain backwards compatibility with code that uses
3931 formatting macros from @code{<inttypes.h>}. For example:
3932
3933 @smallexample
3934 #define __STDC_FORMAT_MACROS
3935 #include <inttypes.h>
3936 #include <stdio.h>
3937
3938 int main() @{
3939 int64_t i64 = 123;
3940 printf("My int64: %" PRId64"\n", i64);
3941 @}
3942 @end smallexample
3943
3944 In this case, @code{PRId64} is treated as a separate preprocessing token.
3945
3946 This option also controls warnings when a user-defined literal
3947 operator is declared with a literal suffix identifier that doesn't
3948 begin with an underscore. Literal suffix identifiers that don't begin
3949 with an underscore are reserved for future standardization.
3950
3951 These warnings are enabled by default.
3952
3953 @opindex Wnarrowing
3954 @opindex Wno-narrowing
3955 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3956 For C++11 and later standards, narrowing conversions are diagnosed by default,
3957 as required by the standard. A narrowing conversion from a constant produces
3958 an error, and a narrowing conversion from a non-constant produces a warning,
3959 but @option{-Wno-narrowing} suppresses the diagnostic.
3960 Note that this does not affect the meaning of well-formed code;
3961 narrowing conversions are still considered ill-formed in SFINAE contexts.
3962
3963 With @option{-Wnarrowing} in C++98, warn when a narrowing
3964 conversion prohibited by C++11 occurs within
3965 @samp{@{ @}}, e.g.
3966
3967 @smallexample
3968 int i = @{ 2.2 @}; // error: narrowing from double to int
3969 @end smallexample
3970
3971 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3972
3973 @opindex Wnoexcept
3974 @opindex Wno-noexcept
3975 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3976 Warn when a noexcept-expression evaluates to false because of a call
3977 to a function that does not have a non-throwing exception
3978 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3979 the compiler to never throw an exception.
3980
3981 @opindex Wnoexcept-type
3982 @opindex Wno-noexcept-type
3983 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3984 Warn if the C++17 feature making @code{noexcept} part of a function
3985 type changes the mangled name of a symbol relative to C++14. Enabled
3986 by @option{-Wabi} and @option{-Wc++17-compat}.
3987
3988 As an example:
3989
3990 @smallexample
3991 template <class T> void f(T t) @{ t(); @};
3992 void g() noexcept;
3993 void h() @{ f(g); @}
3994 @end smallexample
3995
3996 @noindent
3997 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3998 C++17 it calls @code{f<void(*)()noexcept>}.
3999
4000 @opindex Wclass-memaccess
4001 @opindex Wno-class-memaccess
4002 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4003 Warn when the destination of a call to a raw memory function such as
4004 @code{memset} or @code{memcpy} is an object of class type, and when writing
4005 into such an object might bypass the class non-trivial or deleted constructor
4006 or copy assignment, violate const-correctness or encapsulation, or corrupt
4007 virtual table pointers. Modifying the representation of such objects may
4008 violate invariants maintained by member functions of the class. For example,
4009 the call to @code{memset} below is undefined because it modifies a non-trivial
4010 class object and is, therefore, diagnosed. The safe way to either initialize
4011 or clear the storage of objects of such types is by using the appropriate
4012 constructor or assignment operator, if one is available.
4013 @smallexample
4014 std::string str = "abc";
4015 memset (&str, 0, sizeof str);
4016 @end smallexample
4017 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4018 Explicitly casting the pointer to the class object to @code{void *} or
4019 to a type that can be safely accessed by the raw memory function suppresses
4020 the warning.
4021
4022 @opindex Wnon-virtual-dtor
4023 @opindex Wno-non-virtual-dtor
4024 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4025 Warn when a class has virtual functions and an accessible non-virtual
4026 destructor itself or in an accessible polymorphic base class, in which
4027 case it is possible but unsafe to delete an instance of a derived
4028 class through a pointer to the class itself or base class. This
4029 warning is automatically enabled if @option{-Weffc++} is specified.
4030 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4031 should be preferred because it warns about the unsafe cases without false
4032 positives.
4033
4034 @opindex Wregister
4035 @opindex Wno-register
4036 @item -Wregister @r{(C++ and Objective-C++ only)}
4037 Warn on uses of the @code{register} storage class specifier, except
4038 when it is part of the GNU @ref{Explicit Register Variables} extension.
4039 The use of the @code{register} keyword as storage class specifier has
4040 been deprecated in C++11 and removed in C++17.
4041 Enabled by default with @option{-std=c++17}.
4042
4043 @opindex Wreorder
4044 @opindex Wno-reorder
4045 @cindex reordering, warning
4046 @cindex warning for reordering of member initializers
4047 @item -Wreorder @r{(C++ and Objective-C++ only)}
4048 Warn when the order of member initializers given in the code does not
4049 match the order in which they must be executed. For instance:
4050
4051 @smallexample
4052 struct A @{
4053 int i;
4054 int j;
4055 A(): j (0), i (1) @{ @}
4056 @};
4057 @end smallexample
4058
4059 @noindent
4060 The compiler rearranges the member initializers for @code{i}
4061 and @code{j} to match the declaration order of the members, emitting
4062 a warning to that effect. This warning is enabled by @option{-Wall}.
4063
4064 @opindex Wpessimizing-move
4065 @opindex Wno-pessimizing-move
4066 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4067 This warning warns when a call to @code{std::move} prevents copy
4068 elision. A typical scenario when copy elision can occur is when returning in
4069 a function with a class return type, when the expression being returned is the
4070 name of a non-volatile automatic object, and is not a function parameter, and
4071 has the same type as the function return type.
4072
4073 @smallexample
4074 struct T @{
4075 @dots{}
4076 @};
4077 T fn()
4078 @{
4079 T t;
4080 @dots{}
4081 return std::move (t);
4082 @}
4083 @end smallexample
4084
4085 But in this example, the @code{std::move} call prevents copy elision.
4086
4087 This warning is enabled by @option{-Wall}.
4088
4089 @opindex Wredundant-move
4090 @opindex Wno-redundant-move
4091 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4092 This warning warns about redundant calls to @code{std::move}; that is, when
4093 a move operation would have been performed even without the @code{std::move}
4094 call. This happens because the compiler is forced to treat the object as if
4095 it were an rvalue in certain situations such as returning a local variable,
4096 where copy elision isn't applicable. Consider:
4097
4098 @smallexample
4099 struct T @{
4100 @dots{}
4101 @};
4102 T fn(T t)
4103 @{
4104 @dots{}
4105 return std::move (t);
4106 @}
4107 @end smallexample
4108
4109 Here, the @code{std::move} call is redundant. Because G++ implements Core
4110 Issue 1579, another example is:
4111
4112 @smallexample
4113 struct T @{ // convertible to U
4114 @dots{}
4115 @};
4116 struct U @{
4117 @dots{}
4118 @};
4119 U fn()
4120 @{
4121 T t;
4122 @dots{}
4123 return std::move (t);
4124 @}
4125 @end smallexample
4126 In this example, copy elision isn't applicable because the type of the
4127 expression being returned and the function return type differ, yet G++
4128 treats the return value as if it were designated by an rvalue.
4129
4130 This warning is enabled by @option{-Wextra}.
4131
4132 @opindex Wrange-loop-construct
4133 @opindex Wno-range-loop-construct
4134 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4135 This warning warns when a C++ range-based for-loop is creating an unnecessary
4136 copy. This can happen when the range declaration is not a reference, but
4137 probably should be. For example:
4138
4139 @smallexample
4140 struct S @{ char arr[128]; @};
4141 void fn () @{
4142 S arr[5];
4143 for (const auto x : arr) @{ @dots{} @}
4144 @}
4145 @end smallexample
4146
4147 It does not warn when the type being copied is a trivially-copyable type whose
4148 size is less than 64 bytes.
4149
4150 This warning also warns when a loop variable in a range-based for-loop is
4151 initialized with a value of a different type resulting in a copy. For example:
4152
4153 @smallexample
4154 void fn() @{
4155 int arr[10];
4156 for (const double &x : arr) @{ @dots{} @}
4157 @}
4158 @end smallexample
4159
4160 In the example above, in every iteration of the loop a temporary value of
4161 type @code{double} is created and destroyed, to which the reference
4162 @code{const double &} is bound.
4163
4164 This warning is enabled by @option{-Wall}.
4165
4166 @opindex Wredundant-tags
4167 @opindex Wno-redundant-tags
4168 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4169 Warn about redundant class-key and enum-key in references to class types
4170 and enumerated types in contexts where the key can be eliminated without
4171 causing an ambiguity. For example:
4172
4173 @smallexample
4174 struct foo;
4175 struct foo *p; // warn that keyword struct can be eliminated
4176 @end smallexample
4177
4178 @noindent
4179 On the other hand, in this example there is no warning:
4180
4181 @smallexample
4182 struct foo;
4183 void foo (); // "hides" struct foo
4184 void bar (struct foo&); // no warning, keyword struct is necessary
4185 @end smallexample
4186
4187 @opindex Wsubobject-linkage
4188 @opindex Wno-subobject-linkage
4189 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4190 Do not warn
4191 if a class type has a base or a field whose type uses the anonymous
4192 namespace or depends on a type with no linkage. If a type A depends on
4193 a type B with no or internal linkage, defining it in multiple
4194 translation units would be an ODR violation because the meaning of B
4195 is different in each translation unit. If A only appears in a single
4196 translation unit, the best way to silence the warning is to give it
4197 internal linkage by putting it in an anonymous namespace as well. The
4198 compiler doesn't give this warning for types defined in the main .C
4199 file, as those are unlikely to have multiple definitions.
4200 @option{-Wsubobject-linkage} is enabled by default.
4201
4202 @opindex Weffc++
4203 @opindex Wno-effc++
4204 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4205 Warn about violations of the following style guidelines from Scott Meyers'
4206 @cite{Effective C++} series of books:
4207
4208 @itemize @bullet
4209 @item
4210 Define a copy constructor and an assignment operator for classes
4211 with dynamically-allocated memory.
4212
4213 @item
4214 Prefer initialization to assignment in constructors.
4215
4216 @item
4217 Have @code{operator=} return a reference to @code{*this}.
4218
4219 @item
4220 Don't try to return a reference when you must return an object.
4221
4222 @item
4223 Distinguish between prefix and postfix forms of increment and
4224 decrement operators.
4225
4226 @item
4227 Never overload @code{&&}, @code{||}, or @code{,}.
4228
4229 @end itemize
4230
4231 This option also enables @option{-Wnon-virtual-dtor}, which is also
4232 one of the effective C++ recommendations. However, the check is
4233 extended to warn about the lack of virtual destructor in accessible
4234 non-polymorphic bases classes too.
4235
4236 When selecting this option, be aware that the standard library
4237 headers do not obey all of these guidelines; use @samp{grep -v}
4238 to filter out those warnings.
4239
4240 @opindex Wexceptions
4241 @opindex Wno-exceptions
4242 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4243 Disable the warning about the case when an exception handler is shadowed by
4244 another handler, which can point out a wrong ordering of exception handlers.
4245
4246 @opindex Wstrict-null-sentinel
4247 @opindex Wno-strict-null-sentinel
4248 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4249 Warn about the use of an uncasted @code{NULL} as sentinel. When
4250 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4251 to @code{__null}. Although it is a null pointer constant rather than a
4252 null pointer, it is guaranteed to be of the same size as a pointer.
4253 But this use is not portable across different compilers.
4254
4255 @opindex Wno-non-template-friend
4256 @opindex Wnon-template-friend
4257 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4258 Disable warnings when non-template friend functions are declared
4259 within a template. In very old versions of GCC that predate implementation
4260 of the ISO standard, declarations such as
4261 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4262 could be interpreted as a particular specialization of a template
4263 function; the warning exists to diagnose compatibility problems,
4264 and is enabled by default.
4265
4266 @opindex Wold-style-cast
4267 @opindex Wno-old-style-cast
4268 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4269 Warn if an old-style (C-style) cast to a non-void type is used within
4270 a C++ program. The new-style casts (@code{dynamic_cast},
4271 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4272 less vulnerable to unintended effects and much easier to search for.
4273
4274 @opindex Woverloaded-virtual
4275 @opindex Wno-overloaded-virtual
4276 @cindex overloaded virtual function, warning
4277 @cindex warning for overloaded virtual function
4278 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4279 @itemx -Woverloaded-virtual=@var{n}
4280 Warn when a function declaration hides virtual functions from a
4281 base class. For example, in:
4282
4283 @smallexample
4284 struct A @{
4285 virtual void f();
4286 @};
4287
4288 struct B: public A @{
4289 void f(int); // does not override
4290 @};
4291 @end smallexample
4292
4293 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4294 like:
4295
4296 @smallexample
4297 B* b;
4298 b->f();
4299 @end smallexample
4300
4301 @noindent
4302 fails to compile.
4303
4304 In cases where the different signatures are not an accident, the
4305 simplest solution is to add a using-declaration to the derived class
4306 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4307
4308 The optional level suffix controls the behavior when all the
4309 declarations in the derived class override virtual functions in the
4310 base class, even if not all of the base functions are overridden:
4311
4312 @smallexample
4313 struct C @{
4314 virtual void f();
4315 virtual void f(int);
4316 @};
4317
4318 struct D: public C @{
4319 void f(int); // does override
4320 @}
4321 @end smallexample
4322
4323 This pattern is less likely to be a mistake; if D is only used
4324 virtually, the user might have decided that the base class semantics
4325 for some of the overloads are fine.
4326
4327 At level 1, this case does not warn; at level 2, it does.
4328 @option{-Woverloaded-virtual} by itself selects level 2. Level 1 is
4329 included in @option{-Wall}.
4330
4331 @opindex Wno-pmf-conversions
4332 @opindex Wpmf-conversions
4333 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4334 Disable the diagnostic for converting a bound pointer to member function
4335 to a plain pointer.
4336
4337 @opindex Wsign-promo
4338 @opindex Wno-sign-promo
4339 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4340 Warn when overload resolution chooses a promotion from unsigned or
4341 enumerated type to a signed type, over a conversion to an unsigned type of
4342 the same size. Previous versions of G++ tried to preserve
4343 unsignedness, but the standard mandates the current behavior.
4344
4345 @opindex Wtemplates
4346 @opindex Wno-templates
4347 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4348 Warn when a primary template declaration is encountered. Some coding
4349 rules disallow templates, and this may be used to enforce that rule.
4350 The warning is inactive inside a system header file, such as the STL, so
4351 one can still use the STL. One may also instantiate or specialize
4352 templates.
4353
4354 @opindex Wmismatched-new-delete
4355 @opindex Wno-mismatched-new-delete
4356 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4357 Warn for mismatches between calls to @code{operator new} or @code{operator
4358 delete} and the corresponding call to the allocation or deallocation function.
4359 This includes invocations of C++ @code{operator delete} with pointers
4360 returned from either mismatched forms of @code{operator new}, or from other
4361 functions that allocate objects for which the @code{operator delete} isn't
4362 a suitable deallocator, as well as calls to other deallocation functions
4363 with pointers returned from @code{operator new} for which the deallocation
4364 function isn't suitable.
4365
4366 For example, the @code{delete} expression in the function below is diagnosed
4367 because it doesn't match the array form of the @code{new} expression
4368 the pointer argument was returned from. Similarly, the call to @code{free}
4369 is also diagnosed.
4370
4371 @smallexample
4372 void f ()
4373 @{
4374 int *a = new int[n];
4375 delete a; // warning: mismatch in array forms of expressions
4376
4377 char *p = new char[n];
4378 free (p); // warning: mismatch between new and free
4379 @}
4380 @end smallexample
4381
4382 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4383 involving allocation and deallocation functions other than @code{operator
4384 new} and @code{operator delete}.
4385
4386 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4387
4388 @opindex Wmismatched-tags
4389 @opindex Wno-mismatched-tags
4390 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4391 Warn for declarations of structs, classes, and class templates and their
4392 specializations with a class-key that does not match either the definition
4393 or the first declaration if no definition is provided.
4394
4395 For example, the declaration of @code{struct Object} in the argument list
4396 of @code{draw} triggers the warning. To avoid it, either remove the redundant
4397 class-key @code{struct} or replace it with @code{class} to match its definition.
4398 @smallexample
4399 class Object @{
4400 public:
4401 virtual ~Object () = 0;
4402 @};
4403 void draw (struct Object*);
4404 @end smallexample
4405
4406 It is not wrong to declare a class with the class-key @code{struct} as
4407 the example above shows. The @option{-Wmismatched-tags} option is intended
4408 to help achieve a consistent style of class declarations. In code that is
4409 intended to be portable to Windows-based compilers the warning helps prevent
4410 unresolved references due to the difference in the mangling of symbols
4411 declared with different class-keys. The option can be used either on its
4412 own or in conjunction with @option{-Wredundant-tags}.
4413
4414 @opindex Wmultiple-inheritance
4415 @opindex Wno-multiple-inheritance
4416 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4417 Warn when a class is defined with multiple direct base classes. Some
4418 coding rules disallow multiple inheritance, and this may be used to
4419 enforce that rule. The warning is inactive inside a system header file,
4420 such as the STL, so one can still use the STL. One may also define
4421 classes that indirectly use multiple inheritance.
4422
4423 @opindex Wvirtual-inheritance
4424 @opindex Wno-virtual-inheritance
4425 @item -Wvirtual-inheritance
4426 Warn when a class is defined with a virtual direct base class. Some
4427 coding rules disallow multiple inheritance, and this may be used to
4428 enforce that rule. The warning is inactive inside a system header file,
4429 such as the STL, so one can still use the STL. One may also define
4430 classes that indirectly use virtual inheritance.
4431
4432 @opindex Wvirtual-move-assign
4433 @opindex Wno-virtual-move-assign
4434 @item -Wno-virtual-move-assign
4435 Suppress warnings about inheriting from a virtual base with a
4436 non-trivial C++11 move assignment operator. This is dangerous because
4437 if the virtual base is reachable along more than one path, it is
4438 moved multiple times, which can mean both objects end up in the
4439 moved-from state. If the move assignment operator is written to avoid
4440 moving from a moved-from object, this warning can be disabled.
4441
4442 @opindex Wnamespaces
4443 @opindex Wno-namespaces
4444 @item -Wnamespaces
4445 Warn when a namespace definition is opened. Some coding rules disallow
4446 namespaces, and this may be used to enforce that rule. The warning is
4447 inactive inside a system header file, such as the STL, so one can still
4448 use the STL. One may also use using directives and qualified names.
4449
4450 @opindex Wterminate
4451 @opindex Wno-terminate
4452 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4453 Disable the warning about a throw-expression that will immediately
4454 result in a call to @code{terminate}.
4455
4456 @opindex Wvexing-parse
4457 @opindex Wno-vexing-parse
4458 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4459 Warn about the most vexing parse syntactic ambiguity. This warns about
4460 the cases when a declaration looks like a variable definition, but the
4461 C++ language requires it to be interpreted as a function declaration.
4462 For instance:
4463
4464 @smallexample
4465 void f(double a) @{
4466 int i(); // extern int i (void);
4467 int n(int(a)); // extern int n (int);
4468 @}
4469 @end smallexample
4470
4471 Another example:
4472
4473 @smallexample
4474 struct S @{ S(int); @};
4475 void f(double a) @{
4476 S x(int(a)); // extern struct S x (int);
4477 S y(int()); // extern struct S y (int (*) (void));
4478 S z(); // extern struct S z (void);
4479 @}
4480 @end smallexample
4481
4482 The warning will suggest options how to deal with such an ambiguity; e.g.,
4483 it can suggest removing the parentheses or using braces instead.
4484
4485 This warning is enabled by default.
4486
4487 @opindex Wno-class-conversion
4488 @opindex Wclass-conversion
4489 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4490 Do not warn when a conversion function converts an
4491 object to the same type, to a base class of that type, or to void; such
4492 a conversion function will never be called.
4493
4494 @opindex Wvolatile
4495 @opindex Wno-volatile
4496 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4497 Warn about deprecated uses of the @code{volatile} qualifier. This includes
4498 postfix and prefix @code{++} and @code{--} expressions of
4499 @code{volatile}-qualified types, using simple assignments where the left
4500 operand is a @code{volatile}-qualified non-class type for their value,
4501 compound assignments where the left operand is a @code{volatile}-qualified
4502 non-class type, @code{volatile}-qualified function return type,
4503 @code{volatile}-qualified parameter type, and structured bindings of a
4504 @code{volatile}-qualified type. This usage was deprecated in C++20.
4505
4506 Enabled by default with @option{-std=c++20}.
4507
4508 @opindex Wzero-as-null-pointer-constant
4509 @opindex Wno-zero-as-null-pointer-constant
4510 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4511 Warn when a literal @samp{0} is used as null pointer constant. This can
4512 be useful to facilitate the conversion to @code{nullptr} in C++11.
4513
4514 @opindex Waligned-new
4515 @opindex Wno-aligned-new
4516 @item -Waligned-new
4517 Warn about a new-expression of a type that requires greater alignment
4518 than the @code{alignof(std::max_align_t)} but uses an allocation
4519 function without an explicit alignment parameter. This option is
4520 enabled by @option{-Wall}.
4521
4522 Normally this only warns about global allocation functions, but
4523 @option{-Waligned-new=all} also warns about class member allocation
4524 functions.
4525
4526 @opindex Wplacement-new
4527 @opindex Wno-placement-new
4528 @item -Wno-placement-new
4529 @itemx -Wplacement-new=@var{n}
4530 Warn about placement new expressions with undefined behavior, such as
4531 constructing an object in a buffer that is smaller than the type of
4532 the object. For example, the placement new expression below is diagnosed
4533 because it attempts to construct an array of 64 integers in a buffer only
4534 64 bytes large.
4535 @smallexample
4536 char buf [64];
4537 new (buf) int[64];
4538 @end smallexample
4539 This warning is enabled by default.
4540
4541 @table @gcctabopt
4542 @item -Wplacement-new=1
4543 This is the default warning level of @option{-Wplacement-new}. At this
4544 level the warning is not issued for some strictly undefined constructs that
4545 GCC allows as extensions for compatibility with legacy code. For example,
4546 the following @code{new} expression is not diagnosed at this level even
4547 though it has undefined behavior according to the C++ standard because
4548 it writes past the end of the one-element array.
4549 @smallexample
4550 struct S @{ int n, a[1]; @};
4551 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4552 new (s->a)int [32]();
4553 @end smallexample
4554
4555 @item -Wplacement-new=2
4556 At this level, in addition to diagnosing all the same constructs as at level
4557 1, a diagnostic is also issued for placement new expressions that construct
4558 an object in the last member of structure whose type is an array of a single
4559 element and whose size is less than the size of the object being constructed.
4560 While the previous example would be diagnosed, the following construct makes
4561 use of the flexible member array extension to avoid the warning at level 2.
4562 @smallexample
4563 struct S @{ int n, a[]; @};
4564 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4565 new (s->a)int [32]();
4566 @end smallexample
4567
4568 @end table
4569
4570 @opindex Wcatch-value
4571 @opindex Wno-catch-value
4572 @item -Wcatch-value
4573 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4574 Warn about catch handlers that do not catch via reference.
4575 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4576 warn about polymorphic class types that are caught by value.
4577 With @option{-Wcatch-value=2} warn about all class types that are caught
4578 by value. With @option{-Wcatch-value=3} warn about all types that are
4579 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4580
4581 @opindex Wconditionally-supported
4582 @opindex Wno-conditionally-supported
4583 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4584 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4585
4586 @opindex Wdelete-incomplete
4587 @opindex Wno-delete-incomplete
4588 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4589 Do not warn when deleting a pointer to incomplete type, which may cause
4590 undefined behavior at runtime. This warning is enabled by default.
4591
4592 @opindex Wextra-semi
4593 @opindex Wno-extra-semi
4594 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4595 Warn about redundant semicolons after in-class function definitions.
4596
4597 @opindex Winaccessible-base
4598 @opindex Wno-inaccessible-base
4599 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4600 This option controls warnings
4601 when a base class is inaccessible in a class derived from it due to
4602 ambiguity. The warning is enabled by default.
4603 Note that the warning for ambiguous virtual
4604 bases is enabled by the @option{-Wextra} option.
4605 @smallexample
4606 @group
4607 struct A @{ int a; @};
4608
4609 struct B : A @{ @};
4610
4611 struct C : B, A @{ @};
4612 @end group
4613 @end smallexample
4614
4615 @opindex Winherited-variadic-ctor
4616 @opindex Wno-inherited-variadic-ctor
4617 @item -Wno-inherited-variadic-ctor
4618 Suppress warnings about use of C++11 inheriting constructors when the
4619 base class inherited from has a C variadic constructor; the warning is
4620 on by default because the ellipsis is not inherited.
4621
4622 @opindex Wno-invalid-offsetof
4623 @opindex Winvalid-offsetof
4624 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4625 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4626 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
4627 to a non-standard-layout type is undefined. In existing C++ implementations,
4628 however, @code{offsetof} typically gives meaningful results.
4629 This flag is for users who are aware that they are
4630 writing nonportable code and who have deliberately chosen to ignore the
4631 warning about it.
4632
4633 The restrictions on @code{offsetof} may be relaxed in a future version
4634 of the C++ standard.
4635
4636 @opindex Wsized-deallocation
4637 @opindex Wno-sized-deallocation
4638 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4639 Warn about a definition of an unsized deallocation function
4640 @smallexample
4641 void operator delete (void *) noexcept;
4642 void operator delete[] (void *) noexcept;
4643 @end smallexample
4644 without a definition of the corresponding sized deallocation function
4645 @smallexample
4646 void operator delete (void *, std::size_t) noexcept;
4647 void operator delete[] (void *, std::size_t) noexcept;
4648 @end smallexample
4649 or vice versa. Enabled by @option{-Wextra} along with
4650 @option{-fsized-deallocation}.
4651
4652 @opindex Wno-suggest-final-types
4653 @opindex Wsuggest-final-types
4654 @item -Wsuggest-final-types
4655 Warn about types with virtual methods where code quality would be improved
4656 if the type were declared with the C++11 @code{final} specifier,
4657 or, if possible,
4658 declared in an anonymous namespace. This allows GCC to more aggressively
4659 devirtualize the polymorphic calls. This warning is more effective with
4660 link-time optimization,
4661 where the information about the class hierarchy graph is
4662 more complete.
4663
4664 @opindex Wno-suggest-final-methods
4665 @opindex Wsuggest-final-methods
4666 @item -Wsuggest-final-methods
4667 Warn about virtual methods where code quality would be improved if the method
4668 were declared with the C++11 @code{final} specifier,
4669 or, if possible, its type were
4670 declared in an anonymous namespace or with the @code{final} specifier.
4671 This warning is
4672 more effective with link-time optimization, where the information about the
4673 class hierarchy graph is more complete. It is recommended to first consider
4674 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4675 annotations.
4676
4677 @opindex Wsuggest-override
4678 @opindex Wno-suggest-override
4679 @item -Wsuggest-override
4680 Warn about overriding virtual functions that are not marked with the
4681 @code{override} keyword.
4682
4683 @opindex Wuse-after-free
4684 @opindex Wno-use-after-free
4685 @item -Wuse-after-free
4686 @itemx -Wuse-after-free=@var{n}
4687 Warn about uses of pointers to dynamically allocated objects that have
4688 been rendered indeterminate by a call to a deallocation function.
4689 The warning is enabled at all optimization levels but may yield different
4690 results with optimization than without.
4691
4692 @table @gcctabopt
4693 @item -Wuse-after-free=1
4694 At level 1 the warning attempts to diagnose only unconditional uses
4695 of pointers made indeterminate by a deallocation call or a successful
4696 call to @code{realloc}, regardless of whether or not the call resulted
4697 in an actual reallocatio of memory. This includes double-@code{free}
4698 calls as well as uses in arithmetic and relational expressions. Although
4699 undefined, uses of indeterminate pointers in equality (or inequality)
4700 expressions are not diagnosed at this level.
4701 @item -Wuse-after-free=2
4702 At level 2, in addition to unconditional uses, the warning also diagnoses
4703 conditional uses of pointers made indeterminate by a deallocation call.
4704 As at level 2, uses in equality (or inequality) expressions are not
4705 diagnosed. For example, the second call to @code{free} in the following
4706 function is diagnosed at this level:
4707 @smallexample
4708 struct A @{ int refcount; void *data; @};
4709
4710 void release (struct A *p)
4711 @{
4712 int refcount = --p->refcount;
4713 free (p);
4714 if (refcount == 0)
4715 free (p->data); // warning: p may be used after free
4716 @}
4717 @end smallexample
4718 @item -Wuse-after-free=3
4719 At level 3, the warning also diagnoses uses of indeterminate pointers in
4720 equality expressions. All uses of indeterminate pointers are undefined
4721 but equality tests sometimes appear after calls to @code{realloc} as
4722 an attempt to determine whether the call resulted in relocating the object
4723 to a different address. They are diagnosed at a separate level to aid
4724 legacy code gradually transition to safe alternatives. For example,
4725 the equality test in the function below is diagnosed at this level:
4726 @smallexample
4727 void adjust_pointers (int**, int);
4728
4729 void grow (int **p, int n)
4730 @{
4731 int **q = (int**)realloc (p, n *= 2);
4732 if (q == p)
4733 return;
4734 adjust_pointers ((int**)q, n);
4735 @}
4736 @end smallexample
4737 To avoid the warning at this level, store offsets into allocated memory
4738 instead of pointers. This approach obviates needing to adjust the stored
4739 pointers after reallocation.
4740 @end table
4741
4742 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4743
4744 @opindex Wuseless-cast
4745 @opindex Wno-useless-cast
4746 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4747 Warn when an expression is cast to its own type. This warning does not
4748 occur when a class object is converted to a non-reference type as that
4749 is a way to create a temporary:
4750
4751 @smallexample
4752 struct S @{ @};
4753 void g (S&&);
4754 void f (S&& arg)
4755 @{
4756 g (S(arg)); // make arg prvalue so that it can bind to S&&
4757 @}
4758 @end smallexample
4759
4760 @opindex Wconversion-null
4761 @opindex Wno-conversion-null
4762 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4763 Do not warn for conversions between @code{NULL} and non-pointer
4764 types. @option{-Wconversion-null} is enabled by default.
4765
4766 @end table
4767
4768 @node Objective-C and Objective-C++ Dialect Options
4769 @section Options Controlling Objective-C and Objective-C++ Dialects
4770
4771 @cindex compiler options, Objective-C and Objective-C++
4772 @cindex Objective-C and Objective-C++ options, command-line
4773 @cindex options, Objective-C and Objective-C++
4774 (NOTE: This manual does not describe the Objective-C and Objective-C++
4775 languages themselves. @xref{Standards,,Language Standards
4776 Supported by GCC}, for references.)
4777
4778 This section describes the command-line options that are only meaningful
4779 for Objective-C and Objective-C++ programs. You can also use most of
4780 the language-independent GNU compiler options.
4781 For example, you might compile a file @file{some_class.m} like this:
4782
4783 @smallexample
4784 gcc -g -fgnu-runtime -O -c some_class.m
4785 @end smallexample
4786
4787 @noindent
4788 In this example, @option{-fgnu-runtime} is an option meant only for
4789 Objective-C and Objective-C++ programs; you can use the other options with
4790 any language supported by GCC@.
4791
4792 Note that since Objective-C is an extension of the C language, Objective-C
4793 compilations may also use options specific to the C front-end (e.g.,
4794 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4795 C++-specific options (e.g., @option{-Wabi}).
4796
4797 Here is a list of options that are @emph{only} for compiling Objective-C
4798 and Objective-C++ programs:
4799
4800 @table @gcctabopt
4801 @opindex fconstant-string-class
4802 @item -fconstant-string-class=@var{class-name}
4803 Use @var{class-name} as the name of the class to instantiate for each
4804 literal string specified with the syntax @code{@@"@dots{}"}. The default
4805 class name is @code{NXConstantString} if the GNU runtime is being used, and
4806 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4807 @option{-fconstant-cfstrings} option, if also present, overrides the
4808 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4809 to be laid out as constant CoreFoundation strings.
4810
4811 @opindex fgnu-runtime
4812 @item -fgnu-runtime
4813 Generate object code compatible with the standard GNU Objective-C
4814 runtime. This is the default for most types of systems.
4815
4816 @opindex fnext-runtime
4817 @item -fnext-runtime
4818 Generate output compatible with the NeXT runtime. This is the default
4819 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4820 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4821 used.
4822
4823 @opindex fno-nil-receivers
4824 @opindex fnil-receivers
4825 @item -fno-nil-receivers
4826 Assume that all Objective-C message dispatches (@code{[receiver
4827 message:arg]}) in this translation unit ensure that the receiver is
4828 not @code{nil}. This allows for more efficient entry points in the
4829 runtime to be used. This option is only available in conjunction with
4830 the NeXT runtime and ABI version 0 or 1.
4831
4832 @opindex fobjc-abi-version
4833 @item -fobjc-abi-version=@var{n}
4834 Use version @var{n} of the Objective-C ABI for the selected runtime.
4835 This option is currently supported only for the NeXT runtime. In that
4836 case, Version 0 is the traditional (32-bit) ABI without support for
4837 properties and other Objective-C 2.0 additions. Version 1 is the
4838 traditional (32-bit) ABI with support for properties and other
4839 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4840 nothing is specified, the default is Version 0 on 32-bit target
4841 machines, and Version 2 on 64-bit target machines.
4842
4843 @opindex fobjc-call-cxx-cdtors
4844 @item -fobjc-call-cxx-cdtors
4845 For each Objective-C class, check if any of its instance variables is a
4846 C++ object with a non-trivial default constructor. If so, synthesize a
4847 special @code{- (id) .cxx_construct} instance method which runs
4848 non-trivial default constructors on any such instance variables, in order,
4849 and then return @code{self}. Similarly, check if any instance variable
4850 is a C++ object with a non-trivial destructor, and if so, synthesize a
4851 special @code{- (void) .cxx_destruct} method which runs
4852 all such default destructors, in reverse order.
4853
4854 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4855 methods thusly generated only operate on instance variables
4856 declared in the current Objective-C class, and not those inherited
4857 from superclasses. It is the responsibility of the Objective-C
4858 runtime to invoke all such methods in an object's inheritance
4859 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4860 by the runtime immediately after a new object instance is allocated;
4861 the @code{- (void) .cxx_destruct} methods are invoked immediately
4862 before the runtime deallocates an object instance.
4863
4864 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4865 support for invoking the @code{- (id) .cxx_construct} and
4866 @code{- (void) .cxx_destruct} methods.
4867
4868 @opindex fobjc-direct-dispatch
4869 @item -fobjc-direct-dispatch
4870 Allow fast jumps to the message dispatcher. On Darwin this is
4871 accomplished via the comm page.
4872
4873 @opindex fobjc-exceptions
4874 @item -fobjc-exceptions
4875 Enable syntactic support for structured exception handling in
4876 Objective-C, similar to what is offered by C++. This option
4877 is required to use the Objective-C keywords @code{@@try},
4878 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4879 @code{@@synchronized}. This option is available with both the GNU
4880 runtime and the NeXT runtime (but not available in conjunction with
4881 the NeXT runtime on Mac OS X 10.2 and earlier).
4882
4883 @opindex fobjc-gc
4884 @item -fobjc-gc
4885 Enable garbage collection (GC) in Objective-C and Objective-C++
4886 programs. This option is only available with the NeXT runtime; the
4887 GNU runtime has a different garbage collection implementation that
4888 does not require special compiler flags.
4889
4890 @opindex fobjc-nilcheck
4891 @item -fobjc-nilcheck
4892 For the NeXT runtime with version 2 of the ABI, check for a nil
4893 receiver in method invocations before doing the actual method call.
4894 This is the default and can be disabled using
4895 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4896 checked for nil in this way no matter what this flag is set to.
4897 Currently this flag does nothing when the GNU runtime, or an older
4898 version of the NeXT runtime ABI, is used.
4899
4900 @opindex fobjc-std
4901 @item -fobjc-std=objc1
4902 Conform to the language syntax of Objective-C 1.0, the language
4903 recognized by GCC 4.0. This only affects the Objective-C additions to
4904 the C/C++ language; it does not affect conformance to C/C++ standards,
4905 which is controlled by the separate C/C++ dialect option flags. When
4906 this option is used with the Objective-C or Objective-C++ compiler,
4907 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4908 This is useful if you need to make sure that your Objective-C code can
4909 be compiled with older versions of GCC@.
4910
4911 @opindex freplace-objc-classes
4912 @item -freplace-objc-classes
4913 Emit a special marker instructing @command{ld(1)} not to statically link in
4914 the resulting object file, and allow @command{dyld(1)} to load it in at
4915 run time instead. This is used in conjunction with the Fix-and-Continue
4916 debugging mode, where the object file in question may be recompiled and
4917 dynamically reloaded in the course of program execution, without the need
4918 to restart the program itself. Currently, Fix-and-Continue functionality
4919 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4920 and later.
4921
4922 @opindex fzero-link
4923 @item -fzero-link
4924 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4925 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4926 compile time) with static class references that get initialized at load time,
4927 which improves run-time performance. Specifying the @option{-fzero-link} flag
4928 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4929 to be retained. This is useful in Zero-Link debugging mode, since it allows
4930 for individual class implementations to be modified during program execution.
4931 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4932 regardless of command-line options.
4933
4934 @opindex fno-local-ivars
4935 @opindex flocal-ivars
4936 @item -fno-local-ivars
4937 By default instance variables in Objective-C can be accessed as if
4938 they were local variables from within the methods of the class they're
4939 declared in. This can lead to shadowing between instance variables
4940 and other variables declared either locally inside a class method or
4941 globally with the same name. Specifying the @option{-fno-local-ivars}
4942 flag disables this behavior thus avoiding variable shadowing issues.
4943
4944 @opindex fivar-visibility
4945 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4946 Set the default instance variable visibility to the specified option
4947 so that instance variables declared outside the scope of any access
4948 modifier directives default to the specified visibility.
4949
4950 @opindex gen-decls
4951 @item -gen-decls
4952 Dump interface declarations for all classes seen in the source file to a
4953 file named @file{@var{sourcename}.decl}.
4954
4955 @opindex Wassign-intercept
4956 @opindex Wno-assign-intercept
4957 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4958 Warn whenever an Objective-C assignment is being intercepted by the
4959 garbage collector.
4960
4961 @opindex Wproperty-assign-default
4962 @opindex Wno-property-assign-default
4963 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4964 Do not warn if a property for an Objective-C object has no assign
4965 semantics specified.
4966
4967 @opindex Wno-protocol
4968 @opindex Wprotocol
4969 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4970 If a class is declared to implement a protocol, a warning is issued for
4971 every method in the protocol that is not implemented by the class. The
4972 default behavior is to issue a warning for every method not explicitly
4973 implemented in the class, even if a method implementation is inherited
4974 from the superclass. If you use the @option{-Wno-protocol} option, then
4975 methods inherited from the superclass are considered to be implemented,
4976 and no warning is issued for them.
4977
4978 @opindex Wobjc-root-class
4979 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4980 Warn if a class interface lacks a superclass. Most classes will inherit
4981 from @code{NSObject} (or @code{Object}) for example. When declaring
4982 classes intended to be root classes, the warning can be suppressed by
4983 marking their interfaces with @code{__attribute__((objc_root_class))}.
4984
4985 @opindex Wselector
4986 @opindex Wno-selector
4987 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4988 Warn if multiple methods of different types for the same selector are
4989 found during compilation. The check is performed on the list of methods
4990 in the final stage of compilation. Additionally, a check is performed
4991 for each selector appearing in a @code{@@selector(@dots{})}
4992 expression, and a corresponding method for that selector has been found
4993 during compilation. Because these checks scan the method table only at
4994 the end of compilation, these warnings are not produced if the final
4995 stage of compilation is not reached, for example because an error is
4996 found during compilation, or because the @option{-fsyntax-only} option is
4997 being used.
4998
4999 @opindex Wstrict-selector-match
5000 @opindex Wno-strict-selector-match
5001 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5002 Warn if multiple methods with differing argument and/or return types are
5003 found for a given selector when attempting to send a message using this
5004 selector to a receiver of type @code{id} or @code{Class}. When this flag
5005 is off (which is the default behavior), the compiler omits such warnings
5006 if any differences found are confined to types that share the same size
5007 and alignment.
5008
5009 @opindex Wundeclared-selector
5010 @opindex Wno-undeclared-selector
5011 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5012 Warn if a @code{@@selector(@dots{})} expression referring to an
5013 undeclared selector is found. A selector is considered undeclared if no
5014 method with that name has been declared before the
5015 @code{@@selector(@dots{})} expression, either explicitly in an
5016 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5017 an @code{@@implementation} section. This option always performs its
5018 checks as soon as a @code{@@selector(@dots{})} expression is found,
5019 while @option{-Wselector} only performs its checks in the final stage of
5020 compilation. This also enforces the coding style convention
5021 that methods and selectors must be declared before being used.
5022
5023 @opindex print-objc-runtime-info
5024 @item -print-objc-runtime-info
5025 Generate C header describing the largest structure that is passed by
5026 value, if any.
5027
5028 @end table
5029
5030 @node Diagnostic Message Formatting Options
5031 @section Options to Control Diagnostic Messages Formatting
5032 @cindex options to control diagnostics formatting
5033 @cindex diagnostic messages
5034 @cindex message formatting
5035
5036 Traditionally, diagnostic messages have been formatted irrespective of
5037 the output device's aspect (e.g.@: its width, @dots{}). You can use the
5038 options described below
5039 to control the formatting algorithm for diagnostic messages,
5040 e.g.@: how many characters per line, how often source location
5041 information should be reported. Note that some language front ends may not
5042 honor these options.
5043
5044 @table @gcctabopt
5045 @opindex fmessage-length
5046 @item -fmessage-length=@var{n}
5047 Try to format error messages so that they fit on lines of about
5048 @var{n} characters. If @var{n} is zero, then no line-wrapping is
5049 done; each error message appears on a single line. This is the
5050 default for all front ends.
5051
5052 Note - this option also affects the display of the @samp{#error} and
5053 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5054 function/type/variable attribute. It does not however affect the
5055 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5056
5057 @item -fdiagnostics-plain-output
5058 This option requests that diagnostic output look as plain as possible, which
5059 may be useful when running @command{dejagnu} or other utilities that need to
5060 parse diagnostics output and prefer that it remain more stable over time.
5061 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5062 options:
5063 @gccoptlist{-fno-diagnostics-show-caret
5064 -fno-diagnostics-show-line-numbers
5065 -fdiagnostics-color=never
5066 -fdiagnostics-urls=never
5067 -fdiagnostics-path-format=separate-events}
5068 In the future, if GCC changes the default appearance of its diagnostics, the
5069 corresponding option to disable the new behavior will be added to this list.
5070
5071 @opindex fdiagnostics-show-location
5072 @item -fdiagnostics-show-location=once
5073 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
5074 reporter to emit source location information @emph{once}; that is, in
5075 case the message is too long to fit on a single physical line and has to
5076 be wrapped, the source location won't be emitted (as prefix) again,
5077 over and over, in subsequent continuation lines. This is the default
5078 behavior.
5079
5080 @item -fdiagnostics-show-location=every-line
5081 Only meaningful in line-wrapping mode. Instructs the diagnostic
5082 messages reporter to emit the same source location information (as
5083 prefix) for physical lines that result from the process of breaking
5084 a message which is too long to fit on a single line.
5085
5086 @opindex fdiagnostics-color
5087 @cindex highlight, color
5088 @vindex GCC_COLORS @r{environment variable}
5089 @item -fdiagnostics-color[=@var{WHEN}]
5090 @itemx -fno-diagnostics-color
5091 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
5092 or @samp{auto}. The default depends on how the compiler has been configured,
5093 it can be any of the above @var{WHEN} options or also @samp{never}
5094 if @env{GCC_COLORS} environment variable isn't present in the environment,
5095 and @samp{auto} otherwise.
5096 @samp{auto} makes GCC use color only when the standard error is a terminal,
5097 and when not executing in an emacs shell.
5098 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5099 aliases for @option{-fdiagnostics-color=always} and
5100 @option{-fdiagnostics-color=never}, respectively.
5101
5102 The colors are defined by the environment variable @env{GCC_COLORS}.
5103 Its value is a colon-separated list of capabilities and Select Graphic
5104 Rendition (SGR) substrings. SGR commands are interpreted by the
5105 terminal or terminal emulator. (See the section in the documentation
5106 of your text terminal for permitted values and their meanings as
5107 character attributes.) These substring values are integers in decimal
5108 representation and can be concatenated with semicolons.
5109 Common values to concatenate include
5110 @samp{1} for bold,
5111 @samp{4} for underline,
5112 @samp{5} for blink,
5113 @samp{7} for inverse,
5114 @samp{39} for default foreground color,
5115 @samp{30} to @samp{37} for foreground colors,
5116 @samp{90} to @samp{97} for 16-color mode foreground colors,
5117 @samp{38;5;0} to @samp{38;5;255}
5118 for 88-color and 256-color modes foreground colors,
5119 @samp{49} for default background color,
5120 @samp{40} to @samp{47} for background colors,
5121 @samp{100} to @samp{107} for 16-color mode background colors,
5122 and @samp{48;5;0} to @samp{48;5;255}
5123 for 88-color and 256-color modes background colors.
5124
5125 The default @env{GCC_COLORS} is
5126 @smallexample
5127 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5128 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5129 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5130 type-diff=01;32:fnname=01;32:targs=35
5131 @end smallexample
5132 @noindent
5133 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5134 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5135 @samp{01} is bold, and @samp{31} is red.
5136 Setting @env{GCC_COLORS} to the empty string disables colors.
5137 Supported capabilities are as follows.
5138
5139 @table @code
5140 @vindex error GCC_COLORS @r{capability}
5141 @item error=
5142 SGR substring for error: markers.
5143
5144 @vindex warning GCC_COLORS @r{capability}
5145 @item warning=
5146 SGR substring for warning: markers.
5147
5148 @vindex note GCC_COLORS @r{capability}
5149 @item note=
5150 SGR substring for note: markers.
5151
5152 @vindex path GCC_COLORS @r{capability}
5153 @item path=
5154 SGR substring for colorizing paths of control-flow events as printed
5155 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5156 individual events and lines indicating interprocedural calls and returns.
5157
5158 @vindex range1 GCC_COLORS @r{capability}
5159 @item range1=
5160 SGR substring for first additional range.
5161
5162 @vindex range2 GCC_COLORS @r{capability}
5163 @item range2=
5164 SGR substring for second additional range.
5165
5166 @vindex locus GCC_COLORS @r{capability}
5167 @item locus=
5168 SGR substring for location information, @samp{file:line} or
5169 @samp{file:line:column} etc.
5170
5171 @vindex quote GCC_COLORS @r{capability}
5172 @item quote=
5173 SGR substring for information printed within quotes.
5174
5175 @vindex fnname GCC_COLORS @r{capability}
5176 @item fnname=
5177 SGR substring for names of C++ functions.
5178
5179 @vindex targs GCC_COLORS @r{capability}
5180 @item targs=
5181 SGR substring for C++ function template parameter bindings.
5182
5183 @vindex fixit-insert GCC_COLORS @r{capability}
5184 @item fixit-insert=
5185 SGR substring for fix-it hints suggesting text to
5186 be inserted or replaced.
5187
5188 @vindex fixit-delete GCC_COLORS @r{capability}
5189 @item fixit-delete=
5190 SGR substring for fix-it hints suggesting text to
5191 be deleted.
5192
5193 @vindex diff-filename GCC_COLORS @r{capability}
5194 @item diff-filename=
5195 SGR substring for filename headers within generated patches.
5196
5197 @vindex diff-hunk GCC_COLORS @r{capability}
5198 @item diff-hunk=
5199 SGR substring for the starts of hunks within generated patches.
5200
5201 @vindex diff-delete GCC_COLORS @r{capability}
5202 @item diff-delete=
5203 SGR substring for deleted lines within generated patches.
5204
5205 @vindex diff-insert GCC_COLORS @r{capability}
5206 @item diff-insert=
5207 SGR substring for inserted lines within generated patches.
5208
5209 @vindex type-diff GCC_COLORS @r{capability}
5210 @item type-diff=
5211 SGR substring for highlighting mismatching types within template
5212 arguments in the C++ frontend.
5213 @end table
5214
5215 @opindex fdiagnostics-urls
5216 @cindex urls
5217 @vindex GCC_URLS @r{environment variable}
5218 @vindex TERM_URLS @r{environment variable}
5219 @item -fdiagnostics-urls[=@var{WHEN}]
5220 Use escape sequences to embed URLs in diagnostics. For example, when
5221 @option{-fdiagnostics-show-option} emits text showing the command-line
5222 option controlling a diagnostic, embed a URL for documentation of that
5223 option.
5224
5225 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5226 @samp{auto} makes GCC use URL escape sequences only when the standard error
5227 is a terminal, and when not executing in an emacs shell or any graphical
5228 terminal which is known to be incompatible with this feature, see below.
5229
5230 The default depends on how the compiler has been configured.
5231 It can be any of the above @var{WHEN} options.
5232
5233 GCC can also be configured (via the
5234 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5235 so that the default is affected by environment variables.
5236 Under such a configuration, GCC defaults to using @samp{auto}
5237 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5238 present and non-empty in the environment of the compiler, or @samp{never}
5239 if neither are.
5240
5241 However, even with @option{-fdiagnostics-urls=always} the behavior is
5242 dependent on those environment variables:
5243 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5244 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
5245 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5246 Any other non-empty value enables the feature.
5247 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5248 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5249 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5250
5251 At this time GCC tries to detect also a few terminals that are known to
5252 not implement the URL feature, and have bugs or at least had bugs in
5253 some versions that are still in use, where the URL escapes are likely
5254 to misbehave, i.e. print garbage on the screen.
5255 That list is currently xfce4-terminal, certain known to be buggy
5256 gnome-terminal versions, the linux console, and mingw.
5257 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5258
5259 @opindex fno-diagnostics-show-option
5260 @opindex fdiagnostics-show-option
5261 @item -fno-diagnostics-show-option
5262 By default, each diagnostic emitted includes text indicating the
5263 command-line option that directly controls the diagnostic (if such an
5264 option is known to the diagnostic machinery). Specifying the
5265 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5266
5267 @opindex fno-diagnostics-show-caret
5268 @opindex fdiagnostics-show-caret
5269 @item -fno-diagnostics-show-caret
5270 By default, each diagnostic emitted includes the original source line
5271 and a caret @samp{^} indicating the column. This option suppresses this
5272 information. The source line is truncated to @var{n} characters, if
5273 the @option{-fmessage-length=n} option is given. When the output is done
5274 to the terminal, the width is limited to the width given by the
5275 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5276
5277 @opindex fno-diagnostics-show-labels
5278 @opindex fdiagnostics-show-labels
5279 @item -fno-diagnostics-show-labels
5280 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5281 diagnostics can label ranges of source code with pertinent information, such
5282 as the types of expressions:
5283
5284 @smallexample
5285 printf ("foo %s bar", long_i + long_j);
5286 ~^ ~~~~~~~~~~~~~~~
5287 | |
5288 char * long int
5289 @end smallexample
5290
5291 This option suppresses the printing of these labels (in the example above,
5292 the vertical bars and the ``char *'' and ``long int'' text).
5293
5294 @opindex fno-diagnostics-show-cwe
5295 @opindex fdiagnostics-show-cwe
5296 @item -fno-diagnostics-show-cwe
5297 Diagnostic messages can optionally have an associated
5298 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5299 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5300 diagnostics. GCC plugins may also provide diagnostics with such metadata.
5301 By default, if this information is present, it will be printed with
5302 the diagnostic. This option suppresses the printing of this metadata.
5303
5304 @opindex fno-diagnostics-show-rules
5305 @opindex fdiagnostics-show-rules
5306 @item -fno-diagnostics-show-rules
5307 Diagnostic messages can optionally have rules associated with them, such
5308 as from a coding standard, or a specification.
5309 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5310 By default, if this information is present, it will be printed with
5311 the diagnostic. This option suppresses the printing of this metadata.
5312
5313 @opindex fno-diagnostics-show-line-numbers
5314 @opindex fdiagnostics-show-line-numbers
5315 @item -fno-diagnostics-show-line-numbers
5316 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5317 a left margin is printed, showing line numbers. This option suppresses this
5318 left margin.
5319
5320 @opindex fdiagnostics-minimum-margin-width
5321 @item -fdiagnostics-minimum-margin-width=@var{width}
5322 This option controls the minimum width of the left margin printed by
5323 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
5324
5325 @opindex fdiagnostics-parseable-fixits
5326 @item -fdiagnostics-parseable-fixits
5327 Emit fix-it hints in a machine-parseable format, suitable for consumption
5328 by IDEs. For each fix-it, a line will be printed after the relevant
5329 diagnostic, starting with the string ``fix-it:''. For example:
5330
5331 @smallexample
5332 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5333 @end smallexample
5334
5335 The location is expressed as a half-open range, expressed as a count of
5336 bytes, starting at byte 1 for the initial column. In the above example,
5337 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5338 given string:
5339
5340 @smallexample
5341 00000000011111111112222222222
5342 12345678901234567890123456789
5343 gtk_widget_showall (dlg);
5344 ^^^^^^^^^^^^^^^^^^
5345 gtk_widget_show_all
5346 @end smallexample
5347
5348 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5349 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5350 (e.g. vertical tab as ``\013'').
5351
5352 An empty replacement string indicates that the given range is to be removed.
5353 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5354 be inserted at the given position.
5355
5356 @opindex fdiagnostics-generate-patch
5357 @item -fdiagnostics-generate-patch
5358 Print fix-it hints to stderr in unified diff format, after any diagnostics
5359 are printed. For example:
5360
5361 @smallexample
5362 --- test.c
5363 +++ test.c
5364 @@ -42,5 +42,5 @@
5365
5366 void show_cb(GtkDialog *dlg)
5367 @{
5368 - gtk_widget_showall(dlg);
5369 + gtk_widget_show_all(dlg);
5370 @}
5371
5372 @end smallexample
5373
5374 The diff may or may not be colorized, following the same rules
5375 as for diagnostics (see @option{-fdiagnostics-color}).
5376
5377 @opindex fdiagnostics-show-template-tree
5378 @item -fdiagnostics-show-template-tree
5379
5380 In the C++ frontend, when printing diagnostics showing mismatching
5381 template types, such as:
5382
5383 @smallexample
5384 could not convert 'std::map<int, std::vector<double> >()'
5385 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5386 @end smallexample
5387
5388 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5389 tree-like structure showing the common and differing parts of the types,
5390 such as:
5391
5392 @smallexample
5393 map<
5394 [...],
5395 vector<
5396 [double != float]>>
5397 @end smallexample
5398
5399 The parts that differ are highlighted with color (``double'' and
5400 ``float'' in this case).
5401
5402 @opindex fno-elide-type
5403 @opindex felide-type
5404 @item -fno-elide-type
5405 By default when the C++ frontend prints diagnostics showing mismatching
5406 template types, common parts of the types are printed as ``[...]'' to
5407 simplify the error message. For example:
5408
5409 @smallexample
5410 could not convert 'std::map<int, std::vector<double> >()'
5411 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5412 @end smallexample
5413
5414 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5415 This flag also affects the output of the
5416 @option{-fdiagnostics-show-template-tree} flag.
5417
5418 @opindex fdiagnostics-path-format
5419 @item -fdiagnostics-path-format=@var{KIND}
5420 Specify how to print paths of control-flow events for diagnostics that
5421 have such a path associated with them.
5422
5423 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5424 the default.
5425
5426 @samp{none} means to not print diagnostic paths.
5427
5428 @samp{separate-events} means to print a separate ``note'' diagnostic for
5429 each event within the diagnostic. For example:
5430
5431 @smallexample
5432 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5433 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5434 test.c:27:3: note: (2) when 'i < count'
5435 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5436 @end smallexample
5437
5438 @samp{inline-events} means to print the events ``inline'' within the source
5439 code. This view attempts to consolidate the events into runs of
5440 sufficiently-close events, printing them as labelled ranges within the source.
5441
5442 For example, the same events as above might be printed as:
5443
5444 @smallexample
5445 'test': events 1-3
5446 |
5447 | 25 | list = PyList_New(0);
5448 | | ^~~~~~~~~~~~~
5449 | | |
5450 | | (1) when 'PyList_New' fails, returning NULL
5451 | 26 |
5452 | 27 | for (i = 0; i < count; i++) @{
5453 | | ~~~
5454 | | |
5455 | | (2) when 'i < count'
5456 | 28 | item = PyLong_FromLong(random());
5457 | 29 | PyList_Append(list, item);
5458 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
5459 | | |
5460 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5461 |
5462 @end smallexample
5463
5464 Interprocedural control flow is shown by grouping the events by stack frame,
5465 and using indentation to show how stack frames are nested, pushed, and popped.
5466
5467 For example:
5468
5469 @smallexample
5470 'test': events 1-2
5471 |
5472 | 133 | @{
5473 | | ^
5474 | | |
5475 | | (1) entering 'test'
5476 | 134 | boxed_int *obj = make_boxed_int (i);
5477 | | ~~~~~~~~~~~~~~~~~~
5478 | | |
5479 | | (2) calling 'make_boxed_int'
5480 |
5481 +--> 'make_boxed_int': events 3-4
5482 |
5483 | 120 | @{
5484 | | ^
5485 | | |
5486 | | (3) entering 'make_boxed_int'
5487 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5488 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5489 | | |
5490 | | (4) calling 'wrapped_malloc'
5491 |
5492 +--> 'wrapped_malloc': events 5-6
5493 |
5494 | 7 | @{
5495 | | ^
5496 | | |
5497 | | (5) entering 'wrapped_malloc'
5498 | 8 | return malloc (size);
5499 | | ~~~~~~~~~~~~~
5500 | | |
5501 | | (6) calling 'malloc'
5502 |
5503 <-------------+
5504 |
5505 'test': event 7
5506 |
5507 | 138 | free_boxed_int (obj);
5508 | | ^~~~~~~~~~~~~~~~~~~~
5509 | | |
5510 | | (7) calling 'free_boxed_int'
5511 |
5512 (etc)
5513 @end smallexample
5514
5515 @opindex fdiagnostics-show-path-depths
5516 @item -fdiagnostics-show-path-depths
5517 This option provides additional information when printing control-flow paths
5518 associated with a diagnostic.
5519
5520 If this is option is provided then the stack depth will be printed for
5521 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5522 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5523 the stack depth and function declaration will be appended when printing
5524 each event.
5525
5526 This is intended for use by GCC developers and plugin developers when
5527 debugging diagnostics that report interprocedural control flow.
5528
5529 @opindex fno-show-column
5530 @opindex fshow-column
5531 @item -fno-show-column
5532 Do not print column numbers in diagnostics. This may be necessary if
5533 diagnostics are being scanned by a program that does not understand the
5534 column numbers, such as @command{dejagnu}.
5535
5536 @opindex fdiagnostics-column-unit
5537 @item -fdiagnostics-column-unit=@var{UNIT}
5538 Select the units for the column number. This affects traditional diagnostics
5539 (in the absence of @option{-fno-show-column}), as well as JSON format
5540 diagnostics if requested.
5541
5542 The default @var{UNIT}, @samp{display}, considers the number of display
5543 columns occupied by each character. This may be larger than the number
5544 of bytes required to encode the character, in the case of tab
5545 characters, or it may be smaller, in the case of multibyte characters.
5546 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5547 display column, and its UTF-8 encoding requires two bytes; the character
5548 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5549 its UTF-8 encoding requires four bytes.
5550
5551 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5552 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5553
5554 @opindex fdiagnostics-column-origin
5555 @item -fdiagnostics-column-origin=@var{ORIGIN}
5556 Select the origin for column numbers, i.e. the column number assigned to the
5557 first column. The default value of 1 corresponds to traditional GCC
5558 behavior and to the GNU style guide. Some utilities may perform better with an
5559 origin of 0; any non-negative value may be specified.
5560
5561 @opindex fdiagnostics-escape-format
5562 @item -fdiagnostics-escape-format=@var{FORMAT}
5563 When GCC prints pertinent source lines for a diagnostic it normally attempts
5564 to print the source bytes directly. However, some diagnostics relate to encoding
5565 issues in the source file, such as malformed UTF-8, or issues with Unicode
5566 normalization. These diagnostics are flagged so that GCC will escape bytes
5567 that are not printable ASCII when printing their pertinent source lines.
5568
5569 This option controls how such bytes should be escaped.
5570
5571 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5572 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5573 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5574 displayed as hexadecimal in the form @samp{<XX>}.
5575
5576 For example, a source line containing the string @samp{before} followed by the
5577 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5578 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5579 the string @samp{after} will be printed for such a diagnostic as:
5580
5581 @smallexample
5582 before<U+03C0><BF>after
5583 @end smallexample
5584
5585 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5586 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5587 Unicode characters. For the example above, the following will be printed:
5588
5589 @smallexample
5590 before<CF><80><BF>after
5591 @end smallexample
5592
5593 @opindex fdiagnostics-format
5594 @item -fdiagnostics-format=@var{FORMAT}
5595 Select a different format for printing diagnostics.
5596 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5597 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5598
5599 The default is @samp{text}.
5600
5601 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5602 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5603 named @file{@var{source}.sarif}, respectively.
5604
5605 The @samp{json} format is a synonym for @samp{json-stderr}.
5606 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5607 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5608 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5609
5610 The emitted JSON consists of a top-level JSON array containing JSON objects
5611 representing the diagnostics. The JSON is emitted as one line, without
5612 formatting; the examples below have been formatted for clarity.
5613
5614 Diagnostics can have child diagnostics. For example, this error and note:
5615
5616 @smallexample
5617 misleading-indentation.c:15:3: warning: this 'if' clause does not
5618 guard... [-Wmisleading-indentation]
5619 15 | if (flag)
5620 | ^~
5621 misleading-indentation.c:17:5: note: ...this statement, but the latter
5622 is misleadingly indented as if it were guarded by the 'if'
5623 17 | y = 2;
5624 | ^
5625 @end smallexample
5626
5627 @noindent
5628 might be printed in JSON form (after formatting) like this:
5629
5630 @smallexample
5631 [
5632 @{
5633 "kind": "warning",
5634 "locations": [
5635 @{
5636 "caret": @{
5637 "display-column": 3,
5638 "byte-column": 3,
5639 "column": 3,
5640 "file": "misleading-indentation.c",
5641 "line": 15
5642 @},
5643 "finish": @{
5644 "display-column": 4,
5645 "byte-column": 4,
5646 "column": 4,
5647 "file": "misleading-indentation.c",
5648 "line": 15
5649 @}
5650 @}
5651 ],
5652 "message": "this \u2018if\u2019 clause does not guard...",
5653 "option": "-Wmisleading-indentation",
5654 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5655 "children": [
5656 @{
5657 "kind": "note",
5658 "locations": [
5659 @{
5660 "caret": @{
5661 "display-column": 5,
5662 "byte-column": 5,
5663 "column": 5,
5664 "file": "misleading-indentation.c",
5665 "line": 17
5666 @}
5667 @}
5668 ],
5669 "escape-source": false,
5670 "message": "...this statement, but the latter is @dots{}"
5671 @}
5672 ]
5673 "escape-source": false,
5674 "column-origin": 1,
5675 @}
5676 ]
5677 @end smallexample
5678
5679 @noindent
5680 where the @code{note} is a child of the @code{warning}.
5681
5682 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
5683 an @code{option} key describing the command-line option controlling the
5684 warning.
5685
5686 A diagnostic can contain zero or more locations. Each location has an
5687 optional @code{label} string and up to three positions within it: a
5688 @code{caret} position and optional @code{start} and @code{finish} positions.
5689 A position is described by a @code{file} name, a @code{line} number, and
5690 three numbers indicating a column position:
5691 @itemize @bullet
5692
5693 @item
5694 @code{display-column} counts display columns, accounting for tabs and
5695 multibyte characters.
5696
5697 @item
5698 @code{byte-column} counts raw bytes.
5699
5700 @item
5701 @code{column} is equal to one of
5702 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5703 option.
5704
5705 @end itemize
5706 All three columns are relative to the origin specified by
5707 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5708 be set, for instance, to 0 for compatibility with other utilities that
5709 number columns from 0. The column origin is recorded in the JSON output in
5710 the @code{column-origin} tag. In the remaining examples below, the extra
5711 column number outputs have been omitted for brevity.
5712
5713 For example, this error:
5714
5715 @smallexample
5716 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5717 'struct s'@} and 'T' @{aka 'struct t'@})
5718 64 | return callee_4a () + callee_4b ();
5719 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5720 | | |
5721 | | T @{aka struct t@}
5722 | S @{aka struct s@}
5723 @end smallexample
5724
5725 @noindent
5726 has three locations. Its primary location is at the ``+'' token at column
5727 23. It has two secondary locations, describing the left and right-hand sides
5728 of the expression, which have labels. It might be printed in JSON form as:
5729
5730 @smallexample
5731 @{
5732 "children": [],
5733 "kind": "error",
5734 "locations": [
5735 @{
5736 "caret": @{
5737 "column": 23, "file": "bad-binary-ops.c", "line": 64
5738 @}
5739 @},
5740 @{
5741 "caret": @{
5742 "column": 10, "file": "bad-binary-ops.c", "line": 64
5743 @},
5744 "finish": @{
5745 "column": 21, "file": "bad-binary-ops.c", "line": 64
5746 @},
5747 "label": "S @{aka struct s@}"
5748 @},
5749 @{
5750 "caret": @{
5751 "column": 25, "file": "bad-binary-ops.c", "line": 64
5752 @},
5753 "finish": @{
5754 "column": 36, "file": "bad-binary-ops.c", "line": 64
5755 @},
5756 "label": "T @{aka struct t@}"
5757 @}
5758 ],
5759 "escape-source": false,
5760 "message": "invalid operands to binary + @dots{}"
5761 @}
5762 @end smallexample
5763
5764 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5765 consisting of half-open intervals, similar to the output of
5766 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
5767 with a replacement fix-it hint:
5768
5769 @smallexample
5770 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5771 mean 'color'?
5772 8 | return ptr->colour;
5773 | ^~~~~~
5774 | color
5775 @end smallexample
5776
5777 @noindent
5778 might be printed in JSON form as:
5779
5780 @smallexample
5781 @{
5782 "children": [],
5783 "fixits": [
5784 @{
5785 "next": @{
5786 "column": 21,
5787 "file": "demo.c",
5788 "line": 8
5789 @},
5790 "start": @{
5791 "column": 15,
5792 "file": "demo.c",
5793 "line": 8
5794 @},
5795 "string": "color"
5796 @}
5797 ],
5798 "kind": "error",
5799 "locations": [
5800 @{
5801 "caret": @{
5802 "column": 15,
5803 "file": "demo.c",
5804 "line": 8
5805 @},
5806 "finish": @{
5807 "column": 20,
5808 "file": "demo.c",
5809 "line": 8
5810 @}
5811 @}
5812 ],
5813 "escape-source": false,
5814 "message": "\u2018struct s\u2019 has no member named @dots{}"
5815 @}
5816 @end smallexample
5817
5818 @noindent
5819 where the fix-it hint suggests replacing the text from @code{start} up
5820 to but not including @code{next} with @code{string}'s value. Deletions
5821 are expressed via an empty value for @code{string}, insertions by
5822 having @code{start} equal @code{next}.
5823
5824 If the diagnostic has a path of control-flow events associated with it,
5825 it has a @code{path} array of objects representing the events. Each
5826 event object has a @code{description} string, a @code{location} object,
5827 along with a @code{function} string and a @code{depth} number for
5828 representing interprocedural paths. The @code{function} represents the
5829 current function at that event, and the @code{depth} represents the
5830 stack depth relative to some baseline: the higher, the more frames are
5831 within the stack.
5832
5833 For example, the intraprocedural example shown for
5834 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5835
5836 @smallexample
5837 "path": [
5838 @{
5839 "depth": 0,
5840 "description": "when 'PyList_New' fails, returning NULL",
5841 "function": "test",
5842 "location": @{
5843 "column": 10,
5844 "file": "test.c",
5845 "line": 25
5846 @}
5847 @},
5848 @{
5849 "depth": 0,
5850 "description": "when 'i < count'",
5851 "function": "test",
5852 "location": @{
5853 "column": 3,
5854 "file": "test.c",
5855 "line": 27
5856 @}
5857 @},
5858 @{
5859 "depth": 0,
5860 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5861 "function": "test",
5862 "location": @{
5863 "column": 5,
5864 "file": "test.c",
5865 "line": 29
5866 @}
5867 @}
5868 ]
5869 @end smallexample
5870
5871 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5872 non-ASCII bytes should be escaped when printing the pertinent lines of
5873 source code (@code{true} for diagnostics involving source encoding issues).
5874
5875 @end table
5876
5877 @node Warning Options
5878 @section Options to Request or Suppress Warnings
5879 @cindex options to control warnings
5880 @cindex warning messages
5881 @cindex messages, warning
5882 @cindex suppressing warnings
5883
5884 Warnings are diagnostic messages that report constructions that
5885 are not inherently erroneous but that are risky or suggest there
5886 may have been an error.
5887
5888 The following language-independent options do not enable specific
5889 warnings but control the kinds of diagnostics produced by GCC@.
5890
5891 @table @gcctabopt
5892 @cindex syntax checking
5893 @opindex fsyntax-only
5894 @item -fsyntax-only
5895 Check the code for syntax errors, but don't do anything beyond that.
5896
5897 @opindex fmax-errors
5898 @item -fmax-errors=@var{n}
5899 Limits the maximum number of error messages to @var{n}, at which point
5900 GCC bails out rather than attempting to continue processing the source
5901 code. If @var{n} is 0 (the default), there is no limit on the number
5902 of error messages produced. If @option{-Wfatal-errors} is also
5903 specified, then @option{-Wfatal-errors} takes precedence over this
5904 option.
5905
5906 @opindex w
5907 @item -w
5908 Inhibit all warning messages.
5909
5910 @opindex Werror
5911 @opindex Wno-error
5912 @item -Werror
5913 Make all warnings into errors.
5914
5915 @opindex Werror=
5916 @opindex Wno-error=
5917 @item -Werror=
5918 Make the specified warning into an error. The specifier for a warning
5919 is appended; for example @option{-Werror=switch} turns the warnings
5920 controlled by @option{-Wswitch} into errors. This switch takes a
5921 negative form, to be used to negate @option{-Werror} for specific
5922 warnings; for example @option{-Wno-error=switch} makes
5923 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5924 is in effect.
5925
5926 The warning message for each controllable warning includes the
5927 option that controls the warning. That option can then be used with
5928 @option{-Werror=} and @option{-Wno-error=} as described above.
5929 (Printing of the option in the warning message can be disabled using the
5930 @option{-fno-diagnostics-show-option} flag.)
5931
5932 Note that specifying @option{-Werror=}@var{foo} automatically implies
5933 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5934 imply anything.
5935
5936 @opindex Wfatal-errors
5937 @opindex Wno-fatal-errors
5938 @item -Wfatal-errors
5939 This option causes the compiler to abort compilation on the first error
5940 occurred rather than trying to keep going and printing further error
5941 messages.
5942
5943 @end table
5944
5945 You can request many specific warnings with options beginning with
5946 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5947 implicit declarations. Each of these specific warning options also
5948 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5949 example, @option{-Wno-implicit}. This manual lists only one of the
5950 two forms, whichever is not the default. For further
5951 language-specific options also refer to @ref{C++ Dialect Options} and
5952 @ref{Objective-C and Objective-C++ Dialect Options}.
5953 Additional warnings can be produced by enabling the static analyzer;
5954 @xref{Static Analyzer Options}.
5955
5956 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5957 options, such as @option{-Wunused}, which may turn on further options,
5958 such as @option{-Wunused-value}. The combined effect of positive and
5959 negative forms is that more specific options have priority over less
5960 specific ones, independently of their position in the command-line. For
5961 options of the same specificity, the last one takes effect. Options
5962 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5963 as if they appeared at the end of the command-line.
5964
5965 When an unrecognized warning option is requested (e.g.,
5966 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5967 that the option is not recognized. However, if the @option{-Wno-} form
5968 is used, the behavior is slightly different: no diagnostic is
5969 produced for @option{-Wno-unknown-warning} unless other diagnostics
5970 are being produced. This allows the use of new @option{-Wno-} options
5971 with old compilers, but if something goes wrong, the compiler
5972 warns that an unrecognized option is present.
5973
5974 The effectiveness of some warnings depends on optimizations also being
5975 enabled. For example @option{-Wsuggest-final-types} is more effective
5976 with link-time optimization and some instances of other warnings may
5977 not be issued at all unless optimization is enabled. While optimization
5978 in general improves the efficacy of control and data flow sensitive
5979 warnings, in some cases it may also cause false positives.
5980
5981 @table @gcctabopt
5982 @opindex pedantic
5983 @opindex Wpedantic
5984 @opindex Wno-pedantic
5985 @item -Wpedantic
5986 @itemx -pedantic
5987 Issue all the warnings demanded by strict ISO C and ISO C++;
5988 reject all programs that use forbidden extensions, and some other
5989 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5990 version of the ISO C standard specified by any @option{-std} option used.
5991
5992 Valid ISO C and ISO C++ programs should compile properly with or without
5993 this option (though a rare few require @option{-ansi} or a
5994 @option{-std} option specifying the required version of ISO C)@. However,
5995 without this option, certain GNU extensions and traditional C and C++
5996 features are supported as well. With this option, they are rejected.
5997
5998 @option{-Wpedantic} does not cause warning messages for use of the
5999 alternate keywords whose names begin and end with @samp{__}. This alternate
6000 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6001 i.e. @samp{__intN__}.
6002 Pedantic warnings are also disabled in the expression that follows
6003 @code{__extension__}. However, only system header files should use
6004 these escape routes; application programs should avoid them.
6005 @xref{Alternate Keywords}.
6006
6007 Some users try to use @option{-Wpedantic} to check programs for strict ISO
6008 C conformance. They soon find that it does not do quite what they want:
6009 it finds some non-ISO practices, but not all---only those for which
6010 ISO C @emph{requires} a diagnostic, and some others for which
6011 diagnostics have been added.
6012
6013 A feature to report any failure to conform to ISO C might be useful in
6014 some instances, but would require considerable additional work and would
6015 be quite different from @option{-Wpedantic}. We don't have plans to
6016 support such a feature in the near future.
6017
6018 Where the standard specified with @option{-std} represents a GNU
6019 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6020 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6021 extended dialect is based. Warnings from @option{-Wpedantic} are given
6022 where they are required by the base standard. (It does not make sense
6023 for such warnings to be given only for features not in the specified GNU
6024 C dialect, since by definition the GNU dialects of C include all
6025 features the compiler supports with the given option, and there would be
6026 nothing to warn about.)
6027
6028 @opindex pedantic-errors
6029 @item -pedantic-errors
6030 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6031 requires a diagnostic, in some cases where there is undefined behavior
6032 at compile-time and in some other cases that do not prevent compilation
6033 of programs that are valid according to the standard. This is not
6034 equivalent to @option{-Werror=pedantic}, since there are errors enabled
6035 by this option and not enabled by the latter and vice versa.
6036
6037 @opindex Wall
6038 @opindex Wno-all
6039 @item -Wall
6040 This enables all the warnings about constructions that some users
6041 consider questionable, and that are easy to avoid (or modify to
6042 prevent the warning), even in conjunction with macros. This also
6043 enables some language-specific warnings described in @ref{C++ Dialect
6044 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6045
6046 @option{-Wall} turns on the following warning flags:
6047
6048 @gccoptlist{-Waddress
6049 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6050 -Warray-compare
6051 -Warray-parameter=2 @r{(C and Objective-C only)}
6052 -Wbool-compare
6053 -Wbool-operation
6054 -Wc++11-compat -Wc++14-compat
6055 -Wcatch-value @r{(C++ and Objective-C++ only)}
6056 -Wchar-subscripts
6057 -Wcomment
6058 -Wdangling-pointer=2
6059 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6060 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6061 -Wenum-int-mismatch @r{(C and Objective-C only)}
6062 -Wformat
6063 -Wformat-overflow
6064 -Wformat-truncation
6065 -Wint-in-bool-context
6066 -Wimplicit @r{(C and Objective-C only)}
6067 -Wimplicit-int @r{(C and Objective-C only)}
6068 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6069 -Winit-self @r{(only for C++)}
6070 -Wlogical-not-parentheses
6071 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6072 -Wmaybe-uninitialized
6073 -Wmemset-elt-size
6074 -Wmemset-transposed-args
6075 -Wmisleading-indentation @r{(only for C/C++)}
6076 -Wmismatched-dealloc
6077 -Wmismatched-new-delete @r{(only for C/C++)}
6078 -Wmissing-attributes
6079 -Wmissing-braces @r{(only for C/ObjC)}
6080 -Wmultistatement-macros
6081 -Wnarrowing @r{(only for C++)}
6082 -Wnonnull
6083 -Wnonnull-compare
6084 -Wopenmp-simd
6085 -Wparentheses
6086 -Wpessimizing-move @r{(only for C++)}
6087 -Wpointer-sign
6088 -Wrange-loop-construct @r{(only for C++)}
6089 -Wreorder
6090 -Wrestrict
6091 -Wreturn-type
6092 -Wself-move @r{(only for C++)}
6093 -Wsequence-point
6094 -Wsign-compare @r{(only in C++)}
6095 -Wsizeof-array-div
6096 -Wsizeof-pointer-div
6097 -Wsizeof-pointer-memaccess
6098 -Wstrict-aliasing
6099 -Wstrict-overflow=1
6100 -Wswitch
6101 -Wtautological-compare
6102 -Wtrigraphs
6103 -Wuninitialized
6104 -Wunknown-pragmas
6105 -Wunused-function
6106 -Wunused-label
6107 -Wunused-value
6108 -Wunused-variable
6109 -Wuse-after-free=2
6110 -Wvla-parameter @r{(C and Objective-C only)}
6111 -Wvolatile-register-var
6112 -Wzero-length-bounds}
6113
6114 Note that some warning flags are not implied by @option{-Wall}. Some of
6115 them warn about constructions that users generally do not consider
6116 questionable, but which occasionally you might wish to check for;
6117 others warn about constructions that are necessary or hard to avoid in
6118 some cases, and there is no simple way to modify the code to suppress
6119 the warning. Some of them are enabled by @option{-Wextra} but many of
6120 them must be enabled individually.
6121
6122 @opindex W
6123 @opindex Wextra
6124 @opindex Wno-extra
6125 @item -Wextra
6126 This enables some extra warning flags that are not enabled by
6127 @option{-Wall}. (This option used to be called @option{-W}. The older
6128 name is still supported, but the newer name is more descriptive.)
6129
6130 @gccoptlist{-Wclobbered
6131 -Wcast-function-type
6132 -Wdeprecated-copy @r{(C++ only)}
6133 -Wempty-body
6134 -Wenum-conversion @r{(C only)}
6135 -Wignored-qualifiers
6136 -Wimplicit-fallthrough=3
6137 -Wmissing-field-initializers
6138 -Wmissing-parameter-type @r{(C only)}
6139 -Wold-style-declaration @r{(C only)}
6140 -Woverride-init
6141 -Wsign-compare @r{(C only)}
6142 -Wstring-compare
6143 -Wredundant-move @r{(only for C++)}
6144 -Wtype-limits
6145 -Wuninitialized
6146 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6147 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6148 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6149
6150
6151 The option @option{-Wextra} also prints warning messages for the
6152 following cases:
6153
6154 @itemize @bullet
6155
6156 @item
6157 A pointer is compared against integer zero with @code{<}, @code{<=},
6158 @code{>}, or @code{>=}.
6159
6160 @item
6161 (C++ only) An enumerator and a non-enumerator both appear in a
6162 conditional expression.
6163
6164 @item
6165 (C++ only) Ambiguous virtual bases.
6166
6167 @item
6168 (C++ only) Subscripting an array that has been declared @code{register}.
6169
6170 @item
6171 (C++ only) Taking the address of a variable that has been declared
6172 @code{register}.
6173
6174 @item
6175 (C++ only) A base class is not initialized in the copy constructor
6176 of a derived class.
6177
6178 @end itemize
6179
6180 @opindex Wabi
6181 @opindex Wno-abi
6182 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6183
6184 Warn about code affected by ABI changes. This includes code that may
6185 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6186 for the particular target.
6187
6188 Since G++ now defaults to updating the ABI with each major release,
6189 normally @option{-Wabi} warns only about C++ ABI compatibility
6190 problems if there is a check added later in a release series for an
6191 ABI issue discovered since the initial release. @option{-Wabi} warns
6192 about more things if an older ABI version is selected (with
6193 @option{-fabi-version=@var{n}}).
6194
6195 @option{-Wabi} can also be used with an explicit version number to
6196 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6197 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6198 @option{-fabi-version=2}.
6199
6200 If an explicit version number is provided and
6201 @option{-fabi-compat-version} is not specified, the version number
6202 from this option is used for compatibility aliases. If no explicit
6203 version number is provided with this option, but
6204 @option{-fabi-compat-version} is specified, that version number is
6205 used for C++ ABI warnings.
6206
6207 Although an effort has been made to warn about
6208 all such cases, there are probably some cases that are not warned about,
6209 even though G++ is generating incompatible code. There may also be
6210 cases where warnings are emitted even though the code that is generated
6211 is compatible.
6212
6213 You should rewrite your code to avoid these warnings if you are
6214 concerned about the fact that code generated by G++ may not be binary
6215 compatible with code generated by other compilers.
6216
6217 Known incompatibilities in @option{-fabi-version=2} (which was the
6218 default from GCC 3.4 to 4.9) include:
6219
6220 @itemize @bullet
6221
6222 @item
6223 A template with a non-type template parameter of reference type was
6224 mangled incorrectly:
6225 @smallexample
6226 extern int N;
6227 template <int &> struct S @{@};
6228 void n (S<N>) @{2@}
6229 @end smallexample
6230
6231 This was fixed in @option{-fabi-version=3}.
6232
6233 @item
6234 SIMD vector types declared using @code{__attribute ((vector_size))} were
6235 mangled in a non-standard way that does not allow for overloading of
6236 functions taking vectors of different sizes.
6237
6238 The mangling was changed in @option{-fabi-version=4}.
6239
6240 @item
6241 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6242 qualifiers, and @code{decltype} of a plain declaration was folded away.
6243
6244 These mangling issues were fixed in @option{-fabi-version=5}.
6245
6246 @item
6247 Scoped enumerators passed as arguments to a variadic function are
6248 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6249 On most targets this does not actually affect the parameter passing
6250 ABI, as there is no way to pass an argument smaller than @code{int}.
6251
6252 Also, the ABI changed the mangling of template argument packs,
6253 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6254 a class scope function used as a template argument.
6255
6256 These issues were corrected in @option{-fabi-version=6}.
6257
6258 @item
6259 Lambdas in default argument scope were mangled incorrectly, and the
6260 ABI changed the mangling of @code{nullptr_t}.
6261
6262 These issues were corrected in @option{-fabi-version=7}.
6263
6264 @item
6265 When mangling a function type with function-cv-qualifiers, the
6266 un-qualified function type was incorrectly treated as a substitution
6267 candidate.
6268
6269 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6270
6271 @item
6272 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6273 unaligned accesses. Note that this did not affect the ABI of a
6274 function with a @code{nullptr_t} parameter, as parameters have a
6275 minimum alignment.
6276
6277 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6278
6279 @item
6280 Target-specific attributes that affect the identity of a type, such as
6281 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6282 did not affect the mangled name, leading to name collisions when
6283 function pointers were used as template arguments.
6284
6285 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6286
6287 @end itemize
6288
6289 This option also enables warnings about psABI-related changes.
6290 The known psABI changes at this point include:
6291
6292 @itemize @bullet
6293
6294 @item
6295 For SysV/x86-64, unions with @code{long double} members are
6296 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
6297 the case. For example:
6298
6299 @smallexample
6300 union U @{
6301 long double ld;
6302 int i;
6303 @};
6304 @end smallexample
6305
6306 @noindent
6307 @code{union U} is now always passed in memory.
6308
6309 @end itemize
6310
6311 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6312 C++ requires that unqualified uses of a name within a class have the
6313 same meaning in the complete scope of the class, so declaring the name
6314 after using it is ill-formed:
6315 @smallexample
6316 struct A;
6317 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6318 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6319 @end smallexample
6320 By default, the B1 case is only a warning because the two declarations
6321 have the same type, while the B2 case is an error. Both diagnostics
6322 can be disabled with @option{-Wno-changes-meaning}. Alternately, the
6323 error case can be reduced to a warning with
6324 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6325
6326 Both diagnostics are also suppressed by @option{-fms-extensions}.
6327
6328 @opindex Wchar-subscripts
6329 @opindex Wno-char-subscripts
6330 @item -Wchar-subscripts
6331 Warn if an array subscript has type @code{char}. This is a common cause
6332 of error, as programmers often forget that this type is signed on some
6333 machines.
6334 This warning is enabled by @option{-Wall}.
6335
6336 @opindex Wno-coverage-mismatch
6337 @opindex Wcoverage-mismatch
6338 @item -Wno-coverage-mismatch
6339 Warn if feedback profiles do not match when using the
6340 @option{-fprofile-use} option.
6341 If a source file is changed between compiling with @option{-fprofile-generate}
6342 and with @option{-fprofile-use}, the files with the profile feedback can fail
6343 to match the source file and GCC cannot use the profile feedback
6344 information. By default, this warning is enabled and is treated as an
6345 error. @option{-Wno-coverage-mismatch} can be used to disable the
6346 warning or @option{-Wno-error=coverage-mismatch} can be used to
6347 disable the error. Disabling the error for this warning can result in
6348 poorly optimized code and is useful only in the
6349 case of very minor changes such as bug fixes to an existing code-base.
6350 Completely disabling the warning is not recommended.
6351
6352 @opindex Wno-coverage-invalid-line-number
6353 @opindex Wcoverage-invalid-line-number
6354 @item -Wno-coverage-invalid-line-number
6355 Warn in case a function ends earlier than it begins due
6356 to an invalid linenum macros. The warning is emitted only
6357 with @option{--coverage} enabled.
6358
6359 By default, this warning is enabled and is treated as an
6360 error. @option{-Wno-coverage-invalid-line-number} can be used to disable the
6361 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6362 disable the error.
6363
6364 @opindex Wno-cpp
6365 @opindex Wcpp
6366 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6367 Suppress warning messages emitted by @code{#warning} directives.
6368
6369 @opindex Wdouble-promotion
6370 @opindex Wno-double-promotion
6371 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6372 Give a warning when a value of type @code{float} is implicitly
6373 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
6374 floating-point unit implement @code{float} in hardware, but emulate
6375 @code{double} in software. On such a machine, doing computations
6376 using @code{double} values is much more expensive because of the
6377 overhead required for software emulation.
6378
6379 It is easy to accidentally do computations with @code{double} because
6380 floating-point literals are implicitly of type @code{double}. For
6381 example, in:
6382 @smallexample
6383 @group
6384 float area(float radius)
6385 @{
6386 return 3.14159 * radius * radius;
6387 @}
6388 @end group
6389 @end smallexample
6390 the compiler performs the entire computation with @code{double}
6391 because the floating-point literal is a @code{double}.
6392
6393 @opindex Wduplicate-decl-specifier
6394 @opindex Wno-duplicate-decl-specifier
6395 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6396 Warn if a declaration has duplicate @code{const}, @code{volatile},
6397 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
6398 @option{-Wall}.
6399
6400 @opindex Wformat
6401 @opindex Wno-format
6402 @opindex ffreestanding
6403 @opindex fno-builtin
6404 @opindex Wformat=
6405 @item -Wformat
6406 @itemx -Wformat=@var{n}
6407 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6408 the arguments supplied have types appropriate to the format string
6409 specified, and that the conversions specified in the format string make
6410 sense. This includes standard functions, and others specified by format
6411 attributes (@pxref{Function Attributes}), in the @code{printf},
6412 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6413 not in the C standard) families (or other target-specific families).
6414 Which functions are checked without format attributes having been
6415 specified depends on the standard version selected, and such checks of
6416 functions without the attribute specified are disabled by
6417 @option{-ffreestanding} or @option{-fno-builtin}.
6418
6419 The formats are checked against the format features supported by GNU
6420 libc version 2.2. These include all ISO C90 and C99 features, as well
6421 as features from the Single Unix Specification and some BSD and GNU
6422 extensions. Other library implementations may not support all these
6423 features; GCC does not support warning about features that go beyond a
6424 particular library's limitations. However, if @option{-Wpedantic} is used
6425 with @option{-Wformat}, warnings are given about format features not
6426 in the selected standard version (but not for @code{strfmon} formats,
6427 since those are not in any version of the C standard). @xref{C Dialect
6428 Options,,Options Controlling C Dialect}.
6429
6430 @table @gcctabopt
6431 @opindex Wformat
6432 @opindex Wformat=1
6433 @item -Wformat=1
6434 @itemx -Wformat
6435 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6436 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
6437 @option{-Wformat} also checks for null format arguments for several
6438 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
6439 aspects of this level of format checking can be disabled by the
6440 options: @option{-Wno-format-contains-nul},
6441 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6442 @option{-Wformat} is enabled by @option{-Wall}.
6443
6444 @opindex Wformat=2
6445 @item -Wformat=2
6446 Enable @option{-Wformat} plus additional format checks. Currently
6447 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6448 -Wformat-y2k}.
6449 @end table
6450
6451 @opindex Wno-format-contains-nul
6452 @opindex Wformat-contains-nul
6453 @item -Wno-format-contains-nul
6454 If @option{-Wformat} is specified, do not warn about format strings that
6455 contain NUL bytes.
6456
6457 @opindex Wno-format-extra-args
6458 @opindex Wformat-extra-args
6459 @item -Wno-format-extra-args
6460 If @option{-Wformat} is specified, do not warn about excess arguments to a
6461 @code{printf} or @code{scanf} format function. The C standard specifies
6462 that such arguments are ignored.
6463
6464 Where the unused arguments lie between used arguments that are
6465 specified with @samp{$} operand number specifications, normally
6466 warnings are still given, since the implementation could not know what
6467 type to pass to @code{va_arg} to skip the unused arguments. However,
6468 in the case of @code{scanf} formats, this option suppresses the
6469 warning if the unused arguments are all pointers, since the Single
6470 Unix Specification says that such unused arguments are allowed.
6471
6472 @opindex Wformat-overflow
6473 @opindex Wno-format-overflow
6474 @item -Wformat-overflow
6475 @itemx -Wformat-overflow=@var{level}
6476 Warn about calls to formatted input/output functions such as @code{sprintf}
6477 and @code{vsprintf} that might overflow the destination buffer. When the
6478 exact number of bytes written by a format directive cannot be determined
6479 at compile-time it is estimated based on heuristics that depend on the
6480 @var{level} argument and on optimization. While enabling optimization
6481 will in most cases improve the accuracy of the warning, it may also
6482 result in false positives.
6483
6484 @table @gcctabopt
6485 @opindex Wformat-overflow
6486 @opindex Wno-format-overflow
6487 @item -Wformat-overflow
6488 @itemx -Wformat-overflow=1
6489 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6490 employs a conservative approach that warns only about calls that most
6491 likely overflow the buffer. At this level, numeric arguments to format
6492 directives with unknown values are assumed to have the value of one, and
6493 strings of unknown length to be empty. Numeric arguments that are known
6494 to be bounded to a subrange of their type, or string arguments whose output
6495 is bounded either by their directive's precision or by a finite set of
6496 string literals, are assumed to take on the value within the range that
6497 results in the most bytes on output. For example, the call to @code{sprintf}
6498 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6499 the terminating NUL character (@code{'\0'}) appended by the function
6500 to the destination buffer will be written past its end. Increasing
6501 the size of the buffer by a single byte is sufficient to avoid the
6502 warning, though it may not be sufficient to avoid the overflow.
6503
6504 @smallexample
6505 void f (int a, int b)
6506 @{
6507 char buf [13];
6508 sprintf (buf, "a = %i, b = %i\n", a, b);
6509 @}
6510 @end smallexample
6511
6512 @item -Wformat-overflow=2
6513 Level @var{2} warns also about calls that might overflow the destination
6514 buffer given an argument of sufficient length or magnitude. At level
6515 @var{2}, unknown numeric arguments are assumed to have the minimum
6516 representable value for signed types with a precision greater than 1, and
6517 the maximum representable value otherwise. Unknown string arguments whose
6518 length cannot be assumed to be bounded either by the directive's precision,
6519 or by a finite set of string literals they may evaluate to, or the character
6520 array they may point to, are assumed to be 1 character long.
6521
6522 At level @var{2}, the call in the example above is again diagnosed, but
6523 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6524 @code{%i} directive will write some of its digits beyond the end of
6525 the destination buffer. To make the call safe regardless of the values
6526 of the two variables, the size of the destination buffer must be increased
6527 to at least 34 bytes. GCC includes the minimum size of the buffer in
6528 an informational note following the warning.
6529
6530 An alternative to increasing the size of the destination buffer is to
6531 constrain the range of formatted values. The maximum length of string
6532 arguments can be bounded by specifying the precision in the format
6533 directive. When numeric arguments of format directives can be assumed
6534 to be bounded by less than the precision of their type, choosing
6535 an appropriate length modifier to the format specifier will reduce
6536 the required buffer size. For example, if @var{a} and @var{b} in the
6537 example above can be assumed to be within the precision of
6538 the @code{short int} type then using either the @code{%hi} format
6539 directive or casting the argument to @code{short} reduces the maximum
6540 required size of the buffer to 24 bytes.
6541
6542 @smallexample
6543 void f (int a, int b)
6544 @{
6545 char buf [23];
6546 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6547 @}
6548 @end smallexample
6549 @end table
6550
6551 @opindex Wno-format-zero-length
6552 @opindex Wformat-zero-length
6553 @item -Wno-format-zero-length
6554 If @option{-Wformat} is specified, do not warn about zero-length formats.
6555 The C standard specifies that zero-length formats are allowed.
6556
6557 @opindex Wformat-nonliteral
6558 @opindex Wno-format-nonliteral
6559 @item -Wformat-nonliteral
6560 If @option{-Wformat} is specified, also warn if the format string is not a
6561 string literal and so cannot be checked, unless the format function
6562 takes its format arguments as a @code{va_list}.
6563
6564 @opindex Wformat-security
6565 @opindex Wno-format-security
6566 @item -Wformat-security
6567 If @option{-Wformat} is specified, also warn about uses of format
6568 functions that represent possible security problems. At present, this
6569 warns about calls to @code{printf} and @code{scanf} functions where the
6570 format string is not a string literal and there are no format arguments,
6571 as in @code{printf (foo);}. This may be a security hole if the format
6572 string came from untrusted input and contains @samp{%n}. (This is
6573 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6574 in future warnings may be added to @option{-Wformat-security} that are not
6575 included in @option{-Wformat-nonliteral}.)
6576
6577 @opindex Wformat-signedness
6578 @opindex Wno-format-signedness
6579 @item -Wformat-signedness
6580 If @option{-Wformat} is specified, also warn if the format string
6581 requires an unsigned argument and the argument is signed and vice versa.
6582
6583 @opindex Wformat-truncation
6584 @opindex Wno-format-truncation
6585 @item -Wformat-truncation
6586 @itemx -Wformat-truncation=@var{level}
6587 Warn about calls to formatted input/output functions such as @code{snprintf}
6588 and @code{vsnprintf} that might result in output truncation. When the exact
6589 number of bytes written by a format directive cannot be determined at
6590 compile-time it is estimated based on heuristics that depend on
6591 the @var{level} argument and on optimization. While enabling optimization
6592 will in most cases improve the accuracy of the warning, it may also result
6593 in false positives. Except as noted otherwise, the option uses the same
6594 logic @option{-Wformat-overflow}.
6595
6596 @table @gcctabopt
6597 @opindex Wformat-truncation
6598 @opindex Wno-format-truncation
6599 @item -Wformat-truncation
6600 @itemx -Wformat-truncation=1
6601 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6602 employs a conservative approach that warns only about calls to bounded
6603 functions whose return value is unused and that will most likely result
6604 in output truncation.
6605
6606 @item -Wformat-truncation=2
6607 Level @var{2} warns also about calls to bounded functions whose return
6608 value is used and that might result in truncation given an argument of
6609 sufficient length or magnitude.
6610 @end table
6611
6612 @opindex Wformat-y2k
6613 @opindex Wno-format-y2k
6614 @item -Wformat-y2k
6615 If @option{-Wformat} is specified, also warn about @code{strftime}
6616 formats that may yield only a two-digit year.
6617
6618 @opindex Wnonnull
6619 @opindex Wno-nonnull
6620 @item -Wnonnull
6621 Warn about passing a null pointer for arguments marked as
6622 requiring a non-null value by the @code{nonnull} function attribute.
6623
6624 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
6625 can be disabled with the @option{-Wno-nonnull} option.
6626
6627 @opindex Wnonnull-compare
6628 @opindex Wno-nonnull-compare
6629 @item -Wnonnull-compare
6630 Warn when comparing an argument marked with the @code{nonnull}
6631 function attribute against null inside the function.
6632
6633 @option{-Wnonnull-compare} is included in @option{-Wall}. It
6634 can be disabled with the @option{-Wno-nonnull-compare} option.
6635
6636 @opindex Wnull-dereference
6637 @opindex Wno-null-dereference
6638 @item -Wnull-dereference
6639 Warn if the compiler detects paths that trigger erroneous or
6640 undefined behavior due to dereferencing a null pointer. This option
6641 is only active when @option{-fdelete-null-pointer-checks} is active,
6642 which is enabled by optimizations in most targets. The precision of
6643 the warnings depends on the optimization options used.
6644
6645 @opindex Winfinite-recursion
6646 @opindex Wno-infinite-recursion
6647 @item -Winfinite-recursion
6648 Warn about infinitely recursive calls. The warning is effective at all
6649 optimization levels but requires optimization in order to detect infinite
6650 recursion in calls between two or more functions.
6651 @option{-Winfinite-recursion} is included in @option{-Wall}.
6652
6653 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6654 similar diagnostic, but is implemented in a different way (as part of
6655 @option{-fanalyzer}).
6656
6657 @opindex Winit-self
6658 @opindex Wno-init-self
6659 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6660 Warn about uninitialized variables that are initialized with themselves.
6661 Note this option can only be used with the @option{-Wuninitialized} option.
6662
6663 For example, GCC warns about @code{i} being uninitialized in the
6664 following snippet only when @option{-Winit-self} has been specified:
6665 @smallexample
6666 @group
6667 int f()
6668 @{
6669 int i = i;
6670 return i;
6671 @}
6672 @end group
6673 @end smallexample
6674
6675 This warning is enabled by @option{-Wall} in C++.
6676
6677 @opindex Wimplicit-int
6678 @opindex Wno-implicit-int
6679 @item -Wno-implicit-int @r{(C and Objective-C only)}
6680 This option controls warnings when a declaration does not specify a type.
6681 This warning is enabled by default in C99 and later dialects of C,
6682 and also by @option{-Wall}.
6683
6684 @opindex Wimplicit-function-declaration
6685 @opindex Wno-implicit-function-declaration
6686 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6687 This option controls warnings when a function is used before being declared.
6688 This warning is enabled by default in C99 and later dialects of C,
6689 and also by @option{-Wall}.
6690 The warning is made into an error by @option{-pedantic-errors}.
6691
6692 @opindex Wimplicit
6693 @opindex Wno-implicit
6694 @item -Wimplicit @r{(C and Objective-C only)}
6695 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6696 This warning is enabled by @option{-Wall}.
6697
6698 @opindex Wimplicit-fallthrough
6699 @opindex Wno-implicit-fallthrough
6700 @item -Wimplicit-fallthrough
6701 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6702 and @option{-Wno-implicit-fallthrough} is the same as
6703 @option{-Wimplicit-fallthrough=0}.
6704
6705 @opindex Wimplicit-fallthrough=
6706 @item -Wimplicit-fallthrough=@var{n}
6707 Warn when a switch case falls through. For example:
6708
6709 @smallexample
6710 @group
6711 switch (cond)
6712 @{
6713 case 1:
6714 a = 1;
6715 break;
6716 case 2:
6717 a = 2;
6718 case 3:
6719 a = 3;
6720 break;
6721 @}
6722 @end group
6723 @end smallexample
6724
6725 This warning does not warn when the last statement of a case cannot
6726 fall through, e.g. when there is a return statement or a call to function
6727 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
6728 also takes into account control flow statements, such as ifs, and only
6729 warns when appropriate. E.g.@:
6730
6731 @smallexample
6732 @group
6733 switch (cond)
6734 @{
6735 case 1:
6736 if (i > 3) @{
6737 bar (5);
6738 break;
6739 @} else if (i < 1) @{
6740 bar (0);
6741 @} else
6742 return;
6743 default:
6744 @dots{}
6745 @}
6746 @end group
6747 @end smallexample
6748
6749 Since there are occasions where a switch case fall through is desirable,
6750 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6751 to be used along with a null statement to suppress this warning that
6752 would normally occur:
6753
6754 @smallexample
6755 @group
6756 switch (cond)
6757 @{
6758 case 1:
6759 bar (0);
6760 __attribute__ ((fallthrough));
6761 default:
6762 @dots{}
6763 @}
6764 @end group
6765 @end smallexample
6766
6767 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6768 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
6769 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6770 Instead of these attributes, it is also possible to add a fallthrough comment
6771 to silence the warning. The whole body of the C or C++ style comment should
6772 match the given regular expressions listed below. The option argument @var{n}
6773 specifies what kind of comments are accepted:
6774
6775 @itemize @bullet
6776
6777 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6778
6779 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6780 expression, any comment is used as fallthrough comment.
6781
6782 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6783 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6784
6785 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6786 following regular expressions:
6787
6788 @itemize @bullet
6789
6790 @item @code{-fallthrough}
6791
6792 @item @code{@@fallthrough@@}
6793
6794 @item @code{lint -fallthrough[ \t]*}
6795
6796 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6797
6798 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6799
6800 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6801
6802 @end itemize
6803
6804 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6805 following regular expressions:
6806
6807 @itemize @bullet
6808
6809 @item @code{-fallthrough}
6810
6811 @item @code{@@fallthrough@@}
6812
6813 @item @code{lint -fallthrough[ \t]*}
6814
6815 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6816
6817 @end itemize
6818
6819 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6820 fallthrough comments, only attributes disable the warning.
6821
6822 @end itemize
6823
6824 The comment needs to be followed after optional whitespace and other comments
6825 by @code{case} or @code{default} keywords or by a user label that precedes some
6826 @code{case} or @code{default} label.
6827
6828 @smallexample
6829 @group
6830 switch (cond)
6831 @{
6832 case 1:
6833 bar (0);
6834 /* FALLTHRU */
6835 default:
6836 @dots{}
6837 @}
6838 @end group
6839 @end smallexample
6840
6841 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6842
6843 @opindex Wif-not-aligned
6844 @opindex Wno-if-not-aligned
6845 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6846 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6847 should be issued. These warnings are enabled by default.
6848
6849 @opindex Wignored-qualifiers
6850 @opindex Wno-ignored-qualifiers
6851 @item -Wignored-qualifiers @r{(C and C++ only)}
6852 Warn if the return type of a function has a type qualifier
6853 such as @code{const}. For ISO C such a type qualifier has no effect,
6854 since the value returned by a function is not an lvalue.
6855 For C++, the warning is only emitted for scalar types or @code{void}.
6856 ISO C prohibits qualified @code{void} return types on function
6857 definitions, so such return types always receive a warning
6858 even without this option.
6859
6860 This warning is also enabled by @option{-Wextra}.
6861
6862 @opindex Wignored-attributes
6863 @opindex Wno-ignored-attributes
6864 @item -Wno-ignored-attributes @r{(C and C++ only)}
6865 This option controls warnings when an attribute is ignored.
6866 This is different from the
6867 @option{-Wattributes} option in that it warns whenever the compiler decides
6868 to drop an attribute, not that the attribute is either unknown, used in a
6869 wrong place, etc. This warning is enabled by default.
6870
6871 @opindex Wmain
6872 @opindex Wno-main
6873 @item -Wmain
6874 Warn if the type of @code{main} is suspicious. @code{main} should be
6875 a function with external linkage, returning int, taking either zero
6876 arguments, two, or three arguments of appropriate types. This warning
6877 is enabled by default in C++ and is enabled by either @option{-Wall}
6878 or @option{-Wpedantic}.
6879
6880 @opindex Wmisleading-indentation
6881 @opindex Wno-misleading-indentation
6882 @item -Wmisleading-indentation @r{(C and C++ only)}
6883 Warn when the indentation of the code does not reflect the block structure.
6884 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6885 @code{for} clauses with a guarded statement that does not use braces,
6886 followed by an unguarded statement with the same indentation.
6887
6888 In the following example, the call to ``bar'' is misleadingly indented as
6889 if it were guarded by the ``if'' conditional.
6890
6891 @smallexample
6892 if (some_condition ())
6893 foo ();
6894 bar (); /* Gotcha: this is not guarded by the "if". */
6895 @end smallexample
6896
6897 In the case of mixed tabs and spaces, the warning uses the
6898 @option{-ftabstop=} option to determine if the statements line up
6899 (defaulting to 8).
6900
6901 The warning is not issued for code involving multiline preprocessor logic
6902 such as the following example.
6903
6904 @smallexample
6905 if (flagA)
6906 foo (0);
6907 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6908 if (flagB)
6909 #endif
6910 foo (1);
6911 @end smallexample
6912
6913 The warning is not issued after a @code{#line} directive, since this
6914 typically indicates autogenerated code, and no assumptions can be made
6915 about the layout of the file that the directive references.
6916
6917 This warning is enabled by @option{-Wall} in C and C++.
6918
6919 @opindex Wmissing-attributes
6920 @opindex Wno-missing-attributes
6921 @item -Wmissing-attributes
6922 Warn when a declaration of a function is missing one or more attributes
6923 that a related function is declared with and whose absence may adversely
6924 affect the correctness or efficiency of generated code. For example,
6925 the warning is issued for declarations of aliases that use attributes
6926 to specify less restrictive requirements than those of their targets.
6927 This typically represents a potential optimization opportunity.
6928 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6929 issued when the alias is more restrictive than the target, which could
6930 lead to incorrect code generation.
6931 Attributes considered include @code{alloc_align}, @code{alloc_size},
6932 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6933 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6934 @code{returns_nonnull}, and @code{returns_twice}.
6935
6936 In C++, the warning is issued when an explicit specialization of a primary
6937 template declared with attribute @code{alloc_align}, @code{alloc_size},
6938 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6939 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6940 @code{error}, and @code{warning} suppress the warning.
6941 (@pxref{Function Attributes}).
6942
6943 You can use the @code{copy} attribute to apply the same
6944 set of attributes to a declaration as that on another declaration without
6945 explicitly enumerating the attributes. This attribute can be applied
6946 to declarations of functions (@pxref{Common Function Attributes}),
6947 variables (@pxref{Common Variable Attributes}), or types
6948 (@pxref{Common Type Attributes}).
6949
6950 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6951
6952 For example, since the declaration of the primary function template
6953 below makes use of both attribute @code{malloc} and @code{alloc_size}
6954 the declaration of the explicit specialization of the template is
6955 diagnosed because it is missing one of the attributes.
6956
6957 @smallexample
6958 template <class T>
6959 T* __attribute__ ((malloc, alloc_size (1)))
6960 allocate (size_t);
6961
6962 template <>
6963 void* __attribute__ ((malloc)) // missing alloc_size
6964 allocate<void> (size_t);
6965 @end smallexample
6966
6967 @opindex Wmissing-braces
6968 @opindex Wno-missing-braces
6969 @item -Wmissing-braces
6970 Warn if an aggregate or union initializer is not fully bracketed. In
6971 the following example, the initializer for @code{a} is not fully
6972 bracketed, but that for @code{b} is fully bracketed.
6973
6974 @smallexample
6975 int a[2][2] = @{ 0, 1, 2, 3 @};
6976 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6977 @end smallexample
6978
6979 This warning is enabled by @option{-Wall}.
6980
6981 @opindex Wmissing-include-dirs
6982 @opindex Wno-missing-include-dirs
6983 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6984 Warn if a user-supplied include directory does not exist. This opions is disabled
6985 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6986 enabled by default by warning for -I and -J, only.
6987
6988 @opindex Wmissing-profile
6989 @opindex Wno-missing-profile
6990 @item -Wno-missing-profile
6991 This option controls warnings if feedback profiles are missing when using the
6992 @option{-fprofile-use} option.
6993 This option diagnoses those cases where a new function or a new file is added
6994 between compiling with @option{-fprofile-generate} and with
6995 @option{-fprofile-use}, without regenerating the profiles.
6996 In these cases, the profile feedback data files do not contain any
6997 profile feedback information for
6998 the newly added function or file respectively. Also, in the case when profile
6999 count data (.gcda) files are removed, GCC cannot use any profile feedback
7000 information. In all these cases, warnings are issued to inform you that a
7001 profile generation step is due.
7002 Ignoring the warning can result in poorly optimized code.
7003 @option{-Wno-missing-profile} can be used to
7004 disable the warning, but this is not recommended and should be done only
7005 when non-existent profile data is justified.
7006
7007 @opindex Wmismatched-dealloc
7008 @opindex Wno-mismatched-dealloc
7009 @item -Wmismatched-dealloc
7010
7011 Warn for calls to deallocation functions with pointer arguments returned
7012 from from allocations functions for which the former isn't a suitable
7013 deallocator. A pair of functions can be associated as matching allocators
7014 and deallocators by use of attribute @code{malloc}. Unless disabled by
7015 the @option{-fno-builtin} option the standard functions @code{calloc},
7016 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7017 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7018 associated as matching allocators and deallocators. In the following
7019 example @code{mydealloc} is the deallocator for pointers returned from
7020 @code{myalloc}.
7021
7022 @smallexample
7023 void mydealloc (void*);
7024
7025 __attribute__ ((malloc (mydealloc, 1))) void*
7026 myalloc (size_t);
7027
7028 void f (void)
7029 @{
7030 void *p = myalloc (32);
7031 // @dots{}use p@dots{}
7032 free (p); // warning: not a matching deallocator for myalloc
7033 mydealloc (p); // ok
7034 @}
7035 @end smallexample
7036
7037 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7038 mismatches involving either @code{operator new} or @code{operator delete}.
7039
7040 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7041
7042 @opindex Wmultistatement-macros
7043 @opindex Wno-multistatement-macros
7044 @item -Wmultistatement-macros
7045 Warn about unsafe multiple statement macros that appear to be guarded
7046 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7047 @code{while}, in which only the first statement is actually guarded after
7048 the macro is expanded.
7049
7050 For example:
7051
7052 @smallexample
7053 #define DOIT x++; y++
7054 if (c)
7055 DOIT;
7056 @end smallexample
7057
7058 will increment @code{y} unconditionally, not just when @code{c} holds.
7059 The can usually be fixed by wrapping the macro in a do-while loop:
7060 @smallexample
7061 #define DOIT do @{ x++; y++; @} while (0)
7062 if (c)
7063 DOIT;
7064 @end smallexample
7065
7066 This warning is enabled by @option{-Wall} in C and C++.
7067
7068 @opindex Wparentheses
7069 @opindex Wno-parentheses
7070 @item -Wparentheses
7071 Warn if parentheses are omitted in certain contexts, such
7072 as when there is an assignment in a context where a truth value
7073 is expected, or when operators are nested whose precedence people
7074 often get confused about.
7075
7076 Also warn if a comparison like @code{x<=y<=z} appears; this is
7077 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7078 interpretation from that of ordinary mathematical notation.
7079
7080 Also warn for dangerous uses of the GNU extension to
7081 @code{?:} with omitted middle operand. When the condition
7082 in the @code{?}: operator is a boolean expression, the omitted value is
7083 always 1. Often programmers expect it to be a value computed
7084 inside the conditional expression instead.
7085
7086 For C++ this also warns for some cases of unnecessary parentheses in
7087 declarations, which can indicate an attempt at a function call instead
7088 of a declaration:
7089 @smallexample
7090 @{
7091 // Declares a local variable called mymutex.
7092 std::unique_lock<std::mutex> (mymutex);
7093 // User meant std::unique_lock<std::mutex> lock (mymutex);
7094 @}
7095 @end smallexample
7096
7097 This warning is enabled by @option{-Wall}.
7098
7099 @opindex Wself-move
7100 @opindex Wno-self-move
7101 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7102 This warning warns when a value is moved to itself with @code{std::move}.
7103 Such a @code{std::move} typically has no effect.
7104
7105 @smallexample
7106 struct T @{
7107 @dots{}
7108 @};
7109 void fn()
7110 @{
7111 T t;
7112 @dots{}
7113 t = std::move (t);
7114 @}
7115 @end smallexample
7116
7117 This warning is enabled by @option{-Wall}.
7118
7119 @opindex Wsequence-point
7120 @opindex Wno-sequence-point
7121 @item -Wsequence-point
7122 Warn about code that may have undefined semantics because of violations
7123 of sequence point rules in the C and C++ standards.
7124
7125 The C and C++ standards define the order in which expressions in a C/C++
7126 program are evaluated in terms of @dfn{sequence points}, which represent
7127 a partial ordering between the execution of parts of the program: those
7128 executed before the sequence point, and those executed after it. These
7129 occur after the evaluation of a full expression (one which is not part
7130 of a larger expression), after the evaluation of the first operand of a
7131 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7132 function is called (but after the evaluation of its arguments and the
7133 expression denoting the called function), and in certain other places.
7134 Other than as expressed by the sequence point rules, the order of
7135 evaluation of subexpressions of an expression is not specified. All
7136 these rules describe only a partial order rather than a total order,
7137 since, for example, if two functions are called within one expression
7138 with no sequence point between them, the order in which the functions
7139 are called is not specified. However, the standards committee have
7140 ruled that function calls do not overlap.
7141
7142 It is not specified when between sequence points modifications to the
7143 values of objects take effect. Programs whose behavior depends on this
7144 have undefined behavior; the C and C++ standards specify that ``Between
7145 the previous and next sequence point an object shall have its stored
7146 value modified at most once by the evaluation of an expression.
7147 Furthermore, the prior value shall be read only to determine the value
7148 to be stored.''. If a program breaks these rules, the results on any
7149 particular implementation are entirely unpredictable.
7150
7151 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7152 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
7153 diagnosed by this option, and it may give an occasional false positive
7154 result, but in general it has been found fairly effective at detecting
7155 this sort of problem in programs.
7156
7157 The C++17 standard will define the order of evaluation of operands in
7158 more cases: in particular it requires that the right-hand side of an
7159 assignment be evaluated before the left-hand side, so the above
7160 examples are no longer undefined. But this option will still warn
7161 about them, to help people avoid writing code that is undefined in C
7162 and earlier revisions of C++.
7163
7164 The standard is worded confusingly, therefore there is some debate
7165 over the precise meaning of the sequence point rules in subtle cases.
7166 Links to discussions of the problem, including proposed formal
7167 definitions, may be found on the GCC readings page, at
7168 @uref{https://gcc.gnu.org/@/readings.html}.
7169
7170 This warning is enabled by @option{-Wall} for C and C++.
7171
7172 @opindex Wno-return-local-addr
7173 @opindex Wreturn-local-addr
7174 @item -Wno-return-local-addr
7175 Do not warn about returning a pointer (or in C++, a reference) to a
7176 variable that goes out of scope after the function returns.
7177
7178 @opindex Wreturn-type
7179 @opindex Wno-return-type
7180 @item -Wreturn-type
7181 Warn whenever a function is defined with a return type that defaults
7182 to @code{int}. Also warn about any @code{return} statement with no
7183 return value in a function whose return type is not @code{void}
7184 (falling off the end of the function body is considered returning
7185 without a value).
7186
7187 For C only, warn about a @code{return} statement with an expression in a
7188 function whose return type is @code{void}, unless the expression type is
7189 also @code{void}. As a GNU extension, the latter case is accepted
7190 without a warning unless @option{-Wpedantic} is used. Attempting
7191 to use the return value of a non-@code{void} function other than @code{main}
7192 that flows off the end by reaching the closing curly brace that terminates
7193 the function is undefined.
7194
7195 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7196 than @code{main} results in undefined behavior even when the value of
7197 the function is not used.
7198
7199 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7200
7201 @opindex Wshift-count-negative
7202 @opindex Wno-shift-count-negative
7203 @item -Wno-shift-count-negative
7204 Controls warnings if a shift count is negative.
7205 This warning is enabled by default.
7206
7207 @opindex Wshift-count-overflow
7208 @opindex Wno-shift-count-overflow
7209 @item -Wno-shift-count-overflow
7210 Controls warnings if a shift count is greater than or equal to the bit width
7211 of the type. This warning is enabled by default.
7212
7213 @opindex Wshift-negative-value
7214 @opindex Wno-shift-negative-value
7215 @item -Wshift-negative-value
7216 Warn if left shifting a negative value. This warning is enabled by
7217 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7218
7219 @opindex Wshift-overflow
7220 @opindex Wno-shift-overflow
7221 @item -Wno-shift-overflow
7222 @itemx -Wshift-overflow=@var{n}
7223 These options control warnings about left shift overflows.
7224
7225 @table @gcctabopt
7226 @item -Wshift-overflow=1
7227 This is the warning level of @option{-Wshift-overflow} and is enabled
7228 by default in C99 and C++11 modes (and newer). This warning level does
7229 not warn about left-shifting 1 into the sign bit. (However, in C, such
7230 an overflow is still rejected in contexts where an integer constant expression
7231 is required.) No warning is emitted in C++20 mode (and newer), as signed left
7232 shifts always wrap.
7233
7234 @item -Wshift-overflow=2
7235 This warning level also warns about left-shifting 1 into the sign bit,
7236 unless C++14 mode (or newer) is active.
7237 @end table
7238
7239 @opindex Wswitch
7240 @opindex Wno-switch
7241 @item -Wswitch
7242 Warn whenever a @code{switch} statement has an index of enumerated type
7243 and lacks a @code{case} for one or more of the named codes of that
7244 enumeration. (The presence of a @code{default} label prevents this
7245 warning.) @code{case} labels outside the enumeration range also
7246 provoke warnings when this option is used (even if there is a
7247 @code{default} label).
7248 This warning is enabled by @option{-Wall}.
7249
7250 @opindex Wswitch-default
7251 @opindex Wno-switch-default
7252 @item -Wswitch-default
7253 Warn whenever a @code{switch} statement does not have a @code{default}
7254 case.
7255
7256 @opindex Wswitch-enum
7257 @opindex Wno-switch-enum
7258 @item -Wswitch-enum
7259 Warn whenever a @code{switch} statement has an index of enumerated type
7260 and lacks a @code{case} for one or more of the named codes of that
7261 enumeration. @code{case} labels outside the enumeration range also
7262 provoke warnings when this option is used. The only difference
7263 between @option{-Wswitch} and this option is that this option gives a
7264 warning about an omitted enumeration code even if there is a
7265 @code{default} label.
7266
7267 @opindex Wswitch-bool
7268 @opindex Wno-switch-bool
7269 @item -Wno-switch-bool
7270 Do not warn when a @code{switch} statement has an index of boolean type
7271 and the case values are outside the range of a boolean type.
7272 It is possible to suppress this warning by casting the controlling
7273 expression to a type other than @code{bool}. For example:
7274 @smallexample
7275 @group
7276 switch ((int) (a == 4))
7277 @{
7278 @dots{}
7279 @}
7280 @end group
7281 @end smallexample
7282 This warning is enabled by default for C and C++ programs.
7283
7284 @opindex Wswitch-outside-range
7285 @opindex Wno-switch-outside-range
7286 @item -Wno-switch-outside-range
7287 This option controls warnings when a @code{switch} case has a value
7288 that is outside of its
7289 respective type range. This warning is enabled by default for
7290 C and C++ programs.
7291
7292 @opindex Wswitch-unreachable
7293 @opindex Wno-switch-unreachable
7294 @item -Wno-switch-unreachable
7295 Do not warn when a @code{switch} statement contains statements between the
7296 controlling expression and the first case label, which will never be
7297 executed. For example:
7298 @smallexample
7299 @group
7300 switch (cond)
7301 @{
7302 i = 15;
7303 @dots{}
7304 case 5:
7305 @dots{}
7306 @}
7307 @end group
7308 @end smallexample
7309 @option{-Wswitch-unreachable} does not warn if the statement between the
7310 controlling expression and the first case label is just a declaration:
7311 @smallexample
7312 @group
7313 switch (cond)
7314 @{
7315 int i;
7316 @dots{}
7317 case 5:
7318 i = 5;
7319 @dots{}
7320 @}
7321 @end group
7322 @end smallexample
7323 This warning is enabled by default for C and C++ programs.
7324
7325 @opindex Wsync-nand
7326 @opindex Wno-sync-nand
7327 @item -Wsync-nand @r{(C and C++ only)}
7328 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7329 built-in functions are used. These functions changed semantics in GCC 4.4.
7330
7331 @opindex Wtrivial-auto-var-init
7332 @opindex Wno-trivial-auto-var-init
7333 @item -Wtrivial-auto-var-init
7334 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7335 variable. A common situation is an automatic variable that is declared
7336 between the controlling expression and the first case label of a @code{switch}
7337 statement.
7338
7339 @opindex Wunused-but-set-parameter
7340 @opindex Wno-unused-but-set-parameter
7341 @item -Wunused-but-set-parameter
7342 Warn whenever a function parameter is assigned to, but otherwise unused
7343 (aside from its declaration).
7344
7345 To suppress this warning use the @code{unused} attribute
7346 (@pxref{Variable Attributes}).
7347
7348 This warning is also enabled by @option{-Wunused} together with
7349 @option{-Wextra}.
7350
7351 @opindex Wunused-but-set-variable
7352 @opindex Wno-unused-but-set-variable
7353 @item -Wunused-but-set-variable
7354 Warn whenever a local variable is assigned to, but otherwise unused
7355 (aside from its declaration).
7356 This warning is enabled by @option{-Wall}.
7357
7358 To suppress this warning use the @code{unused} attribute
7359 (@pxref{Variable Attributes}).
7360
7361 This warning is also enabled by @option{-Wunused}, which is enabled
7362 by @option{-Wall}.
7363
7364 @opindex Wunused-function
7365 @opindex Wno-unused-function
7366 @item -Wunused-function
7367 Warn whenever a static function is declared but not defined or a
7368 non-inline static function is unused.
7369 This warning is enabled by @option{-Wall}.
7370
7371 @opindex Wunused-label
7372 @opindex Wno-unused-label
7373 @item -Wunused-label
7374 Warn whenever a label is declared but not used.
7375 This warning is enabled by @option{-Wall}.
7376
7377 To suppress this warning use the @code{unused} attribute
7378 (@pxref{Variable Attributes}).
7379
7380 @opindex Wunused-local-typedefs
7381 @opindex Wno-unused-local-typedefs
7382 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7383 Warn when a typedef locally defined in a function is not used.
7384 This warning is enabled by @option{-Wall}.
7385
7386 @opindex Wunused-parameter
7387 @opindex Wno-unused-parameter
7388 @item -Wunused-parameter
7389 Warn whenever a function parameter is unused aside from its declaration.
7390
7391 To suppress this warning use the @code{unused} attribute
7392 (@pxref{Variable Attributes}).
7393
7394 @opindex Wunused-result
7395 @opindex Wno-unused-result
7396 @item -Wno-unused-result
7397 Do not warn if a caller of a function marked with attribute
7398 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7399 its return value. The default is @option{-Wunused-result}.
7400
7401 @opindex Wunused-variable
7402 @opindex Wno-unused-variable
7403 @item -Wunused-variable
7404 Warn whenever a local or static variable is unused aside from its
7405 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7406 but not for C++. This warning is enabled by @option{-Wall}.
7407
7408 To suppress this warning use the @code{unused} attribute
7409 (@pxref{Variable Attributes}).
7410
7411 @opindex Wunused-const-variable
7412 @opindex Wno-unused-const-variable
7413 @item -Wunused-const-variable
7414 @itemx -Wunused-const-variable=@var{n}
7415 Warn whenever a constant static variable is unused aside from its declaration.
7416 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7417 for C, but not for C++. In C this declares variable storage, but in C++ this
7418 is not an error since const variables take the place of @code{#define}s.
7419
7420 To suppress this warning use the @code{unused} attribute
7421 (@pxref{Variable Attributes}).
7422
7423 @table @gcctabopt
7424 @item -Wunused-const-variable=1
7425 This is the warning level that is enabled by @option{-Wunused-variable} for
7426 C. It warns only about unused static const variables defined in the main
7427 compilation unit, but not about static const variables declared in any
7428 header included.
7429
7430 @item -Wunused-const-variable=2
7431 This warning level also warns for unused constant static variables in
7432 headers (excluding system headers). This is the warning level of
7433 @option{-Wunused-const-variable} and must be explicitly requested since
7434 in C++ this isn't an error and in C it might be harder to clean up all
7435 headers included.
7436 @end table
7437
7438 @opindex Wunused-value
7439 @opindex Wno-unused-value
7440 @item -Wunused-value
7441 Warn whenever a statement computes a result that is explicitly not
7442 used. To suppress this warning cast the unused expression to
7443 @code{void}. This includes an expression-statement or the left-hand
7444 side of a comma expression that contains no side effects. For example,
7445 an expression such as @code{x[i,j]} causes a warning, while
7446 @code{x[(void)i,j]} does not.
7447
7448 This warning is enabled by @option{-Wall}.
7449
7450 @opindex Wunused
7451 @opindex Wno-unused
7452 @item -Wunused
7453 All the above @option{-Wunused} options combined.
7454
7455 In order to get a warning about an unused function parameter, you must
7456 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7457 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7458
7459 @opindex Wuninitialized
7460 @opindex Wno-uninitialized
7461 @item -Wuninitialized
7462 Warn if an object with automatic or allocated storage duration is used
7463 without having been initialized. In C++, also warn if a non-static
7464 reference or non-static @code{const} member appears in a class without
7465 constructors.
7466
7467 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7468 object to a @code{const}-qualified argument of a built-in function known to
7469 read the object is also diagnosed by this warning.
7470 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7471
7472 If you want to warn about code that uses the uninitialized value of the
7473 variable in its own initializer, use the @option{-Winit-self} option.
7474
7475 These warnings occur for individual uninitialized elements of
7476 structure, union or array variables as well as for variables that are
7477 uninitialized as a whole. They do not occur for variables or elements
7478 declared @code{volatile}. Because these warnings depend on
7479 optimization, the exact variables or elements for which there are
7480 warnings depend on the precise optimization options and version of GCC
7481 used.
7482
7483 Note that there may be no warning about a variable that is used only
7484 to compute a value that itself is never used, because such
7485 computations may be deleted by data flow analysis before the warnings
7486 are printed.
7487
7488 In C++, this warning also warns about using uninitialized objects in
7489 member-initializer-lists. For example, GCC warns about @code{b} being
7490 uninitialized in the following snippet:
7491
7492 @smallexample
7493 struct A @{
7494 int a;
7495 int b;
7496 A() : a(b) @{ @}
7497 @};
7498 @end smallexample
7499
7500 @opindex Winvalid-memory-model
7501 @opindex Wno-invalid-memory-model
7502 @item -Wno-invalid-memory-model
7503 This option controls warnings
7504 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7505 and the C11 atomic generic functions with a memory consistency argument
7506 that is either invalid for the operation or outside the range of values
7507 of the @code{memory_order} enumeration. For example, since the
7508 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7509 defined for the relaxed, release, and sequentially consistent memory
7510 orders the following code is diagnosed:
7511
7512 @smallexample
7513 void store (int *i)
7514 @{
7515 __atomic_store_n (i, 0, memory_order_consume);
7516 @}
7517 @end smallexample
7518
7519 @option{-Winvalid-memory-model} is enabled by default.
7520
7521 @opindex Wmaybe-uninitialized
7522 @opindex Wno-maybe-uninitialized
7523 @item -Wmaybe-uninitialized
7524 For an object with automatic or allocated storage duration, if there exists
7525 a path from the function entry to a use of the object that is initialized,
7526 but there exist some other paths for which the object is not initialized,
7527 the compiler emits a warning if it cannot prove the uninitialized paths
7528 are not executed at run time.
7529
7530 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7531 object to a @code{const}-qualified function argument is also diagnosed by
7532 this warning. (@option{-Wuninitialized} is issued for built-in functions
7533 known to read the object.) Annotating the function with attribute
7534 @code{access (none)} indicates that the argument isn't used to access
7535 the object and avoids the warning (@pxref{Common Function Attributes}).
7536
7537 These warnings are only possible in optimizing compilation, because otherwise
7538 GCC does not keep track of the state of variables.
7539
7540 These warnings are made optional because GCC may not be able to determine when
7541 the code is correct in spite of appearing to have an error. Here is one
7542 example of how this can happen:
7543
7544 @smallexample
7545 @group
7546 @{
7547 int x;
7548 switch (y)
7549 @{
7550 case 1: x = 1;
7551 break;
7552 case 2: x = 4;
7553 break;
7554 case 3: x = 5;
7555 @}
7556 foo (x);
7557 @}
7558 @end group
7559 @end smallexample
7560
7561 @noindent
7562 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7563 always initialized, but GCC doesn't know this. To suppress the
7564 warning, you need to provide a default case with assert(0) or
7565 similar code.
7566
7567 @cindex @code{longjmp} warnings
7568 This option also warns when a non-volatile automatic variable might be
7569 changed by a call to @code{longjmp}.
7570 The compiler sees only the calls to @code{setjmp}. It cannot know
7571 where @code{longjmp} will be called; in fact, a signal handler could
7572 call it at any point in the code. As a result, you may get a warning
7573 even when there is in fact no problem because @code{longjmp} cannot
7574 in fact be called at the place that would cause a problem.
7575
7576 Some spurious warnings can be avoided if you declare all the functions
7577 you use that never return as @code{noreturn}. @xref{Function
7578 Attributes}.
7579
7580 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7581
7582 @opindex Wunknown-pragmas
7583 @opindex Wno-unknown-pragmas
7584 @cindex warning for unknown pragmas
7585 @cindex unknown pragmas, warning
7586 @cindex pragmas, warning of unknown
7587 @item -Wunknown-pragmas
7588 Warn when a @code{#pragma} directive is encountered that is not understood by
7589 GCC@. If this command-line option is used, warnings are even issued
7590 for unknown pragmas in system header files. This is not the case if
7591 the warnings are only enabled by the @option{-Wall} command-line option.
7592
7593 @opindex Wno-pragmas
7594 @opindex Wpragmas
7595 @item -Wno-pragmas
7596 Do not warn about misuses of pragmas, such as incorrect parameters,
7597 invalid syntax, or conflicts between pragmas. See also
7598 @option{-Wunknown-pragmas}.
7599
7600 @opindex Wno-prio-ctor-dtor
7601 @opindex Wprio-ctor-dtor
7602 @item -Wno-prio-ctor-dtor
7603 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7604 The use of constructor and destructor attributes allow you to assign a
7605 priority to the constructor/destructor to control its order of execution
7606 before @code{main} is called or after it returns. The priority values must be
7607 greater than 100 as the compiler reserves priority values between 0--100 for
7608 the implementation.
7609
7610 @opindex Wstrict-aliasing
7611 @opindex Wno-strict-aliasing
7612 @item -Wstrict-aliasing
7613 This option is only active when @option{-fstrict-aliasing} is active.
7614 It warns about code that might break the strict aliasing rules that the
7615 compiler is using for optimization. The warning does not catch all
7616 cases, but does attempt to catch the more common pitfalls. It is
7617 included in @option{-Wall}.
7618 It is equivalent to @option{-Wstrict-aliasing=3}
7619
7620 @opindex Wstrict-aliasing=n
7621 @item -Wstrict-aliasing=n
7622 This option is only active when @option{-fstrict-aliasing} is active.
7623 It warns about code that might break the strict aliasing rules that the
7624 compiler is using for optimization.
7625 Higher levels correspond to higher accuracy (fewer false positives).
7626 Higher levels also correspond to more effort, similar to the way @option{-O}
7627 works.
7628 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7629
7630 Level 1: Most aggressive, quick, least accurate.
7631 Possibly useful when higher levels
7632 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7633 false negatives. However, it has many false positives.
7634 Warns for all pointer conversions between possibly incompatible types,
7635 even if never dereferenced. Runs in the front end only.
7636
7637 Level 2: Aggressive, quick, not too precise.
7638 May still have many false positives (not as many as level 1 though),
7639 and few false negatives (but possibly more than level 1).
7640 Unlike level 1, it only warns when an address is taken. Warns about
7641 incomplete types. Runs in the front end only.
7642
7643 Level 3 (default for @option{-Wstrict-aliasing}):
7644 Should have very few false positives and few false
7645 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
7646 Takes care of the common pun+dereference pattern in the front end:
7647 @code{*(int*)&some_float}.
7648 If optimization is enabled, it also runs in the back end, where it deals
7649 with multiple statement cases using flow-sensitive points-to information.
7650 Only warns when the converted pointer is dereferenced.
7651 Does not warn about incomplete types.
7652
7653 @opindex Wstrict-overflow
7654 @opindex Wno-strict-overflow
7655 @item -Wstrict-overflow
7656 @itemx -Wstrict-overflow=@var{n}
7657 This option is only active when signed overflow is undefined.
7658 It warns about cases where the compiler optimizes based on the
7659 assumption that signed overflow does not occur. Note that it does not
7660 warn about all cases where the code might overflow: it only warns
7661 about cases where the compiler implements some optimization. Thus
7662 this warning depends on the optimization level.
7663
7664 An optimization that assumes that signed overflow does not occur is
7665 perfectly safe if the values of the variables involved are such that
7666 overflow never does, in fact, occur. Therefore this warning can
7667 easily give a false positive: a warning about code that is not
7668 actually a problem. To help focus on important issues, several
7669 warning levels are defined. No warnings are issued for the use of
7670 undefined signed overflow when estimating how many iterations a loop
7671 requires, in particular when determining whether a loop will be
7672 executed at all.
7673
7674 @table @gcctabopt
7675 @item -Wstrict-overflow=1
7676 Warn about cases that are both questionable and easy to avoid. For
7677 example the compiler simplifies
7678 @code{x + 1 > x} to @code{1}. This level of
7679 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7680 are not, and must be explicitly requested.
7681
7682 @item -Wstrict-overflow=2
7683 Also warn about other cases where a comparison is simplified to a
7684 constant. For example: @code{abs (x) >= 0}. This can only be
7685 simplified when signed integer overflow is undefined, because
7686 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7687 zero. @option{-Wstrict-overflow} (with no level) is the same as
7688 @option{-Wstrict-overflow=2}.
7689
7690 @item -Wstrict-overflow=3
7691 Also warn about other cases where a comparison is simplified. For
7692 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7693
7694 @item -Wstrict-overflow=4
7695 Also warn about other simplifications not covered by the above cases.
7696 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7697
7698 @item -Wstrict-overflow=5
7699 Also warn about cases where the compiler reduces the magnitude of a
7700 constant involved in a comparison. For example: @code{x + 2 > y} is
7701 simplified to @code{x + 1 >= y}. This is reported only at the
7702 highest warning level because this simplification applies to many
7703 comparisons, so this warning level gives a very large number of
7704 false positives.
7705 @end table
7706
7707 @opindex Wstring-compare
7708 @opindex Wno-string-compare
7709 @item -Wstring-compare
7710 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7711 determined to be either zero or non-zero in tests for such equality
7712 owing to the length of one argument being greater than the size of
7713 the array the other argument is stored in (or the bound in the case
7714 of @code{strncmp}). Such calls could be mistakes. For example,
7715 the call to @code{strcmp} below is diagnosed because its result is
7716 necessarily non-zero irrespective of the contents of the array @code{a}.
7717
7718 @smallexample
7719 extern char a[4];
7720 void f (char *d)
7721 @{
7722 strcpy (d, "string");
7723 @dots{}
7724 if (0 == strcmp (a, d)) // cannot be true
7725 puts ("a and d are the same");
7726 @}
7727 @end smallexample
7728
7729 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7730
7731 @opindex Wstringop-overflow
7732 @opindex Wno-stringop-overflow
7733 @item -Wno-stringop-overflow
7734 @item -Wstringop-overflow
7735 @itemx -Wstringop-overflow=@var{type}
7736 Warn for calls to string manipulation functions such as @code{memcpy} and
7737 @code{strcpy} that are determined to overflow the destination buffer. The
7738 optional argument is one greater than the type of Object Size Checking to
7739 perform to determine the size of the destination. @xref{Object Size Checking}.
7740 The argument is meaningful only for functions that operate on character arrays
7741 but not for raw memory functions like @code{memcpy} which always make use
7742 of Object Size type-0. The option also warns for calls that specify a size
7743 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7744 The option produces the best results with optimization enabled but can detect
7745 a small subset of simple buffer overflows even without optimization in
7746 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7747 correspond to the standard functions. In any case, the option warns about
7748 just a subset of buffer overflows detected by the corresponding overflow
7749 checking built-ins. For example, the option issues a warning for
7750 the @code{strcpy} call below because it copies at least 5 characters
7751 (the string @code{"blue"} including the terminating NUL) into the buffer
7752 of size 4.
7753
7754 @smallexample
7755 enum Color @{ blue, purple, yellow @};
7756 const char* f (enum Color clr)
7757 @{
7758 static char buf [4];
7759 const char *str;
7760 switch (clr)
7761 @{
7762 case blue: str = "blue"; break;
7763 case purple: str = "purple"; break;
7764 case yellow: str = "yellow"; break;
7765 @}
7766
7767 return strcpy (buf, str); // warning here
7768 @}
7769 @end smallexample
7770
7771 Option @option{-Wstringop-overflow=2} is enabled by default.
7772
7773 @table @gcctabopt
7774 @opindex Wstringop-overflow
7775 @opindex Wno-stringop-overflow
7776 @item -Wstringop-overflow
7777 @itemx -Wstringop-overflow=1
7778 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7779 to determine the sizes of destination objects. At this setting the option
7780 does not warn for writes past the end of subobjects of larger objects accessed
7781 by pointers unless the size of the largest surrounding object is known. When
7782 the destination may be one of several objects it is assumed to be the largest
7783 one of them. On Linux systems, when optimization is enabled at this setting
7784 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7785 is defined to a non-zero value.
7786
7787 @item -Wstringop-overflow=2
7788 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7789 to determine the sizes of destination objects. At this setting the option
7790 warns about overflows when writing to members of the largest complete
7791 objects whose exact size is known. However, it does not warn for excessive
7792 writes to the same members of unknown objects referenced by pointers since
7793 they may point to arrays containing unknown numbers of elements. This is
7794 the default setting of the option.
7795
7796 @item -Wstringop-overflow=3
7797 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7798 to determine the sizes of destination objects. At this setting the option
7799 warns about overflowing the smallest object or data member. This is the
7800 most restrictive setting of the option that may result in warnings for safe
7801 code.
7802
7803 @item -Wstringop-overflow=4
7804 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7805 to determine the sizes of destination objects. At this setting the option
7806 warns about overflowing any data members, and when the destination is
7807 one of several objects it uses the size of the largest of them to decide
7808 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
7809 setting of the option may result in warnings for benign code.
7810 @end table
7811
7812 @opindex Wstringop-overread
7813 @opindex Wno-stringop-overread
7814 @item -Wno-stringop-overread
7815 Warn for calls to string manipulation functions such as @code{memchr}, or
7816 @code{strcpy} that are determined to read past the end of the source
7817 sequence.
7818
7819 Option @option{-Wstringop-overread} is enabled by default.
7820
7821 @opindex Wstringop-truncation
7822 @opindex Wno-stringop-truncation
7823 @item -Wno-stringop-truncation
7824 Do not warn for calls to bounded string manipulation functions
7825 such as @code{strncat},
7826 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7827 or leave the destination unchanged.
7828
7829 In the following example, the call to @code{strncat} specifies a bound that
7830 is less than the length of the source string. As a result, the copy of
7831 the source will be truncated and so the call is diagnosed. To avoid the
7832 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7833
7834 @smallexample
7835 void append (char *buf, size_t bufsize)
7836 @{
7837 strncat (buf, ".txt", 3);
7838 @}
7839 @end smallexample
7840
7841 As another example, the following call to @code{strncpy} results in copying
7842 to @code{d} just the characters preceding the terminating NUL, without
7843 appending the NUL to the end. Assuming the result of @code{strncpy} is
7844 necessarily a NUL-terminated string is a common mistake, and so the call
7845 is diagnosed. To avoid the warning when the result is not expected to be
7846 NUL-terminated, call @code{memcpy} instead.
7847
7848 @smallexample
7849 void copy (char *d, const char *s)
7850 @{
7851 strncpy (d, s, strlen (s));
7852 @}
7853 @end smallexample
7854
7855 In the following example, the call to @code{strncpy} specifies the size
7856 of the destination buffer as the bound. If the length of the source
7857 string is equal to or greater than this size the result of the copy will
7858 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
7859 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7860 element of the buffer to @code{NUL}.
7861
7862 @smallexample
7863 void copy (const char *s)
7864 @{
7865 char buf[80];
7866 strncpy (buf, s, sizeof buf);
7867 @dots{}
7868 @}
7869 @end smallexample
7870
7871 In situations where a character array is intended to store a sequence
7872 of bytes with no terminating @code{NUL} such an array may be annotated
7873 with attribute @code{nonstring} to avoid this warning. Such arrays,
7874 however, are not suitable arguments to functions that expect
7875 @code{NUL}-terminated strings. To help detect accidental misuses of
7876 such arrays GCC issues warnings unless it can prove that the use is
7877 safe. @xref{Common Variable Attributes}.
7878
7879 @opindex Wstrict-flex-arrays
7880 @opindex Wno-strict-flex-arrays
7881 @item -Wstrict-flex-arrays
7882 Warn about inproper usages of flexible array members
7883 according to the @var{level} of the @code{strict_flex_array (@var{level})}
7884 attribute attached to the trailing array field of a structure if it's
7885 available, otherwise according to the @var{level} of the option
7886 @option{-fstrict-flex-arrays=@var{level}}.
7887
7888 This option is effective only when @var{level} is bigger than 0. Otherwise,
7889 it will be ignored with a warning.
7890
7891 when @var{level}=1, warnings will be issued for a trailing array reference
7892 of a structure that have 2 or more elements if the trailing array is referenced
7893 as a flexible array member.
7894
7895 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
7896 issued for a trailing one-element array reference of a structure
7897 if the array is referenced as a flexible array member.
7898
7899 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
7900 issued for a trailing zero-length array reference of a structure
7901 if the array is referenced as a flexible array member.
7902
7903
7904 @opindex Wsuggest-attribute=
7905 @opindex Wno-suggest-attribute=
7906 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7907 Warn for cases where adding an attribute may be beneficial. The
7908 attributes currently supported are listed below.
7909
7910 @table @gcctabopt
7911 @opindex Wsuggest-attribute=pure
7912 @opindex Wno-suggest-attribute=pure
7913 @opindex Wsuggest-attribute=const
7914 @opindex Wno-suggest-attribute=const
7915 @opindex Wsuggest-attribute=noreturn
7916 @opindex Wno-suggest-attribute=noreturn
7917 @opindex Wmissing-noreturn
7918 @opindex Wno-missing-noreturn
7919 @opindex Wsuggest-attribute=malloc
7920 @opindex Wno-suggest-attribute=malloc
7921 @item -Wsuggest-attribute=pure
7922 @itemx -Wsuggest-attribute=const
7923 @itemx -Wsuggest-attribute=noreturn
7924 @itemx -Wmissing-noreturn
7925 @itemx -Wsuggest-attribute=malloc
7926
7927 Warn about functions that might be candidates for attributes
7928 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7929 only warns for functions visible in other compilation units or (in the case of
7930 @code{pure} and @code{const}) if it cannot prove that the function returns
7931 normally. A function returns normally if it doesn't contain an infinite loop or
7932 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7933 requires option @option{-fipa-pure-const}, which is enabled by default at
7934 @option{-O} and higher. Higher optimization levels improve the accuracy
7935 of the analysis.
7936
7937 @opindex Wsuggest-attribute=format
7938 @opindex Wmissing-format-attribute
7939 @opindex Wno-suggest-attribute=format
7940 @opindex Wno-missing-format-attribute
7941 @opindex Wformat
7942 @opindex Wno-format
7943 @item -Wsuggest-attribute=format
7944 @itemx -Wmissing-format-attribute
7945
7946 Warn about function pointers that might be candidates for @code{format}
7947 attributes. Note these are only possible candidates, not absolute ones.
7948 GCC guesses that function pointers with @code{format} attributes that
7949 are used in assignment, initialization, parameter passing or return
7950 statements should have a corresponding @code{format} attribute in the
7951 resulting type. I.e.@: the left-hand side of the assignment or
7952 initialization, the type of the parameter variable, or the return type
7953 of the containing function respectively should also have a @code{format}
7954 attribute to avoid the warning.
7955
7956 GCC also warns about function definitions that might be
7957 candidates for @code{format} attributes. Again, these are only
7958 possible candidates. GCC guesses that @code{format} attributes
7959 might be appropriate for any function that calls a function like
7960 @code{vprintf} or @code{vscanf}, but this might not always be the
7961 case, and some functions for which @code{format} attributes are
7962 appropriate may not be detected.
7963
7964 @opindex Wsuggest-attribute=cold
7965 @opindex Wno-suggest-attribute=cold
7966 @item -Wsuggest-attribute=cold
7967
7968 Warn about functions that might be candidates for @code{cold} attribute. This
7969 is based on static detection and generally only warns about functions which
7970 always leads to a call to another @code{cold} function such as wrappers of
7971 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7972 @end table
7973
7974 @opindex Wno-alloc-zero
7975 @opindex Walloc-zero
7976 @item -Walloc-zero
7977 Warn about calls to allocation functions decorated with attribute
7978 @code{alloc_size} that specify zero bytes, including those to the built-in
7979 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7980 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7981 when called with a zero size differs among implementations (and in the case
7982 of @code{realloc} has been deprecated) relying on it may result in subtle
7983 portability bugs and should be avoided.
7984
7985 @opindex Walloc-size-larger-than=
7986 @opindex Wno-alloc-size-larger-than
7987 @item -Walloc-size-larger-than=@var{byte-size}
7988 Warn about calls to functions decorated with attribute @code{alloc_size}
7989 that attempt to allocate objects larger than the specified number of bytes,
7990 or where the result of the size computation in an integer type with infinite
7991 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7992 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7993 Warnings controlled by the option can be disabled either by specifying
7994 @var{byte-size} of @samp{SIZE_MAX} or more or by
7995 @option{-Wno-alloc-size-larger-than}.
7996 @xref{Function Attributes}.
7997
7998 @opindex Wno-alloc-size-larger-than
7999 @item -Wno-alloc-size-larger-than
8000 Disable @option{-Walloc-size-larger-than=} warnings. The option is
8001 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8002 larger.
8003
8004 @opindex Wno-alloca
8005 @opindex Walloca
8006 @item -Walloca
8007 This option warns on all uses of @code{alloca} in the source.
8008
8009 @opindex Walloca-larger-than=
8010 @opindex Wno-alloca-larger-than
8011 @item -Walloca-larger-than=@var{byte-size}
8012 This option warns on calls to @code{alloca} with an integer argument whose
8013 value is either zero, or that is not bounded by a controlling predicate
8014 that limits its value to at most @var{byte-size}. It also warns for calls
8015 to @code{alloca} where the bound value is unknown. Arguments of non-integer
8016 types are considered unbounded even if they appear to be constrained to
8017 the expected range.
8018
8019 For example, a bounded case of @code{alloca} could be:
8020
8021 @smallexample
8022 void func (size_t n)
8023 @{
8024 void *p;
8025 if (n <= 1000)
8026 p = alloca (n);
8027 else
8028 p = malloc (n);
8029 f (p);
8030 @}
8031 @end smallexample
8032
8033 In the above example, passing @code{-Walloca-larger-than=1000} would not
8034 issue a warning because the call to @code{alloca} is known to be at most
8035 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
8036 the compiler would emit a warning.
8037
8038 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8039 controlling predicate constraining its integer argument. For example:
8040
8041 @smallexample
8042 void func ()
8043 @{
8044 void *p = alloca (n);
8045 f (p);
8046 @}
8047 @end smallexample
8048
8049 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8050 a warning, but this time because of the lack of bounds checking.
8051
8052 Note, that even seemingly correct code involving signed integers could
8053 cause a warning:
8054
8055 @smallexample
8056 void func (signed int n)
8057 @{
8058 if (n < 500)
8059 @{
8060 p = alloca (n);
8061 f (p);
8062 @}
8063 @}
8064 @end smallexample
8065
8066 In the above example, @var{n} could be negative, causing a larger than
8067 expected argument to be implicitly cast into the @code{alloca} call.
8068
8069 This option also warns when @code{alloca} is used in a loop.
8070
8071 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8072 but is usually only effective when @option{-ftree-vrp} is active (default
8073 for @option{-O2} and above).
8074
8075 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8076
8077 @opindex Wno-alloca-larger-than
8078 @item -Wno-alloca-larger-than
8079 Disable @option{-Walloca-larger-than=} warnings. The option is
8080 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8081
8082 @opindex Warith-conversion
8083 @opindex Wno-arith-conversion
8084 @item -Warith-conversion
8085 Do warn about implicit conversions from arithmetic operations even
8086 when conversion of the operands to the same type cannot change their
8087 values. This affects warnings from @option{-Wconversion},
8088 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8089
8090 @smallexample
8091 @group
8092 void f (char c, int i)
8093 @{
8094 c = c + i; // warns with @option{-Wconversion}
8095 c = c + 1; // only warns with @option{-Warith-conversion}
8096 @}
8097 @end group
8098 @end smallexample
8099
8100 @opindex Wno-array-bounds
8101 @opindex Warray-bounds
8102 @item -Warray-bounds
8103 @itemx -Warray-bounds=@var{n}
8104 Warn about out of bounds subscripts or offsets into arrays. This warning
8105 is enabled by @option{-Wall}. It is more effective when @option{-ftree-vrp}
8106 is active (the default for @option{-O2} and above) but a subset of instances
8107 are issued even without optimization.
8108
8109 By default, the trailing array of a structure will be treated as a flexible
8110 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8111 if it is declared as either a flexible array member per C99 standard onwards
8112 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8113 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8114 zero-length arrays or one-element arrays are not warned by default.
8115
8116 You can add the option @option{-fstrict-flex-arrays} or
8117 @option{-fstrict-flex-arrays=@var{level}} to control how this
8118 option treat trailing array of a structure as a flexible array member:
8119
8120 when @var{level}<=1, no change to the default behavior.
8121
8122 when @var{level}=2, additional warnings will be issued for out of bounds
8123 subscripts or offsets into one-element arrays;
8124
8125 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8126 issued for out of bounds subscripts or offsets into zero-length arrays.
8127
8128 @table @gcctabopt
8129 @item -Warray-bounds=1
8130 This is the default warning level of @option{-Warray-bounds} and is enabled
8131 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8132
8133 @item -Warray-bounds=2
8134 This warning level also warns about the intermediate results of pointer
8135 arithmetic that may yield out of bounds values. This warning level may
8136 give a larger number of false positives and is deactivated by default.
8137 @end table
8138
8139 @opindex Warray-compare
8140 @opindex Wno-array-compare
8141 @item -Warray-compare
8142 Warn about equality and relational comparisons between two operands of array
8143 type. This comparison was deprecated in C++20. For example:
8144
8145 @smallexample
8146 int arr1[5];
8147 int arr2[5];
8148 bool same = arr1 == arr2;
8149 @end smallexample
8150
8151 @option{-Warray-compare} is enabled by @option{-Wall}.
8152
8153 @opindex Wno-array-parameter
8154 @item -Warray-parameter
8155 @itemx -Warray-parameter=@var{n}
8156 Warn about redeclarations of functions involving arguments of array or
8157 pointer types of inconsistent kinds or forms, and enable the detection
8158 of out-of-bounds accesses to such parameters by warnings such as
8159 @option{-Warray-bounds}.
8160
8161 If the first function declaration uses the array form the bound specified
8162 in the array is assumed to be the minimum number of elements expected to
8163 be provided in calls to the function and the maximum number of elements
8164 accessed by it. Failing to provide arguments of sufficient size or accessing
8165 more than the maximum number of elements may be diagnosed by warnings such
8166 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
8167 involving array parameters declared using the @code{T[static N]} form.
8168
8169 For example, the warning triggers for the following redeclarations because
8170 the first one allows an array of any size to be passed to @code{f} while
8171 the second one with the keyword @code{static} specifies that the array
8172 argument must have at least four elements.
8173
8174 @smallexample
8175 void f (int[static 4]);
8176 void f (int[]); // warning (inconsistent array form)
8177
8178 void g (void)
8179 @{
8180 int *p = (int *)malloc (4);
8181 f (p); // warning (array too small)
8182 @dots{}
8183 @}
8184 @end smallexample
8185
8186 At level 2 the warning also triggers for redeclarations involving any other
8187 inconsistency in array or pointer argument forms denoting array sizes.
8188 Pointers and arrays of unspecified bound are considered equivalent and do
8189 not trigger a warning.
8190
8191 @smallexample
8192 void g (int*);
8193 void g (int[]); // no warning
8194 void g (int[8]); // warning (inconsistent array bound)
8195 @end smallexample
8196
8197 @option{-Warray-parameter=2} is included in @option{-Wall}. The
8198 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8199 involving Variable Length Array arguments.
8200
8201 @opindex Wattribute-alias
8202 @opindex Wno-attribute-alias
8203 @item -Wattribute-alias=@var{n}
8204 @itemx -Wno-attribute-alias
8205 Warn about declarations using the @code{alias} and similar attributes whose
8206 target is incompatible with the type of the alias.
8207 @xref{Function Attributes,,Declaring Attributes of Functions}.
8208
8209 @table @gcctabopt
8210 @item -Wattribute-alias=1
8211 The default warning level of the @option{-Wattribute-alias} option diagnoses
8212 incompatibilities between the type of the alias declaration and that of its
8213 target. Such incompatibilities are typically indicative of bugs.
8214
8215 @item -Wattribute-alias=2
8216
8217 At this level @option{-Wattribute-alias} also diagnoses cases where
8218 the attributes of the alias declaration are more restrictive than the
8219 attributes applied to its target. These mismatches can potentially
8220 result in incorrect code generation. In other cases they may be
8221 benign and could be resolved simply by adding the missing attribute to
8222 the target. For comparison, see the @option{-Wmissing-attributes}
8223 option, which controls diagnostics when the alias declaration is less
8224 restrictive than the target, rather than more restrictive.
8225
8226 Attributes considered include @code{alloc_align}, @code{alloc_size},
8227 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8228 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8229 @code{returns_nonnull}, and @code{returns_twice}.
8230 @end table
8231
8232 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8233 This is the default. You can disable these warnings with either
8234 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8235
8236 @opindex Wbidi-chars=
8237 @opindex Wbidi-chars
8238 @opindex Wno-bidi-chars
8239 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8240 Warn about possibly misleading UTF-8 bidirectional control characters in
8241 comments, string literals, character constants, and identifiers. Such
8242 characters can change left-to-right writing direction into right-to-left
8243 (and vice versa), which can cause confusion between the logical order and
8244 visual order. This may be dangerous; for instance, it may seem that a piece
8245 of code is not commented out, whereas it in fact is.
8246
8247 There are three levels of warning supported by GCC@. The default is
8248 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8249 bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
8250 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8251 characters.
8252
8253 By default, this warning does not warn about UCNs. It is, however, possible
8254 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8255 @option{-Wbidi-chars=any,ucn}. Using @option{-Wbidi-chars=ucn} is valid,
8256 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8257 @option{-Wbidi-chars=any} was specified.
8258
8259 @opindex Wno-bool-compare
8260 @opindex Wbool-compare
8261 @item -Wbool-compare
8262 Warn about boolean expression compared with an integer value different from
8263 @code{true}/@code{false}. For instance, the following comparison is
8264 always false:
8265 @smallexample
8266 int n = 5;
8267 @dots{}
8268 if ((n > 1) == 2) @{ @dots{} @}
8269 @end smallexample
8270 This warning is enabled by @option{-Wall}.
8271
8272 @opindex Wno-bool-operation
8273 @opindex Wbool-operation
8274 @item -Wbool-operation
8275 Warn about suspicious operations on expressions of a boolean type. For
8276 instance, bitwise negation of a boolean is very likely a bug in the program.
8277 For C, this warning also warns about incrementing or decrementing a boolean,
8278 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
8279 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8280
8281 This warning is enabled by @option{-Wall}.
8282
8283 @opindex Wno-duplicated-branches
8284 @opindex Wduplicated-branches
8285 @item -Wduplicated-branches
8286 Warn when an if-else has identical branches. This warning detects cases like
8287 @smallexample
8288 if (p != NULL)
8289 return 0;
8290 else
8291 return 0;
8292 @end smallexample
8293 It doesn't warn when both branches contain just a null statement. This warning
8294 also warn for conditional operators:
8295 @smallexample
8296 int i = x ? *p : *p;
8297 @end smallexample
8298
8299 @opindex Wno-duplicated-cond
8300 @opindex Wduplicated-cond
8301 @item -Wduplicated-cond
8302 Warn about duplicated conditions in an if-else-if chain. For instance,
8303 warn for the following code:
8304 @smallexample
8305 if (p->q != NULL) @{ @dots{} @}
8306 else if (p->q != NULL) @{ @dots{} @}
8307 @end smallexample
8308
8309 @opindex Wno-frame-address
8310 @opindex Wframe-address
8311 @item -Wframe-address
8312 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8313 is called with an argument greater than 0. Such calls may return indeterminate
8314 values or crash the program. The warning is included in @option{-Wall}.
8315
8316 @opindex Wno-discarded-qualifiers
8317 @opindex Wdiscarded-qualifiers
8318 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8319 Do not warn if type qualifiers on pointers are being discarded.
8320 Typically, the compiler warns if a @code{const char *} variable is
8321 passed to a function that takes a @code{char *} parameter. This option
8322 can be used to suppress such a warning.
8323
8324 @opindex Wno-discarded-array-qualifiers
8325 @opindex Wdiscarded-array-qualifiers
8326 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8327 Do not warn if type qualifiers on arrays which are pointer targets
8328 are being discarded. Typically, the compiler warns if a
8329 @code{const int (*)[]} variable is passed to a function that
8330 takes a @code{int (*)[]} parameter. This option can be used to
8331 suppress such a warning.
8332
8333 @opindex Wno-incompatible-pointer-types
8334 @opindex Wincompatible-pointer-types
8335 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8336 Do not warn when there is a conversion between pointers that have incompatible
8337 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
8338 which warns for pointer argument passing or assignment with different
8339 signedness.
8340
8341 @opindex Wno-int-conversion
8342 @opindex Wint-conversion
8343 @item -Wno-int-conversion @r{(C and Objective-C only)}
8344 Do not warn about incompatible integer to pointer and pointer to integer
8345 conversions. This warning is about implicit conversions; for explicit
8346 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8347 @option{-Wno-pointer-to-int-cast} may be used.
8348
8349 @opindex Wzero-length-bounds
8350 @opindex Wzero-length-bounds
8351 @item -Wzero-length-bounds
8352 Warn about accesses to elements of zero-length array members that might
8353 overlap other members of the same object. Declaring interior zero-length
8354 arrays is discouraged because accesses to them are undefined.
8355 @xref{Zero Length}.
8356
8357 For example, the first two stores in function @code{bad} are diagnosed
8358 because the array elements overlap the subsequent members @code{b} and
8359 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
8360 because it is beyond the bounds of the enclosing object.
8361
8362 @smallexample
8363 struct X @{ int a[0]; int b, c; @};
8364 struct X x;
8365
8366 void bad (void)
8367 @{
8368 x.a[0] = 0; // -Wzero-length-bounds
8369 x.a[1] = 1; // -Wzero-length-bounds
8370 x.a[2] = 2; // -Warray-bounds
8371 @}
8372 @end smallexample
8373
8374 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8375
8376 @opindex Wno-div-by-zero
8377 @opindex Wdiv-by-zero
8378 @item -Wno-div-by-zero
8379 Do not warn about compile-time integer division by zero. Floating-point
8380 division by zero is not warned about, as it can be a legitimate way of
8381 obtaining infinities and NaNs.
8382
8383 @opindex Wsystem-headers
8384 @opindex Wno-system-headers
8385 @cindex warnings from system headers
8386 @cindex system headers, warnings from
8387 @item -Wsystem-headers
8388 Print warning messages for constructs found in system header files.
8389 Warnings from system headers are normally suppressed, on the assumption
8390 that they usually do not indicate real problems and would only make the
8391 compiler output harder to read. Using this command-line option tells
8392 GCC to emit warnings from system headers as if they occurred in user
8393 code. However, note that using @option{-Wall} in conjunction with this
8394 option does @emph{not} warn about unknown pragmas in system
8395 headers---for that, @option{-Wunknown-pragmas} must also be used.
8396
8397 @opindex Wtautological-compare
8398 @opindex Wno-tautological-compare
8399 @item -Wtautological-compare
8400 Warn if a self-comparison always evaluates to true or false. This
8401 warning detects various mistakes such as:
8402 @smallexample
8403 int i = 1;
8404 @dots{}
8405 if (i > i) @{ @dots{} @}
8406 @end smallexample
8407
8408 This warning also warns about bitwise comparisons that always evaluate
8409 to true or false, for instance:
8410 @smallexample
8411 if ((a & 16) == 10) @{ @dots{} @}
8412 @end smallexample
8413 will always be false.
8414
8415 This warning is enabled by @option{-Wall}.
8416
8417 @opindex Wtrampolines
8418 @opindex Wno-trampolines
8419 @item -Wtrampolines
8420 Warn about trampolines generated for pointers to nested functions.
8421 A trampoline is a small piece of data or code that is created at run
8422 time on the stack when the address of a nested function is taken, and is
8423 used to call the nested function indirectly. For some targets, it is
8424 made up of data only and thus requires no special treatment. But, for
8425 most targets, it is made up of code and thus requires the stack to be
8426 made executable in order for the program to work properly.
8427
8428 @opindex Wfloat-equal
8429 @opindex Wno-float-equal
8430 @item -Wfloat-equal
8431 Warn if floating-point values are used in equality comparisons.
8432
8433 The idea behind this is that sometimes it is convenient (for the
8434 programmer) to consider floating-point values as approximations to
8435 infinitely precise real numbers. If you are doing this, then you need
8436 to compute (by analyzing the code, or in some other way) the maximum or
8437 likely maximum error that the computation introduces, and allow for it
8438 when performing comparisons (and when producing output, but that's a
8439 different problem). In particular, instead of testing for equality, you
8440 should check to see whether the two values have ranges that overlap; and
8441 this is done with the relational operators, so equality comparisons are
8442 probably mistaken.
8443
8444 @opindex Wtraditional
8445 @opindex Wno-traditional
8446 @item -Wtraditional @r{(C and Objective-C only)}
8447 Warn about certain constructs that behave differently in traditional and
8448 ISO C@. Also warn about ISO C constructs that have no traditional C
8449 equivalent, and/or problematic constructs that should be avoided.
8450
8451 @itemize @bullet
8452 @item
8453 Macro parameters that appear within string literals in the macro body.
8454 In traditional C macro replacement takes place within string literals,
8455 but in ISO C it does not.
8456
8457 @item
8458 In traditional C, some preprocessor directives did not exist.
8459 Traditional preprocessors only considered a line to be a directive
8460 if the @samp{#} appeared in column 1 on the line. Therefore
8461 @option{-Wtraditional} warns about directives that traditional C
8462 understands but ignores because the @samp{#} does not appear as the
8463 first character on the line. It also suggests you hide directives like
8464 @code{#pragma} not understood by traditional C by indenting them. Some
8465 traditional implementations do not recognize @code{#elif}, so this option
8466 suggests avoiding it altogether.
8467
8468 @item
8469 A function-like macro that appears without arguments.
8470
8471 @item
8472 The unary plus operator.
8473
8474 @item
8475 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8476 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
8477 constants.) Note, these suffixes appear in macros defined in the system
8478 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8479 Use of these macros in user code might normally lead to spurious
8480 warnings, however GCC's integrated preprocessor has enough context to
8481 avoid warning in these cases.
8482
8483 @item
8484 A function declared external in one block and then used after the end of
8485 the block.
8486
8487 @item
8488 A @code{switch} statement has an operand of type @code{long}.
8489
8490 @item
8491 A non-@code{static} function declaration follows a @code{static} one.
8492 This construct is not accepted by some traditional C compilers.
8493
8494 @item
8495 The ISO type of an integer constant has a different width or
8496 signedness from its traditional type. This warning is only issued if
8497 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
8498 typically represent bit patterns, are not warned about.
8499
8500 @item
8501 Usage of ISO string concatenation is detected.
8502
8503 @item
8504 Initialization of automatic aggregates.
8505
8506 @item
8507 Identifier conflicts with labels. Traditional C lacks a separate
8508 namespace for labels.
8509
8510 @item
8511 Initialization of unions. If the initializer is zero, the warning is
8512 omitted. This is done under the assumption that the zero initializer in
8513 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8514 initializer warnings and relies on default initialization to zero in the
8515 traditional C case.
8516
8517 @item
8518 Conversions by prototypes between fixed/floating-point values and vice
8519 versa. The absence of these prototypes when compiling with traditional
8520 C causes serious problems. This is a subset of the possible
8521 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8522
8523 @item
8524 Use of ISO C style function definitions. This warning intentionally is
8525 @emph{not} issued for prototype declarations or variadic functions
8526 because these ISO C features appear in your code when using
8527 libiberty's traditional C compatibility macros, @code{PARAMS} and
8528 @code{VPARAMS}. This warning is also bypassed for nested functions
8529 because that feature is already a GCC extension and thus not relevant to
8530 traditional C compatibility.
8531 @end itemize
8532
8533 @opindex Wtraditional-conversion
8534 @opindex Wno-traditional-conversion
8535 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8536 Warn if a prototype causes a type conversion that is different from what
8537 would happen to the same argument in the absence of a prototype. This
8538 includes conversions of fixed point to floating and vice versa, and
8539 conversions changing the width or signedness of a fixed-point argument
8540 except when the same as the default promotion.
8541
8542 @opindex Wdeclaration-after-statement
8543 @opindex Wno-declaration-after-statement
8544 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8545 Warn when a declaration is found after a statement in a block. This
8546 construct, known from C++, was introduced with ISO C99 and is by default
8547 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
8548
8549 @opindex Wshadow
8550 @opindex Wno-shadow
8551 @item -Wshadow
8552 Warn whenever a local variable or type declaration shadows another
8553 variable, parameter, type, class member (in C++), or instance variable
8554 (in Objective-C) or whenever a built-in function is shadowed. Note
8555 that in C++, the compiler warns if a local variable shadows an
8556 explicit typedef, but not if it shadows a struct/class/enum.
8557 If this warning is enabled, it includes also all instances of
8558 local shadowing. This means that @option{-Wno-shadow=local}
8559 and @option{-Wno-shadow=compatible-local} are ignored when
8560 @option{-Wshadow} is used.
8561 Same as @option{-Wshadow=global}.
8562
8563 @opindex Wno-shadow-ivar
8564 @opindex Wshadow-ivar
8565 @item -Wno-shadow-ivar @r{(Objective-C only)}
8566 Do not warn whenever a local variable shadows an instance variable in an
8567 Objective-C method.
8568
8569 @opindex Wshadow=global
8570 @item -Wshadow=global
8571 Warn for any shadowing.
8572 Same as @option{-Wshadow}.
8573
8574 @opindex Wshadow=local
8575 @item -Wshadow=local
8576 Warn when a local variable shadows another local variable or parameter.
8577
8578 @opindex Wshadow=compatible-local
8579 @item -Wshadow=compatible-local
8580 Warn when a local variable shadows another local variable or parameter
8581 whose type is compatible with that of the shadowing variable. In C++,
8582 type compatibility here means the type of the shadowing variable can be
8583 converted to that of the shadowed variable. The creation of this flag
8584 (in addition to @option{-Wshadow=local}) is based on the idea that when
8585 a local variable shadows another one of incompatible type, it is most
8586 likely intentional, not a bug or typo, as shown in the following example:
8587
8588 @smallexample
8589 @group
8590 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8591 @{
8592 for (int i = 0; i < N; ++i)
8593 @{
8594 ...
8595 @}
8596 ...
8597 @}
8598 @end group
8599 @end smallexample
8600
8601 Since the two variable @code{i} in the example above have incompatible types,
8602 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8603 Because their types are incompatible, if a programmer accidentally uses one
8604 in place of the other, type checking is expected to catch that and emit an
8605 error or warning. Use of this flag instead of @option{-Wshadow=local} can
8606 possibly reduce the number of warnings triggered by intentional shadowing.
8607 Note that this also means that shadowing @code{const char *i} by
8608 @code{char *i} does not emit a warning.
8609
8610 This warning is also enabled by @option{-Wshadow=local}.
8611
8612 @opindex Wlarger-than=
8613 @opindex Wlarger-than-@var{byte-size}
8614 @item -Wlarger-than=@var{byte-size}
8615 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8616 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8617 Warnings controlled by the option can be disabled either by specifying
8618 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8619
8620 Also warn for calls to bounded functions such as @code{memchr} or
8621 @code{strnlen} that specify a bound greater than the largest possible
8622 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
8623 can only be disabled by @option{-Wno-larger-than}.
8624
8625 @opindex Wno-larger-than
8626 @item -Wno-larger-than
8627 Disable @option{-Wlarger-than=} warnings. The option is equivalent
8628 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8629
8630 @opindex Wframe-larger-than=
8631 @opindex Wno-frame-larger-than
8632 @item -Wframe-larger-than=@var{byte-size}
8633 Warn if the size of a function frame exceeds @var{byte-size}.
8634 The computation done to determine the stack frame size is approximate
8635 and not conservative.
8636 The actual requirements may be somewhat greater than @var{byte-size}
8637 even if you do not get a warning. In addition, any space allocated
8638 via @code{alloca}, variable-length arrays, or related constructs
8639 is not included by the compiler when determining
8640 whether or not to issue a warning.
8641 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8642 Warnings controlled by the option can be disabled either by specifying
8643 @var{byte-size} of @samp{SIZE_MAX} or more or by
8644 @option{-Wno-frame-larger-than}.
8645
8646 @opindex Wno-frame-larger-than
8647 @item -Wno-frame-larger-than
8648 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8649 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8650
8651 @opindex Wfree-nonheap-object
8652 @opindex Wno-free-nonheap-object
8653 @item -Wfree-nonheap-object
8654 Warn when attempting to deallocate an object that was either not allocated
8655 on the heap, or by using a pointer that was not returned from a prior call
8656 to the corresponding allocation function. For example, because the call
8657 to @code{stpcpy} returns a pointer to the terminating nul character and
8658 not to the beginning of the object, the call to @code{free} below is
8659 diagnosed.
8660
8661 @smallexample
8662 void f (char *p)
8663 @{
8664 p = stpcpy (p, "abc");
8665 // ...
8666 free (p); // warning
8667 @}
8668 @end smallexample
8669
8670 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8671
8672 @opindex Wstack-usage
8673 @opindex Wno-stack-usage
8674 @item -Wstack-usage=@var{byte-size}
8675 Warn if the stack usage of a function might exceed @var{byte-size}.
8676 The computation done to determine the stack usage is conservative.
8677 Any space allocated via @code{alloca}, variable-length arrays, or related
8678 constructs is included by the compiler when determining whether or not to
8679 issue a warning.
8680
8681 The message is in keeping with the output of @option{-fstack-usage}.
8682
8683 @itemize
8684 @item
8685 If the stack usage is fully static but exceeds the specified amount, it's:
8686
8687 @smallexample
8688 warning: stack usage is 1120 bytes
8689 @end smallexample
8690 @item
8691 If the stack usage is (partly) dynamic but bounded, it's:
8692
8693 @smallexample
8694 warning: stack usage might be 1648 bytes
8695 @end smallexample
8696 @item
8697 If the stack usage is (partly) dynamic and not bounded, it's:
8698
8699 @smallexample
8700 warning: stack usage might be unbounded
8701 @end smallexample
8702 @end itemize
8703
8704 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8705 Warnings controlled by the option can be disabled either by specifying
8706 @var{byte-size} of @samp{SIZE_MAX} or more or by
8707 @option{-Wno-stack-usage}.
8708
8709 @opindex Wno-stack-usage
8710 @item -Wno-stack-usage
8711 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8712 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8713
8714 @opindex Wunsafe-loop-optimizations
8715 @opindex Wno-unsafe-loop-optimizations
8716 @item -Wunsafe-loop-optimizations
8717 Warn if the loop cannot be optimized because the compiler cannot
8718 assume anything on the bounds of the loop indices. With
8719 @option{-funsafe-loop-optimizations} warn if the compiler makes
8720 such assumptions.
8721
8722 @opindex Wno-pedantic-ms-format
8723 @opindex Wpedantic-ms-format
8724 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8725 When used in combination with @option{-Wformat}
8726 and @option{-pedantic} without GNU extensions, this option
8727 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8728 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8729 which depend on the MS runtime.
8730
8731 @opindex Wpointer-arith
8732 @opindex Wno-pointer-arith
8733 @item -Wpointer-arith
8734 Warn about anything that depends on the ``size of'' a function type or
8735 of @code{void}. GNU C assigns these types a size of 1, for
8736 convenience in calculations with @code{void *} pointers and pointers
8737 to functions. In C++, warn also when an arithmetic operation involves
8738 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8739
8740 @opindex Wpointer-compare
8741 @opindex Wno-pointer-compare
8742 @item -Wno-pointer-compare
8743 Do not warn if a pointer is compared with a zero character constant.
8744 This usually
8745 means that the pointer was meant to be dereferenced. For example:
8746
8747 @smallexample
8748 const char *p = foo ();
8749 if (p == '\0')
8750 return 42;
8751 @end smallexample
8752
8753 Note that the code above is invalid in C++11.
8754
8755 This warning is enabled by default.
8756
8757 @opindex Wtsan
8758 @opindex Wno-tsan
8759 @item -Wtsan
8760 Warn about unsupported features in ThreadSanitizer.
8761
8762 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8763 can report false positives.
8764
8765 This warning is enabled by default.
8766
8767 @opindex Wtype-limits
8768 @opindex Wno-type-limits
8769 @item -Wtype-limits
8770 Warn if a comparison is always true or always false due to the limited
8771 range of the data type, but do not warn for constant expressions. For
8772 example, warn if an unsigned variable is compared against zero with
8773 @code{<} or @code{>=}. This warning is also enabled by
8774 @option{-Wextra}.
8775
8776 @opindex Wabsolute-value
8777 @opindex Wno-absolute-value
8778 @item -Wabsolute-value @r{(C and Objective-C only)}
8779 Warn for calls to standard functions that compute the absolute value
8780 of an argument when a more appropriate standard function is available.
8781 For example, calling @code{abs(3.14)} triggers the warning because the
8782 appropriate function to call to compute the absolute value of a double
8783 argument is @code{fabs}. The option also triggers warnings when the
8784 argument in a call to such a function has an unsigned type. This
8785 warning can be suppressed with an explicit type cast and it is also
8786 enabled by @option{-Wextra}.
8787
8788 @include cppwarnopts.texi
8789
8790 @opindex Wbad-function-cast
8791 @opindex Wno-bad-function-cast
8792 @item -Wbad-function-cast @r{(C and Objective-C only)}
8793 Warn when a function call is cast to a non-matching type.
8794 For example, warn if a call to a function returning an integer type
8795 is cast to a pointer type.
8796
8797 @opindex Wc90-c99-compat
8798 @opindex Wno-c90-c99-compat
8799 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8800 Warn about features not present in ISO C90, but present in ISO C99.
8801 For instance, warn about use of variable length arrays, @code{long long}
8802 type, @code{bool} type, compound literals, designated initializers, and so
8803 on. This option is independent of the standards mode. Warnings are disabled
8804 in the expression that follows @code{__extension__}.
8805
8806 @opindex Wc99-c11-compat
8807 @opindex Wno-c99-c11-compat
8808 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8809 Warn about features not present in ISO C99, but present in ISO C11.
8810 For instance, warn about use of anonymous structures and unions,
8811 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8812 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8813 and so on. This option is independent of the standards mode. Warnings are
8814 disabled in the expression that follows @code{__extension__}.
8815
8816 @opindex Wc11-c2x-compat
8817 @opindex Wno-c11-c2x-compat
8818 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8819 Warn about features not present in ISO C11, but present in ISO C2X.
8820 For instance, warn about omitting the string in @code{_Static_assert},
8821 use of @samp{[[]]} syntax for attributes, use of decimal
8822 floating-point types, and so on. This option is independent of the
8823 standards mode. Warnings are disabled in the expression that follows
8824 @code{__extension__}.
8825
8826 @opindex Wc++-compat
8827 @opindex Wno-c++-compat
8828 @item -Wc++-compat @r{(C and Objective-C only)}
8829 Warn about ISO C constructs that are outside of the common subset of
8830 ISO C and ISO C++, e.g.@: request for implicit conversion from
8831 @code{void *} to a pointer to non-@code{void} type.
8832
8833 @opindex Wc++11-compat
8834 @opindex Wno-c++11-compat
8835 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8836 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8837 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8838 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8839 enabled by @option{-Wall}.
8840
8841 @opindex Wc++14-compat
8842 @opindex Wno-c++14-compat
8843 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8844 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8845 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8846
8847 @opindex Wc++17-compat
8848 @opindex Wno-c++17-compat
8849 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8850 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8851 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8852
8853 @opindex Wc++20-compat
8854 @opindex Wno-c++20-compat
8855 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8856 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8857 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8858
8859 @opindex Wc++11-extensions
8860 @opindex Wno-c++11-extensions
8861 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8862 Do not warn about C++11 constructs in code being compiled using
8863 an older C++ standard. Even without this option, some C++11 constructs
8864 will only be diagnosed if @option{-Wpedantic} is used.
8865
8866 @opindex Wc++14-extensions
8867 @opindex Wno-c++14-extensions
8868 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8869 Do not warn about C++14 constructs in code being compiled using
8870 an older C++ standard. Even without this option, some C++14 constructs
8871 will only be diagnosed if @option{-Wpedantic} is used.
8872
8873 @opindex Wc++17-extensions
8874 @opindex Wno-c++17-extensions
8875 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8876 Do not warn about C++17 constructs in code being compiled using
8877 an older C++ standard. Even without this option, some C++17 constructs
8878 will only be diagnosed if @option{-Wpedantic} is used.
8879
8880 @opindex Wc++20-extensions
8881 @opindex Wno-c++20-extensions
8882 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8883 Do not warn about C++20 constructs in code being compiled using
8884 an older C++ standard. Even without this option, some C++20 constructs
8885 will only be diagnosed if @option{-Wpedantic} is used.
8886
8887 @opindex Wc++23-extensions
8888 @opindex Wno-c++23-extensions
8889 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8890 Do not warn about C++23 constructs in code being compiled using
8891 an older C++ standard. Even without this option, some C++23 constructs
8892 will only be diagnosed if @option{-Wpedantic} is used.
8893
8894 @opindex Wcast-qual
8895 @opindex Wno-cast-qual
8896 @item -Wcast-qual
8897 Warn whenever a pointer is cast so as to remove a type qualifier from
8898 the target type. For example, warn if a @code{const char *} is cast
8899 to an ordinary @code{char *}.
8900
8901 Also warn when making a cast that introduces a type qualifier in an
8902 unsafe way. For example, casting @code{char **} to @code{const char **}
8903 is unsafe, as in this example:
8904
8905 @smallexample
8906 /* p is char ** value. */
8907 const char **q = (const char **) p;
8908 /* Assignment of readonly string to const char * is OK. */
8909 *q = "string";
8910 /* Now char** pointer points to read-only memory. */
8911 **p = 'b';
8912 @end smallexample
8913
8914 @opindex Wcast-align
8915 @opindex Wno-cast-align
8916 @item -Wcast-align
8917 Warn whenever a pointer is cast such that the required alignment of the
8918 target is increased. For example, warn if a @code{char *} is cast to
8919 an @code{int *} on machines where integers can only be accessed at
8920 two- or four-byte boundaries.
8921
8922 @opindex Wcast-align=strict
8923 @item -Wcast-align=strict
8924 Warn whenever a pointer is cast such that the required alignment of the
8925 target is increased. For example, warn if a @code{char *} is cast to
8926 an @code{int *} regardless of the target machine.
8927
8928 @opindex Wcast-function-type
8929 @opindex Wno-cast-function-type
8930 @item -Wcast-function-type
8931 Warn when a function pointer is cast to an incompatible function pointer.
8932 In a cast involving function types with a variable argument list only
8933 the types of initial arguments that are provided are considered.
8934 Any parameter of pointer-type matches any other pointer-type. Any benign
8935 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8936 on ILP32 targets. Likewise type qualifiers are ignored. The function
8937 type @code{void (*) (void)} is special and matches everything, which can
8938 be used to suppress this warning.
8939 In a cast involving pointer to member types this warning warns whenever
8940 the type cast is changing the pointer to member type.
8941 This warning is enabled by @option{-Wextra}.
8942
8943 @opindex Wwrite-strings
8944 @opindex Wno-write-strings
8945 @item -Wwrite-strings
8946 When compiling C, give string constants the type @code{const
8947 char[@var{length}]} so that copying the address of one into a
8948 non-@code{const} @code{char *} pointer produces a warning. These
8949 warnings help you find at compile time code that can try to write
8950 into a string constant, but only if you have been very careful about
8951 using @code{const} in declarations and prototypes. Otherwise, it is
8952 just a nuisance. This is why we did not make @option{-Wall} request
8953 these warnings.
8954
8955 When compiling C++, warn about the deprecated conversion from string
8956 literals to @code{char *}. This warning is enabled by default for C++
8957 programs.
8958
8959 @opindex Wclobbered
8960 @opindex Wno-clobbered
8961 @item -Wclobbered
8962 Warn for variables that might be changed by @code{longjmp} or
8963 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8964
8965 @opindex Wcomplain-wrong-lang
8966 @opindex Wno-complain-wrong-lang
8967 @item -Wno-complain-wrong-lang
8968 By default, language front ends complain when a command-line option is
8969 valid, but not applicable to that front end.
8970 This may be disabled with @option{-Wno-complain-wrong-lang},
8971 which is mostly useful when invoking a single compiler driver for
8972 multiple source files written in different languages, for example:
8973
8974 @smallexample
8975 $ g++ -fno-rtti a.cc b.f90
8976 @end smallexample
8977
8978 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
8979 and the Fortran front end to compile @file{b.f90}.
8980 The latter front end diagnoses
8981 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
8982 which may be disabled with @option{-Wno-complain-wrong-lang}.
8983
8984 @opindex Wconversion
8985 @opindex Wno-conversion
8986 @item -Wconversion
8987 Warn for implicit conversions that may alter a value. This includes
8988 conversions between real and integer, like @code{abs (x)} when
8989 @code{x} is @code{double}; conversions between signed and unsigned,
8990 like @code{unsigned ui = -1}; and conversions to smaller types, like
8991 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8992 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8993 changed by the conversion like in @code{abs (2.0)}. Warnings about
8994 conversions between signed and unsigned integers can be disabled by
8995 using @option{-Wno-sign-conversion}.
8996
8997 For C++, also warn for confusing overload resolution for user-defined
8998 conversions; and conversions that never use a type conversion
8999 operator: conversions to @code{void}, the same type, a base class or a
9000 reference to them. Warnings about conversions between signed and
9001 unsigned integers are disabled by default in C++ unless
9002 @option{-Wsign-conversion} is explicitly enabled.
9003
9004 Warnings about conversion from arithmetic on a small type back to that
9005 type are only given with @option{-Warith-conversion}.
9006
9007 @opindex Wdangling-else
9008 @opindex Wno-dangling-else
9009 @item -Wdangling-else
9010 Warn about constructions where there may be confusion to which
9011 @code{if} statement an @code{else} branch belongs. Here is an example of
9012 such a case:
9013
9014 @smallexample
9015 @group
9016 @{
9017 if (a)
9018 if (b)
9019 foo ();
9020 else
9021 bar ();
9022 @}
9023 @end group
9024 @end smallexample
9025
9026 In C/C++, every @code{else} branch belongs to the innermost possible
9027 @code{if} statement, which in this example is @code{if (b)}. This is
9028 often not what the programmer expected, as illustrated in the above
9029 example by indentation the programmer chose. When there is the
9030 potential for this confusion, GCC issues a warning when this flag
9031 is specified. To eliminate the warning, add explicit braces around
9032 the innermost @code{if} statement so there is no way the @code{else}
9033 can belong to the enclosing @code{if}. The resulting code
9034 looks like this:
9035
9036 @smallexample
9037 @group
9038 @{
9039 if (a)
9040 @{
9041 if (b)
9042 foo ();
9043 else
9044 bar ();
9045 @}
9046 @}
9047 @end group
9048 @end smallexample
9049
9050 This warning is enabled by @option{-Wparentheses}.
9051
9052 @opindex Wdangling-pointer
9053 @opindex Wno-dangling-pointer
9054 @item -Wdangling-pointer
9055 @itemx -Wdangling-pointer=@var{n}
9056 Warn about uses of pointers (or C++ references) to objects with automatic
9057 storage duration after their lifetime has ended. This includes local
9058 variables declared in nested blocks, compound literals and other unnamed
9059 temporary objects. In addition, warn about storing the address of such
9060 objects in escaped pointers. The warning is enabled at all optimization
9061 levels but may yield different results with optimization than without.
9062
9063 @table @gcctabopt
9064 @item -Wdangling-pointer=1
9065 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9066 For example
9067 @smallexample
9068 int f (int c1, int c2, x)
9069 @{
9070 char *p = strchr ((char[])@{ c1, c2 @}, c3);
9071 // warning: dangling pointer to a compound literal
9072 return p ? *p : 'x';
9073 @}
9074 @end smallexample
9075 In the following function the store of the address of the local variable
9076 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9077 @smallexample
9078 void g (int **p)
9079 @{
9080 int x = 7;
9081 // warning: storing the address of a local variable in *p
9082 *p = &x;
9083 @}
9084 @end smallexample
9085
9086 @item -Wdangling-pointer=2
9087 At level 2, in addition to unconditional uses the warning also diagnoses
9088 conditional uses of dangling pointers.
9089
9090 For example, because the array @var{a} in the following function is out of
9091 scope when the pointer @var{s} that was set to point is used, the warning
9092 triggers at this level.
9093
9094 @smallexample
9095 void f (char *s)
9096 @{
9097 if (!s)
9098 @{
9099 char a[12] = "tmpname";
9100 s = a;
9101 @}
9102 // warning: dangling pointer to a may be used
9103 strcat (s, ".tmp");
9104 ...
9105 @}
9106 @end smallexample
9107 @end table
9108
9109 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9110
9111 @opindex Wdate-time
9112 @opindex Wno-date-time
9113 @item -Wdate-time
9114 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9115 are encountered as they might prevent bit-wise-identical reproducible
9116 compilations.
9117
9118 @opindex Wempty-body
9119 @opindex Wno-empty-body
9120 @item -Wempty-body
9121 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9122 while} statement. This warning is also enabled by @option{-Wextra}.
9123
9124 @opindex Wendif-labels
9125 @opindex Wno-endif-labels
9126 @item -Wno-endif-labels
9127 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9128
9129 @opindex Wenum-compare
9130 @opindex Wno-enum-compare
9131 @item -Wenum-compare
9132 Warn about a comparison between values of different enumerated types.
9133 In C++ enumerated type mismatches in conditional expressions are also
9134 diagnosed and the warning is enabled by default. In C this warning is
9135 enabled by @option{-Wall}.
9136
9137 @opindex Wenum-conversion
9138 @opindex Wno-enum-conversion
9139 @item -Wenum-conversion
9140 Warn when a value of enumerated type is implicitly converted to a
9141 different enumerated type. This warning is enabled by @option{-Wextra}
9142 in C@.
9143
9144 @opindex Wenum-int-mismatch
9145 @opindex Wno-enum-int-mismatch
9146 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9147 Warn about mismatches between an enumerated type and an integer type in
9148 declarations. For example:
9149
9150 @smallexample
9151 enum E @{ l = -1, z = 0, g = 1 @};
9152 int foo(void);
9153 enum E foo(void);
9154 @end smallexample
9155
9156 In C, an enumerated type is compatible with @code{char}, a signed
9157 integer type, or an unsigned integer type. However, since the choice
9158 of the underlying type of an enumerated type is implementation-defined,
9159 such mismatches may cause portability issues. In C++, such mismatches
9160 are an error. In C, this warning is enabled by @option{-Wall} and
9161 @option{-Wc++-compat}.
9162
9163 @opindex Wjump-misses-init
9164 @opindex Wno-jump-misses-init
9165 @item -Wjump-misses-init @r{(C, Objective-C only)}
9166 Warn if a @code{goto} statement or a @code{switch} statement jumps
9167 forward across the initialization of a variable, or jumps backward to a
9168 label after the variable has been initialized. This only warns about
9169 variables that are initialized when they are declared. This warning is
9170 only supported for C and Objective-C; in C++ this sort of branch is an
9171 error in any case.
9172
9173 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
9174 can be disabled with the @option{-Wno-jump-misses-init} option.
9175
9176 @opindex Wsign-compare
9177 @opindex Wno-sign-compare
9178 @cindex warning for comparison of signed and unsigned values
9179 @cindex comparison of signed and unsigned values, warning
9180 @cindex signed and unsigned values, comparison warning
9181 @item -Wsign-compare
9182 Warn when a comparison between signed and unsigned values could produce
9183 an incorrect result when the signed value is converted to unsigned.
9184 In C++, this warning is also enabled by @option{-Wall}. In C, it is
9185 also enabled by @option{-Wextra}.
9186
9187 @opindex Wsign-conversion
9188 @opindex Wno-sign-conversion
9189 @item -Wsign-conversion
9190 Warn for implicit conversions that may change the sign of an integer
9191 value, like assigning a signed integer expression to an unsigned
9192 integer variable. An explicit cast silences the warning. In C, this
9193 option is enabled also by @option{-Wconversion}.
9194
9195 @opindex Wfloat-conversion
9196 @opindex Wno-float-conversion
9197 @item -Wfloat-conversion
9198 Warn for implicit conversions that reduce the precision of a real value.
9199 This includes conversions from real to integer, and from higher precision
9200 real to lower precision real values. This option is also enabled by
9201 @option{-Wconversion}.
9202
9203 @opindex Wno-scalar-storage-order
9204 @opindex Wscalar-storage-order
9205 @item -Wno-scalar-storage-order
9206 Do not warn on suspicious constructs involving reverse scalar storage order.
9207
9208 @opindex Wsizeof-array-div
9209 @opindex Wno-sizeof-array-div
9210 @item -Wsizeof-array-div
9211 Warn about divisions of two sizeof operators when the first one is applied
9212 to an array and the divisor does not equal the size of the array element.
9213 In such a case, the computation will not yield the number of elements in the
9214 array, which is likely what the user intended. This warning warns e.g. about
9215 @smallexample
9216 int fn ()
9217 @{
9218 int arr[10];
9219 return sizeof (arr) / sizeof (short);
9220 @}
9221 @end smallexample
9222
9223 This warning is enabled by @option{-Wall}.
9224
9225 @opindex Wsizeof-pointer-div
9226 @opindex Wno-sizeof-pointer-div
9227 @item -Wsizeof-pointer-div
9228 Warn for suspicious divisions of two sizeof expressions that divide
9229 the pointer size by the element size, which is the usual way to compute
9230 the array size but won't work out correctly with pointers. This warning
9231 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9232 not an array, but a pointer. This warning is enabled by @option{-Wall}.
9233
9234 @opindex Wsizeof-pointer-memaccess
9235 @opindex Wno-sizeof-pointer-memaccess
9236 @item -Wsizeof-pointer-memaccess
9237 Warn for suspicious length parameters to certain string and memory built-in
9238 functions if the argument uses @code{sizeof}. This warning triggers for
9239 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9240 an array, but a pointer, and suggests a possible fix, or about
9241 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
9242 also warns about calls to bounded string copy functions like @code{strncat}
9243 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9244 the source array. For example, in the following function the call to
9245 @code{strncat} specifies the size of the source string as the bound. That
9246 is almost certainly a mistake and so the call is diagnosed.
9247 @smallexample
9248 void make_file (const char *name)
9249 @{
9250 char path[PATH_MAX];
9251 strncpy (path, name, sizeof path - 1);
9252 strncat (path, ".text", sizeof ".text");
9253 @dots{}
9254 @}
9255 @end smallexample
9256
9257 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9258
9259 @opindex Wsizeof-array-argument
9260 @opindex Wno-sizeof-array-argument
9261 @item -Wno-sizeof-array-argument
9262 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9263 declared as an array in a function definition. This warning is enabled by
9264 default for C and C++ programs.
9265
9266 @opindex Wmemset-elt-size
9267 @opindex Wno-memset-elt-size
9268 @item -Wmemset-elt-size
9269 Warn for suspicious calls to the @code{memset} built-in function, if the
9270 first argument references an array, and the third argument is a number
9271 equal to the number of elements, but not equal to the size of the array
9272 in memory. This indicates that the user has omitted a multiplication by
9273 the element size. This warning is enabled by @option{-Wall}.
9274
9275 @opindex Wmemset-transposed-args
9276 @opindex Wno-memset-transposed-args
9277 @item -Wmemset-transposed-args
9278 Warn for suspicious calls to the @code{memset} built-in function where
9279 the second argument is not zero and the third argument is zero. For
9280 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9281 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
9282 is only emitted if the third argument is a literal zero. Otherwise, if
9283 it is an expression that is folded to zero, or a cast of zero to some
9284 type, it is far less likely that the arguments have been mistakenly
9285 transposed and no warning is emitted. This warning is enabled
9286 by @option{-Wall}.
9287
9288 @opindex Waddress
9289 @opindex Wno-address
9290 @item -Waddress
9291 Warn about suspicious uses of address expressions. These include comparing
9292 the address of a function or a declared object to the null pointer constant
9293 such as in
9294 @smallexample
9295 void f (void);
9296 void g (void)
9297 @{
9298 if (!f) // warning: expression evaluates to false
9299 abort ();
9300 @}
9301 @end smallexample
9302 comparisons of a pointer to a string literal, such as in
9303 @smallexample
9304 void f (const char *x)
9305 @{
9306 if (x == "abc") // warning: expression evaluates to false
9307 puts ("equal");
9308 @}
9309 @end smallexample
9310 and tests of the results of pointer addition or subtraction for equality
9311 to null, such as in
9312 @smallexample
9313 void f (const int *p, int i)
9314 @{
9315 return p + i == NULL;
9316 @}
9317 @end smallexample
9318 Such uses typically indicate a programmer error: the address of most
9319 functions and objects necessarily evaluates to true (the exception are
9320 weak symbols), so their use in a conditional might indicate missing
9321 parentheses in a function call or a missing dereference in an array
9322 expression. The subset of the warning for object pointers can be
9323 suppressed by casting the pointer operand to an integer type such
9324 as @code{intptr_t} or @code{uintptr_t}.
9325 Comparisons against string literals result in unspecified behavior
9326 and are not portable, and suggest the intent was to call @code{strcmp}.
9327 The warning is suppressed if the suspicious expression is the result
9328 of macro expansion.
9329 @option{-Waddress} warning is enabled by @option{-Wall}.
9330
9331 @opindex Waddress-of-packed-member
9332 @opindex Wno-address-of-packed-member
9333 @item -Wno-address-of-packed-member
9334 Do not warn when the address of packed member of struct or union is taken,
9335 which usually results in an unaligned pointer value. This is
9336 enabled by default.
9337
9338 @opindex Wlogical-op
9339 @opindex Wno-logical-op
9340 @item -Wlogical-op
9341 Warn about suspicious uses of logical operators in expressions.
9342 This includes using logical operators in contexts where a
9343 bit-wise operator is likely to be expected. Also warns when
9344 the operands of a logical operator are the same:
9345 @smallexample
9346 extern int a;
9347 if (a < 0 && a < 0) @{ @dots{} @}
9348 @end smallexample
9349
9350 @opindex Wlogical-not-parentheses
9351 @opindex Wno-logical-not-parentheses
9352 @item -Wlogical-not-parentheses
9353 Warn about logical not used on the left hand side operand of a comparison.
9354 This option does not warn if the right operand is considered to be a boolean
9355 expression. Its purpose is to detect suspicious code like the following:
9356 @smallexample
9357 int a;
9358 @dots{}
9359 if (!a > 1) @{ @dots{} @}
9360 @end smallexample
9361
9362 It is possible to suppress the warning by wrapping the LHS into
9363 parentheses:
9364 @smallexample
9365 if ((!a) > 1) @{ @dots{} @}
9366 @end smallexample
9367
9368 This warning is enabled by @option{-Wall}.
9369
9370 @opindex Waggregate-return
9371 @opindex Wno-aggregate-return
9372 @item -Waggregate-return
9373 Warn if any functions that return structures or unions are defined or
9374 called. (In languages where you can return an array, this also elicits
9375 a warning.)
9376
9377 @opindex Wno-aggressive-loop-optimizations
9378 @opindex Waggressive-loop-optimizations
9379 @item -Wno-aggressive-loop-optimizations
9380 Warn if in a loop with constant number of iterations the compiler detects
9381 undefined behavior in some statement during one or more of the iterations.
9382
9383 @opindex Wno-attributes
9384 @opindex Wattributes
9385 @item -Wno-attributes
9386 Do not warn if an unexpected @code{__attribute__} is used, such as
9387 unrecognized attributes, function attributes applied to variables,
9388 etc. This does not stop errors for incorrect use of supported
9389 attributes.
9390
9391 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9392 warnings about unknown scoped attributes (in C++11 and C2X). For example,
9393 @option{-Wno-attributes=vendor::attr} disables warning about the following
9394 declaration:
9395
9396 @smallexample
9397 [[vendor::attr]] void f();
9398 @end smallexample
9399
9400 It is also possible to disable warning about all attributes in a namespace
9401 using @option{-Wno-attributes=vendor::} which prevents warning about both
9402 of these declarations:
9403
9404 @smallexample
9405 [[vendor::safe]] void f();
9406 [[vendor::unsafe]] void f2();
9407 @end smallexample
9408
9409 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9410
9411 @opindex Wno-builtin-declaration-mismatch
9412 @opindex Wbuiltin-declaration-mismatch
9413 @item -Wno-builtin-declaration-mismatch
9414 Warn if a built-in function is declared with an incompatible signature
9415 or as a non-function, or when a built-in function declared with a type
9416 that does not include a prototype is called with arguments whose promoted
9417 types do not match those expected by the function. When @option{-Wextra}
9418 is specified, also warn when a built-in function that takes arguments is
9419 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
9420 warning is enabled by default. To avoid the warning include the appropriate
9421 header to bring the prototypes of built-in functions into scope.
9422
9423 For example, the call to @code{memset} below is diagnosed by the warning
9424 because the function expects a value of type @code{size_t} as its argument
9425 but the type of @code{32} is @code{int}. With @option{-Wextra},
9426 the declaration of the function is diagnosed as well.
9427 @smallexample
9428 extern void* memset ();
9429 void f (void *d)
9430 @{
9431 memset (d, '\0', 32);
9432 @}
9433 @end smallexample
9434
9435 @opindex Wno-builtin-macro-redefined
9436 @opindex Wbuiltin-macro-redefined
9437 @item -Wno-builtin-macro-redefined
9438 Do not warn if certain built-in macros are redefined. This suppresses
9439 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9440 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9441
9442 @opindex Wstrict-prototypes
9443 @opindex Wno-strict-prototypes
9444 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9445 Warn if a function is declared or defined without specifying the
9446 argument types. (An old-style function definition is permitted without
9447 a warning if preceded by a declaration that specifies the argument
9448 types.)
9449
9450 @opindex Wold-style-declaration
9451 @opindex Wno-old-style-declaration
9452 @item -Wold-style-declaration @r{(C and Objective-C only)}
9453 Warn for obsolescent usages, according to the C Standard, in a
9454 declaration. For example, warn if storage-class specifiers like
9455 @code{static} are not the first things in a declaration. This warning
9456 is also enabled by @option{-Wextra}.
9457
9458 @opindex Wold-style-definition
9459 @opindex Wno-old-style-definition
9460 @item -Wold-style-definition @r{(C and Objective-C only)}
9461 Warn if an old-style function definition is used. A warning is given
9462 even if there is a previous prototype. A definition using @samp{()}
9463 is not considered an old-style definition in C2X mode, because it is
9464 equivalent to @samp{(void)} in that case, but is considered an
9465 old-style definition for older standards.
9466
9467 @opindex Wmissing-parameter-type
9468 @opindex Wno-missing-parameter-type
9469 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9470 A function parameter is declared without a type specifier in K&R-style
9471 functions:
9472
9473 @smallexample
9474 void foo(bar) @{ @}
9475 @end smallexample
9476
9477 This warning is also enabled by @option{-Wextra}.
9478
9479 @opindex Wmissing-prototypes
9480 @opindex Wno-missing-prototypes
9481 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9482 Warn if a global function is defined without a previous prototype
9483 declaration. This warning is issued even if the definition itself
9484 provides a prototype. Use this option to detect global functions
9485 that do not have a matching prototype declaration in a header file.
9486 This option is not valid for C++ because all function declarations
9487 provide prototypes and a non-matching declaration declares an
9488 overload rather than conflict with an earlier declaration.
9489 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9490
9491 @opindex Wmissing-declarations
9492 @opindex Wno-missing-declarations
9493 @item -Wmissing-declarations
9494 Warn if a global function is defined without a previous declaration.
9495 Do so even if the definition itself provides a prototype.
9496 Use this option to detect global functions that are not declared in
9497 header files. In C, no warnings are issued for functions with previous
9498 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9499 missing prototypes. In C++, no warnings are issued for function templates,
9500 or for inline functions, or for functions in anonymous namespaces.
9501
9502 @opindex Wmissing-field-initializers
9503 @opindex Wno-missing-field-initializers
9504 @opindex W
9505 @opindex Wextra
9506 @opindex Wno-extra
9507 @item -Wmissing-field-initializers
9508 Warn if a structure's initializer has some fields missing. For
9509 example, the following code causes such a warning, because
9510 @code{x.h} is implicitly zero:
9511
9512 @smallexample
9513 struct s @{ int f, g, h; @};
9514 struct s x = @{ 3, 4 @};
9515 @end smallexample
9516
9517 This option does not warn about designated initializers, so the following
9518 modification does not trigger a warning:
9519
9520 @smallexample
9521 struct s @{ int f, g, h; @};
9522 struct s x = @{ .f = 3, .g = 4 @};
9523 @end smallexample
9524
9525 In C this option does not warn about the universal zero initializer
9526 @samp{@{ 0 @}}:
9527
9528 @smallexample
9529 struct s @{ int f, g, h; @};
9530 struct s x = @{ 0 @};
9531 @end smallexample
9532
9533 Likewise, in C++ this option does not warn about the empty @{ @}
9534 initializer, for example:
9535
9536 @smallexample
9537 struct s @{ int f, g, h; @};
9538 s x = @{ @};
9539 @end smallexample
9540
9541 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
9542 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9543
9544 @opindex Wmissing-requires
9545 @opindex Wno-missing-requires
9546 @item -Wno-missing-requires
9547
9548 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9549
9550 @smallexample
9551 bool satisfied = requires @{ C<T> @};
9552 @end smallexample
9553
9554 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9555 expression, which it is for all T. Presumably the user meant to write
9556
9557 @smallexample
9558 bool satisfied = requires @{ requires C<T> @};
9559 @end smallexample
9560
9561 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9562 type @samp{T}.
9563
9564 This warning can be disabled with @option{-Wno-missing-requires}.
9565
9566 @opindex Wmissing-template-keyword
9567 @opindex Wno-missing-template-keyword
9568 @item -Wno-missing-template-keyword
9569
9570 The member access tokens ., -> and :: must be followed by the @code{template}
9571 keyword if the parent object is dependent and the member being named is a
9572 template.
9573
9574 @smallexample
9575 template <class X>
9576 void DoStuff (X x)
9577 @{
9578 x.template DoSomeOtherStuff<X>(); // Good.
9579 x.DoMoreStuff<X>(); // Warning, x is dependent.
9580 @}
9581 @end smallexample
9582
9583 In rare cases it is possible to get false positives. To silence this, wrap
9584 the expression in parentheses. For example, the following is treated as a
9585 template, even where m and N are integers:
9586
9587 @smallexample
9588 void NotATemplate (my_class t)
9589 @{
9590 int N = 5;
9591
9592 bool test = t.m < N > (0); // Treated as a template.
9593 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9594 @}
9595 @end smallexample
9596
9597 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9598
9599 @opindex Wno-multichar
9600 @opindex Wmultichar
9601 @item -Wno-multichar
9602 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9603 Usually they indicate a typo in the user's code, as they have
9604 implementation-defined values, and should not be used in portable code.
9605
9606 @opindex Wnormalized=
9607 @opindex Wnormalized
9608 @opindex Wno-normalized
9609 @cindex NFC
9610 @cindex NFKC
9611 @cindex character set, input normalization
9612 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9613 In ISO C and ISO C++, two identifiers are different if they are
9614 different sequences of characters. However, sometimes when characters
9615 outside the basic ASCII character set are used, you can have two
9616 different character sequences that look the same. To avoid confusion,
9617 the ISO 10646 standard sets out some @dfn{normalization rules} which
9618 when applied ensure that two sequences that look the same are turned into
9619 the same sequence. GCC can warn you if you are using identifiers that
9620 have not been normalized; this option controls that warning.
9621
9622 There are four levels of warning supported by GCC@. The default is
9623 @option{-Wnormalized=nfc}, which warns about any identifier that is
9624 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
9625 recommended form for most uses. It is equivalent to
9626 @option{-Wnormalized}.
9627
9628 Unfortunately, there are some characters allowed in identifiers by
9629 ISO C and ISO C++ that, when turned into NFC, are not allowed in
9630 identifiers. That is, there's no way to use these symbols in portable
9631 ISO C or C++ and have all your identifiers in NFC@.
9632 @option{-Wnormalized=id} suppresses the warning for these characters.
9633 It is hoped that future versions of the standards involved will correct
9634 this, which is why this option is not the default.
9635
9636 You can switch the warning off for all characters by writing
9637 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
9638 only do this if you are using some other normalization scheme (like
9639 ``D''), because otherwise you can easily create bugs that are
9640 literally impossible to see.
9641
9642 Some characters in ISO 10646 have distinct meanings but look identical
9643 in some fonts or display methodologies, especially once formatting has
9644 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9645 LETTER N'', displays just like a regular @code{n} that has been
9646 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
9647 normalization scheme to convert all these into a standard form as
9648 well, and GCC warns if your code is not in NFKC if you use
9649 @option{-Wnormalized=nfkc}. This warning is comparable to warning
9650 about every identifier that contains the letter O because it might be
9651 confused with the digit 0, and so is not the default, but may be
9652 useful as a local coding convention if the programming environment
9653 cannot be fixed to display these characters distinctly.
9654
9655 @opindex Wno-attribute-warning
9656 @opindex Wattribute-warning
9657 @item -Wno-attribute-warning
9658 Do not warn about usage of functions (@pxref{Function Attributes})
9659 declared with @code{warning} attribute. By default, this warning is
9660 enabled. @option{-Wno-attribute-warning} can be used to disable the
9661 warning or @option{-Wno-error=attribute-warning} can be used to
9662 disable the error when compiled with @option{-Werror} flag.
9663
9664 @opindex Wno-deprecated
9665 @opindex Wdeprecated
9666 @item -Wno-deprecated
9667 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
9668
9669 @opindex Wno-deprecated-declarations
9670 @opindex Wdeprecated-declarations
9671 @item -Wno-deprecated-declarations
9672 Do not warn about uses of functions (@pxref{Function Attributes}),
9673 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9674 Attributes}) marked as deprecated by using the @code{deprecated}
9675 attribute.
9676
9677 @opindex Wno-overflow
9678 @opindex Woverflow
9679 @item -Wno-overflow
9680 Do not warn about compile-time overflow in constant expressions.
9681
9682 @opindex Wno-odr
9683 @opindex Wodr
9684 @item -Wno-odr
9685 Warn about One Definition Rule violations during link-time optimization.
9686 Enabled by default.
9687
9688 @opindex Wopenacc-parallelism
9689 @opindex Wno-openacc-parallelism
9690 @cindex OpenACC accelerator programming
9691 @item -Wopenacc-parallelism
9692 Warn about potentially suboptimal choices related to OpenACC parallelism.
9693
9694 @opindex Wopenmp-simd
9695 @opindex Wno-openmp-simd
9696 @item -Wopenmp-simd
9697 Warn if the vectorizer cost model overrides the OpenMP
9698 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
9699 option can be used to relax the cost model.
9700
9701 @opindex Woverride-init
9702 @opindex Wno-override-init
9703 @opindex W
9704 @opindex Wextra
9705 @opindex Wno-extra
9706 @item -Woverride-init @r{(C and Objective-C only)}
9707 Warn if an initialized field without side effects is overridden when
9708 using designated initializers (@pxref{Designated Inits, , Designated
9709 Initializers}).
9710
9711 This warning is included in @option{-Wextra}. To get other
9712 @option{-Wextra} warnings without this one, use @option{-Wextra
9713 -Wno-override-init}.
9714
9715 @opindex Woverride-init-side-effects
9716 @opindex Wno-override-init-side-effects
9717 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9718 Do not warn if an initialized field with side effects is overridden when
9719 using designated initializers (@pxref{Designated Inits, , Designated
9720 Initializers}). This warning is enabled by default.
9721
9722 @opindex Wpacked
9723 @opindex Wno-packed
9724 @item -Wpacked
9725 Warn if a structure is given the packed attribute, but the packed
9726 attribute has no effect on the layout or size of the structure.
9727 Such structures may be mis-aligned for little benefit. For
9728 instance, in this code, the variable @code{f.x} in @code{struct bar}
9729 is misaligned even though @code{struct bar} does not itself
9730 have the packed attribute:
9731
9732 @smallexample
9733 @group
9734 struct foo @{
9735 int x;
9736 char a, b, c, d;
9737 @} __attribute__((packed));
9738 struct bar @{
9739 char z;
9740 struct foo f;
9741 @};
9742 @end group
9743 @end smallexample
9744
9745 @opindex Wpacked-bitfield-compat
9746 @opindex Wno-packed-bitfield-compat
9747 @item -Wnopacked-bitfield-compat
9748 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9749 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
9750 the change can lead to differences in the structure layout. GCC
9751 informs you when the offset of such a field has changed in GCC 4.4.
9752 For example there is no longer a 4-bit padding between field @code{a}
9753 and @code{b} in this structure:
9754
9755 @smallexample
9756 struct foo
9757 @{
9758 char a:4;
9759 char b:8;
9760 @} __attribute__ ((packed));
9761 @end smallexample
9762
9763 This warning is enabled by default. Use
9764 @option{-Wno-packed-bitfield-compat} to disable this warning.
9765
9766 @opindex Wpacked-not-aligned
9767 @opindex Wno-packed-not-aligned
9768 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9769 Warn if a structure field with explicitly specified alignment in a
9770 packed struct or union is misaligned. For example, a warning will
9771 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9772 'struct S' is less than 8}, in this code:
9773
9774 @smallexample
9775 @group
9776 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9777 struct __attribute__ ((packed)) S @{
9778 struct S8 s8;
9779 @};
9780 @end group
9781 @end smallexample
9782
9783 This warning is enabled by @option{-Wall}.
9784
9785 @opindex Wpadded
9786 @opindex Wno-padded
9787 @item -Wpadded
9788 Warn if padding is included in a structure, either to align an element
9789 of the structure or to align the whole structure. Sometimes when this
9790 happens it is possible to rearrange the fields of the structure to
9791 reduce the padding and so make the structure smaller.
9792
9793 @opindex Wredundant-decls
9794 @opindex Wno-redundant-decls
9795 @item -Wredundant-decls
9796 Warn if anything is declared more than once in the same scope, even in
9797 cases where multiple declaration is valid and changes nothing.
9798
9799 @opindex Wrestrict
9800 @opindex Wno-restrict
9801 @item -Wrestrict
9802 Warn when an object referenced by a @code{restrict}-qualified parameter
9803 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9804 argument, or when copies between such objects overlap. For example,
9805 the call to the @code{strcpy} function below attempts to truncate the string
9806 by replacing its initial characters with the last four. However, because
9807 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9808 the call is diagnosed.
9809
9810 @smallexample
9811 void foo (void)
9812 @{
9813 char a[] = "abcd1234";
9814 strcpy (a, a + 4);
9815 @dots{}
9816 @}
9817 @end smallexample
9818 The @option{-Wrestrict} option detects some instances of simple overlap
9819 even without optimization but works best at @option{-O2} and above. It
9820 is included in @option{-Wall}.
9821
9822 @opindex Wnested-externs
9823 @opindex Wno-nested-externs
9824 @item -Wnested-externs @r{(C and Objective-C only)}
9825 Warn if an @code{extern} declaration is encountered within a function.
9826
9827 @opindex Winline
9828 @opindex Wno-inline
9829 @item -Winline
9830 Warn if a function that is declared as inline cannot be inlined.
9831 Even with this option, the compiler does not warn about failures to
9832 inline functions declared in system headers.
9833
9834 The compiler uses a variety of heuristics to determine whether or not
9835 to inline a function. For example, the compiler takes into account
9836 the size of the function being inlined and the amount of inlining
9837 that has already been done in the current function. Therefore,
9838 seemingly insignificant changes in the source program can cause the
9839 warnings produced by @option{-Winline} to appear or disappear.
9840
9841 @opindex Winterference-size
9842 @item -Winterference-size
9843 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9844 without specifying its value with @option{--param destructive-interference-size}.
9845 Also warn about questionable values for that option.
9846
9847 This variable is intended to be used for controlling class layout, to
9848 avoid false sharing in concurrent code:
9849
9850 @smallexample
9851 struct independent_fields @{
9852 alignas(std::hardware_destructive_interference_size)
9853 std::atomic<int> one;
9854 alignas(std::hardware_destructive_interference_size)
9855 std::atomic<int> two;
9856 @};
9857 @end smallexample
9858
9859 Here @samp{one} and @samp{two} are intended to be far enough apart
9860 that stores to one won't require accesses to the other to reload the
9861 cache line.
9862
9863 By default, @option{--param destructive-interference-size} and
9864 @option{--param constructive-interference-size} are set based on the
9865 current @option{-mtune} option, typically to the L1 cache line size
9866 for the particular target CPU, sometimes to a range if tuning for a
9867 generic target. So all translation units that depend on ABI
9868 compatibility for the use of these variables must be compiled with
9869 the same @option{-mtune} (or @option{-mcpu}).
9870
9871 If ABI stability is important, such as if the use is in a header for a
9872 library, you should probably not use the hardware interference size
9873 variables at all. Alternatively, you can force a particular value
9874 with @option{--param}.
9875
9876 If you are confident that your use of the variable does not affect ABI
9877 outside a single build of your project, you can turn off the warning
9878 with @option{-Wno-interference-size}.
9879
9880 @opindex Wint-in-bool-context
9881 @opindex Wno-int-in-bool-context
9882 @item -Wint-in-bool-context
9883 Warn for suspicious use of integer values where boolean values are expected,
9884 such as conditional expressions (?:) using non-boolean integer constants in
9885 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9886 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9887 for all kinds of multiplications regardless of the data type.
9888 This warning is enabled by @option{-Wall}.
9889
9890 @opindex Wno-int-to-pointer-cast
9891 @opindex Wint-to-pointer-cast
9892 @item -Wno-int-to-pointer-cast
9893 Suppress warnings from casts to pointer type of an integer of a
9894 different size. In C++, casting to a pointer type of smaller size is
9895 an error. @option{Wint-to-pointer-cast} is enabled by default.
9896
9897
9898 @opindex Wno-pointer-to-int-cast
9899 @opindex Wpointer-to-int-cast
9900 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9901 Suppress warnings from casts from a pointer to an integer type of a
9902 different size.
9903
9904 @opindex Winvalid-pch
9905 @opindex Wno-invalid-pch
9906 @item -Winvalid-pch
9907 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9908 the search path but cannot be used.
9909
9910 @opindex Winvalid-utf8
9911 @opindex Wno-invalid-utf8
9912 @item -Winvalid-utf8
9913 Warn if an invalid UTF-8 character is found.
9914 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
9915 is used and turned into error with @option{-pedantic-errors}.
9916
9917 @opindex Wunicode
9918 @opindex Wno-unicode
9919 @item -Wno-unicode
9920 Don't diagnose invalid forms of delimited or named escape sequences which are
9921 treated as separate tokens. @option{Wunicode} is enabled by default.
9922
9923 @opindex Wlong-long
9924 @opindex Wno-long-long
9925 @item -Wlong-long
9926 Warn if @code{long long} type is used. This is enabled by either
9927 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9928 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9929
9930 @opindex Wvariadic-macros
9931 @opindex Wno-variadic-macros
9932 @item -Wvariadic-macros
9933 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9934 alternate syntax is used in ISO C99 mode. This is enabled by either
9935 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9936 messages, use @option{-Wno-variadic-macros}.
9937
9938 @opindex Wvarargs
9939 @opindex Wno-varargs
9940 @item -Wno-varargs
9941 Do not warn upon questionable usage of the macros used to handle variable
9942 arguments like @code{va_start}. These warnings are enabled by default.
9943
9944 @opindex Wvector-operation-performance
9945 @opindex Wno-vector-operation-performance
9946 @item -Wvector-operation-performance
9947 Warn if vector operation is not implemented via SIMD capabilities of the
9948 architecture. Mainly useful for the performance tuning.
9949 Vector operation can be implemented @code{piecewise}, which means that the
9950 scalar operation is performed on every vector element;
9951 @code{in parallel}, which means that the vector operation is implemented
9952 using scalars of wider type, which normally is more performance efficient;
9953 and @code{as a single scalar}, which means that vector fits into a
9954 scalar type.
9955
9956 @opindex Wvla
9957 @opindex Wno-vla
9958 @item -Wvla
9959 Warn if a variable-length array is used in the code.
9960 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9961 the variable-length array.
9962
9963 @opindex Wvla-larger-than=
9964 @opindex Wno-vla-larger-than
9965 @item -Wvla-larger-than=@var{byte-size}
9966 If this option is used, the compiler warns for declarations of
9967 variable-length arrays whose size is either unbounded, or bounded
9968 by an argument that allows the array size to exceed @var{byte-size}
9969 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9970 works, but with variable-length arrays.
9971
9972 Note that GCC may optimize small variable-length arrays of a known
9973 value into plain arrays, so this warning may not get triggered for
9974 such arrays.
9975
9976 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9977 is typically only effective when @option{-ftree-vrp} is active (default
9978 for @option{-O2} and above).
9979
9980 See also @option{-Walloca-larger-than=@var{byte-size}}.
9981
9982 @opindex Wno-vla-larger-than
9983 @item -Wno-vla-larger-than
9984 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9985 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9986
9987 @opindex Wno-vla-parameter
9988 @item -Wvla-parameter
9989 Warn about redeclarations of functions involving arguments of Variable
9990 Length Array types of inconsistent kinds or forms, and enable the detection
9991 of out-of-bounds accesses to such parameters by warnings such as
9992 @option{-Warray-bounds}.
9993
9994 If the first function declaration uses the VLA form the bound specified
9995 in the array is assumed to be the minimum number of elements expected to
9996 be provided in calls to the function and the maximum number of elements
9997 accessed by it. Failing to provide arguments of sufficient size or
9998 accessing more than the maximum number of elements may be diagnosed.
9999
10000 For example, the warning triggers for the following redeclarations because
10001 the first one allows an array of any size to be passed to @code{f} while
10002 the second one specifies that the array argument must have at least @code{n}
10003 elements. In addition, calling @code{f} with the associated VLA bound
10004 parameter in excess of the actual VLA bound triggers a warning as well.
10005
10006 @smallexample
10007 void f (int n, int[n]);
10008 // warning: argument 2 previously declared as a VLA
10009 void f (int, int[]);
10010
10011 void g (int n)
10012 @{
10013 if (n > 4)
10014 return;
10015 int a[n];
10016 // warning: access to a by f may be out of bounds
10017 f (sizeof a, a);
10018 @dots{}
10019 @}
10020
10021 @end smallexample
10022
10023 @option{-Wvla-parameter} is included in @option{-Wall}. The
10024 @option{-Warray-parameter} option triggers warnings for similar problems
10025 involving ordinary array arguments.
10026
10027 @opindex Wvolatile-register-var
10028 @opindex Wno-volatile-register-var
10029 @item -Wvolatile-register-var
10030 Warn if a register variable is declared volatile. The volatile
10031 modifier does not inhibit all optimizations that may eliminate reads
10032 and/or writes to register variables. This warning is enabled by
10033 @option{-Wall}.
10034
10035 @opindex Wxor-used-as-pow
10036 @opindex Wno-xor-used-as-pow
10037 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10038 Warn about uses of @code{^}, the exclusive or operator, where it appears
10039 the user meant exponentiation. Specifically, the warning occurs when the
10040 left-hand side is the decimal constant 2 or 10 and the right-hand side
10041 is also a decimal constant.
10042
10043 In C and C++, @code{^} means exclusive or, whereas in some other languages
10044 (e.g. TeX and some versions of BASIC) it means exponentiation.
10045
10046 This warning is enabled by default. It can be silenced by converting one
10047 of the operands to hexadecimal.
10048
10049 @opindex Wdisabled-optimization
10050 @opindex Wno-disabled-optimization
10051 @item -Wdisabled-optimization
10052 Warn if a requested optimization pass is disabled. This warning does
10053 not generally indicate that there is anything wrong with your code; it
10054 merely indicates that GCC's optimizers are unable to handle the code
10055 effectively. Often, the problem is that your code is too big or too
10056 complex; GCC refuses to optimize programs when the optimization
10057 itself is likely to take inordinate amounts of time.
10058
10059 @opindex Wpointer-sign
10060 @opindex Wno-pointer-sign
10061 @item -Wpointer-sign @r{(C and Objective-C only)}
10062 Warn for pointer argument passing or assignment with different signedness.
10063 This option is only supported for C and Objective-C@. It is implied by
10064 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10065 @option{-Wno-pointer-sign}.
10066
10067 @opindex Wstack-protector
10068 @opindex Wno-stack-protector
10069 @item -Wstack-protector
10070 This option is only active when @option{-fstack-protector} is active. It
10071 warns about functions that are not protected against stack smashing.
10072
10073 @opindex Woverlength-strings
10074 @opindex Wno-overlength-strings
10075 @item -Woverlength-strings
10076 Warn about string constants that are longer than the ``minimum
10077 maximum'' length specified in the C standard. Modern compilers
10078 generally allow string constants that are much longer than the
10079 standard's minimum limit, but very portable programs should avoid
10080 using longer strings.
10081
10082 The limit applies @emph{after} string constant concatenation, and does
10083 not count the trailing NUL@. In C90, the limit was 509 characters; in
10084 C99, it was raised to 4095. C++98 does not specify a normative
10085 minimum maximum, so we do not diagnose overlength strings in C++@.
10086
10087 This option is implied by @option{-Wpedantic}, and can be disabled with
10088 @option{-Wno-overlength-strings}.
10089
10090 @opindex Wunsuffixed-float-constants
10091 @opindex Wno-unsuffixed-float-constants
10092 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10093
10094 Issue a warning for any floating constant that does not have
10095 a suffix. When used together with @option{-Wsystem-headers} it
10096 warns about such constants in system header files. This can be useful
10097 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10098 from the decimal floating-point extension to C99.
10099
10100 @opindex Wlto-type-mismatch
10101 @opindex Wno-lto-type-mismatch
10102 @item -Wno-lto-type-mismatch
10103
10104 During the link-time optimization, do not warn about type mismatches in
10105 global declarations from different compilation units.
10106 Requires @option{-flto} to be enabled. Enabled by default.
10107
10108 @opindex Wdesignated-init
10109 @opindex Wno-designated-init
10110 @item -Wno-designated-init @r{(C and Objective-C only)}
10111 Suppress warnings when a positional initializer is used to initialize
10112 a structure that has been marked with the @code{designated_init}
10113 attribute.
10114
10115 @end table
10116
10117 @node Static Analyzer Options
10118 @section Options That Control Static Analysis
10119
10120 @table @gcctabopt
10121 @opindex analyzer
10122 @opindex fanalyzer
10123 @opindex fno-analyzer
10124 @item -fanalyzer
10125 This option enables an static analysis of program flow which looks
10126 for ``interesting'' interprocedural paths through the
10127 code, and issues warnings for problems found on them.
10128
10129 This analysis is much more expensive than other GCC warnings.
10130
10131 In technical terms, it performs coverage-guided symbolic execution of
10132 the code being compiled. It is neither sound nor complete: it can
10133 have false positives and false negatives. It is a bug-finding tool,
10134 rather than a tool for proving program correctness.
10135
10136 The analyzer is only suitable for use on C code in this release.
10137
10138 Enabling this option effectively enables the following warnings:
10139
10140 @gccoptlist{
10141 -Wanalyzer-allocation-size
10142 -Wanalyzer-deref-before-check
10143 -Wanalyzer-double-fclose
10144 -Wanalyzer-double-free
10145 -Wanalyzer-exposure-through-output-file
10146 -Wanalyzer-exposure-through-uninit-copy
10147 -Wanalyzer-fd-access-mode-mismatch
10148 -Wanalyzer-fd-double-close
10149 -Wanalyzer-fd-leak
10150 -Wanalyzer-fd-phase-mismatch
10151 -Wanalyzer-fd-type-mismatch
10152 -Wanalyzer-fd-use-after-close
10153 -Wanalyzer-fd-use-without-check
10154 -Wanalyzer-file-leak
10155 -Wanalyzer-free-of-non-heap
10156 -Wanalyzer-imprecise-fp-arithmetic
10157 -Wanalyzer-infinite-recursion
10158 -Wanalyzer-jump-through-null
10159 -Wanalyzer-malloc-leak
10160 -Wanalyzer-mismatching-deallocation
10161 -Wanalyzer-null-argument
10162 -Wanalyzer-null-dereference
10163 -Wanalyzer-out-of-bounds
10164 -Wanalyzer-possible-null-argument
10165 -Wanalyzer-possible-null-dereference
10166 -Wanalyzer-putenv-of-auto-var
10167 -Wanalyzer-shift-count-negative
10168 -Wanalyzer-shift-count-overflow
10169 -Wanalyzer-stale-setjmp-buffer
10170 -Wanalyzer-unsafe-call-within-signal-handler
10171 -Wanalyzer-use-after-free
10172 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10173 -Wanalyzer-use-of-uninitialized-value
10174 -Wanalyzer-va-arg-type-mismatch
10175 -Wanalyzer-va-list-exhausted
10176 -Wanalyzer-va-list-leak
10177 -Wanalyzer-va-list-use-after-va-end
10178 -Wanalyzer-write-to-const
10179 -Wanalyzer-write-to-string-literal
10180 }
10181 @ignore
10182 -Wanalyzer-tainted-allocation-size
10183 -Wanalyzer-tainted-array-index
10184 -Wanalyzer-tainted-divisor
10185 -Wanalyzer-tainted-offset
10186 -Wanalyzer-tainted-size
10187 @end ignore
10188
10189 This option is only available if GCC was configured with analyzer
10190 support enabled.
10191
10192 @opindex Wanalyzer-too-complex
10193 @opindex Wno-analyzer-too-complex
10194 @item -Wanalyzer-too-complex
10195 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10196 to attempt to explore the control flow and data flow in the program,
10197 but these can be defeated by sufficiently complicated code.
10198
10199 By default, the analysis silently stops if the code is too
10200 complicated for the analyzer to fully explore and it reaches an internal
10201 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
10202
10203 @opindex Wanalyzer-allocation-size
10204 @opindex Wno-analyzer-allocation-size
10205 @item -Wno-analyzer-allocation-size
10206 This warning requires @option{-fanalyzer}, which enables it;
10207 to disable it, use @option{-Wno-analyzer-allocation-size}.
10208
10209 This diagnostic warns for paths through the code in which a pointer to
10210 a buffer is assigned to point at a buffer with a size that is not a
10211 multiple of @code{sizeof (*pointer)}.
10212
10213 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10214
10215 @opindex Wanalyzer-deref-before-check
10216 @opindex Wno-analyzer-deref-before-check
10217 @item -Wno-analyzer-deref-before-check
10218 This warning requires @option{-fanalyzer}, which enables it; use
10219 @option{-Wno-analyzer-deref-before-check}
10220 to disable it.
10221
10222 This diagnostic warns for paths through the code in which a pointer
10223 is checked for @code{NULL} *after* it has already been
10224 dereferenced, suggesting that the pointer could have been NULL.
10225 Such cases suggest that the check for NULL is either redundant,
10226 or that it needs to be moved to before the pointer is dereferenced.
10227
10228 This diagnostic also considers values passed to a function argument
10229 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10230 value, and thus will complain if such values are checked for @code{NULL}
10231 after returning from such a function call.
10232
10233 This diagnostic is unlikely to be reported when any level of optimization
10234 is enabled, as GCC's optimization logic will typically consider such
10235 checks for NULL as being redundant, and optimize them away before the
10236 analyzer "sees" them. Hence optimization should be disabled when
10237 attempting to trigger this diagnostic.
10238
10239 @opindex Wanalyzer-double-fclose
10240 @opindex Wno-analyzer-double-fclose
10241 @item -Wno-analyzer-double-fclose
10242 This warning requires @option{-fanalyzer}, which enables it; use
10243 @option{-Wno-analyzer-double-fclose} to disable it.
10244
10245 This diagnostic warns for paths through the code in which a @code{FILE *}
10246 can have @code{fclose} called on it more than once.
10247
10248 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10249
10250 @opindex Wanalyzer-double-free
10251 @opindex Wno-analyzer-double-free
10252 @item -Wno-analyzer-double-free
10253 This warning requires @option{-fanalyzer}, which enables it; use
10254 @option{-Wno-analyzer-double-free} to disable it.
10255
10256 This diagnostic warns for paths through the code in which a pointer
10257 can have a deallocator called on it more than once, either @code{free},
10258 or a deallocator referenced by attribute @code{malloc}.
10259
10260 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10261
10262 @opindex Wanalyzer-exposure-through-output-file
10263 @opindex Wno-analyzer-exposure-through-output-file
10264 @item -Wno-analyzer-exposure-through-output-file
10265 This warning requires @option{-fanalyzer}, which enables it; use
10266 @option{-Wno-analyzer-exposure-through-output-file}
10267 to disable it.
10268
10269 This diagnostic warns for paths through the code in which a
10270 security-sensitive value is written to an output file
10271 (such as writing a password to a log file).
10272
10273 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10274
10275 @opindex Wanalyzer-exposure-through-uninit-copy
10276 @opindex Wno-analyzer-exposure-through-uninit-copy
10277 @item -Wanalyzer-exposure-through-uninit-copy
10278 This warning requires both @option{-fanalyzer} and the use of a plugin
10279 to specify a function that copies across a ``trust boundary''. Use
10280 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10281
10282 This diagnostic warns for ``infoleaks'' - paths through the code in which
10283 uninitialized values are copied across a security boundary
10284 (such as code within an OS kernel that copies a partially-initialized
10285 struct on the stack to user space).
10286
10287 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10288
10289 @opindex Wanalyzer-fd-access-mode-mismatch
10290 @opindex Wno-analyzer-fd-access-mode-mismatch
10291 @item -Wno-analyzer-fd-access-mode-mismatch
10292 This warning requires @option{-fanalyzer}, which enables it; use
10293 @option{-Wno-analyzer-fd-access-mode-mismatch}
10294 to disable it.
10295
10296 This diagnostic warns for paths through code in which a
10297 @code{read} on a write-only file descriptor is attempted, or vice versa.
10298
10299 This diagnostic also warns for code paths in a which a function with attribute
10300 @code{fd_arg_read (N)} is called with a file descriptor opened with
10301 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10302 @code{fd_arg_write (N)} is called with a file descriptor opened with
10303 @code{O_RDONLY} at referenced argument @var{N}.
10304
10305 @opindex Wanalyzer-fd-double-close
10306 @opindex Wno-analyzer-fd-double-close
10307 @item -Wno-analyzer-fd-double-close
10308 This warning requires @option{-fanalyzer}, which enables it; use
10309 @option{-Wno-analyzer-fd-double-close}
10310 to disable it.
10311
10312 This diagnostic warns for paths through code in which a
10313 file descriptor can be closed more than once.
10314
10315 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10316
10317 @opindex Wanalyzer-fd-leak
10318 @opindex Wno-analyzer-fd-leak
10319 @item -Wno-analyzer-fd-leak
10320 This warning requires @option{-fanalyzer}, which enables it; use
10321 @option{-Wno-analyzer-fd-leak}
10322 to disable it.
10323
10324 This diagnostic warns for paths through code in which an
10325 open file descriptor is leaked.
10326
10327 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10328
10329 @opindex Wanalyzer-fd-phase-mismatch
10330 @opindex Wno-analyzer-fd-phase-mismatch
10331 @item -Wno-analyzer-fd-phase-mismatch
10332 This warning requires @option{-fanalyzer}, which enables it; use
10333 @option{-Wno-analyzer-fd-phase-mismatch}
10334 to disable it.
10335
10336 This diagnostic warns for paths through code in which an operation is
10337 attempted in the wrong phase of a file descriptor's lifetime.
10338 For example, it will warn on attempts to call @code{accept} on a stream
10339 socket that has not yet had @code{listen} successfully called on it.
10340
10341 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10342
10343 @opindex Wanalyzer-fd-type-mismatch
10344 @opindex Wno-analyzer-fd-type-mismatch
10345 @item -Wno-analyzer-fd-type-mismatch
10346 This warning requires @option{-fanalyzer}, which enables it; use
10347 @option{-Wno-analyzer-fd-type-mismatch}
10348 to disable it.
10349
10350 This diagnostic warns for paths through code in which an
10351 operation is attempted on the wrong type of file descriptor.
10352 For example, it will warn on attempts to use socket operations
10353 on a file descriptor obtained via @code{open}, or when attempting
10354 to use a stream socket operation on a datagram socket.
10355
10356 @opindex Wanalyzer-fd-use-after-close
10357 @opindex Wno-analyzer-fd-use-after-close
10358 @item -Wno-analyzer-fd-use-after-close
10359 This warning requires @option{-fanalyzer}, which enables it; use
10360 @option{-Wno-analyzer-fd-use-after-close}
10361 to disable it.
10362
10363 This diagnostic warns for paths through code in which a
10364 read or write is called on a closed file descriptor.
10365
10366 This diagnostic also warns for paths through code in which
10367 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10368 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10369 referenced argument @code{N}.
10370
10371 @opindex Wanalyzer-fd-use-without-check
10372 @opindex Wno-analyzer-fd-use-without-check
10373 @item -Wno-analyzer-fd-use-without-check
10374 This warning requires @option{-fanalyzer}, which enables it; use
10375 @option{-Wno-analyzer-fd-use-without-check}
10376 to disable it.
10377
10378 This diagnostic warns for paths through code in which a
10379 file descriptor is used without being checked for validity.
10380
10381 This diagnostic also warns for paths through code in which
10382 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10383 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10384 argument @code{N}, without being checked for validity.
10385
10386 @opindex Wanalyzer-file-leak
10387 @opindex Wno-analyzer-file-leak
10388 @item -Wno-analyzer-file-leak
10389 This warning requires @option{-fanalyzer}, which enables it; use
10390 @option{-Wno-analyzer-file-leak}
10391 to disable it.
10392
10393 This diagnostic warns for paths through the code in which a
10394 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10395
10396 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10397
10398 @opindex Wanalyzer-free-of-non-heap
10399 @opindex Wno-analyzer-free-of-non-heap
10400 @item -Wno-analyzer-free-of-non-heap
10401 This warning requires @option{-fanalyzer}, which enables it; use
10402 @option{-Wno-analyzer-free-of-non-heap}
10403 to disable it.
10404
10405 This diagnostic warns for paths through the code in which @code{free}
10406 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10407
10408 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10409
10410 @opindex Wanalyzer-imprecise-fp-arithmetic
10411 @opindex Wno-analyzer-imprecise-fp-arithmetic
10412 @item -Wno-analyzer-imprecise-fp-arithmetic
10413 This warning requires @option{-fanalyzer}, which enables it; use
10414 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10415 to disable it.
10416
10417 This diagnostic warns for paths through the code in which floating-point
10418 arithmetic is used in locations where precise computation is needed. This
10419 diagnostic only warns on use of floating-point operands inside the
10420 calculation of an allocation size at the moment.
10421
10422 @opindex Wanalyzer-infinite-recursion
10423 @opindex Wno-analyzer-infinite-recursion
10424 @item -Wno-analyzer-infinite-recursion
10425 This warning requires @option{-fanalyzer}, which enables it; use
10426 @option{-Wno-analyzer-infinite-recursion} to disable it.
10427
10428 This diagnostics warns for paths through the code which appear to
10429 lead to infinite recursion.
10430
10431 Specifically, when the analyzer "sees" a recursive call, it will compare
10432 the state of memory at the entry to the new frame with that at the entry
10433 to the previous frame of that function on the stack. The warning is
10434 issued if nothing in memory appears to be changing; any changes observed
10435 to parameters or globals are assumed to lead to termination of the
10436 recursion and thus suppress the warning.
10437
10438 This diagnostic is likely to miss cases of infinite recursion that
10439 are convered to iteration by the optimizer before the analyzer "sees"
10440 them. Hence optimization should be disabled when attempting to trigger
10441 this diagnostic.
10442
10443 Compare with @option{-Winfinite-recursion}, which provides a similar
10444 diagnostic, but is implemented in a different way.
10445
10446 @opindex Wanalyzer-jump-through-null
10447 @opindex Wno-analyzer-jump-through-null
10448 @item -Wno-analyzer-jump-through-null
10449 This warning requires @option{-fanalyzer}, which enables it; use
10450 @option{-Wno-analyzer-jump-through-null}
10451 to disable it.
10452
10453 This diagnostic warns for paths through the code in which a @code{NULL}
10454 function pointer is called.
10455
10456 @opindex Wanalyzer-malloc-leak
10457 @opindex Wno-analyzer-malloc-leak
10458 @item -Wno-analyzer-malloc-leak
10459 This warning requires @option{-fanalyzer}, which enables it; use
10460 @option{-Wno-analyzer-malloc-leak}
10461 to disable it.
10462
10463 This diagnostic warns for paths through the code in which a
10464 pointer allocated via an allocator is leaked: either @code{malloc},
10465 or a function marked with attribute @code{malloc}.
10466
10467 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10468
10469 @opindex Wanalyzer-mismatching-deallocation
10470 @opindex Wno-analyzer-mismatching-deallocation
10471 @item -Wno-analyzer-mismatching-deallocation
10472 This warning requires @option{-fanalyzer}, which enables it; use
10473 @option{-Wno-analyzer-mismatching-deallocation}
10474 to disable it.
10475
10476 This diagnostic warns for paths through the code in which the
10477 wrong deallocation function is called on a pointer value, based on
10478 which function was used to allocate the pointer value. The diagnostic
10479 will warn about mismatches between @code{free}, scalar @code{delete}
10480 and vector @code{delete[]}, and those marked as allocator/deallocator
10481 pairs using attribute @code{malloc}.
10482
10483 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10484
10485 @opindex Wanalyzer-out-of-bounds
10486 @opindex Wno-analyzer-out-of-bounds
10487 @item -Wno-analyzer-out-of-bounds
10488 This warning requires @option{-fanalyzer}, which enables it; use
10489 @option{-Wno-analyzer-out-of-bounds} to disable it.
10490
10491 This diagnostic warns for paths through the code in which a buffer is
10492 definitely read or written out-of-bounds. The diagnostic applies for
10493 cases where the analyzer is able to determine a constant offset and for
10494 accesses past the end of a buffer, also a constant capacity. Further,
10495 the diagnostic does limited checking for accesses past the end when the
10496 offset as well as the capacity is symbolic.
10497
10498 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10499
10500 @opindex Wanalyzer-possible-null-argument
10501 @opindex Wno-analyzer-possible-null-argument
10502 @item -Wno-analyzer-possible-null-argument
10503 This warning requires @option{-fanalyzer}, which enables it; use
10504 @option{-Wno-analyzer-possible-null-argument} to disable it.
10505
10506 This diagnostic warns for paths through the code in which a
10507 possibly-NULL value is passed to a function argument marked
10508 with @code{__attribute__((nonnull))} as requiring a non-NULL
10509 value.
10510
10511 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10512
10513 @opindex Wanalyzer-possible-null-dereference
10514 @opindex Wno-analyzer-possible-null-dereference
10515 @item -Wno-analyzer-possible-null-dereference
10516 This warning requires @option{-fanalyzer}, which enables it; use
10517 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10518
10519 This diagnostic warns for paths through the code in which a
10520 possibly-NULL value is dereferenced.
10521
10522 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10523
10524 @opindex Wanalyzer-null-argument
10525 @opindex Wno-analyzer-null-argument
10526 @item -Wno-analyzer-null-argument
10527 This warning requires @option{-fanalyzer}, which enables it; use
10528 @option{-Wno-analyzer-null-argument} to disable it.
10529
10530 This diagnostic warns for paths through the code in which a
10531 value known to be NULL is passed to a function argument marked
10532 with @code{__attribute__((nonnull))} as requiring a non-NULL
10533 value.
10534
10535 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10536
10537 @opindex Wanalyzer-null-dereference
10538 @opindex Wno-analyzer-null-dereference
10539 @item -Wno-analyzer-null-dereference
10540 This warning requires @option{-fanalyzer}, which enables it; use
10541 @option{-Wno-analyzer-null-dereference} to disable it.
10542
10543 This diagnostic warns for paths through the code in which a
10544 value known to be NULL is dereferenced.
10545
10546 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10547
10548 @opindex Wanalyzer-putenv-of-auto-var
10549 @opindex Wno-analyzer-putenv-of-auto-var
10550 @item -Wno-analyzer-putenv-of-auto-var
10551 This warning requires @option{-fanalyzer}, which enables it; use
10552 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10553
10554 This diagnostic warns for paths through the code in which a
10555 call to @code{putenv} is passed a pointer to an automatic variable
10556 or an on-stack buffer.
10557
10558 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}.
10559
10560 @opindex Wanalyzer-shift-count-negative
10561 @opindex Wno-analyzer-shift-count-negative
10562 @item -Wno-analyzer-shift-count-negative
10563 This warning requires @option{-fanalyzer}, which enables it; use
10564 @option{-Wno-analyzer-shift-count-negative} to disable it.
10565
10566 This diagnostic warns for paths through the code in which a
10567 shift is attempted with a negative count. It is analogous to
10568 the @option{-Wshift-count-negative} diagnostic implemented in
10569 the C/C++ front ends, but is implemented based on analyzing
10570 interprocedural paths, rather than merely parsing the syntax tree.
10571 However, the analyzer does not prioritize detection of such paths, so
10572 false negatives are more likely relative to other warnings.
10573
10574 @opindex Wanalyzer-shift-count-overflow
10575 @opindex Wno-analyzer-shift-count-overflow
10576 @item -Wno-analyzer-shift-count-overflow
10577 This warning requires @option{-fanalyzer}, which enables it; use
10578 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10579
10580 This diagnostic warns for paths through the code in which a
10581 shift is attempted with a count greater than or equal to the
10582 precision of the operand's type. It is analogous to
10583 the @option{-Wshift-count-overflow} diagnostic implemented in
10584 the C/C++ front ends, but is implemented based on analyzing
10585 interprocedural paths, rather than merely parsing the syntax tree.
10586 However, the analyzer does not prioritize detection of such paths, so
10587 false negatives are more likely relative to other warnings.
10588
10589 @opindex Wanalyzer-stale-setjmp-buffer
10590 @opindex Wno-analyzer-stale-setjmp-buffer
10591 @item -Wno-analyzer-stale-setjmp-buffer
10592 This warning requires @option{-fanalyzer}, which enables it; use
10593 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10594
10595 This diagnostic warns for paths through the code in which
10596 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10597 to a @code{setjmp} call in a function that has returned.
10598
10599 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10600 location, it records the stack frame. The stack frame becomes invalid
10601 when the function containing the @code{setjmp} call returns. Attempting
10602 to rewind to it via @code{longjmp} would reference a stack frame that
10603 no longer exists, and likely lead to a crash (or worse).
10604
10605 @opindex Wanalyzer-tainted-allocation-size
10606 @opindex Wno-analyzer-tainted-allocation-size
10607 @item -Wno-analyzer-tainted-allocation-size
10608 This warning requires both @option{-fanalyzer} and
10609 @option{-fanalyzer-checker=taint} to enable it;
10610 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10611
10612 This diagnostic warns for paths through the code in which a value
10613 that could be under an attacker's control is used as the size
10614 of an allocation without being sanitized, so that an attacker could
10615 inject an excessively large allocation and potentially cause a denial
10616 of service attack.
10617
10618 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10619
10620 @opindex Wanalyzer-tainted-assertion
10621 @opindex Wno-analyzer-tainted-assertion
10622 @item -Wno-analyzer-tainted-assertion
10623
10624 This warning requires both @option{-fanalyzer} and
10625 @option{-fanalyzer-checker=taint} to enable it;
10626 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10627
10628 This diagnostic warns for paths through the code in which a value
10629 that could be under an attacker's control is used as part of a
10630 condition without being first sanitized, and that condition guards a
10631 call to a function marked with attribute @code{noreturn}
10632 (such as the function @code{__builtin_unreachable}). Such functions
10633 typically indicate abnormal termination of the program, such as for
10634 assertion failure handlers. For example:
10635
10636 @smallexample
10637 assert (some_tainted_value < SOME_LIMIT);
10638 @end smallexample
10639
10640 In such cases:
10641
10642 @itemize
10643 @item
10644 when assertion-checking is enabled: an attacker could trigger
10645 a denial of service by injecting an assertion failure
10646
10647 @item
10648 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10649 an attacker could inject data that subverts the process, since it
10650 presumably violates a precondition that is being assumed by the code.
10651
10652 @end itemize
10653
10654 Note that when assertion-checking is disabled, the assertions are
10655 typically removed by the preprocessor before the analyzer has a chance
10656 to "see" them, so this diagnostic can only generate warnings on builds
10657 in which assertion-checking is enabled.
10658
10659 For the purpose of this warning, any function marked with attribute
10660 @code{noreturn} is considered as a possible assertion failure
10661 handler, including @code{__builtin_unreachable}. Note that these functions
10662 are sometimes removed by the optimizer before the analyzer "sees" them.
10663 Hence optimization should be disabled when attempting to trigger this
10664 diagnostic.
10665
10666 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10667
10668 The warning can also report problematic constructions such as
10669
10670 @smallexample
10671 switch (some_tainted_value) @{
10672 case 0:
10673 /* [...etc; various valid cases omitted...] */
10674 break;
10675
10676 default:
10677 __builtin_unreachable (); /* BUG: attacker can trigger this */
10678 @}
10679 @end smallexample
10680
10681 despite the above not being an assertion failure, strictly speaking.
10682
10683 @opindex Wanalyzer-tainted-array-index
10684 @opindex Wno-analyzer-tainted-array-index
10685 @item -Wno-analyzer-tainted-array-index
10686 This warning requires both @option{-fanalyzer} and
10687 @option{-fanalyzer-checker=taint} to enable it;
10688 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10689
10690 This diagnostic warns for paths through the code in which a value
10691 that could be under an attacker's control is used as the index
10692 of an array access without being sanitized, so that an attacker
10693 could inject an out-of-bounds access.
10694
10695 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10696
10697 @opindex Wanalyzer-tainted-divisor
10698 @opindex Wno-analyzer-tainted-divisor
10699 @item -Wno-analyzer-tainted-divisor
10700 This warning requires both @option{-fanalyzer} and
10701 @option{-fanalyzer-checker=taint} to enable it;
10702 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10703
10704 This diagnostic warns for paths through the code in which a value
10705 that could be under an attacker's control is used as the divisor
10706 in a division or modulus operation without being sanitized, so that
10707 an attacker could inject a division-by-zero.
10708
10709 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10710
10711 @opindex Wanalyzer-tainted-offset
10712 @opindex Wno-analyzer-tainted-offset
10713 @item -Wno-analyzer-tainted-offset
10714 This warning requires both @option{-fanalyzer} and
10715 @option{-fanalyzer-checker=taint} to enable it;
10716 use @option{-Wno-analyzer-tainted-offset} to disable it.
10717
10718 This diagnostic warns for paths through the code in which a value
10719 that could be under an attacker's control is used as a pointer offset
10720 without being sanitized, so that an attacker could inject an out-of-bounds
10721 access.
10722
10723 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10724
10725 @opindex Wanalyzer-tainted-size
10726 @opindex Wno-analyzer-tainted-size
10727 @item -Wno-analyzer-tainted-size
10728 This warning requires both @option{-fanalyzer} and
10729 @option{-fanalyzer-checker=taint} to enable it;
10730 use @option{-Wno-analyzer-tainted-size} to disable it.
10731
10732 This diagnostic warns for paths through the code in which a value
10733 that could be under an attacker's control is used as the size of
10734 an operation such as @code{memset} without being sanitized, so that an
10735 attacker could inject an out-of-bounds access.
10736
10737 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10738
10739 @opindex Wanalyzer-unsafe-call-within-signal-handler
10740 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10741 @item -Wno-analyzer-unsafe-call-within-signal-handler
10742 This warning requires @option{-fanalyzer}, which enables it; use
10743 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10744
10745 This diagnostic warns for paths through the code in which a
10746 function known to be async-signal-unsafe (such as @code{fprintf}) is
10747 called from a signal handler.
10748
10749 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10750
10751 @opindex Wanalyzer-use-after-free
10752 @opindex Wno-analyzer-use-after-free
10753 @item -Wno-analyzer-use-after-free
10754 This warning requires @option{-fanalyzer}, which enables it; use
10755 @option{-Wno-analyzer-use-after-free} to disable it.
10756
10757 This diagnostic warns for paths through the code in which a
10758 pointer is used after a deallocator is called on it: either @code{free},
10759 or a deallocator referenced by attribute @code{malloc}.
10760
10761 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10762
10763 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10764 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10765 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10766 This warning requires @option{-fanalyzer}, which enables it; use
10767 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10768 to disable it.
10769
10770 This diagnostic warns for paths through the code in which a pointer
10771 is dereferenced that points to a variable in a stale stack frame.
10772
10773 @opindex Wanalyzer-va-arg-type-mismatch
10774 @opindex Wno-analyzer-va-arg-type-mismatch
10775 @item -Wno-analyzer-va-arg-type-mismatch
10776 This warning requires @option{-fanalyzer}, which enables it; use
10777 @option{-Wno-analyzer-va-arg-type-mismatch}
10778 to disable it.
10779
10780 This diagnostic warns for interprocedural paths through the code for which
10781 the analyzer detects an attempt to use @code{va_arg} to extract a value
10782 passed to a variadic call, but uses a type that does not match that of
10783 the expression passed to the call.
10784
10785 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
10786
10787 @opindex Wanalyzer-va-list-exhausted
10788 @opindex Wno-analyzer-va-list-exhausted
10789 @item -Wno-analyzer-va-list-exhausted
10790 This warning requires @option{-fanalyzer}, which enables it; use
10791 @option{-Wno-analyzer-va-list-exhausted}
10792 to disable it.
10793
10794 This diagnostic warns for interprocedural paths through the code for which
10795 the analyzer detects an attempt to use @code{va_arg} to access the next
10796 value passed to a variadic call, but all of the values in the
10797 @code{va_list} have already been consumed.
10798
10799 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
10800
10801 @opindex Wanalyzer-va-list-leak
10802 @opindex Wno-analyzer-va-list-leak
10803 @item -Wno-analyzer-va-list-leak
10804 This warning requires @option{-fanalyzer}, which enables it; use
10805 @option{-Wno-analyzer-va-list-leak}
10806 to disable it.
10807
10808 This diagnostic warns for interprocedural paths through the code for which
10809 the analyzer detects that @code{va_start} or @code{va_copy} has been called
10810 on a @code{va_list} without a corresponding call to @code{va_end}.
10811
10812 @opindex Wanalyzer-va-list-use-after-va-end
10813 @opindex Wno-analyzer-va-list-use-after-va-end
10814 @item -Wno-analyzer-va-list-use-after-va-end
10815 This warning requires @option{-fanalyzer}, which enables it; use
10816 @option{-Wno-analyzer-va-list-use-after-va-end}
10817 to disable it.
10818
10819 This diagnostic warns for interprocedural paths through the code for which
10820 the analyzer detects an attempt to use a @code{va_list} after
10821 @code{va_end} has been called on it.
10822 @code{va_list}.
10823
10824 @opindex Wanalyzer-write-to-const
10825 @opindex Wno-analyzer-write-to-const
10826 @item -Wno-analyzer-write-to-const
10827 This warning requires @option{-fanalyzer}, which enables it; use
10828 @option{-Wno-analyzer-write-to-const}
10829 to disable it.
10830
10831 This diagnostic warns for paths through the code in which the analyzer
10832 detects an attempt to write through a pointer to a @code{const} object.
10833 However, the analyzer does not prioritize detection of such paths, so
10834 false negatives are more likely relative to other warnings.
10835
10836 @opindex Wanalyzer-write-to-string-literal
10837 @opindex Wno-analyzer-write-to-string-literal
10838 @item -Wno-analyzer-write-to-string-literal
10839 This warning requires @option{-fanalyzer}, which enables it; use
10840 @option{-Wno-analyzer-write-to-string-literal}
10841 to disable it.
10842
10843 This diagnostic warns for paths through the code in which the analyzer
10844 detects an attempt to write through a pointer to a string literal.
10845 However, the analyzer does not prioritize detection of such paths, so
10846 false negatives are more likely relative to other warnings.
10847
10848 @opindex Wanalyzer-use-of-uninitialized-value
10849 @opindex Wno-analyzer-use-of-uninitialized-value
10850 @item -Wno-analyzer-use-of-uninitialized-value
10851 This warning requires @option{-fanalyzer}, which enables it; use
10852 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
10853
10854 This diagnostic warns for paths through the code in which an uninitialized
10855 value is used.
10856
10857 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
10858
10859 @end table
10860
10861 The analyzer has hardcoded knowledge about the behavior of the following
10862 memory-management functions:
10863
10864 @itemize @bullet
10865 @item @code{alloca}
10866 @item The built-in functions @code{__builtin_alloc},
10867 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
10868 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
10869 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
10870 @code{__builtin_memset_chk}, @code{__builtin_realloc},
10871 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
10872 @item @code{calloc}
10873 @item @code{free}
10874 @item @code{malloc}
10875 @item @code{memset}
10876 @item @code{operator delete}
10877 @item @code{operator delete []}
10878 @item @code{operator new}
10879 @item @code{operator new []}
10880 @item @code{realloc}
10881 @item @code{strdup}
10882 @item @code{strndup}
10883 @end itemize
10884
10885 @noindent
10886 of the following functions for working with file descriptors:
10887
10888 @itemize @bullet
10889 @item @code{open}
10890 @item @code{close}
10891 @item @code{creat}
10892 @item @code{dup}, @code{dup2} and @code{dup3}
10893 @item @code{isatty}
10894 @item @code{pipe}, and @code{pipe2}
10895 @item @code{read}
10896 @item @code{write}
10897 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
10898 @end itemize
10899
10900 @noindent
10901 of the following functions for working with @code{<stdio.h>} streams:
10902 @itemize @bullet
10903 @item The built-in functions @code{__builtin_fprintf},
10904 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
10905 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
10906 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
10907 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
10908 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
10909 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
10910 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
10911 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
10912 @code{__builtin_vprintf}
10913 @item @code{fopen}
10914 @item @code{fclose}
10915 @item @code{ferror}
10916 @item @code{fgets}
10917 @item @code{fgets_unlocked}
10918 @item @code{fileno}
10919 @item @code{fread}
10920 @item @code{getc}
10921 @item @code{getchar}
10922 @item @code{fprintf}
10923 @item @code{printf}
10924 @item @code{fwrite}
10925 @end itemize
10926
10927 @noindent
10928 and of the following functions:
10929
10930 @itemize @bullet
10931 @item The built-in functions @code{__builtin_expect},
10932 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
10933 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
10934 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
10935 @code{__builtin_va_start}
10936 @item The GNU extensions @code{error} and @code{error_at_line}
10937 @item @code{getpass}
10938 @item @code{longjmp}
10939 @item @code{putenv}
10940 @item @code{setjmp}
10941 @item @code{siglongjmp}
10942 @item @code{signal}
10943 @item @code{sigsetjmp}
10944 @item @code{strchr}
10945 @item @code{strlen}
10946 @end itemize
10947
10948 In addition, various functions with an @code{__analyzer_} prefix have
10949 special meaning to the analyzer, described in the GCC Internals manual.
10950
10951 Pertinent parameters for controlling the exploration are:
10952 @itemize @bullet
10953 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
10954 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
10955 @item @option{--param analyzer-max-recursion-depth=@var{value}}
10956 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
10957 @end itemize
10958
10959 The following options control the analyzer.
10960
10961 @table @gcctabopt
10962
10963 @opindex fanalyzer-call-summaries
10964 @opindex fno-analyzer-call-summaries
10965 @item -fanalyzer-call-summaries
10966 Simplify interprocedural analysis by computing the effect of certain calls,
10967 rather than exploring all paths through the function from callsite to each
10968 possible return.
10969
10970 If enabled, call summaries are only used for functions with more than one
10971 call site, and that are sufficiently complicated (as per
10972 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
10973
10974 @opindex fanalyzer-checker
10975 @item -fanalyzer-checker=@var{name}
10976 Restrict the analyzer to run just the named checker, and enable it.
10977
10978 Some checkers are disabled by default (even with @option{-fanalyzer}),
10979 such as the @code{taint} checker that implements
10980 @option{-Wanalyzer-tainted-array-index}, and this option is required
10981 to enable them.
10982
10983 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
10984 following warnings from @option{-fanalyzer}:
10985
10986 @gccoptlist{
10987 -Wanalyzer-deref-before-check
10988 -Wanalyzer-double-fclose
10989 -Wanalyzer-double-free
10990 -Wanalyzer-exposure-through-output-file
10991 -Wanalyzer-fd-access-mode-mismatch
10992 -Wanalyzer-fd-double-close
10993 -Wanalyzer-fd-leak
10994 -Wanalyzer-fd-use-after-close
10995 -Wanalyzer-fd-use-without-check
10996 -Wanalyzer-file-leak
10997 -Wanalyzer-free-of-non-heap
10998 -Wanalyzer-malloc-leak
10999 -Wanalyzer-mismatching-deallocation
11000 -Wanalyzer-null-argument
11001 -Wanalyzer-null-dereference
11002 -Wanalyzer-possible-null-argument
11003 -Wanalyzer-possible-null-dereference
11004 -Wanalyzer-unsafe-call-within-signal-handler
11005 -Wanalyzer-use-after-free
11006 -Wanalyzer-va-list-leak
11007 -Wanalyzer-va-list-use-after-va-end
11008 }
11009
11010 @opindex fanalyzer-feasibility
11011 @opindex fno-analyzer-feasibility
11012 @item -fno-analyzer-feasibility
11013 This option is intended for analyzer developers.
11014
11015 By default the analyzer verifies that there is a feasible control flow path
11016 for each diagnostic it emits: that the conditions that hold are not mutually
11017 exclusive. Diagnostics for which no feasible path can be found are rejected.
11018 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11019 debugging issues in this code.
11020
11021 @opindex fanalyzer-fine-grained
11022 @opindex fno-analyzer-fine-grained
11023 @item -fanalyzer-fine-grained
11024 This option is intended for analyzer developers.
11025
11026 Internally the analyzer builds an ``exploded graph'' that combines
11027 control flow graphs with data flow information.
11028
11029 By default, an edge in this graph can contain the effects of a run
11030 of multiple statements within a basic block. With
11031 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11032
11033 @opindex fanalyzer-show-duplicate-count
11034 @opindex fno-analyzer-show-duplicate-count
11035 @item -fanalyzer-show-duplicate-count
11036 This option is intended for analyzer developers: if multiple diagnostics
11037 have been detected as being duplicates of each other, it emits a note when
11038 reporting the best diagnostic, giving the number of additional diagnostics
11039 that were suppressed by the deduplication logic.
11040
11041 @opindex fanalyzer-state-merge
11042 @opindex fno-analyzer-state-merge
11043 @item -fno-analyzer-state-merge
11044 This option is intended for analyzer developers.
11045
11046 By default the analyzer attempts to simplify analysis by merging
11047 sufficiently similar states at each program point as it builds its
11048 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
11049 merging can be suppressed, for debugging state-handling issues.
11050
11051 @opindex fanalyzer-state-purge
11052 @opindex fno-analyzer-state-purge
11053 @item -fno-analyzer-state-purge
11054 This option is intended for analyzer developers.
11055
11056 By default the analyzer attempts to simplify analysis by purging
11057 aspects of state at a program point that appear to no longer be relevant
11058 e.g. the values of locals that aren't accessed later in the function
11059 and which aren't relevant to leak analysis.
11060
11061 With @option{-fno-analyzer-state-purge} this purging of state can
11062 be suppressed, for debugging state-handling issues.
11063
11064 @opindex fanalyzer-suppress-followups
11065 @opindex fno-analyzer-suppress-followups
11066 @item -fno-analyzer-suppress-followups
11067 This option is intended for analyzer developers.
11068
11069 By default the analyzer will stop exploring an execution path after
11070 encountering certain diagnostics, in order to avoid potentially issuing a
11071 cascade of follow-up diagnostics.
11072
11073 The diagnostics that terminate analysis along a path are:
11074
11075 @itemize
11076 @item @option{-Wanalyzer-null-argument}
11077 @item @option{-Wanalyzer-null-dereference}
11078 @item @option{-Wanalyzer-use-after-free}
11079 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11080 @item @option{-Wanalyzer-use-of-uninitialized-value}
11081 @end itemize
11082
11083 With @option{-fno-analyzer-suppress-followups} the analyzer will
11084 continue to explore such paths even after such diagnostics, which may
11085 be helpful for debugging issues in the analyzer, or for microbenchmarks
11086 for detecting undefined behavior.
11087
11088 @opindex fanalyzer-transitivity
11089 @opindex fno-analyzer-transitivity
11090 @item -fanalyzer-transitivity
11091 This option enables transitivity of constraints within the analyzer.
11092
11093 @opindex fanalyzer-undo-inlining
11094 @opindex fno-analyzer-undo-inlining
11095 @item -fno-analyzer-undo-inlining
11096 This option is intended for analyzer developers.
11097
11098 @option{-fanalyzer} runs relatively late compared to other code analysis
11099 tools, and some optimizations have already been applied to the code. In
11100 particular function inlining may have occurred, leading to the
11101 interprocedural execution paths emitted by the analyzer containing
11102 function frames that don't correspond to those in the original source
11103 code.
11104
11105 By default the analyzer attempts to reconstruct the original function
11106 frames, and to emit events showing the inlined calls.
11107
11108 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11109 the original frame information can be be disabled, which may be of help
11110 when debugging issues in the analyzer.
11111
11112 @item -fanalyzer-verbose-edges
11113 This option is intended for analyzer developers. It enables more
11114 verbose, lower-level detail in the descriptions of control flow
11115 within diagnostic paths.
11116
11117 @item -fanalyzer-verbose-state-changes
11118 This option is intended for analyzer developers. It enables more
11119 verbose, lower-level detail in the descriptions of events relating
11120 to state machines within diagnostic paths.
11121
11122 @item -fanalyzer-verbosity=@var{level}
11123 This option controls the complexity of the control flow paths that are
11124 emitted for analyzer diagnostics.
11125
11126 The @var{level} can be one of:
11127
11128 @table @samp
11129 @item 0
11130 At this level, interprocedural call and return events are displayed,
11131 along with the most pertinent state-change events relating to
11132 a diagnostic. For example, for a double-@code{free} diagnostic,
11133 both calls to @code{free} will be shown.
11134
11135 @item 1
11136 As per the previous level, but also show events for the entry
11137 to each function.
11138
11139 @item 2
11140 As per the previous level, but also show events relating to
11141 control flow that are significant to triggering the issue
11142 (e.g. ``true path taken'' at a conditional).
11143
11144 This level is the default.
11145
11146 @item 3
11147 As per the previous level, but show all control flow events, not
11148 just significant ones.
11149
11150 @item 4
11151 This level is intended for analyzer developers; it adds various
11152 other events intended for debugging the analyzer.
11153
11154 @end table
11155
11156 @opindex fdump-analyzer
11157 @item -fdump-analyzer
11158 Dump internal details about what the analyzer is doing to
11159 @file{@var{file}.analyzer.txt}.
11160 @option{-fdump-analyzer-stderr} overrides this option.
11161
11162 @opindex fdump-analyzer-stderr
11163 @item -fdump-analyzer-stderr
11164 Dump internal details about what the analyzer is doing to stderr.
11165 This option overrides @option{-fdump-analyzer}.
11166
11167 @opindex fdump-analyzer-callgraph
11168 @item -fdump-analyzer-callgraph
11169 Dump a representation of the call graph suitable for viewing with
11170 GraphViz to @file{@var{file}.callgraph.dot}.
11171
11172 @opindex fdump-analyzer-exploded-graph
11173 @item -fdump-analyzer-exploded-graph
11174 Dump a representation of the ``exploded graph'' suitable for viewing with
11175 GraphViz to @file{@var{file}.eg.dot}.
11176 Nodes are color-coded based on state-machine states to emphasize
11177 state changes.
11178
11179 @opindex dump-analyzer-exploded-nodes
11180 @item -fdump-analyzer-exploded-nodes
11181 Emit diagnostics showing where nodes in the ``exploded graph'' are
11182 in relation to the program source.
11183
11184 @opindex dump-analyzer-exploded-nodes-2
11185 @item -fdump-analyzer-exploded-nodes-2
11186 Dump a textual representation of the ``exploded graph'' to
11187 @file{@var{file}.eg.txt}.
11188
11189 @opindex dump-analyzer-exploded-nodes-3
11190 @item -fdump-analyzer-exploded-nodes-3
11191 Dump a textual representation of the ``exploded graph'' to
11192 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11193 This is typically a large number of dump files.
11194
11195 @opindex fdump-analyzer-exploded-paths
11196 @item -fdump-analyzer-exploded-paths
11197 Dump a textual representation of the ``exploded path'' for each
11198 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11199
11200 @opindex dump-analyzer-feasibility
11201 @item -fdump-analyzer-feasibility
11202 Dump internal details about the analyzer's search for feasible paths.
11203 The details are written in a form suitable for viewing with GraphViz
11204 to filenames of the form @file{@var{file}.*.fg.dot},
11205 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11206
11207 @opindex fdump-analyzer-json
11208 @item -fdump-analyzer-json
11209 Dump a compressed JSON representation of analyzer internals to
11210 @file{@var{file}.analyzer.json.gz}. The precise format is subject
11211 to change.
11212
11213 @opindex fdump-analyzer-state-purge
11214 @item -fdump-analyzer-state-purge
11215 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11216 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11217 graph with information on what state will be purged at each node.
11218 The graph is written to @file{@var{file}.state-purge.dot}.
11219
11220 @opindex fdump-analyzer-supergraph
11221 @item -fdump-analyzer-supergraph
11222 Dump representations of the ``supergraph'' suitable for viewing with
11223 GraphViz to @file{@var{file}.supergraph.dot} and to
11224 @file{@var{file}.supergraph-eg.dot}. These show all of the
11225 control flow graphs in the program, with interprocedural edges for
11226 calls and returns. The second dump contains annotations showing nodes
11227 in the ``exploded graph'' and diagnostics associated with them.
11228
11229 @opindex fdump-analyzer-untracked
11230 @item -fdump-analyzer-untracked
11231 Emit custom warnings with internal details intended for analyzer developers.
11232
11233 @end table
11234
11235 @node Debugging Options
11236 @section Options for Debugging Your Program
11237 @cindex options, debugging
11238 @cindex debugging information options
11239
11240 To tell GCC to emit extra information for use by a debugger, in almost
11241 all cases you need only to add @option{-g} to your other options. Some debug
11242 formats can co-exist (like DWARF with CTF) when each of them is enabled
11243 explicitly by adding the respective command line option to your other options.
11244
11245 GCC allows you to use @option{-g} with
11246 @option{-O}. The shortcuts taken by optimized code may occasionally
11247 be surprising: some variables you declared may not exist
11248 at all; flow of control may briefly move where you did not expect it;
11249 some statements may not be executed because they compute constant
11250 results or their values are already at hand; some statements may
11251 execute in different places because they have been moved out of loops.
11252 Nevertheless it is possible to debug optimized output. This makes
11253 it reasonable to use the optimizer for programs that might have bugs.
11254
11255 If you are not using some other optimization option, consider
11256 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
11257 With no @option{-O} option at all, some compiler passes that collect
11258 information useful for debugging do not run at all, so that
11259 @option{-Og} may result in a better debugging experience.
11260
11261 @table @gcctabopt
11262 @opindex g
11263 @item -g
11264 Produce debugging information in the operating system's native format
11265 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
11266 information.
11267
11268 On most systems that use stabs format, @option{-g} enables use of extra
11269 debugging information that only GDB can use; this extra information
11270 makes debugging work better in GDB but probably makes other debuggers
11271 crash or refuse to read the program. If you want to control for certain whether
11272 to generate the extra information, use @option{-gvms} (see below).
11273
11274 @opindex ggdb
11275 @item -ggdb
11276 Produce debugging information for use by GDB@. This means to use the
11277 most expressive format available (DWARF, stabs, or the native format
11278 if neither of those are supported), including GDB extensions if at all
11279 possible.
11280
11281 @opindex gdwarf
11282 @item -gdwarf
11283 @itemx -gdwarf-@var{version}
11284 Produce debugging information in DWARF format (if that is supported).
11285 The value of @var{version} may be either 2, 3, 4 or 5; the default
11286 version for most targets is 5 (with the exception of VxWorks, TPF and
11287 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
11288 to version 4).
11289
11290 Note that with DWARF Version 2, some ports require and always
11291 use some non-conflicting DWARF 3 extensions in the unwind tables.
11292
11293 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11294 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11295
11296 GCC no longer supports DWARF Version 1, which is substantially
11297 different than Version 2 and later. For historical reasons, some
11298 other DWARF-related options such as
11299 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11300 in their names, but apply to all currently-supported versions of DWARF.
11301
11302 @opindex gbtf
11303 @item -gbtf
11304 Request BTF debug information. BTF is the default debugging format for the
11305 eBPF target. On other targets, like x86, BTF debug information can be
11306 generated along with DWARF debug information when both of the debug formats are
11307 enabled explicitly via their respective command line options.
11308
11309 @opindex gctf
11310 @item -gctf
11311 @itemx -gctf@var{level}
11312 Request CTF debug information and use level to specify how much CTF debug
11313 information should be produced. If @option{-gctf} is specified
11314 without a value for level, the default level of CTF debug information is 2.
11315
11316 CTF debug information can be generated along with DWARF debug information when
11317 both of the debug formats are enabled explicitly via their respective command
11318 line options.
11319
11320 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
11321 negates @option{-gctf}.
11322
11323 Level 1 produces CTF information for tracebacks only. This includes callsite
11324 information, but does not include type information.
11325
11326 Level 2 produces type information for entities (functions, data objects etc.)
11327 at file-scope or global-scope only.
11328
11329 @opindex gvms
11330 @item -gvms
11331 Produce debugging information in Alpha/VMS debug format (if that is
11332 supported). This is the format used by DEBUG on Alpha/VMS systems.
11333
11334 @item -gcodeview
11335 @opindex gcodeview
11336 Produce debugging information in CodeView debug format (if that is
11337 supported). This is the format used by Microsoft Visual C++ on
11338 Windows.
11339
11340 @item -g@var{level}
11341 @itemx -ggdb@var{level}
11342 @itemx -gvms@var{level}
11343 Request debugging information and also use @var{level} to specify how
11344 much information. The default level is 2.
11345
11346 Level 0 produces no debug information at all. Thus, @option{-g0} negates
11347 @option{-g}.
11348
11349 Level 1 produces minimal information, enough for making backtraces in
11350 parts of the program that you don't plan to debug. This includes
11351 descriptions of functions and external variables, and line number
11352 tables, but no information about local variables.
11353
11354 Level 3 includes extra information, such as all the macro definitions
11355 present in the program. Some debuggers support macro expansion when
11356 you use @option{-g3}.
11357
11358 If you use multiple @option{-g} options, with or without level numbers,
11359 the last such option is the one that is effective.
11360
11361 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11362 confusion with @option{-gdwarf-@var{level}}.
11363 Instead use an additional @option{-g@var{level}} option to change the
11364 debug level for DWARF.
11365
11366 @opindex feliminate-unused-debug-symbols
11367 @opindex fno-eliminate-unused-debug-symbols
11368 @item -fno-eliminate-unused-debug-symbols
11369 By default, no debug information is produced for symbols that are not actually
11370 used. Use this option if you want debug information for all symbols.
11371
11372 @opindex femit-class-debug-always
11373 @item -femit-class-debug-always
11374 Instead of emitting debugging information for a C++ class in only one
11375 object file, emit it in all object files using the class. This option
11376 should be used only with debuggers that are unable to handle the way GCC
11377 normally emits debugging information for classes because using this
11378 option increases the size of debugging information by as much as a
11379 factor of two.
11380
11381 @opindex fmerge-debug-strings
11382 @opindex fno-merge-debug-strings
11383 @item -fno-merge-debug-strings
11384 Direct the linker to not merge together strings in the debugging
11385 information that are identical in different object files. Merging is
11386 not supported by all assemblers or linkers. Merging decreases the size
11387 of the debug information in the output file at the cost of increasing
11388 link processing time. Merging is enabled by default.
11389
11390 @opindex fdebug-prefix-map
11391 @item -fdebug-prefix-map=@var{old}=@var{new}
11392 When compiling files residing in directory @file{@var{old}}, record
11393 debugging information describing them as if the files resided in
11394 directory @file{@var{new}} instead. This can be used to replace a
11395 build-time path with an install-time path in the debug info. It can
11396 also be used to change an absolute path to a relative path by using
11397 @file{.} for @var{new}. This can give more reproducible builds, which
11398 are location independent, but may require an extra command to tell GDB
11399 where to find the source files. See also @option{-ffile-prefix-map}
11400 and @option{-fcanon-prefix-map}.
11401
11402 @opindex fvar-tracking
11403 @item -fvar-tracking
11404 Run variable tracking pass. It computes where variables are stored at each
11405 position in code. Better debugging information is then generated
11406 (if the debugging information format supports this information).
11407
11408 It is enabled by default when compiling with optimization (@option{-Os},
11409 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11410 the debug info format supports it.
11411
11412 @opindex fvar-tracking-assignments
11413 @opindex fno-var-tracking-assignments
11414 @item -fvar-tracking-assignments
11415 Annotate assignments to user variables early in the compilation and
11416 attempt to carry the annotations over throughout the compilation all the
11417 way to the end, in an attempt to improve debug information while
11418 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
11419
11420 It can be enabled even if var-tracking is disabled, in which case
11421 annotations are created and maintained, but discarded at the end.
11422 By default, this flag is enabled together with @option{-fvar-tracking},
11423 except when selective scheduling is enabled.
11424
11425 @opindex gsplit-dwarf
11426 @item -gsplit-dwarf
11427 If DWARF debugging information is enabled, separate as much debugging
11428 information as possible into a separate output file with the extension
11429 @file{.dwo}. This option allows the build system to avoid linking files with
11430 debug information. To be useful, this option requires a debugger capable of
11431 reading @file{.dwo} files.
11432
11433 @opindex gdwarf32
11434 @opindex gdwarf64
11435 @item -gdwarf32
11436 @itemx -gdwarf64
11437 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11438 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11439 DWARF format. The default is target specific, on most targets it is
11440 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
11441 can't support more than 2GiB of debug information in any of the DWARF
11442 debug information sections. The 64-bit DWARF format allows larger debug
11443 information and might not be well supported by all consumers yet.
11444
11445 @opindex gdescribe-dies
11446 @item -gdescribe-dies
11447 Add description attributes to some DWARF DIEs that have no name attribute,
11448 such as artificial variables, external references and call site
11449 parameter DIEs.
11450
11451 @opindex gpubnames
11452 @item -gpubnames
11453 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11454
11455 @opindex ggnu-pubnames
11456 @item -ggnu-pubnames
11457 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11458 suitable for conversion into a GDB@ index. This option is only useful
11459 with a linker that can produce GDB@ index version 7.
11460
11461 @opindex fdebug-types-section
11462 @opindex fno-debug-types-section
11463 @item -fdebug-types-section
11464 When using DWARF Version 4 or higher, type DIEs can be put into
11465 their own @code{.debug_types} section instead of making them part of the
11466 @code{.debug_info} section. It is more efficient to put them in a separate
11467 comdat section since the linker can then remove duplicates.
11468 But not all DWARF consumers support @code{.debug_types} sections yet
11469 and on some objects @code{.debug_types} produces larger instead of smaller
11470 debugging information.
11471
11472 @opindex grecord-gcc-switches
11473 @opindex gno-record-gcc-switches
11474 @item -grecord-gcc-switches
11475 @itemx -gno-record-gcc-switches
11476 This switch causes the command-line options used to invoke the
11477 compiler that may affect code generation to be appended to the
11478 DW_AT_producer attribute in DWARF debugging information. The options
11479 are concatenated with spaces separating them from each other and from
11480 the compiler version.
11481 It is enabled by default.
11482 See also @option{-frecord-gcc-switches} for another
11483 way of storing compiler options into the object file.
11484
11485 @opindex gstrict-dwarf
11486 @item -gstrict-dwarf
11487 Disallow using extensions of later DWARF standard version than selected
11488 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
11489 DWARF extensions from later standard versions is allowed.
11490
11491 @opindex gno-strict-dwarf
11492 @item -gno-strict-dwarf
11493 Allow using extensions of later DWARF standard version than selected with
11494 @option{-gdwarf-@var{version}}.
11495
11496 @opindex gas-loc-support
11497 @item -gas-loc-support
11498 Inform the compiler that the assembler supports @code{.loc} directives.
11499 It may then use them for the assembler to generate DWARF2+ line number
11500 tables.
11501
11502 This is generally desirable, because assembler-generated line-number
11503 tables are a lot more compact than those the compiler can generate
11504 itself.
11505
11506 This option will be enabled by default if, at GCC configure time, the
11507 assembler was found to support such directives.
11508
11509 @opindex gno-as-loc-support
11510 @item -gno-as-loc-support
11511 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11512 line number tables are to be generated.
11513
11514 @opindex gas-locview-support
11515 @item -gas-locview-support
11516 Inform the compiler that the assembler supports @code{view} assignment
11517 and reset assertion checking in @code{.loc} directives.
11518
11519 This option will be enabled by default if, at GCC configure time, the
11520 assembler was found to support them.
11521
11522 @item -gno-as-locview-support
11523 Force GCC to assign view numbers internally, if
11524 @option{-gvariable-location-views} are explicitly requested.
11525
11526 @opindex gcolumn-info
11527 @opindex gno-column-info
11528 @item -gcolumn-info
11529 @itemx -gno-column-info
11530 Emit location column information into DWARF debugging information, rather
11531 than just file and line.
11532 This option is enabled by default.
11533
11534 @opindex gstatement-frontiers
11535 @opindex gno-statement-frontiers
11536 @item -gstatement-frontiers
11537 @itemx -gno-statement-frontiers
11538 This option causes GCC to create markers in the internal representation
11539 at the beginning of statements, and to keep them roughly in place
11540 throughout compilation, using them to guide the output of @code{is_stmt}
11541 markers in the line number table. This is enabled by default when
11542 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11543 @dots{}), and outputting DWARF 2 debug information at the normal level.
11544
11545 @opindex gvariable-location-views
11546 @opindex gvariable-location-views=incompat5
11547 @opindex gno-variable-location-views
11548 @item -gvariable-location-views
11549 @itemx -gvariable-location-views=incompat5
11550 @itemx -gno-variable-location-views
11551 Augment variable location lists with progressive view numbers implied
11552 from the line number table. This enables debug information consumers to
11553 inspect state at certain points of the program, even if no instructions
11554 associated with the corresponding source locations are present at that
11555 point. If the assembler lacks support for view numbers in line number
11556 tables, this will cause the compiler to emit the line number table,
11557 which generally makes them somewhat less compact. The augmented line
11558 number tables and location lists are fully backward-compatible, so they
11559 can be consumed by debug information consumers that are not aware of
11560 these augmentations, but they won't derive any benefit from them either.
11561
11562 This is enabled by default when outputting DWARF 2 debug information at
11563 the normal level, as long as there is assembler support,
11564 @option{-fvar-tracking-assignments} is enabled and
11565 @option{-gstrict-dwarf} is not. When assembler support is not
11566 available, this may still be enabled, but it will force GCC to output
11567 internal line number tables, and if
11568 @option{-ginternal-reset-location-views} is not enabled, that will most
11569 certainly lead to silently mismatching location views.
11570
11571 There is a proposed representation for view numbers that is not backward
11572 compatible with the location list format introduced in DWARF 5, that can
11573 be enabled with @option{-gvariable-location-views=incompat5}. This
11574 option may be removed in the future, is only provided as a reference
11575 implementation of the proposed representation. Debug information
11576 consumers are not expected to support this extended format, and they
11577 would be rendered unable to decode location lists using it.
11578
11579 @opindex ginternal-reset-location-views
11580 @opindex gno-internal-reset-location-views
11581 @item -ginternal-reset-location-views
11582 @itemx -gno-internal-reset-location-views
11583 Attempt to determine location views that can be omitted from location
11584 view lists. This requires the compiler to have very accurate insn
11585 length estimates, which isn't always the case, and it may cause
11586 incorrect view lists to be generated silently when using an assembler
11587 that does not support location view lists. The GNU assembler will flag
11588 any such error as a @code{view number mismatch}. This is only enabled
11589 on ports that define a reliable estimation function.
11590
11591 @opindex ginline-points
11592 @opindex gno-inline-points
11593 @item -ginline-points
11594 @itemx -gno-inline-points
11595 Generate extended debug information for inlined functions. Location
11596 view tracking markers are inserted at inlined entry points, so that
11597 address and view numbers can be computed and output in debug
11598 information. This can be enabled independently of location views, in
11599 which case the view numbers won't be output, but it can only be enabled
11600 along with statement frontiers, and it is only enabled by default if
11601 location views are enabled.
11602
11603 @opindex gz
11604 @item -gz@r{[}=@var{type}@r{]}
11605 Produce compressed debug sections in DWARF format, if that is supported.
11606 If @var{type} is not given, the default type depends on the capabilities
11607 of the assembler and linker used. @var{type} may be one of
11608 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11609 compression in ELF gABI format). If the linker doesn't support writing
11610 compressed debug sections, the option is rejected. Otherwise, if the
11611 assembler does not support them, @option{-gz} is silently ignored when
11612 producing object files.
11613
11614 @opindex femit-struct-debug-baseonly
11615 @item -femit-struct-debug-baseonly
11616 Emit debug information for struct-like types
11617 only when the base name of the compilation source file
11618 matches the base name of file in which the struct is defined.
11619
11620 This option substantially reduces the size of debugging information,
11621 but at significant potential loss in type information to the debugger.
11622 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11623 See @option{-femit-struct-debug-detailed} for more detailed control.
11624
11625 This option works only with DWARF debug output.
11626
11627 @opindex femit-struct-debug-reduced
11628 @item -femit-struct-debug-reduced
11629 Emit debug information for struct-like types
11630 only when the base name of the compilation source file
11631 matches the base name of file in which the type is defined,
11632 unless the struct is a template or defined in a system header.
11633
11634 This option significantly reduces the size of debugging information,
11635 with some potential loss in type information to the debugger.
11636 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11637 See @option{-femit-struct-debug-detailed} for more detailed control.
11638
11639 This option works only with DWARF debug output.
11640
11641 @opindex femit-struct-debug-detailed
11642 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11643 Specify the struct-like types
11644 for which the compiler generates debug information.
11645 The intent is to reduce duplicate struct debug information
11646 between different object files within the same program.
11647
11648 This option is a detailed version of
11649 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11650 which serves for most needs.
11651
11652 A specification has the syntax@*
11653 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11654
11655 The optional first word limits the specification to
11656 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11657 A struct type is used directly when it is the type of a variable, member.
11658 Indirect uses arise through pointers to structs.
11659 That is, when use of an incomplete struct is valid, the use is indirect.
11660 An example is
11661 @samp{struct one direct; struct two * indirect;}.
11662
11663 The optional second word limits the specification to
11664 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11665 Generic structs are a bit complicated to explain.
11666 For C++, these are non-explicit specializations of template classes,
11667 or non-template classes within the above.
11668 Other programming languages have generics,
11669 but @option{-femit-struct-debug-detailed} does not yet implement them.
11670
11671 The third word specifies the source files for those
11672 structs for which the compiler should emit debug information.
11673 The values @samp{none} and @samp{any} have the normal meaning.
11674 The value @samp{base} means that
11675 the base of name of the file in which the type declaration appears
11676 must match the base of the name of the main compilation file.
11677 In practice, this means that when compiling @file{foo.c}, debug information
11678 is generated for types declared in that file and @file{foo.h},
11679 but not other header files.
11680 The value @samp{sys} means those types satisfying @samp{base}
11681 or declared in system or compiler headers.
11682
11683 You may need to experiment to determine the best settings for your application.
11684
11685 The default is @option{-femit-struct-debug-detailed=all}.
11686
11687 This option works only with DWARF debug output.
11688
11689 @opindex fdwarf2-cfi-asm
11690 @opindex fno-dwarf2-cfi-asm
11691 @item -fno-dwarf2-cfi-asm
11692 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11693 instead of using GAS @code{.cfi_*} directives.
11694
11695 @opindex feliminate-unused-debug-types
11696 @opindex fno-eliminate-unused-debug-types
11697 @item -fno-eliminate-unused-debug-types
11698 Normally, when producing DWARF output, GCC avoids producing debug symbol
11699 output for types that are nowhere used in the source file being compiled.
11700 Sometimes it is useful to have GCC emit debugging
11701 information for all types declared in a compilation
11702 unit, regardless of whether or not they are actually used
11703 in that compilation unit, for example
11704 if, in the debugger, you want to cast a value to a type that is
11705 not actually used in your program (but is declared). More often,
11706 however, this results in a significant amount of wasted space.
11707 @end table
11708
11709 @node Optimize Options
11710 @section Options That Control Optimization
11711 @cindex optimize options
11712 @cindex options, optimization
11713
11714 These options control various sorts of optimizations.
11715
11716 Without any optimization option, the compiler's goal is to reduce the
11717 cost of compilation and to make debugging produce the expected
11718 results. Statements are independent: if you stop the program with a
11719 breakpoint between statements, you can then assign a new value to any
11720 variable or change the program counter to any other statement in the
11721 function and get exactly the results you expect from the source
11722 code.
11723
11724 Turning on optimization flags makes the compiler attempt to improve
11725 the performance and/or code size at the expense of compilation time
11726 and possibly the ability to debug the program.
11727
11728 The compiler performs optimization based on the knowledge it has of the
11729 program. Compiling multiple files at once to a single output file mode allows
11730 the compiler to use information gained from all of the files when compiling
11731 each of them.
11732
11733 Not all optimizations are controlled directly by a flag. Only
11734 optimizations that have a flag are listed in this section.
11735
11736 Most optimizations are completely disabled at @option{-O0} or if an
11737 @option{-O} level is not set on the command line, even if individual
11738 optimization flags are specified. Similarly, @option{-Og} suppresses
11739 many optimization passes.
11740
11741 Depending on the target and how GCC was configured, a slightly different
11742 set of optimizations may be enabled at each @option{-O} level than
11743 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
11744 to find out the exact set of optimizations that are enabled at each level.
11745 @xref{Overall Options}, for examples.
11746
11747 @table @gcctabopt
11748 @opindex O
11749 @opindex O1
11750 @item -O
11751 @itemx -O1
11752 Optimize. Optimizing compilation takes somewhat more time, and a lot
11753 more memory for a large function.
11754
11755 With @option{-O}, the compiler tries to reduce code size and execution
11756 time, without performing any optimizations that take a great deal of
11757 compilation time.
11758
11759 @c Note that in addition to the default_options_table list in opts.cc,
11760 @c several optimization flags default to true but control optimization
11761 @c passes that are explicitly disabled at -O0.
11762
11763 @option{-O} turns on the following optimization flags:
11764
11765 @c Please keep the following list alphabetized.
11766 @gccoptlist{-fauto-inc-dec
11767 -fbranch-count-reg
11768 -fcombine-stack-adjustments
11769 -fcompare-elim
11770 -fcprop-registers
11771 -fdce
11772 -fdefer-pop
11773 -fdelayed-branch
11774 -fdse
11775 -fforward-propagate
11776 -fguess-branch-probability
11777 -fif-conversion
11778 -fif-conversion2
11779 -finline-functions-called-once
11780 -fipa-modref
11781 -fipa-profile
11782 -fipa-pure-const
11783 -fipa-reference
11784 -fipa-reference-addressable
11785 -fmerge-constants
11786 -fmove-loop-invariants
11787 -fmove-loop-stores
11788 -fomit-frame-pointer
11789 -freorder-blocks
11790 -fshrink-wrap
11791 -fshrink-wrap-separate
11792 -fsplit-wide-types
11793 -fssa-backprop
11794 -fssa-phiopt
11795 -ftree-bit-ccp
11796 -ftree-ccp
11797 -ftree-ch
11798 -ftree-coalesce-vars
11799 -ftree-copy-prop
11800 -ftree-dce
11801 -ftree-dominator-opts
11802 -ftree-dse
11803 -ftree-forwprop
11804 -ftree-fre
11805 -ftree-phiprop
11806 -ftree-pta
11807 -ftree-scev-cprop
11808 -ftree-sink
11809 -ftree-slsr
11810 -ftree-sra
11811 -ftree-ter
11812 -funit-at-a-time}
11813
11814 @opindex O2
11815 @item -O2
11816 Optimize even more. GCC performs nearly all supported optimizations
11817 that do not involve a space-speed tradeoff.
11818 As compared to @option{-O}, this option increases both compilation time
11819 and the performance of the generated code.
11820
11821 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
11822 also turns on the following optimization flags:
11823
11824 @c Please keep the following list alphabetized!
11825 @gccoptlist{-falign-functions -falign-jumps
11826 -falign-labels -falign-loops
11827 -fcaller-saves
11828 -fcode-hoisting
11829 -fcrossjumping
11830 -fcse-follow-jumps -fcse-skip-blocks
11831 -fdelete-null-pointer-checks
11832 -fdevirtualize -fdevirtualize-speculatively
11833 -fexpensive-optimizations
11834 -ffinite-loops
11835 -fgcse -fgcse-lm
11836 -fhoist-adjacent-loads
11837 -finline-functions
11838 -finline-small-functions
11839 -findirect-inlining
11840 -fipa-bit-cp -fipa-cp -fipa-icf
11841 -fipa-ra -fipa-sra -fipa-vrp
11842 -fisolate-erroneous-paths-dereference
11843 -flra-remat
11844 -foptimize-sibling-calls
11845 -foptimize-strlen
11846 -fpartial-inlining
11847 -fpeephole2
11848 -freorder-blocks-algorithm=stc
11849 -freorder-blocks-and-partition -freorder-functions
11850 -frerun-cse-after-loop
11851 -fschedule-insns -fschedule-insns2
11852 -fsched-interblock -fsched-spec
11853 -fstore-merging
11854 -fstrict-aliasing
11855 -fthread-jumps
11856 -ftree-builtin-call-dce
11857 -ftree-loop-vectorize
11858 -ftree-pre
11859 -ftree-slp-vectorize
11860 -ftree-switch-conversion -ftree-tail-merge
11861 -ftree-vrp
11862 -fvect-cost-model=very-cheap}
11863
11864 Please note the warning under @option{-fgcse} about
11865 invoking @option{-O2} on programs that use computed gotos.
11866
11867 @opindex O3
11868 @item -O3
11869 Optimize yet more. @option{-O3} turns on all optimizations specified
11870 by @option{-O2} and also turns on the following optimization flags:
11871
11872 @c Please keep the following list alphabetized!
11873 @gccoptlist{-fgcse-after-reload
11874 -fipa-cp-clone
11875 -floop-interchange
11876 -floop-unroll-and-jam
11877 -fpeel-loops
11878 -fpredictive-commoning
11879 -fsplit-loops
11880 -fsplit-paths
11881 -ftree-loop-distribution
11882 -ftree-partial-pre
11883 -funswitch-loops
11884 -fvect-cost-model=dynamic
11885 -fversion-loops-for-strides}
11886
11887 @opindex O0
11888 @item -O0
11889 Reduce compilation time and make debugging produce the expected
11890 results. This is the default.
11891
11892 @opindex Os
11893 @item -Os
11894 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
11895 except those that often increase code size:
11896
11897 @gccoptlist{-falign-functions -falign-jumps
11898 -falign-labels -falign-loops
11899 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
11900
11901 It also enables @option{-finline-functions}, causes the compiler to tune for
11902 code size rather than execution speed, and performs further optimizations
11903 designed to reduce code size.
11904
11905 @opindex Ofast
11906 @item -Ofast
11907 Disregard strict standards compliance. @option{-Ofast} enables all
11908 @option{-O3} optimizations. It also enables optimizations that are not
11909 valid for all standard-compliant programs.
11910 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
11911 and the Fortran-specific @option{-fstack-arrays}, unless
11912 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
11913 It turns off @option{-fsemantic-interposition}.
11914
11915 @opindex Og
11916 @item -Og
11917 Optimize debugging experience. @option{-Og} should be the optimization
11918 level of choice for the standard edit-compile-debug cycle, offering
11919 a reasonable level of optimization while maintaining fast compilation
11920 and a good debugging experience. It is a better choice than @option{-O0}
11921 for producing debuggable code because some compiler passes
11922 that collect debug information are disabled at @option{-O0}.
11923
11924 Like @option{-O0}, @option{-Og} completely disables a number of
11925 optimization passes so that individual options controlling them have
11926 no effect. Otherwise @option{-Og} enables all @option{-O1}
11927 optimization flags except for those that may interfere with debugging:
11928
11929 @gccoptlist{-fbranch-count-reg -fdelayed-branch
11930 -fdse -fif-conversion -fif-conversion2
11931 -finline-functions-called-once
11932 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
11933 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
11934
11935 @opindex Oz
11936 @item -Oz
11937 Optimize aggressively for size rather than speed. This may increase
11938 the number of instructions executed if those instructions require
11939 fewer bytes to encode. @option{-Oz} behaves similarly to @option{-Os}
11940 including enabling most @option{-O2} optimizations.
11941
11942 @end table
11943
11944 If you use multiple @option{-O} options, with or without level numbers,
11945 the last such option is the one that is effective.
11946
11947 Options of the form @option{-f@var{flag}} specify machine-independent
11948 flags. Most flags have both positive and negative forms; the negative
11949 form of @option{-ffoo} is @option{-fno-foo}. In the table
11950 below, only one of the forms is listed---the one you typically
11951 use. You can figure out the other form by either removing @samp{no-}
11952 or adding it.
11953
11954 The following options control specific optimizations. They are either
11955 activated by @option{-O} options or are related to ones that are. You
11956 can use the following flags in the rare cases when ``fine-tuning'' of
11957 optimizations to be performed is desired.
11958
11959 @table @gcctabopt
11960 @opindex fno-defer-pop
11961 @opindex fdefer-pop
11962 @item -fno-defer-pop
11963 For machines that must pop arguments after a function call, always pop
11964 the arguments as soon as each function returns.
11965 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
11966 this allows the compiler to let arguments accumulate on the stack for several
11967 function calls and pop them all at once.
11968
11969 @opindex fforward-propagate
11970 @item -fforward-propagate
11971 Perform a forward propagation pass on RTL@. The pass tries to combine two
11972 instructions and checks if the result can be simplified. If loop unrolling
11973 is active, two passes are performed and the second is scheduled after
11974 loop unrolling.
11975
11976 This option is enabled by default at optimization levels @option{-O1},
11977 @option{-O2}, @option{-O3}, @option{-Os}.
11978
11979 @opindex ffp-contract
11980 @item -ffp-contract=@var{style}
11981 @option{-ffp-contract=off} disables floating-point expression contraction.
11982 @option{-ffp-contract=fast} enables floating-point expression contraction
11983 such as forming of fused multiply-add operations if the target has
11984 native support for them.
11985 @option{-ffp-contract=on} enables floating-point expression contraction
11986 if allowed by the language standard. This is currently not implemented
11987 and treated equal to @option{-ffp-contract=off}.
11988
11989 The default is @option{-ffp-contract=fast}.
11990
11991 @opindex fomit-frame-pointer
11992 @item -fomit-frame-pointer
11993 Omit the frame pointer in functions that don't need one. This avoids the
11994 instructions to save, set up and restore the frame pointer; on many targets
11995 it also makes an extra register available.
11996
11997 On some targets this flag has no effect because the standard calling sequence
11998 always uses a frame pointer, so it cannot be omitted.
11999
12000 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12001 is used in all functions. Several targets always omit the frame pointer in
12002 leaf functions.
12003
12004 Enabled by default at @option{-O1} and higher.
12005
12006 @opindex foptimize-sibling-calls
12007 @item -foptimize-sibling-calls
12008 Optimize sibling and tail recursive calls.
12009
12010 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12011
12012 @opindex foptimize-strlen
12013 @item -foptimize-strlen
12014 Optimize various standard C string functions (e.g.@: @code{strlen},
12015 @code{strchr} or @code{strcpy}) and
12016 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12017
12018 Enabled at levels @option{-O2}, @option{-O3}.
12019
12020 @opindex fno-inline
12021 @opindex finline
12022 @item -fno-inline
12023 Do not expand any functions inline apart from those marked with
12024 the @code{always_inline} attribute. This is the default when not
12025 optimizing.
12026
12027 Single functions can be exempted from inlining by marking them
12028 with the @code{noinline} attribute.
12029
12030 @opindex finline-small-functions
12031 @item -finline-small-functions
12032 Integrate functions into their callers when their body is smaller than expected
12033 function call code (so overall size of program gets smaller). The compiler
12034 heuristically decides which functions are simple enough to be worth integrating
12035 in this way. This inlining applies to all functions, even those not declared
12036 inline.
12037
12038 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12039
12040 @opindex findirect-inlining
12041 @item -findirect-inlining
12042 Inline also indirect calls that are discovered to be known at compile
12043 time thanks to previous inlining. This option has any effect only
12044 when inlining itself is turned on by the @option{-finline-functions}
12045 or @option{-finline-small-functions} options.
12046
12047 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12048
12049 @opindex finline-functions
12050 @item -finline-functions
12051 Consider all functions for inlining, even if they are not declared inline.
12052 The compiler heuristically decides which functions are worth integrating
12053 in this way.
12054
12055 If all calls to a given function are integrated, and the function is
12056 declared @code{static}, then the function is normally not output as
12057 assembler code in its own right.
12058
12059 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
12060 by @option{-fprofile-use} and @option{-fauto-profile}.
12061
12062 @opindex finline-functions-called-once
12063 @item -finline-functions-called-once
12064 Consider all @code{static} functions called once for inlining into their
12065 caller even if they are not marked @code{inline}. If a call to a given
12066 function is integrated, then the function is not output as assembler code
12067 in its own right.
12068
12069 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12070 but not @option{-Og}.
12071
12072 @opindex fearly-inlining
12073 @item -fearly-inlining
12074 Inline functions marked by @code{always_inline} and functions whose body seems
12075 smaller than the function call overhead early before doing
12076 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
12077 makes profiling significantly cheaper and usually inlining faster on programs
12078 having large chains of nested wrapper functions.
12079
12080 Enabled by default.
12081
12082 @opindex fipa-sra
12083 @item -fipa-sra
12084 Perform interprocedural scalar replacement of aggregates, removal of
12085 unused parameters and replacement of parameters passed by reference
12086 by parameters passed by value.
12087
12088 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12089
12090 @opindex finline-limit
12091 @item -finline-limit=@var{n}
12092 By default, GCC limits the size of functions that can be inlined. This flag
12093 allows coarse control of this limit. @var{n} is the size of functions that
12094 can be inlined in number of pseudo instructions.
12095
12096 Inlining is actually controlled by a number of parameters, which may be
12097 specified individually by using @option{--param @var{name}=@var{value}}.
12098 The @option{-finline-limit=@var{n}} option sets some of these parameters
12099 as follows:
12100
12101 @table @gcctabopt
12102 @item max-inline-insns-single
12103 is set to @var{n}/2.
12104 @item max-inline-insns-auto
12105 is set to @var{n}/2.
12106 @end table
12107
12108 See below for a documentation of the individual
12109 parameters controlling inlining and for the defaults of these parameters.
12110
12111 @emph{Note:} there may be no value to @option{-finline-limit} that results
12112 in default behavior.
12113
12114 @emph{Note:} pseudo instruction represents, in this particular context, an
12115 abstract measurement of function's size. In no way does it represent a count
12116 of assembly instructions and as such its exact meaning might change from one
12117 release to an another.
12118
12119 @opindex fno-keep-inline-dllexport
12120 @opindex fkeep-inline-dllexport
12121 @item -fno-keep-inline-dllexport
12122 This is a more fine-grained version of @option{-fkeep-inline-functions},
12123 which applies only to functions that are declared using the @code{dllexport}
12124 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
12125 Functions}.
12126
12127 @opindex fkeep-inline-functions
12128 @item -fkeep-inline-functions
12129 In C, emit @code{static} functions that are declared @code{inline}
12130 into the object file, even if the function has been inlined into all
12131 of its callers. This switch does not affect functions using the
12132 @code{extern inline} extension in GNU C90@. In C++, emit any and all
12133 inline functions into the object file.
12134
12135 @opindex fkeep-static-functions
12136 @item -fkeep-static-functions
12137 Emit @code{static} functions into the object file, even if the function
12138 is never used.
12139
12140 @opindex fkeep-static-consts
12141 @item -fkeep-static-consts
12142 Emit variables declared @code{static const} when optimization isn't turned
12143 on, even if the variables aren't referenced.
12144
12145 GCC enables this option by default. If you want to force the compiler to
12146 check if a variable is referenced, regardless of whether or not
12147 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12148
12149 @opindex fmerge-constants
12150 @item -fmerge-constants
12151 Attempt to merge identical constants (string constants and floating-point
12152 constants) across compilation units.
12153
12154 This option is the default for optimized compilation if the assembler and
12155 linker support it. Use @option{-fno-merge-constants} to inhibit this
12156 behavior.
12157
12158 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12159
12160 @opindex fmerge-all-constants
12161 @item -fmerge-all-constants
12162 Attempt to merge identical constants and identical variables.
12163
12164 This option implies @option{-fmerge-constants}. In addition to
12165 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12166 arrays or initialized constant variables with integral or floating-point
12167 types. Languages like C or C++ require each variable, including multiple
12168 instances of the same variable in recursive calls, to have distinct locations,
12169 so using this option results in non-conforming
12170 behavior.
12171
12172 @opindex fmodulo-sched
12173 @item -fmodulo-sched
12174 Perform swing modulo scheduling immediately before the first scheduling
12175 pass. This pass looks at innermost loops and reorders their
12176 instructions by overlapping different iterations.
12177
12178 @opindex fmodulo-sched-allow-regmoves
12179 @item -fmodulo-sched-allow-regmoves
12180 Perform more aggressive SMS-based modulo scheduling with register moves
12181 allowed. By setting this flag certain anti-dependences edges are
12182 deleted, which triggers the generation of reg-moves based on the
12183 life-range analysis. This option is effective only with
12184 @option{-fmodulo-sched} enabled.
12185
12186 @opindex fno-branch-count-reg
12187 @opindex fbranch-count-reg
12188 @item -fno-branch-count-reg
12189 Disable the optimization pass that scans for opportunities to use
12190 ``decrement and branch'' instructions on a count register instead of
12191 instruction sequences that decrement a register, compare it against zero, and
12192 then branch based upon the result. This option is only meaningful on
12193 architectures that support such instructions, which include x86, PowerPC,
12194 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
12195 doesn't remove the decrement and branch instructions from the generated
12196 instruction stream introduced by other optimization passes.
12197
12198 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12199 except for @option{-Og}.
12200
12201 @opindex fno-function-cse
12202 @opindex ffunction-cse
12203 @item -fno-function-cse
12204 Do not put function addresses in registers; make each instruction that
12205 calls a constant function contain the function's address explicitly.
12206
12207 This option results in less efficient code, but some strange hacks
12208 that alter the assembler output may be confused by the optimizations
12209 performed when this option is not used.
12210
12211 The default is @option{-ffunction-cse}
12212
12213 @opindex fno-zero-initialized-in-bss
12214 @opindex fzero-initialized-in-bss
12215 @item -fno-zero-initialized-in-bss
12216 If the target supports a BSS section, GCC by default puts variables that
12217 are initialized to zero into BSS@. This can save space in the resulting
12218 code.
12219
12220 This option turns off this behavior because some programs explicitly
12221 rely on variables going to the data section---e.g., so that the
12222 resulting executable can find the beginning of that section and/or make
12223 assumptions based on that.
12224
12225 The default is @option{-fzero-initialized-in-bss}.
12226
12227 @opindex fthread-jumps
12228 @item -fthread-jumps
12229 Perform optimizations that check to see if a jump branches to a
12230 location where another comparison subsumed by the first is found. If
12231 so, the first branch is redirected to either the destination of the
12232 second branch or a point immediately following it, depending on whether
12233 the condition is known to be true or false.
12234
12235 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12236
12237 @opindex fsplit-wide-types
12238 @item -fsplit-wide-types
12239 When using a type that occupies multiple registers, such as @code{long
12240 long} on a 32-bit system, split the registers apart and allocate them
12241 independently. This normally generates better code for those types,
12242 but may make debugging more difficult.
12243
12244 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12245 @option{-Os}.
12246
12247 @opindex fsplit-wide-types-early
12248 @item -fsplit-wide-types-early
12249 Fully split wide types early, instead of very late.
12250 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12251
12252 This is the default on some targets.
12253
12254 @opindex fcse-follow-jumps
12255 @item -fcse-follow-jumps
12256 In common subexpression elimination (CSE), scan through jump instructions
12257 when the target of the jump is not reached by any other path. For
12258 example, when CSE encounters an @code{if} statement with an
12259 @code{else} clause, CSE follows the jump when the condition
12260 tested is false.
12261
12262 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12263
12264 @opindex fcse-skip-blocks
12265 @item -fcse-skip-blocks
12266 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12267 follow jumps that conditionally skip over blocks. When CSE
12268 encounters a simple @code{if} statement with no else clause,
12269 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12270 body of the @code{if}.
12271
12272 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12273
12274 @opindex frerun-cse-after-loop
12275 @item -frerun-cse-after-loop
12276 Re-run common subexpression elimination after loop optimizations are
12277 performed.
12278
12279 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12280
12281 @opindex fgcse
12282 @item -fgcse
12283 Perform a global common subexpression elimination pass.
12284 This pass also performs global constant and copy propagation.
12285
12286 @emph{Note:} When compiling a program using computed gotos, a GCC
12287 extension, you may get better run-time performance if you disable
12288 the global common subexpression elimination pass by adding
12289 @option{-fno-gcse} to the command line.
12290
12291 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12292
12293 @opindex fgcse-lm
12294 @item -fgcse-lm
12295 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12296 attempts to move loads that are only killed by stores into themselves. This
12297 allows a loop containing a load/store sequence to be changed to a load outside
12298 the loop, and a copy/store within the loop.
12299
12300 Enabled by default when @option{-fgcse} is enabled.
12301
12302 @opindex fgcse-sm
12303 @item -fgcse-sm
12304 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12305 global common subexpression elimination. This pass attempts to move
12306 stores out of loops. When used in conjunction with @option{-fgcse-lm},
12307 loops containing a load/store sequence can be changed to a load before
12308 the loop and a store after the loop.
12309
12310 Not enabled at any optimization level.
12311
12312 @opindex fgcse-las
12313 @item -fgcse-las
12314 When @option{-fgcse-las} is enabled, the global common subexpression
12315 elimination pass eliminates redundant loads that come after stores to the
12316 same memory location (both partial and full redundancies).
12317
12318 Not enabled at any optimization level.
12319
12320 @opindex fgcse-after-reload
12321 @item -fgcse-after-reload
12322 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12323 pass is performed after reload. The purpose of this pass is to clean up
12324 redundant spilling.
12325
12326 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12327
12328 @opindex faggressive-loop-optimizations
12329 @item -faggressive-loop-optimizations
12330 This option tells the loop optimizer to use language constraints to
12331 derive bounds for the number of iterations of a loop. This assumes that
12332 loop code does not invoke undefined behavior by for example causing signed
12333 integer overflows or out-of-bound array accesses. The bounds for the
12334 number of iterations of a loop are used to guide loop unrolling and peeling
12335 and loop exit test optimizations.
12336 This option is enabled by default.
12337
12338 @opindex funconstrained-commons
12339 @item -funconstrained-commons
12340 This option tells the compiler that variables declared in common blocks
12341 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12342 prevents certain optimizations that depend on knowing the array bounds.
12343
12344 @opindex fcrossjumping
12345 @item -fcrossjumping
12346 Perform cross-jumping transformation.
12347 This transformation unifies equivalent code and saves code size. The
12348 resulting code may or may not perform better than without cross-jumping.
12349
12350 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12351
12352 @opindex fauto-inc-dec
12353 @item -fauto-inc-dec
12354 Combine increments or decrements of addresses with memory accesses.
12355 This pass is always skipped on architectures that do not have
12356 instructions to support this. Enabled by default at @option{-O1} and
12357 higher on architectures that support this.
12358
12359 @opindex fdce
12360 @item -fdce
12361 Perform dead code elimination (DCE) on RTL@.
12362 Enabled by default at @option{-O1} and higher.
12363
12364 @opindex fdse
12365 @item -fdse
12366 Perform dead store elimination (DSE) on RTL@.
12367 Enabled by default at @option{-O1} and higher.
12368
12369 @opindex fif-conversion
12370 @item -fif-conversion
12371 Attempt to transform conditional jumps into branch-less equivalents. This
12372 includes use of conditional moves, min, max, set flags and abs instructions, and
12373 some tricks doable by standard arithmetics. The use of conditional execution
12374 on chips where it is available is controlled by @option{-fif-conversion2}.
12375
12376 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12377 not with @option{-Og}.
12378
12379 @opindex fif-conversion2
12380 @item -fif-conversion2
12381 Use conditional execution (where available) to transform conditional jumps into
12382 branch-less equivalents.
12383
12384 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12385 not with @option{-Og}.
12386
12387 @opindex fdeclone-ctor-dtor
12388 @item -fdeclone-ctor-dtor
12389 The C++ ABI requires multiple entry points for constructors and
12390 destructors: one for a base subobject, one for a complete object, and
12391 one for a virtual destructor that calls operator delete afterwards.
12392 For a hierarchy with virtual bases, the base and complete variants are
12393 clones, which means two copies of the function. With this option, the
12394 base and complete variants are changed to be thunks that call a common
12395 implementation.
12396
12397 Enabled by @option{-Os}.
12398
12399 @opindex fdelete-null-pointer-checks
12400 @item -fdelete-null-pointer-checks
12401 Assume that programs cannot safely dereference null pointers, and that
12402 no code or data element resides at address zero.
12403 This option enables simple constant
12404 folding optimizations at all optimization levels. In addition, other
12405 optimization passes in GCC use this flag to control global dataflow
12406 analyses that eliminate useless checks for null pointers; these assume
12407 that a memory access to address zero always results in a trap, so
12408 that if a pointer is checked after it has already been dereferenced,
12409 it cannot be null.
12410
12411 Note however that in some environments this assumption is not true.
12412 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12413 for programs that depend on that behavior.
12414
12415 This option is enabled by default on most targets. On Nios II ELF, it
12416 defaults to off. On AVR and MSP430, this option is completely disabled.
12417
12418 Passes that use the dataflow information
12419 are enabled independently at different optimization levels.
12420
12421 @opindex fdevirtualize
12422 @item -fdevirtualize
12423 Attempt to convert calls to virtual functions to direct calls. This
12424 is done both within a procedure and interprocedurally as part of
12425 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12426 propagation (@option{-fipa-cp}).
12427 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12428
12429 @opindex fdevirtualize-speculatively
12430 @item -fdevirtualize-speculatively
12431 Attempt to convert calls to virtual functions to speculative direct calls.
12432 Based on the analysis of the type inheritance graph, determine for a given call
12433 the set of likely targets. If the set is small, preferably of size 1, change
12434 the call into a conditional deciding between direct and indirect calls. The
12435 speculative calls enable more optimizations, such as inlining. When they seem
12436 useless after further optimization, they are converted back into original form.
12437
12438 @opindex fdevirtualize-at-ltrans
12439 @item -fdevirtualize-at-ltrans
12440 Stream extra information needed for aggressive devirtualization when running
12441 the link-time optimizer in local transformation mode.
12442 This option enables more devirtualization but
12443 significantly increases the size of streamed data. For this reason it is
12444 disabled by default.
12445
12446 @opindex fexpensive-optimizations
12447 @item -fexpensive-optimizations
12448 Perform a number of minor optimizations that are relatively expensive.
12449
12450 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12451
12452 @opindex free
12453 @item -free
12454 Attempt to remove redundant extension instructions. This is especially
12455 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12456 registers after writing to their lower 32-bit half.
12457
12458 Enabled for Alpha, AArch64, PowerPC, RISC-V, SPARC, h83000 and x86 at levels
12459 @option{-O2}, @option{-O3}, @option{-Os}.
12460
12461 @opindex fno-lifetime-dse
12462 @opindex flifetime-dse
12463 @item -fno-lifetime-dse
12464 In C++ the value of an object is only affected by changes within its
12465 lifetime: when the constructor begins, the object has an indeterminate
12466 value, and any changes during the lifetime of the object are dead when
12467 the object is destroyed. Normally dead store elimination will take
12468 advantage of this; if your code relies on the value of the object
12469 storage persisting beyond the lifetime of the object, you can use this
12470 flag to disable this optimization. To preserve stores before the
12471 constructor starts (e.g.@: because your operator new clears the object
12472 storage) but still treat the object as dead after the destructor, you
12473 can use @option{-flifetime-dse=1}. The default behavior can be
12474 explicitly selected with @option{-flifetime-dse=2}.
12475 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12476
12477 @opindex flive-range-shrinkage
12478 @item -flive-range-shrinkage
12479 Attempt to decrease register pressure through register live range
12480 shrinkage. This is helpful for fast processors with small or moderate
12481 size register sets.
12482
12483 @opindex fira-algorithm
12484 @item -fira-algorithm=@var{algorithm}
12485 Use the specified coloring algorithm for the integrated register
12486 allocator. The @var{algorithm} argument can be @samp{priority}, which
12487 specifies Chow's priority coloring, or @samp{CB}, which specifies
12488 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
12489 for all architectures, but for those targets that do support it, it is
12490 the default because it generates better code.
12491
12492 @opindex fira-region
12493 @item -fira-region=@var{region}
12494 Use specified regions for the integrated register allocator. The
12495 @var{region} argument should be one of the following:
12496
12497 @table @samp
12498
12499 @item all
12500 Use all loops as register allocation regions.
12501 This can give the best results for machines with a small and/or
12502 irregular register set.
12503
12504 @item mixed
12505 Use all loops except for loops with small register pressure
12506 as the regions. This value usually gives
12507 the best results in most cases and for most architectures,
12508 and is enabled by default when compiling with optimization for speed
12509 (@option{-O}, @option{-O2}, @dots{}).
12510
12511 @item one
12512 Use all functions as a single region.
12513 This typically results in the smallest code size, and is enabled by default for
12514 @option{-Os} or @option{-O0}.
12515
12516 @end table
12517
12518 @opindex fira-hoist-pressure
12519 @item -fira-hoist-pressure
12520 Use IRA to evaluate register pressure in the code hoisting pass for
12521 decisions to hoist expressions. This option usually results in smaller
12522 code, but it can slow the compiler down.
12523
12524 This option is enabled at level @option{-Os} for all targets.
12525
12526 @opindex fira-loop-pressure
12527 @item -fira-loop-pressure
12528 Use IRA to evaluate register pressure in loops for decisions to move
12529 loop invariants. This option usually results in generation
12530 of faster and smaller code on machines with large register files (>= 32
12531 registers), but it can slow the compiler down.
12532
12533 This option is enabled at level @option{-O3} for some targets.
12534
12535 @opindex fno-ira-share-save-slots
12536 @opindex fira-share-save-slots
12537 @item -fno-ira-share-save-slots
12538 Disable sharing of stack slots used for saving call-used hard
12539 registers living through a call. Each hard register gets a
12540 separate stack slot, and as a result function stack frames are
12541 larger.
12542
12543 @opindex fno-ira-share-spill-slots
12544 @opindex fira-share-spill-slots
12545 @item -fno-ira-share-spill-slots
12546 Disable sharing of stack slots allocated for pseudo-registers. Each
12547 pseudo-register that does not get a hard register gets a separate
12548 stack slot, and as a result function stack frames are larger.
12549
12550 @opindex flra-remat
12551 @item -flra-remat
12552 Enable CFG-sensitive rematerialization in LRA. Instead of loading
12553 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12554 values if it is profitable.
12555
12556 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12557
12558 @opindex fdelayed-branch
12559 @item -fdelayed-branch
12560 If supported for the target machine, attempt to reorder instructions
12561 to exploit instruction slots available after delayed branch
12562 instructions.
12563
12564 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12565 but not at @option{-Og}.
12566
12567 @opindex fschedule-insns
12568 @item -fschedule-insns
12569 If supported for the target machine, attempt to reorder instructions to
12570 eliminate execution stalls due to required data being unavailable. This
12571 helps machines that have slow floating point or memory load instructions
12572 by allowing other instructions to be issued until the result of the load
12573 or floating-point instruction is required.
12574
12575 Enabled at levels @option{-O2}, @option{-O3}.
12576
12577 @opindex fschedule-insns2
12578 @item -fschedule-insns2
12579 Similar to @option{-fschedule-insns}, but requests an additional pass of
12580 instruction scheduling after register allocation has been done. This is
12581 especially useful on machines with a relatively small number of
12582 registers and where memory load instructions take more than one cycle.
12583
12584 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12585
12586 @opindex fno-sched-interblock
12587 @opindex fsched-interblock
12588 @item -fno-sched-interblock
12589 Disable instruction scheduling across basic blocks, which
12590 is normally enabled when scheduling before register allocation, i.e.@:
12591 with @option{-fschedule-insns} or at @option{-O2} or higher.
12592
12593 @opindex fno-sched-spec
12594 @opindex fsched-spec
12595 @item -fno-sched-spec
12596 Disable speculative motion of non-load instructions, which
12597 is normally enabled when scheduling before register allocation, i.e.@:
12598 with @option{-fschedule-insns} or at @option{-O2} or higher.
12599
12600 @opindex fsched-pressure
12601 @item -fsched-pressure
12602 Enable register pressure sensitive insn scheduling before register
12603 allocation. This only makes sense when scheduling before register
12604 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12605 @option{-O2} or higher. Usage of this option can improve the
12606 generated code and decrease its size by preventing register pressure
12607 increase above the number of available hard registers and subsequent
12608 spills in register allocation.
12609
12610 @opindex fsched-spec-load
12611 @item -fsched-spec-load
12612 Allow speculative motion of some load instructions. This only makes
12613 sense when scheduling before register allocation, i.e.@: with
12614 @option{-fschedule-insns} or at @option{-O2} or higher.
12615
12616 @opindex fsched-spec-load-dangerous
12617 @item -fsched-spec-load-dangerous
12618 Allow speculative motion of more load instructions. This only makes
12619 sense when scheduling before register allocation, i.e.@: with
12620 @option{-fschedule-insns} or at @option{-O2} or higher.
12621
12622 @opindex fsched-stalled-insns
12623 @item -fsched-stalled-insns
12624 @itemx -fsched-stalled-insns=@var{n}
12625 Define how many insns (if any) can be moved prematurely from the queue
12626 of stalled insns into the ready list during the second scheduling pass.
12627 @option{-fno-sched-stalled-insns} means that no insns are moved
12628 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12629 on how many queued insns can be moved prematurely.
12630 @option{-fsched-stalled-insns} without a value is equivalent to
12631 @option{-fsched-stalled-insns=1}.
12632
12633 @opindex fsched-stalled-insns-dep
12634 @item -fsched-stalled-insns-dep
12635 @itemx -fsched-stalled-insns-dep=@var{n}
12636 Define how many insn groups (cycles) are examined for a dependency
12637 on a stalled insn that is a candidate for premature removal from the queue
12638 of stalled insns. This has an effect only during the second scheduling pass,
12639 and only if @option{-fsched-stalled-insns} is used.
12640 @option{-fno-sched-stalled-insns-dep} is equivalent to
12641 @option{-fsched-stalled-insns-dep=0}.
12642 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12643 @option{-fsched-stalled-insns-dep=1}.
12644
12645 @opindex fsched2-use-superblocks
12646 @item -fsched2-use-superblocks
12647 When scheduling after register allocation, use superblock scheduling.
12648 This allows motion across basic block boundaries,
12649 resulting in faster schedules. This option is experimental, as not all machine
12650 descriptions used by GCC model the CPU closely enough to avoid unreliable
12651 results from the algorithm.
12652
12653 This only makes sense when scheduling after register allocation, i.e.@: with
12654 @option{-fschedule-insns2} or at @option{-O2} or higher.
12655
12656 @opindex fsched-group-heuristic
12657 @item -fsched-group-heuristic
12658 Enable the group heuristic in the scheduler. This heuristic favors
12659 the instruction that belongs to a schedule group. This is enabled
12660 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12661 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12662
12663 @opindex fsched-critical-path-heuristic
12664 @item -fsched-critical-path-heuristic
12665 Enable the critical-path heuristic in the scheduler. This heuristic favors
12666 instructions on the critical path. This is enabled by default when
12667 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12668 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12669
12670 @opindex fsched-spec-insn-heuristic
12671 @item -fsched-spec-insn-heuristic
12672 Enable the speculative instruction heuristic in the scheduler. This
12673 heuristic favors speculative instructions with greater dependency weakness.
12674 This is enabled by default when scheduling is enabled, i.e.@:
12675 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12676 or at @option{-O2} or higher.
12677
12678 @opindex fsched-rank-heuristic
12679 @item -fsched-rank-heuristic
12680 Enable the rank heuristic in the scheduler. This heuristic favors
12681 the instruction belonging to a basic block with greater size or frequency.
12682 This is enabled by default when scheduling is enabled, i.e.@:
12683 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12684 at @option{-O2} or higher.
12685
12686 @opindex fsched-last-insn-heuristic
12687 @item -fsched-last-insn-heuristic
12688 Enable the last-instruction heuristic in the scheduler. This heuristic
12689 favors the instruction that is less dependent on the last instruction
12690 scheduled. This is enabled by default when scheduling is enabled,
12691 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12692 at @option{-O2} or higher.
12693
12694 @opindex fsched-dep-count-heuristic
12695 @item -fsched-dep-count-heuristic
12696 Enable the dependent-count heuristic in the scheduler. This heuristic
12697 favors the instruction that has more instructions depending on it.
12698 This is enabled by default when scheduling is enabled, i.e.@:
12699 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12700 at @option{-O2} or higher.
12701
12702 @opindex freschedule-modulo-scheduled-loops
12703 @item -freschedule-modulo-scheduled-loops
12704 Modulo scheduling is performed before traditional scheduling. If a loop
12705 is modulo scheduled, later scheduling passes may change its schedule.
12706 Use this option to control that behavior.
12707
12708 @opindex fselective-scheduling
12709 @item -fselective-scheduling
12710 Schedule instructions using selective scheduling algorithm. Selective
12711 scheduling runs instead of the first scheduler pass.
12712
12713 @opindex fselective-scheduling2
12714 @item -fselective-scheduling2
12715 Schedule instructions using selective scheduling algorithm. Selective
12716 scheduling runs instead of the second scheduler pass.
12717
12718 @opindex fsel-sched-pipelining
12719 @item -fsel-sched-pipelining
12720 Enable software pipelining of innermost loops during selective scheduling.
12721 This option has no effect unless one of @option{-fselective-scheduling} or
12722 @option{-fselective-scheduling2} is turned on.
12723
12724 @opindex fsel-sched-pipelining-outer-loops
12725 @item -fsel-sched-pipelining-outer-loops
12726 When pipelining loops during selective scheduling, also pipeline outer loops.
12727 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12728
12729 @opindex fsemantic-interposition
12730 @item -fsemantic-interposition
12731 Some object formats, like ELF, allow interposing of symbols by the
12732 dynamic linker.
12733 This means that for symbols exported from the DSO, the compiler cannot perform
12734 interprocedural propagation, inlining and other optimizations in anticipation
12735 that the function or variable in question may change. While this feature is
12736 useful, for example, to rewrite memory allocation functions by a debugging
12737 implementation, it is expensive in the terms of code quality.
12738 With @option{-fno-semantic-interposition} the compiler assumes that
12739 if interposition happens for functions the overwriting function will have
12740 precisely the same semantics (and side effects).
12741 Similarly if interposition happens
12742 for variables, the constructor of the variable will be the same. The flag
12743 has no effect for functions explicitly declared inline
12744 (where it is never allowed for interposition to change semantics)
12745 and for symbols explicitly declared weak.
12746
12747 @opindex fshrink-wrap
12748 @item -fshrink-wrap
12749 Emit function prologues only before parts of the function that need it,
12750 rather than at the top of the function. This flag is enabled by default at
12751 @option{-O} and higher.
12752
12753 @opindex fshrink-wrap-separate
12754 @item -fshrink-wrap-separate
12755 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12756 those parts are only executed when needed.
12757 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12758 is also turned on and the target supports this.
12759
12760 @opindex fcaller-saves
12761 @item -fcaller-saves
12762 Enable allocation of values to registers that are clobbered by
12763 function calls, by emitting extra instructions to save and restore the
12764 registers around such calls. Such allocation is done only when it
12765 seems to result in better code.
12766
12767 This option is always enabled by default on certain machines, usually
12768 those which have no call-preserved registers to use instead.
12769
12770 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12771
12772 @opindex fcombine-stack-adjustments
12773 @item -fcombine-stack-adjustments
12774 Tracks stack adjustments (pushes and pops) and stack memory references
12775 and then tries to find ways to combine them.
12776
12777 Enabled by default at @option{-O1} and higher.
12778
12779 @opindex fipa-ra
12780 @item -fipa-ra
12781 Use caller save registers for allocation if those registers are not used by
12782 any called function. In that case it is not necessary to save and restore
12783 them around calls. This is only possible if called functions are part of
12784 same compilation unit as current function and they are compiled before it.
12785
12786 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
12787 is disabled if generated code will be instrumented for profiling
12788 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
12789 exactly (this happens on targets that do not expose prologues
12790 and epilogues in RTL).
12791
12792 @opindex fconserve-stack
12793 @item -fconserve-stack
12794 Attempt to minimize stack usage. The compiler attempts to use less
12795 stack space, even if that makes the program slower. This option
12796 implies setting the @option{large-stack-frame} parameter to 100
12797 and the @option{large-stack-frame-growth} parameter to 400.
12798
12799 @opindex ftree-reassoc
12800 @item -ftree-reassoc
12801 Perform reassociation on trees. This flag is enabled by default
12802 at @option{-O1} and higher.
12803
12804 @opindex fcode-hoisting
12805 @item -fcode-hoisting
12806 Perform code hoisting. Code hoisting tries to move the
12807 evaluation of expressions executed on all paths to the function exit
12808 as early as possible. This is especially useful as a code size
12809 optimization, but it often helps for code speed as well.
12810 This flag is enabled by default at @option{-O2} and higher.
12811
12812 @opindex ftree-pre
12813 @item -ftree-pre
12814 Perform partial redundancy elimination (PRE) on trees. This flag is
12815 enabled by default at @option{-O2} and @option{-O3}.
12816
12817 @opindex ftree-partial-pre
12818 @item -ftree-partial-pre
12819 Make partial redundancy elimination (PRE) more aggressive. This flag is
12820 enabled by default at @option{-O3}.
12821
12822 @opindex ftree-forwprop
12823 @item -ftree-forwprop
12824 Perform forward propagation on trees. This flag is enabled by default
12825 at @option{-O1} and higher.
12826
12827 @opindex ftree-fre
12828 @item -ftree-fre
12829 Perform full redundancy elimination (FRE) on trees. The difference
12830 between FRE and PRE is that FRE only considers expressions
12831 that are computed on all paths leading to the redundant computation.
12832 This analysis is faster than PRE, though it exposes fewer redundancies.
12833 This flag is enabled by default at @option{-O1} and higher.
12834
12835 @opindex ftree-phiprop
12836 @item -ftree-phiprop
12837 Perform hoisting of loads from conditional pointers on trees. This
12838 pass is enabled by default at @option{-O1} and higher.
12839
12840 @opindex fhoist-adjacent-loads
12841 @item -fhoist-adjacent-loads
12842 Speculatively hoist loads from both branches of an if-then-else if the
12843 loads are from adjacent locations in the same structure and the target
12844 architecture has a conditional move instruction. This flag is enabled
12845 by default at @option{-O2} and higher.
12846
12847 @opindex ftree-copy-prop
12848 @item -ftree-copy-prop
12849 Perform copy propagation on trees. This pass eliminates unnecessary
12850 copy operations. This flag is enabled by default at @option{-O1} and
12851 higher.
12852
12853 @opindex fipa-pure-const
12854 @item -fipa-pure-const
12855 Discover which functions are pure or constant.
12856 Enabled by default at @option{-O1} and higher.
12857
12858 @opindex fipa-reference
12859 @item -fipa-reference
12860 Discover which static variables do not escape the
12861 compilation unit.
12862 Enabled by default at @option{-O1} and higher.
12863
12864 @opindex fipa-reference-addressable
12865 @item -fipa-reference-addressable
12866 Discover read-only, write-only and non-addressable static variables.
12867 Enabled by default at @option{-O1} and higher.
12868
12869 @opindex fipa-stack-alignment
12870 @item -fipa-stack-alignment
12871 Reduce stack alignment on call sites if possible.
12872 Enabled by default.
12873
12874 @opindex fipa-pta
12875 @item -fipa-pta
12876 Perform interprocedural pointer analysis and interprocedural modification
12877 and reference analysis. This option can cause excessive memory and
12878 compile-time usage on large compilation units. It is not enabled by
12879 default at any optimization level.
12880
12881 @opindex fipa-profile
12882 @item -fipa-profile
12883 Perform interprocedural profile propagation. The functions called only from
12884 cold functions are marked as cold. Also functions executed once (such as
12885 @code{cold}, @code{noreturn}, static constructors or destructors) are
12886 identified. Cold functions and loop less parts of functions executed once are
12887 then optimized for size.
12888 Enabled by default at @option{-O1} and higher.
12889
12890 @opindex fipa-modref
12891 @item -fipa-modref
12892 Perform interprocedural mod/ref analysis. This optimization analyzes the side
12893 effects of functions (memory locations that are modified or referenced) and
12894 enables better optimization across the function call boundary. This flag is
12895 enabled by default at @option{-O1} and higher.
12896
12897 @opindex fipa-cp
12898 @item -fipa-cp
12899 Perform interprocedural constant propagation.
12900 This optimization analyzes the program to determine when values passed
12901 to functions are constants and then optimizes accordingly.
12902 This optimization can substantially increase performance
12903 if the application has constants passed to functions.
12904 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
12905 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12906
12907 @opindex fipa-cp-clone
12908 @item -fipa-cp-clone
12909 Perform function cloning to make interprocedural constant propagation stronger.
12910 When enabled, interprocedural constant propagation performs function cloning
12911 when externally visible function can be called with constant arguments.
12912 Because this optimization can create multiple copies of functions,
12913 it may significantly increase code size
12914 (see @option{--param ipa-cp-unit-growth=@var{value}}).
12915 This flag is enabled by default at @option{-O3}.
12916 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12917
12918 @opindex fipa-bit-cp
12919 @item -fipa-bit-cp
12920 When enabled, perform interprocedural bitwise constant
12921 propagation. This flag is enabled by default at @option{-O2} and
12922 by @option{-fprofile-use} and @option{-fauto-profile}.
12923 It requires that @option{-fipa-cp} is enabled.
12924
12925 @opindex fipa-vrp
12926 @item -fipa-vrp
12927 When enabled, perform interprocedural propagation of value
12928 ranges. This flag is enabled by default at @option{-O2}. It requires
12929 that @option{-fipa-cp} is enabled.
12930
12931 @opindex fipa-icf
12932 @item -fipa-icf
12933 Perform Identical Code Folding for functions and read-only variables.
12934 The optimization reduces code size and may disturb unwind stacks by replacing
12935 a function by equivalent one with a different name. The optimization works
12936 more effectively with link-time optimization enabled.
12937
12938 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
12939 works on different levels and thus the optimizations are not same - there are
12940 equivalences that are found only by GCC and equivalences found only by Gold.
12941
12942 This flag is enabled by default at @option{-O2} and @option{-Os}.
12943
12944 @opindex flive-patching
12945 @item -flive-patching=@var{level}
12946 Control GCC's optimizations to produce output suitable for live-patching.
12947
12948 If the compiler's optimization uses a function's body or information extracted
12949 from its body to optimize/change another function, the latter is called an
12950 impacted function of the former. If a function is patched, its impacted
12951 functions should be patched too.
12952
12953 The impacted functions are determined by the compiler's interprocedural
12954 optimizations. For example, a caller is impacted when inlining a function
12955 into its caller,
12956 cloning a function and changing its caller to call this new clone,
12957 or extracting a function's pureness/constness information to optimize
12958 its direct or indirect callers, etc.
12959
12960 Usually, the more IPA optimizations enabled, the larger the number of
12961 impacted functions for each function. In order to control the number of
12962 impacted functions and more easily compute the list of impacted function,
12963 IPA optimizations can be partially enabled at two different levels.
12964
12965 The @var{level} argument should be one of the following:
12966
12967 @table @samp
12968
12969 @item inline-clone
12970
12971 Only enable inlining and cloning optimizations, which includes inlining,
12972 cloning, interprocedural scalar replacement of aggregates and partial inlining.
12973 As a result, when patching a function, all its callers and its clones'
12974 callers are impacted, therefore need to be patched as well.
12975
12976 @option{-flive-patching=inline-clone} disables the following optimization flags:
12977 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra
12978 -fipa-icf -fipa-icf-functions -fipa-icf-variables
12979 -fipa-bit-cp -fipa-vrp -fipa-pure-const
12980 -fipa-reference-addressable
12981 -fipa-stack-alignment -fipa-modref}
12982
12983 @item inline-only-static
12984
12985 Only enable inlining of static functions.
12986 As a result, when patching a static function, all its callers are impacted
12987 and so need to be patched as well.
12988
12989 In addition to all the flags that @option{-flive-patching=inline-clone}
12990 disables,
12991 @option{-flive-patching=inline-only-static} disables the following additional
12992 optimization flags:
12993 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
12994
12995 @end table
12996
12997 When @option{-flive-patching} is specified without any value, the default value
12998 is @var{inline-clone}.
12999
13000 This flag is disabled by default.
13001
13002 Note that @option{-flive-patching} is not supported with link-time optimization
13003 (@option{-flto}).
13004
13005 @opindex fisolate-erroneous-paths-dereference
13006 @item -fisolate-erroneous-paths-dereference
13007 Detect paths that trigger erroneous or undefined behavior due to
13008 dereferencing a null pointer. Isolate those paths from the main control
13009 flow and turn the statement with erroneous or undefined behavior into a trap.
13010 This flag is enabled by default at @option{-O2} and higher and depends on
13011 @option{-fdelete-null-pointer-checks} also being enabled.
13012
13013 @opindex fisolate-erroneous-paths-attribute
13014 @item -fisolate-erroneous-paths-attribute
13015 Detect paths that trigger erroneous or undefined behavior due to a null value
13016 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13017 attribute. Isolate those paths from the main control flow and turn the
13018 statement with erroneous or undefined behavior into a trap. This is not
13019 currently enabled, but may be enabled by @option{-O2} in the future.
13020
13021 @opindex ftree-sink
13022 @item -ftree-sink
13023 Perform forward store motion on trees. This flag is
13024 enabled by default at @option{-O1} and higher.
13025
13026 @opindex ftree-bit-ccp
13027 @item -ftree-bit-ccp
13028 Perform sparse conditional bit constant propagation on trees and propagate
13029 pointer alignment information.
13030 This pass only operates on local scalar variables and is enabled by default
13031 at @option{-O1} and higher, except for @option{-Og}.
13032 It requires that @option{-ftree-ccp} is enabled.
13033
13034 @opindex ftree-ccp
13035 @item -ftree-ccp
13036 Perform sparse conditional constant propagation (CCP) on trees. This
13037 pass only operates on local scalar variables and is enabled by default
13038 at @option{-O1} and higher.
13039
13040 @opindex fssa-backprop
13041 @item -fssa-backprop
13042 Propagate information about uses of a value up the definition chain
13043 in order to simplify the definitions. For example, this pass strips
13044 sign operations if the sign of a value never matters. The flag is
13045 enabled by default at @option{-O1} and higher.
13046
13047 @opindex fssa-phiopt
13048 @item -fssa-phiopt
13049 Perform pattern matching on SSA PHI nodes to optimize conditional
13050 code. This pass is enabled by default at @option{-O1} and higher,
13051 except for @option{-Og}.
13052
13053 @opindex ftree-switch-conversion
13054 @item -ftree-switch-conversion
13055 Perform conversion of simple initializations in a switch to
13056 initializations from a scalar array. This flag is enabled by default
13057 at @option{-O2} and higher.
13058
13059 @opindex ftree-tail-merge
13060 @item -ftree-tail-merge
13061 Look for identical code sequences. When found, replace one with a jump to the
13062 other. This optimization is known as tail merging or cross jumping. This flag
13063 is enabled by default at @option{-O2} and higher. The compilation time
13064 in this pass can
13065 be limited using @option{max-tail-merge-comparisons} parameter and
13066 @option{max-tail-merge-iterations} parameter.
13067
13068 @opindex ftree-dce
13069 @item -ftree-dce
13070 Perform dead code elimination (DCE) on trees. This flag is enabled by
13071 default at @option{-O1} and higher.
13072
13073 @opindex ftree-builtin-call-dce
13074 @item -ftree-builtin-call-dce
13075 Perform conditional dead code elimination (DCE) for calls to built-in functions
13076 that may set @code{errno} but are otherwise free of side effects. This flag is
13077 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13078 specified.
13079
13080 @opindex ffinite-loops
13081 @opindex fno-finite-loops
13082 @item -ffinite-loops
13083 Assume that a loop with an exit will eventually take the exit and not loop
13084 indefinitely. This allows the compiler to remove loops that otherwise have
13085 no side-effects, not considering eventual endless looping as such.
13086
13087 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13088 or higher.
13089
13090 @opindex ftree-dominator-opts
13091 @item -ftree-dominator-opts
13092 Perform a variety of simple scalar cleanups (constant/copy
13093 propagation, redundancy elimination, range propagation and expression
13094 simplification) based on a dominator tree traversal. This also
13095 performs jump threading (to reduce jumps to jumps). This flag is
13096 enabled by default at @option{-O1} and higher.
13097
13098 @opindex ftree-dse
13099 @item -ftree-dse
13100 Perform dead store elimination (DSE) on trees. A dead store is a store into
13101 a memory location that is later overwritten by another store without
13102 any intervening loads. In this case the earlier store can be deleted. This
13103 flag is enabled by default at @option{-O1} and higher.
13104
13105 @opindex ftree-ch
13106 @item -ftree-ch
13107 Perform loop header copying on trees. This is beneficial since it increases
13108 effectiveness of code motion optimizations. It also saves one jump. This flag
13109 is enabled by default at @option{-O1} and higher. It is not enabled
13110 for @option{-Os}, since it usually increases code size.
13111
13112 @opindex ftree-loop-optimize
13113 @item -ftree-loop-optimize
13114 Perform loop optimizations on trees. This flag is enabled by default
13115 at @option{-O1} and higher.
13116
13117 @opindex ftree-loop-linear
13118 @opindex floop-strip-mine
13119 @opindex floop-block
13120 @item -ftree-loop-linear
13121 @itemx -floop-strip-mine
13122 @itemx -floop-block
13123 Perform loop nest optimizations. Same as
13124 @option{-floop-nest-optimize}. To use this code transformation, GCC has
13125 to be configured with @option{--with-isl} to enable the Graphite loop
13126 transformation infrastructure.
13127
13128 @opindex fgraphite-identity
13129 @item -fgraphite-identity
13130 Enable the identity transformation for graphite. For every SCoP we generate
13131 the polyhedral representation and transform it back to gimple. Using
13132 @option{-fgraphite-identity} we can check the costs or benefits of the
13133 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
13134 are also performed by the code generator isl, like index splitting and
13135 dead code elimination in loops.
13136
13137 @opindex floop-nest-optimize
13138 @item -floop-nest-optimize
13139 Enable the isl based loop nest optimizer. This is a generic loop nest
13140 optimizer based on the Pluto optimization algorithms. It calculates a loop
13141 structure optimized for data-locality and parallelism. This option
13142 is experimental.
13143
13144 @opindex floop-parallelize-all
13145 @item -floop-parallelize-all
13146 Use the Graphite data dependence analysis to identify loops that can
13147 be parallelized. Parallelize all the loops that can be analyzed to
13148 not contain loop carried dependences without checking that it is
13149 profitable to parallelize the loops.
13150
13151 @opindex ftree-coalesce-vars
13152 @item -ftree-coalesce-vars
13153 While transforming the program out of the SSA representation, attempt to
13154 reduce copying by coalescing versions of different user-defined
13155 variables, instead of just compiler temporaries. This may severely
13156 limit the ability to debug an optimized program compiled with
13157 @option{-fno-var-tracking-assignments}. In the negated form, this flag
13158 prevents SSA coalescing of user variables. This option is enabled by
13159 default if optimization is enabled, and it does very little otherwise.
13160
13161 @opindex ftree-loop-if-convert
13162 @item -ftree-loop-if-convert
13163 Attempt to transform conditional jumps in the innermost loops to
13164 branch-less equivalents. The intent is to remove control-flow from
13165 the innermost loops in order to improve the ability of the
13166 vectorization pass to handle these loops. This is enabled by default
13167 if vectorization is enabled.
13168
13169 @opindex ftree-loop-distribution
13170 @item -ftree-loop-distribution
13171 Perform loop distribution. This flag can improve cache performance on
13172 big loop bodies and allow further loop optimizations, like
13173 parallelization or vectorization, to take place. For example, the loop
13174 @smallexample
13175 DO I = 1, N
13176 A(I) = B(I) + C
13177 D(I) = E(I) * F
13178 ENDDO
13179 @end smallexample
13180 is transformed to
13181 @smallexample
13182 DO I = 1, N
13183 A(I) = B(I) + C
13184 ENDDO
13185 DO I = 1, N
13186 D(I) = E(I) * F
13187 ENDDO
13188 @end smallexample
13189 This flag is enabled by default at @option{-O3}.
13190 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13191
13192 @opindex ftree-loop-distribute-patterns
13193 @item -ftree-loop-distribute-patterns
13194 Perform loop distribution of patterns that can be code generated with
13195 calls to a library. This flag is enabled by default at @option{-O2} and
13196 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13197
13198 This pass distributes the initialization loops and generates a call to
13199 memset zero. For example, the loop
13200 @smallexample
13201 DO I = 1, N
13202 A(I) = 0
13203 B(I) = A(I) + I
13204 ENDDO
13205 @end smallexample
13206 is transformed to
13207 @smallexample
13208 DO I = 1, N
13209 A(I) = 0
13210 ENDDO
13211 DO I = 1, N
13212 B(I) = A(I) + I
13213 ENDDO
13214 @end smallexample
13215 and the initialization loop is transformed into a call to memset zero.
13216 This flag is enabled by default at @option{-O3}.
13217 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13218
13219 @opindex floop-interchange
13220 @item -floop-interchange
13221 Perform loop interchange outside of graphite. This flag can improve cache
13222 performance on loop nest and allow further loop optimizations, like
13223 vectorization, to take place. For example, the loop
13224 @smallexample
13225 for (int i = 0; i < N; i++)
13226 for (int j = 0; j < N; j++)
13227 for (int k = 0; k < N; k++)
13228 c[i][j] = c[i][j] + a[i][k]*b[k][j];
13229 @end smallexample
13230 is transformed to
13231 @smallexample
13232 for (int i = 0; i < N; i++)
13233 for (int k = 0; k < N; k++)
13234 for (int j = 0; j < N; j++)
13235 c[i][j] = c[i][j] + a[i][k]*b[k][j];
13236 @end smallexample
13237 This flag is enabled by default at @option{-O3}.
13238 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13239
13240 @opindex floop-unroll-and-jam
13241 @item -floop-unroll-and-jam
13242 Apply unroll and jam transformations on feasible loops. In a loop
13243 nest this unrolls the outer loop by some factor and fuses the resulting
13244 multiple inner loops. This flag is enabled by default at @option{-O3}.
13245 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13246
13247 @opindex ftree-loop-im
13248 @item -ftree-loop-im
13249 Perform loop invariant motion on trees. This pass moves only invariants that
13250 are hard to handle at RTL level (function calls, operations that expand to
13251 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
13252 operands of conditions that are invariant out of the loop, so that we can use
13253 just trivial invariantness analysis in loop unswitching. The pass also includes
13254 store motion.
13255
13256 @opindex ftree-loop-ivcanon
13257 @item -ftree-loop-ivcanon
13258 Create a canonical counter for number of iterations in loops for which
13259 determining number of iterations requires complicated analysis. Later
13260 optimizations then may determine the number easily. Useful especially
13261 in connection with unrolling.
13262
13263 @opindex ftree-scev-cprop
13264 @item -ftree-scev-cprop
13265 Perform final value replacement. If a variable is modified in a loop
13266 in such a way that its value when exiting the loop can be determined using
13267 only its initial value and the number of loop iterations, replace uses of
13268 the final value by such a computation, provided it is sufficiently cheap.
13269 This reduces data dependencies and may allow further simplifications.
13270 Enabled by default at @option{-O1} and higher.
13271
13272 @opindex fivopts
13273 @item -fivopts
13274 Perform induction variable optimizations (strength reduction, induction
13275 variable merging and induction variable elimination) on trees.
13276
13277 @opindex ftree-parallelize-loops
13278 @item -ftree-parallelize-loops=n
13279 Parallelize loops, i.e., split their iteration space to run in n threads.
13280 This is only possible for loops whose iterations are independent
13281 and can be arbitrarily reordered. The optimization is only
13282 profitable on multiprocessor machines, for loops that are CPU-intensive,
13283 rather than constrained e.g.@: by memory bandwidth. This option
13284 implies @option{-pthread}, and thus is only supported on targets
13285 that have support for @option{-pthread}.
13286
13287 @opindex ftree-pta
13288 @item -ftree-pta
13289 Perform function-local points-to analysis on trees. This flag is
13290 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13291
13292 @opindex ftree-sra
13293 @item -ftree-sra
13294 Perform scalar replacement of aggregates. This pass replaces structure
13295 references with scalars to prevent committing structures to memory too
13296 early. This flag is enabled by default at @option{-O1} and higher,
13297 except for @option{-Og}.
13298
13299 @opindex fstore-merging
13300 @item -fstore-merging
13301 Perform merging of narrow stores to consecutive memory addresses. This pass
13302 merges contiguous stores of immediate values narrower than a word into fewer
13303 wider stores to reduce the number of instructions. This is enabled by default
13304 at @option{-O2} and higher as well as @option{-Os}.
13305
13306 @opindex ftree-ter
13307 @item -ftree-ter
13308 Perform temporary expression replacement during the SSA->normal phase. Single
13309 use/single def temporaries are replaced at their use location with their
13310 defining expression. This results in non-GIMPLE code, but gives the expanders
13311 much more complex trees to work on resulting in better RTL generation. This is
13312 enabled by default at @option{-O1} and higher.
13313
13314 @opindex ftree-slsr
13315 @item -ftree-slsr
13316 Perform straight-line strength reduction on trees. This recognizes related
13317 expressions involving multiplications and replaces them by less expensive
13318 calculations when possible. This is enabled by default at @option{-O1} and
13319 higher.
13320
13321 @opindex ftree-vectorize
13322 @item -ftree-vectorize
13323 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13324 and @option{-ftree-slp-vectorize} if not explicitly specified.
13325
13326 @opindex ftree-loop-vectorize
13327 @item -ftree-loop-vectorize
13328 Perform loop vectorization on trees. This flag is enabled by default at
13329 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13330 and @option{-fauto-profile}.
13331
13332 @opindex ftree-slp-vectorize
13333 @item -ftree-slp-vectorize
13334 Perform basic block vectorization on trees. This flag is enabled by default at
13335 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13336 and @option{-fauto-profile}.
13337
13338 @opindex ftrivial-auto-var-init
13339 @item -ftrivial-auto-var-init=@var{choice}
13340 Initialize automatic variables with either a pattern or with zeroes to increase
13341 the security and predictability of a program by preventing uninitialized memory
13342 disclosure and use.
13343 GCC still considers an automatic variable that doesn't have an explicit
13344 initializer as uninitialized, @option{-Wuninitialized} and
13345 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13346 warning messages on such automatic variables and the compiler will
13347 perform optimization as if the variable were uninitialized.
13348 With this option, GCC will also initialize any padding of automatic variables
13349 that have structure or union types to zeroes.
13350 However, the current implementation cannot initialize automatic variables that
13351 are declared between the controlling expression and the first case of a
13352 @code{switch} statement. Using @option{-Wtrivial-auto-var-init} to report all
13353 such cases.
13354
13355 The three values of @var{choice} are:
13356
13357 @itemize @bullet
13358 @item
13359 @samp{uninitialized} doesn't initialize any automatic variables.
13360 This is C and C++'s default.
13361
13362 @item
13363 @samp{pattern} Initialize automatic variables with values which will likely
13364 transform logic bugs into crashes down the line, are easily recognized in a
13365 crash dump and without being values that programmers can rely on for useful
13366 program semantics.
13367 The current value is byte-repeatable pattern with byte "0xFE".
13368 The values used for pattern initialization might be changed in the future.
13369
13370 @item
13371 @samp{zero} Initialize automatic variables with zeroes.
13372 @end itemize
13373
13374 The default is @samp{uninitialized}.
13375
13376 You can control this behavior for a specific variable by using the variable
13377 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13378
13379 @opindex fvect-cost-model
13380 @item -fvect-cost-model=@var{model}
13381 Alter the cost model used for vectorization. The @var{model} argument
13382 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13383 @samp{very-cheap}.
13384 With the @samp{unlimited} model the vectorized code-path is assumed
13385 to be profitable while with the @samp{dynamic} model a runtime check
13386 guards the vectorized code-path to enable it only for iteration
13387 counts that will likely execute faster than when executing the original
13388 scalar loop. The @samp{cheap} model disables vectorization of
13389 loops where doing so would be cost prohibitive for example due to
13390 required runtime checks for data dependence or alignment but otherwise
13391 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
13392 allows vectorization if the vector code would entirely replace the
13393 scalar code that is being vectorized. For example, if each iteration
13394 of a vectorized loop would only be able to handle exactly four iterations
13395 of the scalar loop, the @samp{very-cheap} model would only allow
13396 vectorization if the scalar iteration count is known to be a multiple
13397 of four.
13398
13399 The default cost model depends on other optimization flags and is
13400 either @samp{dynamic} or @samp{cheap}.
13401
13402 @opindex fsimd-cost-model
13403 @item -fsimd-cost-model=@var{model}
13404 Alter the cost model used for vectorization of loops marked with the OpenMP
13405 simd directive. The @var{model} argument should be one of
13406 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
13407 have the same meaning as described in @option{-fvect-cost-model} and by
13408 default a cost model defined with @option{-fvect-cost-model} is used.
13409
13410 @opindex ftree-vrp
13411 @item -ftree-vrp
13412 Perform Value Range Propagation on trees. This is similar to the
13413 constant propagation pass, but instead of values, ranges of values are
13414 propagated. This allows the optimizers to remove unnecessary range
13415 checks like array bound checks and null pointer checks. This is
13416 enabled by default at @option{-O2} and higher. Null pointer check
13417 elimination is only done if @option{-fdelete-null-pointer-checks} is
13418 enabled.
13419
13420 @opindex fsplit-paths
13421 @item -fsplit-paths
13422 Split paths leading to loop backedges. This can improve dead code
13423 elimination and common subexpression elimination. This is enabled by
13424 default at @option{-O3} and above.
13425
13426 @opindex fsplit-ivs-in-unroller
13427 @item -fsplit-ivs-in-unroller
13428 Enables expression of values of induction variables in later iterations
13429 of the unrolled loop using the value in the first iteration. This breaks
13430 long dependency chains, thus improving efficiency of the scheduling passes.
13431
13432 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13433 same effect. However, that is not reliable in cases where the loop body
13434 is more complicated than a single basic block. It also does not work at all
13435 on some architectures due to restrictions in the CSE pass.
13436
13437 This optimization is enabled by default.
13438
13439 @opindex fvariable-expansion-in-unroller
13440 @item -fvariable-expansion-in-unroller
13441 With this option, the compiler creates multiple copies of some
13442 local variables when unrolling a loop, which can result in superior code.
13443
13444 This optimization is enabled by default for PowerPC targets, but disabled
13445 by default otherwise.
13446
13447 @opindex fpartial-inlining
13448 @item -fpartial-inlining
13449 Inline parts of functions. This option has any effect only
13450 when inlining itself is turned on by the @option{-finline-functions}
13451 or @option{-finline-small-functions} options.
13452
13453 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13454
13455 @opindex fpredictive-commoning
13456 @item -fpredictive-commoning
13457 Perform predictive commoning optimization, i.e., reusing computations
13458 (especially memory loads and stores) performed in previous
13459 iterations of loops.
13460
13461 This option is enabled at level @option{-O3}.
13462 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13463
13464 @opindex fprefetch-loop-arrays
13465 @item -fprefetch-loop-arrays
13466 If supported by the target machine, generate instructions to prefetch
13467 memory to improve the performance of loops that access large arrays.
13468
13469 This option may generate better or worse code; results are highly
13470 dependent on the structure of loops within the source code.
13471
13472 Disabled at level @option{-Os}.
13473
13474 @opindex fno-printf-return-value
13475 @opindex fprintf-return-value
13476 @item -fno-printf-return-value
13477 Do not substitute constants for known return value of formatted output
13478 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13479 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
13480 transformation allows GCC to optimize or even eliminate branches based
13481 on the known return value of these functions called with arguments that
13482 are either constant, or whose values are known to be in a range that
13483 makes determining the exact return value possible. For example, when
13484 @option{-fprintf-return-value} is in effect, both the branch and the
13485 body of the @code{if} statement (but not the call to @code{snprint})
13486 can be optimized away when @code{i} is a 32-bit or smaller integer
13487 because the return value is guaranteed to be at most 8.
13488
13489 @smallexample
13490 char buf[9];
13491 if (snprintf (buf, "%08x", i) >= sizeof buf)
13492 @dots{}
13493 @end smallexample
13494
13495 The @option{-fprintf-return-value} option relies on other optimizations
13496 and yields best results with @option{-O2} and above. It works in tandem
13497 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13498 options. The @option{-fprintf-return-value} option is enabled by default.
13499
13500 @opindex fno-peephole
13501 @opindex fpeephole
13502 @opindex fno-peephole2
13503 @opindex fpeephole2
13504 @item -fno-peephole
13505 @itemx -fno-peephole2
13506 Disable any machine-specific peephole optimizations. The difference
13507 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13508 are implemented in the compiler; some targets use one, some use the
13509 other, a few use both.
13510
13511 @option{-fpeephole} is enabled by default.
13512 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13513
13514 @opindex fno-guess-branch-probability
13515 @opindex fguess-branch-probability
13516 @item -fno-guess-branch-probability
13517 Do not guess branch probabilities using heuristics.
13518
13519 GCC uses heuristics to guess branch probabilities if they are
13520 not provided by profiling feedback (@option{-fprofile-arcs}). These
13521 heuristics are based on the control flow graph. If some branch probabilities
13522 are specified by @code{__builtin_expect}, then the heuristics are
13523 used to guess branch probabilities for the rest of the control flow graph,
13524 taking the @code{__builtin_expect} info into account. The interactions
13525 between the heuristics and @code{__builtin_expect} can be complex, and in
13526 some cases, it may be useful to disable the heuristics so that the effects
13527 of @code{__builtin_expect} are easier to understand.
13528
13529 It is also possible to specify expected probability of the expression
13530 with @code{__builtin_expect_with_probability} built-in function.
13531
13532 The default is @option{-fguess-branch-probability} at levels
13533 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13534
13535 @opindex freorder-blocks
13536 @item -freorder-blocks
13537 Reorder basic blocks in the compiled function in order to reduce number of
13538 taken branches and improve code locality.
13539
13540 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13541
13542 @opindex freorder-blocks-algorithm
13543 @item -freorder-blocks-algorithm=@var{algorithm}
13544 Use the specified algorithm for basic block reordering. The
13545 @var{algorithm} argument can be @samp{simple}, which does not increase
13546 code size (except sometimes due to secondary effects like alignment),
13547 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13548 put all often executed code together, minimizing the number of branches
13549 executed by making extra copies of code.
13550
13551 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13552 @samp{stc} at levels @option{-O2}, @option{-O3}.
13553
13554 @opindex freorder-blocks-and-partition
13555 @item -freorder-blocks-and-partition
13556 In addition to reordering basic blocks in the compiled function, in order
13557 to reduce number of taken branches, partitions hot and cold basic blocks
13558 into separate sections of the assembly and @file{.o} files, to improve
13559 paging and cache locality performance.
13560
13561 This optimization is automatically turned off in the presence of
13562 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13563 section attribute and on any architecture that does not support named
13564 sections. When @option{-fsplit-stack} is used this option is not
13565 enabled by default (to avoid linker errors), but may be enabled
13566 explicitly (if using a working linker).
13567
13568 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13569
13570 @opindex freorder-functions
13571 @item -freorder-functions
13572 Reorder functions in the object file in order to
13573 improve code locality. This is implemented by using special
13574 subsections @code{.text.hot} for most frequently executed functions and
13575 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
13576 the linker so object file format must support named sections and linker must
13577 place them in a reasonable way.
13578
13579 This option isn't effective unless you either provide profile feedback
13580 (see @option{-fprofile-arcs} for details) or manually annotate functions with
13581 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13582
13583 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13584
13585 @opindex fstrict-aliasing
13586 @item -fstrict-aliasing
13587 Allow the compiler to assume the strictest aliasing rules applicable to
13588 the language being compiled. For C (and C++), this activates
13589 optimizations based on the type of expressions. In particular, an
13590 object of one type is assumed never to reside at the same address as an
13591 object of a different type, unless the types are almost the same. For
13592 example, an @code{unsigned int} can alias an @code{int}, but not a
13593 @code{void*} or a @code{double}. A character type may alias any other
13594 type.
13595
13596 @anchor{Type-punning}Pay special attention to code like this:
13597 @smallexample
13598 union a_union @{
13599 int i;
13600 double d;
13601 @};
13602
13603 int f() @{
13604 union a_union t;
13605 t.d = 3.0;
13606 return t.i;
13607 @}
13608 @end smallexample
13609 The practice of reading from a different union member than the one most
13610 recently written to (called ``type-punning'') is common. Even with
13611 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13612 is accessed through the union type. So, the code above works as
13613 expected. @xref{Structures unions enumerations and bit-fields
13614 implementation}. However, this code might not:
13615 @smallexample
13616 int f() @{
13617 union a_union t;
13618 int* ip;
13619 t.d = 3.0;
13620 ip = &t.i;
13621 return *ip;
13622 @}
13623 @end smallexample
13624
13625 Similarly, access by taking the address, casting the resulting pointer
13626 and dereferencing the result has undefined behavior, even if the cast
13627 uses a union type, e.g.:
13628 @smallexample
13629 int f() @{
13630 double d = 3.0;
13631 return ((union a_union *) &d)->i;
13632 @}
13633 @end smallexample
13634
13635 The @option{-fstrict-aliasing} option is enabled at levels
13636 @option{-O2}, @option{-O3}, @option{-Os}.
13637
13638 @opindex fipa-strict-aliasing
13639 @item -fipa-strict-aliasing
13640 Controls whether rules of @option{-fstrict-aliasing} are applied across
13641 function boundaries. Note that if multiple functions gets inlined into a
13642 single function the memory accesses are no longer considered to be crossing a
13643 function boundary.
13644
13645 The @option{-fipa-strict-aliasing} option is enabled by default and is
13646 effective only in combination with @option{-fstrict-aliasing}.
13647
13648 @opindex falign-functions
13649 @item -falign-functions
13650 @itemx -falign-functions=@var{n}
13651 @itemx -falign-functions=@var{n}:@var{m}
13652 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13653 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13654 Align the start of functions to the next power-of-two greater than or
13655 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
13656 least the first @var{m} bytes of the function can be fetched by the CPU
13657 without crossing an @var{n}-byte alignment boundary.
13658
13659 If @var{m} is not specified, it defaults to @var{n}.
13660
13661 Examples: @option{-falign-functions=32} aligns functions to the next
13662 32-byte boundary, @option{-falign-functions=24} aligns to the next
13663 32-byte boundary only if this can be done by skipping 23 bytes or less,
13664 @option{-falign-functions=32:7} aligns to the next
13665 32-byte boundary only if this can be done by skipping 6 bytes or less.
13666
13667 The second pair of @var{n2}:@var{m2} values allows you to specify
13668 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13669 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13670 otherwise aligns to the next 32-byte boundary if this can be done
13671 by skipping 2 bytes or less.
13672 If @var{m2} is not specified, it defaults to @var{n2}.
13673
13674 Some assemblers only support this flag when @var{n} is a power of two;
13675 in that case, it is rounded up.
13676
13677 @option{-fno-align-functions} and @option{-falign-functions=1} are
13678 equivalent and mean that functions are not aligned.
13679
13680 If @var{n} is not specified or is zero, use a machine-dependent default.
13681 The maximum allowed @var{n} option value is 65536.
13682
13683 Enabled at levels @option{-O2}, @option{-O3}.
13684
13685 @item -flimit-function-alignment
13686 If this option is enabled, the compiler tries to avoid unnecessarily
13687 overaligning functions. It attempts to instruct the assembler to align
13688 by the amount specified by @option{-falign-functions}, but not to
13689 skip more bytes than the size of the function.
13690
13691 @opindex falign-labels
13692 @item -falign-labels
13693 @itemx -falign-labels=@var{n}
13694 @itemx -falign-labels=@var{n}:@var{m}
13695 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13696 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13697 Align all branch targets to a power-of-two boundary.
13698
13699 Parameters of this option are analogous to the @option{-falign-functions} option.
13700 @option{-fno-align-labels} and @option{-falign-labels=1} are
13701 equivalent and mean that labels are not aligned.
13702
13703 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13704 are greater than this value, then their values are used instead.
13705
13706 If @var{n} is not specified or is zero, use a machine-dependent default
13707 which is very likely to be @samp{1}, meaning no alignment.
13708 The maximum allowed @var{n} option value is 65536.
13709
13710 Enabled at levels @option{-O2}, @option{-O3}.
13711
13712 @opindex falign-loops
13713 @item -falign-loops
13714 @itemx -falign-loops=@var{n}
13715 @itemx -falign-loops=@var{n}:@var{m}
13716 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13717 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13718 Align loops to a power-of-two boundary. If the loops are executed
13719 many times, this makes up for any execution of the dummy padding
13720 instructions.
13721
13722 If @option{-falign-labels} is greater than this value, then its value
13723 is used instead.
13724
13725 Parameters of this option are analogous to the @option{-falign-functions} option.
13726 @option{-fno-align-loops} and @option{-falign-loops=1} are
13727 equivalent and mean that loops are not aligned.
13728 The maximum allowed @var{n} option value is 65536.
13729
13730 If @var{n} is not specified or is zero, use a machine-dependent default.
13731
13732 Enabled at levels @option{-O2}, @option{-O3}.
13733
13734 @opindex falign-jumps
13735 @item -falign-jumps
13736 @itemx -falign-jumps=@var{n}
13737 @itemx -falign-jumps=@var{n}:@var{m}
13738 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13739 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13740 Align branch targets to a power-of-two boundary, for branch targets
13741 where the targets can only be reached by jumping. In this case,
13742 no dummy operations need be executed.
13743
13744 If @option{-falign-labels} is greater than this value, then its value
13745 is used instead.
13746
13747 Parameters of this option are analogous to the @option{-falign-functions} option.
13748 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13749 equivalent and mean that loops are not aligned.
13750
13751 If @var{n} is not specified or is zero, use a machine-dependent default.
13752 The maximum allowed @var{n} option value is 65536.
13753
13754 Enabled at levels @option{-O2}, @option{-O3}.
13755
13756 @opindex fno-allocation-dce
13757 @item -fno-allocation-dce
13758 Do not remove unused C++ allocations in dead code elimination.
13759
13760 @opindex fallow-store-data-races
13761 @item -fallow-store-data-races
13762 Allow the compiler to perform optimizations that may introduce new data races
13763 on stores, without proving that the variable cannot be concurrently accessed
13764 by other threads. Does not affect optimization of local data. It is safe to
13765 use this option if it is known that global data will not be accessed by
13766 multiple threads.
13767
13768 Examples of optimizations enabled by @option{-fallow-store-data-races} include
13769 hoisting or if-conversions that may cause a value that was already in memory
13770 to be re-written with that same value. Such re-writing is safe in a single
13771 threaded context but may be unsafe in a multi-threaded context. Note that on
13772 some processors, if-conversions may be required in order to enable
13773 vectorization.
13774
13775 Enabled at level @option{-Ofast}.
13776
13777 @opindex funit-at-a-time
13778 @item -funit-at-a-time
13779 This option is left for compatibility reasons. @option{-funit-at-a-time}
13780 has no effect, while @option{-fno-unit-at-a-time} implies
13781 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
13782
13783 Enabled by default.
13784
13785 @opindex fno-toplevel-reorder
13786 @opindex ftoplevel-reorder
13787 @item -fno-toplevel-reorder
13788 Do not reorder top-level functions, variables, and @code{asm}
13789 statements. Output them in the same order that they appear in the
13790 input file. When this option is used, unreferenced static variables
13791 are not removed. This option is intended to support existing code
13792 that relies on a particular ordering. For new code, it is better to
13793 use attributes when possible.
13794
13795 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
13796 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
13797 Additionally @option{-fno-toplevel-reorder} implies
13798 @option{-fno-section-anchors}.
13799
13800 @opindex funreachable-traps
13801 @item -funreachable-traps
13802 With this option, the compiler turns calls to
13803 @code{__builtin_unreachable} into traps, instead of using them for
13804 optimization. This also affects any such calls implicitly generated
13805 by the compiler.
13806
13807 This option has the same effect as @option{-fsanitize=unreachable
13808 -fsanitize-trap=unreachable}, but does not affect the values of those
13809 options. If @option{-fsanitize=unreachable} is enabled, that option
13810 takes priority over this one.
13811
13812 This option is enabled by default at @option{-O0} and @option{-Og}.
13813
13814 @opindex fweb
13815 @item -fweb
13816 Constructs webs as commonly used for register allocation purposes and assign
13817 each web individual pseudo register. This allows the register allocation pass
13818 to operate on pseudos directly, but also strengthens several other optimization
13819 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
13820 however, make debugging impossible, since variables no longer stay in a
13821 ``home register''.
13822
13823 Enabled by default with @option{-funroll-loops}.
13824
13825 @opindex fwhole-program
13826 @item -fwhole-program
13827 Assume that the current compilation unit represents the whole program being
13828 compiled. All public functions and variables with the exception of @code{main}
13829 and those merged by attribute @code{externally_visible} become static functions
13830 and in effect are optimized more aggressively by interprocedural optimizers.
13831
13832 With @option{-flto} this option has a limited use. In most cases the
13833 precise list of symbols used or exported from the binary is known the
13834 resolution info passed to the link-time optimizer by the linker plugin. It is
13835 still useful if no linker plugin is used or during incremental link step when
13836 final code is produced (with @option{-flto}
13837 @option{-flinker-output=nolto-rel}).
13838
13839 @opindex flto
13840 @item -flto[=@var{n}]
13841 This option runs the standard link-time optimizer. When invoked
13842 with source code, it generates GIMPLE (one of GCC's internal
13843 representations) and writes it to special ELF sections in the object
13844 file. When the object files are linked together, all the function
13845 bodies are read from these ELF sections and instantiated as if they
13846 had been part of the same translation unit.
13847
13848 To use the link-time optimizer, @option{-flto} and optimization
13849 options should be specified at compile time and during the final link.
13850 It is recommended that you compile all the files participating in the
13851 same link with the same options and also specify those options at
13852 link time.
13853 For example:
13854
13855 @smallexample
13856 gcc -c -O2 -flto foo.c
13857 gcc -c -O2 -flto bar.c
13858 gcc -o myprog -flto -O2 foo.o bar.o
13859 @end smallexample
13860
13861 The first two invocations to GCC save a bytecode representation
13862 of GIMPLE into special ELF sections inside @file{foo.o} and
13863 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
13864 @file{foo.o} and @file{bar.o}, merges the two files into a single
13865 internal image, and compiles the result as usual. Since both
13866 @file{foo.o} and @file{bar.o} are merged into a single image, this
13867 causes all the interprocedural analyses and optimizations in GCC to
13868 work across the two files as if they were a single one. This means,
13869 for example, that the inliner is able to inline functions in
13870 @file{bar.o} into functions in @file{foo.o} and vice-versa.
13871
13872 Another (simpler) way to enable link-time optimization is:
13873
13874 @smallexample
13875 gcc -o myprog -flto -O2 foo.c bar.c
13876 @end smallexample
13877
13878 The above generates bytecode for @file{foo.c} and @file{bar.c},
13879 merges them together into a single GIMPLE representation and optimizes
13880 them as usual to produce @file{myprog}.
13881
13882 The important thing to keep in mind is that to enable link-time
13883 optimizations you need to use the GCC driver to perform the link step.
13884 GCC automatically performs link-time optimization if any of the
13885 objects involved were compiled with the @option{-flto} command-line option.
13886 You can always override
13887 the automatic decision to do link-time optimization
13888 by passing @option{-fno-lto} to the link command.
13889
13890 To make whole program optimization effective, it is necessary to make
13891 certain whole program assumptions. The compiler needs to know
13892 what functions and variables can be accessed by libraries and runtime
13893 outside of the link-time optimized unit. When supported by the linker,
13894 the linker plugin (see @option{-fuse-linker-plugin}) passes information
13895 to the compiler about used and externally visible symbols. When
13896 the linker plugin is not available, @option{-fwhole-program} should be
13897 used to allow the compiler to make these assumptions, which leads
13898 to more aggressive optimization decisions.
13899
13900 When a file is compiled with @option{-flto} without
13901 @option{-fuse-linker-plugin}, the generated object file is larger than
13902 a regular object file because it contains GIMPLE bytecodes and the usual
13903 final code (see @option{-ffat-lto-objects}). This means that
13904 object files with LTO information can be linked as normal object
13905 files; if @option{-fno-lto} is passed to the linker, no
13906 interprocedural optimizations are applied. Note that when
13907 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
13908 but you cannot perform a regular, non-LTO link on them.
13909
13910 When producing the final binary, GCC only
13911 applies link-time optimizations to those files that contain bytecode.
13912 Therefore, you can mix and match object files and libraries with
13913 GIMPLE bytecodes and final object code. GCC automatically selects
13914 which files to optimize in LTO mode and which files to link without
13915 further processing.
13916
13917 Generally, options specified at link time override those
13918 specified at compile time, although in some cases GCC attempts to infer
13919 link-time options from the settings used to compile the input files.
13920
13921 If you do not specify an optimization level option @option{-O} at
13922 link time, then GCC uses the highest optimization level
13923 used when compiling the object files. Note that it is generally
13924 ineffective to specify an optimization level option only at link time and
13925 not at compile time, for two reasons. First, compiling without
13926 optimization suppresses compiler passes that gather information
13927 needed for effective optimization at link time. Second, some early
13928 optimization passes can be performed only at compile time and
13929 not at link time.
13930
13931 There are some code generation flags preserved by GCC when
13932 generating bytecodes, as they need to be used during the final link.
13933 Currently, the following options and their settings are taken from
13934 the first object file that explicitly specifies them:
13935 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
13936 @option{-fgnu-tm} and all the @option{-m} target flags.
13937
13938 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
13939 @option{-fPIE} are combined based on the following scheme:
13940
13941 @smallexample
13942 @option{-fPIC} + @option{-fpic} = @option{-fpic}
13943 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
13944 @option{-fpic/-fPIC} + (no option) = (no option)
13945 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
13946 @option{-fpic} + @option{-fPIE} = @option{-fpie}
13947 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
13948 @end smallexample
13949
13950 Certain ABI-changing flags are required to match in all compilation units,
13951 and trying to override this at link time with a conflicting value
13952 is ignored. This includes options such as @option{-freg-struct-return}
13953 and @option{-fpcc-struct-return}.
13954
13955 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
13956 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
13957 are passed through to the link stage and merged conservatively for
13958 conflicting translation units. Specifically
13959 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
13960 precedence; and for example @option{-ffp-contract=off} takes precedence
13961 over @option{-ffp-contract=fast}. You can override them at link time.
13962
13963 Diagnostic options such as @option{-Wstringop-overflow} are passed
13964 through to the link stage and their setting matches that of the
13965 compile-step at function granularity. Note that this matters only
13966 for diagnostics emitted during optimization. Note that code
13967 transforms such as inlining can lead to warnings being enabled
13968 or disabled for regions if code not consistent with the setting
13969 at compile time.
13970
13971 When you need to pass options to the assembler via @option{-Wa} or
13972 @option{-Xassembler} make sure to either compile such translation
13973 units with @option{-fno-lto} or consistently use the same assembler
13974 options on all translation units. You can alternatively also
13975 specify assembler options at LTO link time.
13976
13977 To enable debug info generation you need to supply @option{-g} at
13978 compile time. If any of the input files at link time were built
13979 with debug info generation enabled the link will enable debug info
13980 generation as well. Any elaborate debug info settings
13981 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
13982 at the linker command line and mixing different settings in different
13983 translation units is discouraged.
13984
13985 If LTO encounters objects with C linkage declared with incompatible
13986 types in separate translation units to be linked together (undefined
13987 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
13988 issued. The behavior is still undefined at run time. Similar
13989 diagnostics may be raised for other languages.
13990
13991 Another feature of LTO is that it is possible to apply interprocedural
13992 optimizations on files written in different languages:
13993
13994 @smallexample
13995 gcc -c -flto foo.c
13996 g++ -c -flto bar.cc
13997 gfortran -c -flto baz.f90
13998 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
13999 @end smallexample
14000
14001 Notice that the final link is done with @command{g++} to get the C++
14002 runtime libraries and @option{-lgfortran} is added to get the Fortran
14003 runtime libraries. In general, when mixing languages in LTO mode, you
14004 should use the same link command options as when mixing languages in a
14005 regular (non-LTO) compilation.
14006
14007 If object files containing GIMPLE bytecode are stored in a library archive, say
14008 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14009 are using a linker with plugin support. To create static libraries suitable
14010 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14011 and @command{ranlib};
14012 to show the symbols of object files with GIMPLE bytecode, use
14013 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
14014 and @command{nm} have been compiled with plugin support. At link time, use the
14015 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14016 the LTO optimization process:
14017
14018 @smallexample
14019 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14020 @end smallexample
14021
14022 With the linker plugin enabled, the linker extracts the needed
14023 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14024 to make them part of the aggregated GIMPLE image to be optimized.
14025
14026 If you are not using a linker with plugin support and/or do not
14027 enable the linker plugin, then the objects inside @file{libfoo.a}
14028 are extracted and linked as usual, but they do not participate
14029 in the LTO optimization process. In order to make a static library suitable
14030 for both LTO optimization and usual linkage, compile its object files with
14031 @option{-flto} @option{-ffat-lto-objects}.
14032
14033 Link-time optimizations do not require the presence of the whole program to
14034 operate. If the program does not require any symbols to be exported, it is
14035 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14036 the interprocedural optimizers to use more aggressive assumptions which may
14037 lead to improved optimization opportunities.
14038 Use of @option{-fwhole-program} is not needed when linker plugin is
14039 active (see @option{-fuse-linker-plugin}).
14040
14041 The current implementation of LTO makes no
14042 attempt to generate bytecode that is portable between different
14043 types of hosts. The bytecode files are versioned and there is a
14044 strict version check, so bytecode files generated in one version of
14045 GCC do not work with an older or newer version of GCC.
14046
14047 Link-time optimization does not work well with generation of debugging
14048 information on systems other than those using a combination of ELF and
14049 DWARF.
14050
14051 If you specify the optional @var{n}, the optimization and code
14052 generation done at link time is executed in parallel using @var{n}
14053 parallel jobs by utilizing an installed @command{make} program. The
14054 environment variable @env{MAKE} may be used to override the program
14055 used.
14056
14057 You can also specify @option{-flto=jobserver} to use GNU make's
14058 job server mode to determine the number of parallel jobs. This
14059 is useful when the Makefile calling GCC is already executing in parallel.
14060 You must prepend a @samp{+} to the command recipe in the parent Makefile
14061 for this to work. This option likely only works if @env{MAKE} is
14062 GNU make. Even without the option value, GCC tries to automatically
14063 detect a running GNU make's job server.
14064
14065 Use @option{-flto=auto} to use GNU make's job server, if available,
14066 or otherwise fall back to autodetection of the number of CPU threads
14067 present in your system.
14068
14069 @opindex flto-partition
14070 @item -flto-partition=@var{alg}
14071 Specify the partitioning algorithm used by the link-time optimizer.
14072 The value is either @samp{1to1} to specify a partitioning mirroring
14073 the original source files or @samp{balanced} to specify partitioning
14074 into equally sized chunks (whenever possible) or @samp{max} to create
14075 new partition for every symbol where possible. Specifying @samp{none}
14076 as an algorithm disables partitioning and streaming completely.
14077 The default value is @samp{balanced}. While @samp{1to1} can be used
14078 as an workaround for various code ordering issues, the @samp{max}
14079 partitioning is intended for internal testing only.
14080 The value @samp{one} specifies that exactly one partition should be
14081 used while the value @samp{none} bypasses partitioning and executes
14082 the link-time optimization step directly from the WPA phase.
14083
14084 @opindex flto-compression-level
14085 @item -flto-compression-level=@var{n}
14086 This option specifies the level of compression used for intermediate
14087 language written to LTO object files, and is only meaningful in
14088 conjunction with LTO mode (@option{-flto}). GCC currently supports two
14089 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14090 to 19 (maximum compression), while zlib supports values from 0 to 9.
14091 Values outside this range are clamped to either minimum or maximum
14092 of the supported values. If the option is not given,
14093 a default balanced compression setting is used.
14094
14095 @opindex fuse-linker-plugin
14096 @item -fuse-linker-plugin
14097 Enables the use of a linker plugin during link-time optimization. This
14098 option relies on plugin support in the linker, which is available in gold
14099 or in GNU ld 2.21 or newer.
14100
14101 This option enables the extraction of object files with GIMPLE bytecode out
14102 of library archives. This improves the quality of optimization by exposing
14103 more code to the link-time optimizer. This information specifies what
14104 symbols can be accessed externally (by non-LTO object or during dynamic
14105 linking). Resulting code quality improvements on binaries (and shared
14106 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14107 See @option{-flto} for a description of the effect of this flag and how to
14108 use it.
14109
14110 This option is enabled by default when LTO support in GCC is enabled
14111 and GCC was configured for use with
14112 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14113
14114 @opindex ffat-lto-objects
14115 @item -ffat-lto-objects
14116 Fat LTO objects are object files that contain both the intermediate language
14117 and the object code. This makes them usable for both LTO linking and normal
14118 linking. This option is effective only when compiling with @option{-flto}
14119 and is ignored at link time.
14120
14121 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14122 requires the complete toolchain to be aware of LTO. It requires a linker with
14123 linker plugin support for basic functionality. Additionally,
14124 @command{nm}, @command{ar} and @command{ranlib}
14125 need to support linker plugins to allow a full-featured build environment
14126 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
14127 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14128 to these tools. With non fat LTO makefiles need to be modified to use them.
14129
14130 Note that modern binutils provide plugin auto-load mechanism.
14131 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14132 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14133 @command{gcc-ranlib}).
14134
14135 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14136 support.
14137
14138 @opindex fcompare-elim
14139 @item -fcompare-elim
14140 After register allocation and post-register allocation instruction splitting,
14141 identify arithmetic instructions that compute processor flags similar to a
14142 comparison operation based on that arithmetic. If possible, eliminate the
14143 explicit comparison operation.
14144
14145 This pass only applies to certain targets that cannot explicitly represent
14146 the comparison operation before register allocation is complete.
14147
14148 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14149
14150 @opindex fcprop-registers
14151 @item -fcprop-registers
14152 After register allocation and post-register allocation instruction splitting,
14153 perform a copy-propagation pass to try to reduce scheduling dependencies
14154 and occasionally eliminate the copy.
14155
14156 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14157
14158 @opindex fprofile-correction
14159 @item -fprofile-correction
14160 Profiles collected using an instrumented binary for multi-threaded programs may
14161 be inconsistent due to missed counter updates. When this option is specified,
14162 GCC uses heuristics to correct or smooth out such inconsistencies. By
14163 default, GCC emits an error message when an inconsistent profile is detected.
14164
14165 This option is enabled by @option{-fauto-profile}.
14166
14167 @opindex fprofile-partial-training
14168 @item -fprofile-partial-training
14169 With @code{-fprofile-use} all portions of programs not executed during train
14170 run are optimized agressively for size rather than speed. In some cases it is
14171 not practical to train all possible hot paths in the program. (For
14172 example, program may contain functions specific for a given hardware and
14173 trianing may not cover all hardware configurations program is run on.) With
14174 @code{-fprofile-partial-training} profile feedback will be ignored for all
14175 functions not executed during the train run leading them to be optimized as if
14176 they were compiled without profile feedback. This leads to better performance
14177 when train run is not representative but also leads to significantly bigger
14178 code.
14179
14180 @opindex fprofile-use
14181 @item -fprofile-use
14182 @itemx -fprofile-use=@var{path}
14183 Enable profile feedback-directed optimizations,
14184 and the following optimizations, many of which
14185 are generally profitable only with profile feedback available:
14186
14187 @gccoptlist{-fbranch-probabilities -fprofile-values
14188 -funroll-loops -fpeel-loops -ftracer -fvpt
14189 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp
14190 -fpredictive-commoning -fsplit-loops -funswitch-loops
14191 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize
14192 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns
14193 -fprofile-reorder-functions}
14194
14195 Before you can use this option, you must first generate profiling information.
14196 @xref{Instrumentation Options}, for information about the
14197 @option{-fprofile-generate} option.
14198
14199 By default, GCC emits an error message if the feedback profiles do not
14200 match the source code. This error can be turned into a warning by using
14201 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
14202 optimized code. Additionally, by default, GCC also emits a warning message if
14203 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14204
14205 If @var{path} is specified, GCC looks at the @var{path} to find
14206 the profile feedback data files. See @option{-fprofile-dir}.
14207
14208 @opindex fauto-profile
14209 @item -fauto-profile
14210 @itemx -fauto-profile=@var{path}
14211 Enable sampling-based feedback-directed optimizations,
14212 and the following optimizations,
14213 many of which are generally profitable only with profile feedback available:
14214
14215 @gccoptlist{-fbranch-probabilities -fprofile-values
14216 -funroll-loops -fpeel-loops -ftracer -fvpt
14217 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp
14218 -fpredictive-commoning -fsplit-loops -funswitch-loops
14219 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize
14220 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns
14221 -fprofile-correction}
14222
14223 @var{path} is the name of a file containing AutoFDO profile information.
14224 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14225
14226 Producing an AutoFDO profile data file requires running your program
14227 with the @command{perf} utility on a supported GNU/Linux target system.
14228 For more information, see @uref{https://perf.wiki.kernel.org/}.
14229
14230 E.g.
14231 @smallexample
14232 perf record -e br_inst_retired:near_taken -b -o perf.data \
14233 -- your_program
14234 @end smallexample
14235
14236 Then use the @command{create_gcov} tool to convert the raw profile data
14237 to a format that can be used by GCC.@ You must also supply the
14238 unstripped binary for your program to this tool.
14239 See @uref{https://github.com/google/autofdo}.
14240
14241 E.g.
14242 @smallexample
14243 create_gcov --binary=your_program.unstripped --profile=perf.data \
14244 --gcov=profile.afdo
14245 @end smallexample
14246 @end table
14247
14248 The following options control compiler behavior regarding floating-point
14249 arithmetic. These options trade off between speed and
14250 correctness. All must be specifically enabled.
14251
14252 @table @gcctabopt
14253 @opindex ffloat-store
14254 @item -ffloat-store
14255 Do not store floating-point variables in registers, and inhibit other
14256 options that might change whether a floating-point value is taken from a
14257 register or memory.
14258
14259 @cindex floating-point precision
14260 This option prevents undesirable excess precision on machines such as
14261 the 68000 where the floating registers (of the 68881) keep more
14262 precision than a @code{double} is supposed to have. Similarly for the
14263 x86 architecture. For most programs, the excess precision does only
14264 good, but a few programs rely on the precise definition of IEEE floating
14265 point. Use @option{-ffloat-store} for such programs, after modifying
14266 them to store all pertinent intermediate computations into variables.
14267
14268 @opindex fexcess-precision
14269 @item -fexcess-precision=@var{style}
14270 This option allows further control over excess precision on machines
14271 where floating-point operations occur in a format with more precision or
14272 range than the IEEE standard and interchange floating-point types. By
14273 default, @option{-fexcess-precision=fast} is in effect; this means that
14274 operations may be carried out in a wider precision than the types specified
14275 in the source if that would result in faster code, and it is unpredictable
14276 when rounding to the types specified in the source code takes place.
14277 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14278 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14279 both casts and assignments cause values to be rounded to their
14280 semantic types (whereas @option{-ffloat-store} only affects
14281 assignments). This option is enabled by default for C or C++ if a strict
14282 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14283 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14284 regardless of whether a strict conformance option is used.
14285
14286 @opindex mfpmath
14287 @option{-fexcess-precision=standard} is not implemented for languages
14288 other than C or C++. On the x86, it has no effect if @option{-mfpmath=sse}
14289 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14290 semantics apply without excess precision, and in the latter, rounding
14291 is unpredictable.
14292
14293 @opindex ffast-math
14294 @item -ffast-math
14295 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14296 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14297 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14298 @option{-fexcess-precision=fast}.
14299
14300 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14301
14302 This option is not turned on by any @option{-O} option besides
14303 @option{-Ofast} since it can result in incorrect output for programs
14304 that depend on an exact implementation of IEEE or ISO rules/specifications
14305 for math functions. It may, however, yield faster code for programs
14306 that do not require the guarantees of these specifications.
14307
14308 @opindex fno-math-errno
14309 @opindex fmath-errno
14310 @item -fno-math-errno
14311 Do not set @code{errno} after calling math functions that are executed
14312 with a single instruction, e.g., @code{sqrt}. A program that relies on
14313 IEEE exceptions for math error handling may want to use this flag
14314 for speed while maintaining IEEE arithmetic compatibility.
14315
14316 This option is not turned on by any @option{-O} option since
14317 it can result in incorrect output for programs that depend on
14318 an exact implementation of IEEE or ISO rules/specifications for
14319 math functions. It may, however, yield faster code for programs
14320 that do not require the guarantees of these specifications.
14321
14322 The default is @option{-fmath-errno}.
14323
14324 On Darwin systems, the math library never sets @code{errno}. There is
14325 therefore no reason for the compiler to consider the possibility that
14326 it might, and @option{-fno-math-errno} is the default.
14327
14328 @opindex funsafe-math-optimizations
14329 @item -funsafe-math-optimizations
14330
14331 Allow optimizations for floating-point arithmetic that (a) assume
14332 that arguments and results are valid and (b) may violate IEEE or
14333 ANSI standards. When used at link time, it may include libraries
14334 or startup files that change the default FPU control word or other
14335 similar optimizations.
14336
14337 This option is not turned on by any @option{-O} option since
14338 it can result in incorrect output for programs that depend on
14339 an exact implementation of IEEE or ISO rules/specifications for
14340 math functions. It may, however, yield faster code for programs
14341 that do not require the guarantees of these specifications.
14342 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14343 @option{-fassociative-math} and @option{-freciprocal-math}.
14344
14345 The default is @option{-fno-unsafe-math-optimizations}.
14346
14347 @opindex fassociative-math
14348 @item -fassociative-math
14349
14350 Allow re-association of operands in series of floating-point operations.
14351 This violates the ISO C and C++ language standard by possibly changing
14352 computation result. NOTE: re-ordering may change the sign of zero as
14353 well as ignore NaNs and inhibit or create underflow or overflow (and
14354 thus cannot be used on code that relies on rounding behavior like
14355 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
14356 and thus may not be used when ordered comparisons are required.
14357 This option requires that both @option{-fno-signed-zeros} and
14358 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
14359 much sense with @option{-frounding-math}. For Fortran the option
14360 is automatically enabled when both @option{-fno-signed-zeros} and
14361 @option{-fno-trapping-math} are in effect.
14362
14363 The default is @option{-fno-associative-math}.
14364
14365 @opindex freciprocal-math
14366 @item -freciprocal-math
14367
14368 Allow the reciprocal of a value to be used instead of dividing by
14369 the value if this enables optimizations. For example @code{x / y}
14370 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14371 is subject to common subexpression elimination. Note that this loses
14372 precision and increases the number of flops operating on the value.
14373
14374 The default is @option{-fno-reciprocal-math}.
14375
14376 @opindex ffinite-math-only
14377 @item -ffinite-math-only
14378 Allow optimizations for floating-point arithmetic that assume
14379 that arguments and results are not NaNs or +-Infs.
14380
14381 This option is not turned on by any @option{-O} option since
14382 it can result in incorrect output for programs that depend on
14383 an exact implementation of IEEE or ISO rules/specifications for
14384 math functions. It may, however, yield faster code for programs
14385 that do not require the guarantees of these specifications.
14386
14387 The default is @option{-fno-finite-math-only}.
14388
14389 @opindex fno-signed-zeros
14390 @opindex fsigned-zeros
14391 @item -fno-signed-zeros
14392 Allow optimizations for floating-point arithmetic that ignore the
14393 signedness of zero. IEEE arithmetic specifies the behavior of
14394 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14395 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14396 This option implies that the sign of a zero result isn't significant.
14397
14398 The default is @option{-fsigned-zeros}.
14399
14400 @opindex fno-trapping-math
14401 @opindex ftrapping-math
14402 @item -fno-trapping-math
14403 Compile code assuming that floating-point operations cannot generate
14404 user-visible traps. These traps include division by zero, overflow,
14405 underflow, inexact result and invalid operation. This option requires
14406 that @option{-fno-signaling-nans} be in effect. Setting this option may
14407 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14408
14409 This option should never be turned on by any @option{-O} option since
14410 it can result in incorrect output for programs that depend on
14411 an exact implementation of IEEE or ISO rules/specifications for
14412 math functions.
14413
14414 The default is @option{-ftrapping-math}.
14415
14416 Future versions of GCC may provide finer control of this setting
14417 using C99's @code{FENV_ACCESS} pragma. This command-line option
14418 will be used along with @option{-frounding-math} to specify the
14419 default state for @code{FENV_ACCESS}.
14420
14421 @opindex frounding-math
14422 @item -frounding-math
14423 Disable transformations and optimizations that assume default floating-point
14424 rounding behavior. This is round-to-zero for all floating point
14425 to integer conversions, and round-to-nearest for all other arithmetic
14426 truncations. This option should be specified for programs that change
14427 the FP rounding mode dynamically, or that may be executed with a
14428 non-default rounding mode. This option disables constant folding of
14429 floating-point expressions at compile time (which may be affected by
14430 rounding mode) and arithmetic transformations that are unsafe in the
14431 presence of sign-dependent rounding modes.
14432
14433 The default is @option{-fno-rounding-math}.
14434
14435 This option is experimental and does not currently guarantee to
14436 disable all GCC optimizations that are affected by rounding mode.
14437 Future versions of GCC may provide finer control of this setting
14438 using C99's @code{FENV_ACCESS} pragma. This command-line option
14439 will be used along with @option{-ftrapping-math} to specify the
14440 default state for @code{FENV_ACCESS}.
14441
14442 @opindex fsignaling-nans
14443 @item -fsignaling-nans
14444 Compile code assuming that IEEE signaling NaNs may generate user-visible
14445 traps during floating-point operations. Setting this option disables
14446 optimizations that may change the number of exceptions visible with
14447 signaling NaNs. This option implies @option{-ftrapping-math}.
14448
14449 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14450 be defined.
14451
14452 The default is @option{-fno-signaling-nans}.
14453
14454 This option is experimental and does not currently guarantee to
14455 disable all GCC optimizations that affect signaling NaN behavior.
14456
14457 @opindex fno-fp-int-builtin-inexact
14458 @opindex ffp-int-builtin-inexact
14459 @item -fno-fp-int-builtin-inexact
14460 Do not allow the built-in functions @code{ceil}, @code{floor},
14461 @code{round} and @code{trunc}, and their @code{float} and @code{long
14462 double} variants, to generate code that raises the ``inexact''
14463 floating-point exception for noninteger arguments. ISO C99 and C11
14464 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14465 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14466 ISO C2X, does not allow these functions to do so.
14467
14468 The default is @option{-ffp-int-builtin-inexact}, allowing the
14469 exception to be raised, unless C2X or a later C standard is selected.
14470 This option does nothing unless @option{-ftrapping-math} is in effect.
14471
14472 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14473 generate a call to a library function then the ``inexact'' exception
14474 may be raised if the library implementation does not follow TS 18661.
14475
14476 @opindex fsingle-precision-constant
14477 @item -fsingle-precision-constant
14478 Treat floating-point constants as single precision instead of
14479 implicitly converting them to double-precision constants.
14480
14481 @opindex fcx-limited-range
14482 @item -fcx-limited-range
14483 When enabled, this option states that a range reduction step is not
14484 needed when performing complex division. Also, there is no checking
14485 whether the result of a complex multiplication or division is @code{NaN
14486 + I*NaN}, with an attempt to rescue the situation in that case. The
14487 default is @option{-fno-cx-limited-range}, but is enabled by
14488 @option{-ffast-math}.
14489
14490 This option controls the default setting of the ISO C99
14491 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
14492 all languages.
14493
14494 @opindex fcx-fortran-rules
14495 @item -fcx-fortran-rules
14496 Complex multiplication and division follow Fortran rules. Range
14497 reduction is done as part of complex division, but there is no checking
14498 whether the result of a complex multiplication or division is @code{NaN
14499 + I*NaN}, with an attempt to rescue the situation in that case.
14500
14501 The default is @option{-fno-cx-fortran-rules}.
14502
14503 @end table
14504
14505 The following options control optimizations that may improve
14506 performance, but are not enabled by any @option{-O} options. This
14507 section includes experimental options that may produce broken code.
14508
14509 @table @gcctabopt
14510 @opindex fbranch-probabilities
14511 @item -fbranch-probabilities
14512 After running a program compiled with @option{-fprofile-arcs}
14513 (@pxref{Instrumentation Options}),
14514 you can compile it a second time using
14515 @option{-fbranch-probabilities}, to improve optimizations based on
14516 the number of times each branch was taken. When a program
14517 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14518 counts to a file called @file{@var{sourcename}.gcda} for each source
14519 file. The information in this data file is very dependent on the
14520 structure of the generated code, so you must use the same source code
14521 and the same optimization options for both compilations.
14522 See details about the file naming in @option{-fprofile-arcs}.
14523
14524 With @option{-fbranch-probabilities}, GCC puts a
14525 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14526 These can be used to improve optimization. Currently, they are only
14527 used in one place: in @file{reorg.cc}, instead of guessing which path a
14528 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14529 exactly determine which path is taken more often.
14530
14531 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14532
14533 @opindex fprofile-values
14534 @item -fprofile-values
14535 If combined with @option{-fprofile-arcs}, it adds code so that some
14536 data about values of expressions in the program is gathered.
14537
14538 With @option{-fbranch-probabilities}, it reads back the data gathered
14539 from profiling values of expressions for usage in optimizations.
14540
14541 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14542 @option{-fauto-profile}.
14543
14544 @opindex fprofile-reorder-functions
14545 @item -fprofile-reorder-functions
14546 Function reordering based on profile instrumentation collects
14547 first time of execution of a function and orders these functions
14548 in ascending order.
14549
14550 Enabled with @option{-fprofile-use}.
14551
14552 @opindex fvpt
14553 @item -fvpt
14554 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14555 to add code to gather information about values of expressions.
14556
14557 With @option{-fbranch-probabilities}, it reads back the data gathered
14558 and actually performs the optimizations based on them.
14559 Currently the optimizations include specialization of division operations
14560 using the knowledge about the value of the denominator.
14561
14562 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14563
14564 @opindex frename-registers
14565 @item -frename-registers
14566 Attempt to avoid false dependencies in scheduled code by making use
14567 of registers left over after register allocation. This optimization
14568 most benefits processors with lots of registers. Depending on the
14569 debug information format adopted by the target, however, it can
14570 make debugging impossible, since variables no longer stay in
14571 a ``home register''.
14572
14573 Enabled by default with @option{-funroll-loops}.
14574
14575 @opindex fschedule-fusion
14576 @item -fschedule-fusion
14577 Performs a target dependent pass over the instruction stream to schedule
14578 instructions of same type together because target machine can execute them
14579 more efficiently if they are adjacent to each other in the instruction flow.
14580
14581 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14582
14583 @opindex ftracer
14584 @item -ftracer
14585 Perform tail duplication to enlarge superblock size. This transformation
14586 simplifies the control flow of the function allowing other optimizations to do
14587 a better job.
14588
14589 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14590
14591 @opindex funroll-loops
14592 @item -funroll-loops
14593 Unroll loops whose number of iterations can be determined at compile time or
14594 upon entry to the loop. @option{-funroll-loops} implies
14595 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14596 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14597 a small constant number of iterations). This option makes code larger, and may
14598 or may not make it run faster.
14599
14600 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14601
14602 @opindex funroll-all-loops
14603 @item -funroll-all-loops
14604 Unroll all loops, even if their number of iterations is uncertain when
14605 the loop is entered. This usually makes programs run more slowly.
14606 @option{-funroll-all-loops} implies the same options as
14607 @option{-funroll-loops}.
14608
14609 @opindex fpeel-loops
14610 @item -fpeel-loops
14611 Peels loops for which there is enough information that they do not
14612 roll much (from profile feedback or static analysis). It also turns on
14613 complete loop peeling (i.e.@: complete removal of loops with small constant
14614 number of iterations).
14615
14616 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14617
14618 @opindex fmove-loop-invariants
14619 @item -fmove-loop-invariants
14620 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
14621 at level @option{-O1} and higher, except for @option{-Og}.
14622
14623 @opindex fmove-loop-stores
14624 @item -fmove-loop-stores
14625 Enables the loop store motion pass in the GIMPLE loop optimizer. This
14626 moves invariant stores to after the end of the loop in exchange for
14627 carrying the stored value in a register across the iteration.
14628 Note for this option to have an effect @option{-ftree-loop-im} has to
14629 be enabled as well. Enabled at level @option{-O1} and higher, except
14630 for @option{-Og}.
14631
14632 @opindex fsplit-loops
14633 @item -fsplit-loops
14634 Split a loop into two if it contains a condition that's always true
14635 for one side of the iteration space and false for the other.
14636
14637 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14638
14639 @opindex funswitch-loops
14640 @item -funswitch-loops
14641 Move branches with loop invariant conditions out of the loop, with duplicates
14642 of the loop on both branches (modified according to result of the condition).
14643
14644 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14645
14646 @opindex fversion-loops-for-strides
14647 @item -fversion-loops-for-strides
14648 If a loop iterates over an array with a variable stride, create another
14649 version of the loop that assumes the stride is always one. For example:
14650
14651 @smallexample
14652 for (int i = 0; i < n; ++i)
14653 x[i * stride] = @dots{};
14654 @end smallexample
14655
14656 becomes:
14657
14658 @smallexample
14659 if (stride == 1)
14660 for (int i = 0; i < n; ++i)
14661 x[i] = @dots{};
14662 else
14663 for (int i = 0; i < n; ++i)
14664 x[i * stride] = @dots{};
14665 @end smallexample
14666
14667 This is particularly useful for assumed-shape arrays in Fortran where
14668 (for example) it allows better vectorization assuming contiguous accesses.
14669 This flag is enabled by default at @option{-O3}.
14670 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14671
14672 @opindex ffunction-sections
14673 @opindex fdata-sections
14674 @item -ffunction-sections
14675 @itemx -fdata-sections
14676 Place each function or data item into its own section in the output
14677 file if the target supports arbitrary sections. The name of the
14678 function or the name of the data item determines the section's name
14679 in the output file.
14680
14681 Use these options on systems where the linker can perform optimizations to
14682 improve locality of reference in the instruction space. Most systems using the
14683 ELF object format have linkers with such optimizations. On AIX, the linker
14684 rearranges sections (CSECTs) based on the call graph. The performance impact
14685 varies.
14686
14687 Together with a linker garbage collection (linker @option{--gc-sections}
14688 option) these options may lead to smaller statically-linked executables (after
14689 stripping).
14690
14691 On ELF/DWARF systems these options do not degenerate the quality of the debug
14692 information. There could be issues with other object files/debug info formats.
14693
14694 Only use these options when there are significant benefits from doing so. When
14695 you specify these options, the assembler and linker create larger object and
14696 executable files and are also slower. These options affect code generation.
14697 They prevent optimizations by the compiler and assembler using relative
14698 locations inside a translation unit since the locations are unknown until
14699 link time. An example of such an optimization is relaxing calls to short call
14700 instructions.
14701
14702 @opindex fstdarg-opt
14703 @item -fstdarg-opt
14704 Optimize the prologue of variadic argument functions with respect to usage of
14705 those arguments.
14706
14707 @opindex fsection-anchors
14708 @item -fsection-anchors
14709 Try to reduce the number of symbolic address calculations by using
14710 shared ``anchor'' symbols to address nearby objects. This transformation
14711 can help to reduce the number of GOT entries and GOT accesses on some
14712 targets.
14713
14714 For example, the implementation of the following function @code{foo}:
14715
14716 @smallexample
14717 static int a, b, c;
14718 int foo (void) @{ return a + b + c; @}
14719 @end smallexample
14720
14721 @noindent
14722 usually calculates the addresses of all three variables, but if you
14723 compile it with @option{-fsection-anchors}, it accesses the variables
14724 from a common anchor point instead. The effect is similar to the
14725 following pseudocode (which isn't valid C):
14726
14727 @smallexample
14728 int foo (void)
14729 @{
14730 register int *xr = &x;
14731 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14732 @}
14733 @end smallexample
14734
14735 Not all targets support this option.
14736
14737 @opindex fzero-call-used-regs
14738 @item -fzero-call-used-regs=@var{choice}
14739 Zero call-used registers at function return to increase program
14740 security by either mitigating Return-Oriented Programming (ROP)
14741 attacks or preventing information leakage through registers.
14742
14743 The possible values of @var{choice} are the same as for the
14744 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14745 The default is @samp{skip}.
14746
14747 You can control this behavior for a specific function by using the function
14748 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14749
14750 @opindex param
14751 @item --param @var{name}=@var{value}
14752 In some places, GCC uses various constants to control the amount of
14753 optimization that is done. For example, GCC does not inline functions
14754 that contain more than a certain number of instructions. You can
14755 control some of these constants on the command line using the
14756 @option{--param} option.
14757
14758 The names of specific parameters, and the meaning of the values, are
14759 tied to the internals of the compiler, and are subject to change
14760 without notice in future releases.
14761
14762 In order to get the minimal, maximal and default values of a parameter,
14763 use the @option{--help=param -Q} options.
14764
14765 In each case, the @var{value} is an integer. The following choices
14766 of @var{name} are recognized for all targets:
14767
14768 @table @gcctabopt
14769 @item predictable-branch-outcome
14770 When branch is predicted to be taken with probability lower than this threshold
14771 (in percent), then it is considered well predictable.
14772
14773 @item max-rtl-if-conversion-insns
14774 RTL if-conversion tries to remove conditional branches around a block and
14775 replace them with conditionally executed instructions. This parameter
14776 gives the maximum number of instructions in a block which should be
14777 considered for if-conversion. The compiler will
14778 also use other heuristics to decide whether if-conversion is likely to be
14779 profitable.
14780
14781 @item max-rtl-if-conversion-predictable-cost
14782 RTL if-conversion will try to remove conditional branches around a block
14783 and replace them with conditionally executed instructions. These parameters
14784 give the maximum permissible cost for the sequence that would be generated
14785 by if-conversion depending on whether the branch is statically determined
14786 to be predictable or not. The units for this parameter are the same as
14787 those for the GCC internal seq_cost metric. The compiler will try to
14788 provide a reasonable default for this parameter using the BRANCH_COST
14789 target macro.
14790
14791 @item max-crossjump-edges
14792 The maximum number of incoming edges to consider for cross-jumping.
14793 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
14794 the number of edges incoming to each block. Increasing values mean
14795 more aggressive optimization, making the compilation time increase with
14796 probably small improvement in executable size.
14797
14798 @item min-crossjump-insns
14799 The minimum number of instructions that must be matched at the end
14800 of two blocks before cross-jumping is performed on them. This
14801 value is ignored in the case where all instructions in the block being
14802 cross-jumped from are matched.
14803
14804 @item max-grow-copy-bb-insns
14805 The maximum code size expansion factor when copying basic blocks
14806 instead of jumping. The expansion is relative to a jump instruction.
14807
14808 @item max-goto-duplication-insns
14809 The maximum number of instructions to duplicate to a block that jumps
14810 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
14811 passes, GCC factors computed gotos early in the compilation process,
14812 and unfactors them as late as possible. Only computed jumps at the
14813 end of a basic blocks with no more than max-goto-duplication-insns are
14814 unfactored.
14815
14816 @item max-delay-slot-insn-search
14817 The maximum number of instructions to consider when looking for an
14818 instruction to fill a delay slot. If more than this arbitrary number of
14819 instructions are searched, the time savings from filling the delay slot
14820 are minimal, so stop searching. Increasing values mean more
14821 aggressive optimization, making the compilation time increase with probably
14822 small improvement in execution time.
14823
14824 @item max-delay-slot-live-search
14825 When trying to fill delay slots, the maximum number of instructions to
14826 consider when searching for a block with valid live register
14827 information. Increasing this arbitrarily chosen value means more
14828 aggressive optimization, increasing the compilation time. This parameter
14829 should be removed when the delay slot code is rewritten to maintain the
14830 control-flow graph.
14831
14832 @item max-gcse-memory
14833 The approximate maximum amount of memory in @code{kB} that can be allocated in
14834 order to perform the global common subexpression elimination
14835 optimization. If more memory than specified is required, the
14836 optimization is not done.
14837
14838 @item max-gcse-insertion-ratio
14839 If the ratio of expression insertions to deletions is larger than this value
14840 for any expression, then RTL PRE inserts or removes the expression and thus
14841 leaves partially redundant computations in the instruction stream.
14842
14843 @item max-pending-list-length
14844 The maximum number of pending dependencies scheduling allows
14845 before flushing the current state and starting over. Large functions
14846 with few branches or calls can create excessively large lists which
14847 needlessly consume memory and resources.
14848
14849 @item max-modulo-backtrack-attempts
14850 The maximum number of backtrack attempts the scheduler should make
14851 when modulo scheduling a loop. Larger values can exponentially increase
14852 compilation time.
14853
14854 @item max-inline-functions-called-once-loop-depth
14855 Maximal loop depth of a call considered by inline heuristics that tries to
14856 inline all functions called once.
14857
14858 @item max-inline-functions-called-once-insns
14859 Maximal estimated size of functions produced while inlining functions called
14860 once.
14861
14862 @item max-inline-insns-single
14863 Several parameters control the tree inliner used in GCC@. This number sets the
14864 maximum number of instructions (counted in GCC's internal representation) in a
14865 single function that the tree inliner considers for inlining. This only
14866 affects functions declared inline and methods implemented in a class
14867 declaration (C++).
14868
14869
14870 @item max-inline-insns-auto
14871 When you use @option{-finline-functions} (included in @option{-O3}),
14872 a lot of functions that would otherwise not be considered for inlining
14873 by the compiler are investigated. To those functions, a different
14874 (more restrictive) limit compared to functions declared inline can
14875 be applied (@option{--param max-inline-insns-auto}).
14876
14877 @item max-inline-insns-small
14878 This is bound applied to calls which are considered relevant with
14879 @option{-finline-small-functions}.
14880
14881 @item max-inline-insns-size
14882 This is bound applied to calls which are optimized for size. Small growth
14883 may be desirable to anticipate optimization oppurtunities exposed by inlining.
14884
14885 @item uninlined-function-insns
14886 Number of instructions accounted by inliner for function overhead such as
14887 function prologue and epilogue.
14888
14889 @item uninlined-function-time
14890 Extra time accounted by inliner for function overhead such as time needed to
14891 execute function prologue and epilogue.
14892
14893 @item inline-heuristics-hint-percent
14894 The scale (in percents) applied to @option{inline-insns-single},
14895 @option{inline-insns-single-O2}, @option{inline-insns-auto}
14896 when inline heuristics hints that inlining is
14897 very profitable (will enable later optimizations).
14898
14899 @item uninlined-thunk-insns
14900 @item uninlined-thunk-time
14901 Same as @option{--param uninlined-function-insns} and
14902 @option{--param uninlined-function-time} but applied to function thunks.
14903
14904 @item inline-min-speedup
14905 When estimated performance improvement of caller + callee runtime exceeds this
14906 threshold (in percent), the function can be inlined regardless of the limit on
14907 @option{--param max-inline-insns-single} and @option{--param
14908 max-inline-insns-auto}.
14909
14910 @item large-function-insns
14911 The limit specifying really large functions. For functions larger than this
14912 limit after inlining, inlining is constrained by
14913 @option{--param large-function-growth}. This parameter is useful primarily
14914 to avoid extreme compilation time caused by non-linear algorithms used by the
14915 back end.
14916
14917 @item large-function-growth
14918 Specifies maximal growth of large function caused by inlining in percents.
14919 For example, parameter value 100 limits large function growth to 2.0 times
14920 the original size.
14921
14922 @item large-unit-insns
14923 The limit specifying large translation unit. Growth caused by inlining of
14924 units larger than this limit is limited by @option{--param inline-unit-growth}.
14925 For small units this might be too tight.
14926 For example, consider a unit consisting of function A
14927 that is inline and B that just calls A three times. If B is small relative to
14928 A, the growth of unit is 300\% and yet such inlining is very sane. For very
14929 large units consisting of small inlineable functions, however, the overall unit
14930 growth limit is needed to avoid exponential explosion of code size. Thus for
14931 smaller units, the size is increased to @option{--param large-unit-insns}
14932 before applying @option{--param inline-unit-growth}.
14933
14934 @item lazy-modules
14935 Maximum number of concurrently open C++ module files when lazy loading.
14936
14937 @item inline-unit-growth
14938 Specifies maximal overall growth of the compilation unit caused by inlining.
14939 For example, parameter value 20 limits unit growth to 1.2 times the original
14940 size. Cold functions (either marked cold via an attribute or by profile
14941 feedback) are not accounted into the unit size.
14942
14943 @item ipa-cp-unit-growth
14944 Specifies maximal overall growth of the compilation unit caused by
14945 interprocedural constant propagation. For example, parameter value 10 limits
14946 unit growth to 1.1 times the original size.
14947
14948 @item ipa-cp-large-unit-insns
14949 The size of translation unit that IPA-CP pass considers large.
14950
14951 @item large-stack-frame
14952 The limit specifying large stack frames. While inlining the algorithm is trying
14953 to not grow past this limit too much.
14954
14955 @item large-stack-frame-growth
14956 Specifies maximal growth of large stack frames caused by inlining in percents.
14957 For example, parameter value 1000 limits large stack frame growth to 11 times
14958 the original size.
14959
14960 @item max-inline-insns-recursive
14961 @itemx max-inline-insns-recursive-auto
14962 Specifies the maximum number of instructions an out-of-line copy of a
14963 self-recursive inline
14964 function can grow into by performing recursive inlining.
14965
14966 @option{--param max-inline-insns-recursive} applies to functions
14967 declared inline.
14968 For functions not declared inline, recursive inlining
14969 happens only when @option{-finline-functions} (included in @option{-O3}) is
14970 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
14971
14972 @item max-inline-recursive-depth
14973 @itemx max-inline-recursive-depth-auto
14974 Specifies the maximum recursion depth used for recursive inlining.
14975
14976 @option{--param max-inline-recursive-depth} applies to functions
14977 declared inline. For functions not declared inline, recursive inlining
14978 happens only when @option{-finline-functions} (included in @option{-O3}) is
14979 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
14980
14981 @item min-inline-recursive-probability
14982 Recursive inlining is profitable only for function having deep recursion
14983 in average and can hurt for function having little recursion depth by
14984 increasing the prologue size or complexity of function body to other
14985 optimizers.
14986
14987 When profile feedback is available (see @option{-fprofile-generate}) the actual
14988 recursion depth can be guessed from the probability that function recurses
14989 via a given call expression. This parameter limits inlining only to call
14990 expressions whose probability exceeds the given threshold (in percents).
14991
14992 @item early-inlining-insns
14993 Specify growth that the early inliner can make. In effect it increases
14994 the amount of inlining for code having a large abstraction penalty.
14995
14996 @item max-early-inliner-iterations
14997 Limit of iterations of the early inliner. This basically bounds
14998 the number of nested indirect calls the early inliner can resolve.
14999 Deeper chains are still handled by late inlining.
15000
15001 @item comdat-sharing-probability
15002 Probability (in percent) that C++ inline function with comdat visibility
15003 are shared across multiple compilation units.
15004
15005 @item modref-max-bases
15006 @item modref-max-refs
15007 @item modref-max-accesses
15008 Specifies the maximal number of base pointers, references and accesses stored
15009 for a single function by mod/ref analysis.
15010
15011 @item modref-max-tests
15012 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15013 memory locations using the mod/ref information. This parameter ought to be
15014 bigger than @option{--param modref-max-bases} and @option{--param
15015 modref-max-refs}.
15016
15017 @item modref-max-depth
15018 Specifies the maximum depth of DFS walk used by modref escape analysis.
15019 Setting to 0 disables the analysis completely.
15020
15021 @item modref-max-escape-points
15022 Specifies the maximum number of escape points tracked by modref per SSA-name.
15023
15024 @item modref-max-adjustments
15025 Specifies the maximum number the access range is enlarged during modref dataflow
15026 analysis.
15027
15028 @item profile-func-internal-id
15029 A parameter to control whether to use function internal id in profile
15030 database lookup. If the value is 0, the compiler uses an id that
15031 is based on function assembler name and filename, which makes old profile
15032 data more tolerant to source changes such as function reordering etc.
15033
15034 @item min-vect-loop-bound
15035 The minimum number of iterations under which loops are not vectorized
15036 when @option{-ftree-vectorize} is used. The number of iterations after
15037 vectorization needs to be greater than the value specified by this option
15038 to allow vectorization.
15039
15040 @item gcse-cost-distance-ratio
15041 Scaling factor in calculation of maximum distance an expression
15042 can be moved by GCSE optimizations. This is currently supported only in the
15043 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
15044 is with simple expressions, i.e., the expressions that have cost
15045 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
15046 hoisting of simple expressions.
15047
15048 @item gcse-unrestricted-cost
15049 Cost, roughly measured as the cost of a single typical machine
15050 instruction, at which GCSE optimizations do not constrain
15051 the distance an expression can travel. This is currently
15052 supported only in the code hoisting pass. The lesser the cost,
15053 the more aggressive code hoisting is. Specifying 0
15054 allows all expressions to travel unrestricted distances.
15055
15056 @item max-hoist-depth
15057 The depth of search in the dominator tree for expressions to hoist.
15058 This is used to avoid quadratic behavior in hoisting algorithm.
15059 The value of 0 does not limit on the search, but may slow down compilation
15060 of huge functions.
15061
15062 @item max-tail-merge-comparisons
15063 The maximum amount of similar bbs to compare a bb with. This is used to
15064 avoid quadratic behavior in tree tail merging.
15065
15066 @item max-tail-merge-iterations
15067 The maximum amount of iterations of the pass over the function. This is used to
15068 limit compilation time in tree tail merging.
15069
15070 @item store-merging-allow-unaligned
15071 Allow the store merging pass to introduce unaligned stores if it is legal to
15072 do so.
15073
15074 @item max-stores-to-merge
15075 The maximum number of stores to attempt to merge into wider stores in the store
15076 merging pass.
15077
15078 @item max-store-chains-to-track
15079 The maximum number of store chains to track at the same time in the attempt
15080 to merge them into wider stores in the store merging pass.
15081
15082 @item max-stores-to-track
15083 The maximum number of stores to track at the same time in the attemt to
15084 to merge them into wider stores in the store merging pass.
15085
15086 @item max-unrolled-insns
15087 The maximum number of instructions that a loop may have to be unrolled.
15088 If a loop is unrolled, this parameter also determines how many times
15089 the loop code is unrolled.
15090
15091 @item max-average-unrolled-insns
15092 The maximum number of instructions biased by probabilities of their execution
15093 that a loop may have to be unrolled. If a loop is unrolled,
15094 this parameter also determines how many times the loop code is unrolled.
15095
15096 @item max-unroll-times
15097 The maximum number of unrollings of a single loop.
15098
15099 @item max-peeled-insns
15100 The maximum number of instructions that a loop may have to be peeled.
15101 If a loop is peeled, this parameter also determines how many times
15102 the loop code is peeled.
15103
15104 @item max-peel-times
15105 The maximum number of peelings of a single loop.
15106
15107 @item max-peel-branches
15108 The maximum number of branches on the hot path through the peeled sequence.
15109
15110 @item max-completely-peeled-insns
15111 The maximum number of insns of a completely peeled loop.
15112
15113 @item max-completely-peel-times
15114 The maximum number of iterations of a loop to be suitable for complete peeling.
15115
15116 @item max-completely-peel-loop-nest-depth
15117 The maximum depth of a loop nest suitable for complete peeling.
15118
15119 @item max-unswitch-insns
15120 The maximum number of insns of an unswitched loop.
15121
15122 @item max-unswitch-depth
15123 The maximum depth of a loop nest to be unswitched.
15124
15125 @item lim-expensive
15126 The minimum cost of an expensive expression in the loop invariant motion.
15127
15128 @item min-loop-cond-split-prob
15129 When FDO profile information is available, @option{min-loop-cond-split-prob}
15130 specifies minimum threshold for probability of semi-invariant condition
15131 statement to trigger loop split.
15132
15133 @item iv-consider-all-candidates-bound
15134 Bound on number of candidates for induction variables, below which
15135 all candidates are considered for each use in induction variable
15136 optimizations. If there are more candidates than this,
15137 only the most relevant ones are considered to avoid quadratic time complexity.
15138
15139 @item iv-max-considered-uses
15140 The induction variable optimizations give up on loops that contain more
15141 induction variable uses.
15142
15143 @item iv-always-prune-cand-set-bound
15144 If the number of candidates in the set is smaller than this value,
15145 always try to remove unnecessary ivs from the set
15146 when adding a new one.
15147
15148 @item avg-loop-niter
15149 Average number of iterations of a loop.
15150
15151 @item dse-max-object-size
15152 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15153 Larger values may result in larger compilation times.
15154
15155 @item dse-max-alias-queries-per-store
15156 Maximum number of queries into the alias oracle per store.
15157 Larger values result in larger compilation times and may result in more
15158 removed dead stores.
15159
15160 @item scev-max-expr-size
15161 Bound on size of expressions used in the scalar evolutions analyzer.
15162 Large expressions slow the analyzer.
15163
15164 @item scev-max-expr-complexity
15165 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15166 Complex expressions slow the analyzer.
15167
15168 @item max-tree-if-conversion-phi-args
15169 Maximum number of arguments in a PHI supported by TREE if conversion
15170 unless the loop is marked with simd pragma.
15171
15172 @item vect-max-layout-candidates
15173 The maximum number of possible vector layouts (such as permutations)
15174 to consider when optimizing to-be-vectorized code.
15175
15176 @item vect-max-version-for-alignment-checks
15177 The maximum number of run-time checks that can be performed when
15178 doing loop versioning for alignment in the vectorizer.
15179
15180 @item vect-max-version-for-alias-checks
15181 The maximum number of run-time checks that can be performed when
15182 doing loop versioning for alias in the vectorizer.
15183
15184 @item vect-max-peeling-for-alignment
15185 The maximum number of loop peels to enhance access alignment
15186 for vectorizer. Value -1 means no limit.
15187
15188 @item max-iterations-to-track
15189 The maximum number of iterations of a loop the brute-force algorithm
15190 for analysis of the number of iterations of the loop tries to evaluate.
15191
15192 @item hot-bb-count-fraction
15193 The denominator n of fraction 1/n of the maximal execution count of a
15194 basic block in the entire program that a basic block needs to at least
15195 have in order to be considered hot. The default is 10000, which means
15196 that a basic block is considered hot if its execution count is greater
15197 than 1/10000 of the maximal execution count. 0 means that it is never
15198 considered hot. Used in non-LTO mode.
15199
15200 @item hot-bb-count-ws-permille
15201 The number of most executed permilles, ranging from 0 to 1000, of the
15202 profiled execution of the entire program to which the execution count
15203 of a basic block must be part of in order to be considered hot. The
15204 default is 990, which means that a basic block is considered hot if
15205 its execution count contributes to the upper 990 permilles, or 99.0%,
15206 of the profiled execution of the entire program. 0 means that it is
15207 never considered hot. Used in LTO mode.
15208
15209 @item hot-bb-frequency-fraction
15210 The denominator n of fraction 1/n of the execution frequency of the
15211 entry block of a function that a basic block of this function needs
15212 to at least have in order to be considered hot. The default is 1000,
15213 which means that a basic block is considered hot in a function if it
15214 is executed more frequently than 1/1000 of the frequency of the entry
15215 block of the function. 0 means that it is never considered hot.
15216
15217 @item unlikely-bb-count-fraction
15218 The denominator n of fraction 1/n of the number of profiled runs of
15219 the entire program below which the execution count of a basic block
15220 must be in order for the basic block to be considered unlikely executed.
15221 The default is 20, which means that a basic block is considered unlikely
15222 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15223 the program. 0 means that it is always considered unlikely executed.
15224
15225 @item max-predicted-iterations
15226 The maximum number of loop iterations we predict statically. This is useful
15227 in cases where a function contains a single loop with known bound and
15228 another loop with unknown bound.
15229 The known number of iterations is predicted correctly, while
15230 the unknown number of iterations average to roughly 10. This means that the
15231 loop without bounds appears artificially cold relative to the other one.
15232
15233 @item builtin-expect-probability
15234 Control the probability of the expression having the specified value. This
15235 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15236
15237 @item builtin-string-cmp-inline-length
15238 The maximum length of a constant string for a builtin string cmp call
15239 eligible for inlining.
15240
15241 @item align-threshold
15242
15243 Select fraction of the maximal frequency of executions of a basic block in
15244 a function to align the basic block.
15245
15246 @item align-loop-iterations
15247
15248 A loop expected to iterate at least the selected number of iterations is
15249 aligned.
15250
15251 @item tracer-dynamic-coverage
15252 @itemx tracer-dynamic-coverage-feedback
15253
15254 This value is used to limit superblock formation once the given percentage of
15255 executed instructions is covered. This limits unnecessary code size
15256 expansion.
15257
15258 The @option{tracer-dynamic-coverage-feedback} parameter
15259 is used only when profile
15260 feedback is available. The real profiles (as opposed to statically estimated
15261 ones) are much less balanced allowing the threshold to be larger value.
15262
15263 @item tracer-max-code-growth
15264 Stop tail duplication once code growth has reached given percentage. This is
15265 a rather artificial limit, as most of the duplicates are eliminated later in
15266 cross jumping, so it may be set to much higher values than is the desired code
15267 growth.
15268
15269 @item tracer-min-branch-ratio
15270
15271 Stop reverse growth when the reverse probability of best edge is less than this
15272 threshold (in percent).
15273
15274 @item tracer-min-branch-probability
15275 @itemx tracer-min-branch-probability-feedback
15276
15277 Stop forward growth if the best edge has probability lower than this
15278 threshold.
15279
15280 Similarly to @option{tracer-dynamic-coverage} two parameters are
15281 provided. @option{tracer-min-branch-probability-feedback} is used for
15282 compilation with profile feedback and @option{tracer-min-branch-probability}
15283 compilation without. The value for compilation with profile feedback
15284 needs to be more conservative (higher) in order to make tracer
15285 effective.
15286
15287 @item stack-clash-protection-guard-size
15288 Specify the size of the operating system provided stack guard as
15289 2 raised to @var{num} bytes. Higher values may reduce the
15290 number of explicit probes, but a value larger than the operating system
15291 provided guard will leave code vulnerable to stack clash style attacks.
15292
15293 @item stack-clash-protection-probe-interval
15294 Stack clash protection involves probing stack space as it is allocated. This
15295 param controls the maximum distance between probes into the stack as 2 raised
15296 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
15297 larger than the operating system provided guard will leave code vulnerable to
15298 stack clash style attacks.
15299
15300 @item max-cse-path-length
15301
15302 The maximum number of basic blocks on path that CSE considers.
15303
15304 @item max-cse-insns
15305 The maximum number of instructions CSE processes before flushing.
15306
15307 @item ggc-min-expand
15308
15309 GCC uses a garbage collector to manage its own memory allocation. This
15310 parameter specifies the minimum percentage by which the garbage
15311 collector's heap should be allowed to expand between collections.
15312 Tuning this may improve compilation speed; it has no effect on code
15313 generation.
15314
15315 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15316 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
15317 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
15318 GCC is not able to calculate RAM on a particular platform, the lower
15319 bound of 30% is used. Setting this parameter and
15320 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15321 every opportunity. This is extremely slow, but can be useful for
15322 debugging.
15323
15324 @item ggc-min-heapsize
15325
15326 Minimum size of the garbage collector's heap before it begins bothering
15327 to collect garbage. The first collection occurs after the heap expands
15328 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
15329 tuning this may improve compilation speed, and has no effect on code
15330 generation.
15331
15332 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15333 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15334 with a lower bound of 4096 (four megabytes) and an upper bound of
15335 131072 (128 megabytes). If GCC is not able to calculate RAM on a
15336 particular platform, the lower bound is used. Setting this parameter
15337 very large effectively disables garbage collection. Setting this
15338 parameter and @option{ggc-min-expand} to zero causes a full collection
15339 to occur at every opportunity.
15340
15341 @item max-reload-search-insns
15342 The maximum number of instruction reload should look backward for equivalent
15343 register. Increasing values mean more aggressive optimization, making the
15344 compilation time increase with probably slightly better performance.
15345
15346 @item max-cselib-memory-locations
15347 The maximum number of memory locations cselib should take into account.
15348 Increasing values mean more aggressive optimization, making the compilation time
15349 increase with probably slightly better performance.
15350
15351 @item max-sched-ready-insns
15352 The maximum number of instructions ready to be issued the scheduler should
15353 consider at any given time during the first scheduling pass. Increasing
15354 values mean more thorough searches, making the compilation time increase
15355 with probably little benefit.
15356
15357 @item max-sched-region-blocks
15358 The maximum number of blocks in a region to be considered for
15359 interblock scheduling.
15360
15361 @item max-pipeline-region-blocks
15362 The maximum number of blocks in a region to be considered for
15363 pipelining in the selective scheduler.
15364
15365 @item max-sched-region-insns
15366 The maximum number of insns in a region to be considered for
15367 interblock scheduling.
15368
15369 @item max-pipeline-region-insns
15370 The maximum number of insns in a region to be considered for
15371 pipelining in the selective scheduler.
15372
15373 @item min-spec-prob
15374 The minimum probability (in percents) of reaching a source block
15375 for interblock speculative scheduling.
15376
15377 @item max-sched-extend-regions-iters
15378 The maximum number of iterations through CFG to extend regions.
15379 A value of 0 disables region extensions.
15380
15381 @item max-sched-insn-conflict-delay
15382 The maximum conflict delay for an insn to be considered for speculative motion.
15383
15384 @item sched-spec-prob-cutoff
15385 The minimal probability of speculation success (in percents), so that
15386 speculative insns are scheduled.
15387
15388 @item sched-state-edge-prob-cutoff
15389 The minimum probability an edge must have for the scheduler to save its
15390 state across it.
15391
15392 @item sched-mem-true-dep-cost
15393 Minimal distance (in CPU cycles) between store and load targeting same
15394 memory locations.
15395
15396 @item selsched-max-lookahead
15397 The maximum size of the lookahead window of selective scheduling. It is a
15398 depth of search for available instructions.
15399
15400 @item selsched-max-sched-times
15401 The maximum number of times that an instruction is scheduled during
15402 selective scheduling. This is the limit on the number of iterations
15403 through which the instruction may be pipelined.
15404
15405 @item selsched-insns-to-rename
15406 The maximum number of best instructions in the ready list that are considered
15407 for renaming in the selective scheduler.
15408
15409 @item sms-min-sc
15410 The minimum value of stage count that swing modulo scheduler
15411 generates.
15412
15413 @item max-last-value-rtl
15414 The maximum size measured as number of RTLs that can be recorded in an expression
15415 in combiner for a pseudo register as last known value of that register.
15416
15417 @item max-combine-insns
15418 The maximum number of instructions the RTL combiner tries to combine.
15419
15420 @item integer-share-limit
15421 Small integer constants can use a shared data structure, reducing the
15422 compiler's memory usage and increasing its speed. This sets the maximum
15423 value of a shared integer constant.
15424
15425 @item ssp-buffer-size
15426 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15427 protection when @option{-fstack-protector} is used.
15428
15429 @item min-size-for-stack-sharing
15430 The minimum size of variables taking part in stack slot sharing when not
15431 optimizing.
15432
15433 @item max-jump-thread-duplication-stmts
15434 Maximum number of statements allowed in a block that needs to be
15435 duplicated when threading jumps.
15436
15437 @item max-jump-thread-paths
15438 The maximum number of paths to consider when searching for jump threading
15439 opportunities. When arriving at a block, incoming edges are only considered
15440 if the number of paths to be searched so far multiplied by the number of
15441 incoming edges does not exhaust the specified maximum number of paths to
15442 consider.
15443
15444 @item max-fields-for-field-sensitive
15445 Maximum number of fields in a structure treated in
15446 a field sensitive manner during pointer analysis.
15447
15448 @item prefetch-latency
15449 Estimate on average number of instructions that are executed before
15450 prefetch finishes. The distance prefetched ahead is proportional
15451 to this constant. Increasing this number may also lead to less
15452 streams being prefetched (see @option{simultaneous-prefetches}).
15453
15454 @item simultaneous-prefetches
15455 Maximum number of prefetches that can run at the same time.
15456
15457 @item l1-cache-line-size
15458 The size of cache line in L1 data cache, in bytes.
15459
15460 @item l1-cache-size
15461 The size of L1 data cache, in kilobytes.
15462
15463 @item l2-cache-size
15464 The size of L2 data cache, in kilobytes.
15465
15466 @item prefetch-dynamic-strides
15467 Whether the loop array prefetch pass should issue software prefetch hints
15468 for strides that are non-constant. In some cases this may be
15469 beneficial, though the fact the stride is non-constant may make it
15470 hard to predict when there is clear benefit to issuing these hints.
15471
15472 Set to 1 if the prefetch hints should be issued for non-constant
15473 strides. Set to 0 if prefetch hints should be issued only for strides that
15474 are known to be constant and below @option{prefetch-minimum-stride}.
15475
15476 @item prefetch-minimum-stride
15477 Minimum constant stride, in bytes, to start using prefetch hints for. If
15478 the stride is less than this threshold, prefetch hints will not be issued.
15479
15480 This setting is useful for processors that have hardware prefetchers, in
15481 which case there may be conflicts between the hardware prefetchers and
15482 the software prefetchers. If the hardware prefetchers have a maximum
15483 stride they can handle, it should be used here to improve the use of
15484 software prefetchers.
15485
15486 A value of -1 means we don't have a threshold and therefore
15487 prefetch hints can be issued for any constant stride.
15488
15489 This setting is only useful for strides that are known and constant.
15490
15491 @item destructive-interference-size
15492 @item constructive-interference-size
15493 The values for the C++17 variables
15494 @code{std::hardware_destructive_interference_size} and
15495 @code{std::hardware_constructive_interference_size}. The destructive
15496 interference size is the minimum recommended offset between two
15497 independent concurrently-accessed objects; the constructive
15498 interference size is the maximum recommended size of contiguous memory
15499 accessed together. Typically both will be the size of an L1 cache
15500 line for the target, in bytes. For a generic target covering a range of L1
15501 cache line sizes, typically the constructive interference size will be
15502 the small end of the range and the destructive size will be the large
15503 end.
15504
15505 The destructive interference size is intended to be used for layout,
15506 and thus has ABI impact. The default value is not expected to be
15507 stable, and on some targets varies with @option{-mtune}, so use of
15508 this variable in a context where ABI stability is important, such as
15509 the public interface of a library, is strongly discouraged; if it is
15510 used in that context, users can stabilize the value using this
15511 option.
15512
15513 The constructive interference size is less sensitive, as it is
15514 typically only used in a @samp{static_assert} to make sure that a type
15515 fits within a cache line.
15516
15517 See also @option{-Winterference-size}.
15518
15519 @item loop-interchange-max-num-stmts
15520 The maximum number of stmts in a loop to be interchanged.
15521
15522 @item loop-interchange-stride-ratio
15523 The minimum ratio between stride of two loops for interchange to be profitable.
15524
15525 @item min-insn-to-prefetch-ratio
15526 The minimum ratio between the number of instructions and the
15527 number of prefetches to enable prefetching in a loop.
15528
15529 @item prefetch-min-insn-to-mem-ratio
15530 The minimum ratio between the number of instructions and the
15531 number of memory references to enable prefetching in a loop.
15532
15533 @item use-canonical-types
15534 Whether the compiler should use the ``canonical'' type system.
15535 Should always be 1, which uses a more efficient internal
15536 mechanism for comparing types in C++ and Objective-C++. However, if
15537 bugs in the canonical type system are causing compilation failures,
15538 set this value to 0 to disable canonical types.
15539
15540 @item switch-conversion-max-branch-ratio
15541 Switch initialization conversion refuses to create arrays that are
15542 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15543 branches in the switch.
15544
15545 @item max-partial-antic-length
15546 Maximum length of the partial antic set computed during the tree
15547 partial redundancy elimination optimization (@option{-ftree-pre}) when
15548 optimizing at @option{-O3} and above. For some sorts of source code
15549 the enhanced partial redundancy elimination optimization can run away,
15550 consuming all of the memory available on the host machine. This
15551 parameter sets a limit on the length of the sets that are computed,
15552 which prevents the runaway behavior. Setting a value of 0 for
15553 this parameter allows an unlimited set length.
15554
15555 @item rpo-vn-max-loop-depth
15556 Maximum loop depth that is value-numbered optimistically.
15557 When the limit hits the innermost
15558 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15559 loop nest are value-numbered optimistically and the remaining ones not.
15560
15561 @item sccvn-max-alias-queries-per-access
15562 Maximum number of alias-oracle queries we perform when looking for
15563 redundancies for loads and stores. If this limit is hit the search
15564 is aborted and the load or store is not considered redundant. The
15565 number of queries is algorithmically limited to the number of
15566 stores on all paths from the load to the function entry.
15567
15568 @item ira-max-loops-num
15569 IRA uses regional register allocation by default. If a function
15570 contains more loops than the number given by this parameter, only at most
15571 the given number of the most frequently-executed loops form regions
15572 for regional register allocation.
15573
15574 @item ira-max-conflict-table-size
15575 Although IRA uses a sophisticated algorithm to compress the conflict
15576 table, the table can still require excessive amounts of memory for
15577 huge functions. If the conflict table for a function could be more
15578 than the size in MB given by this parameter, the register allocator
15579 instead uses a faster, simpler, and lower-quality
15580 algorithm that does not require building a pseudo-register conflict table.
15581
15582 @item ira-loop-reserved-regs
15583 IRA can be used to evaluate more accurate register pressure in loops
15584 for decisions to move loop invariants (see @option{-O3}). The number
15585 of available registers reserved for some other purposes is given
15586 by this parameter. Default of the parameter
15587 is the best found from numerous experiments.
15588
15589 @item ira-consider-dup-in-all-alts
15590 Make IRA to consider matching constraint (duplicated operand number)
15591 heavily in all available alternatives for preferred register class.
15592 If it is set as zero, it means IRA only respects the matching
15593 constraint when it's in the only available alternative with an
15594 appropriate register class. Otherwise, it means IRA will check all
15595 available alternatives for preferred register class even if it has
15596 found some choice with an appropriate register class and respect the
15597 found qualified matching constraint.
15598
15599 @item ira-simple-lra-insn-threshold
15600 Approximate function insn number in 1K units triggering simple local RA.
15601
15602 @item lra-inheritance-ebb-probability-cutoff
15603 LRA tries to reuse values reloaded in registers in subsequent insns.
15604 This optimization is called inheritance. EBB is used as a region to
15605 do this optimization. The parameter defines a minimal fall-through
15606 edge probability in percentage used to add BB to inheritance EBB in
15607 LRA. The default value was chosen
15608 from numerous runs of SPEC2000 on x86-64.
15609
15610 @item loop-invariant-max-bbs-in-loop
15611 Loop invariant motion can be very expensive, both in compilation time and
15612 in amount of needed compile-time memory, with very large loops. Loops
15613 with more basic blocks than this parameter won't have loop invariant
15614 motion optimization performed on them.
15615
15616 @item loop-max-datarefs-for-datadeps
15617 Building data dependencies is expensive for very large loops. This
15618 parameter limits the number of data references in loops that are
15619 considered for data dependence analysis. These large loops are no
15620 handled by the optimizations using loop data dependencies.
15621
15622 @item max-vartrack-size
15623 Sets a maximum number of hash table slots to use during variable
15624 tracking dataflow analysis of any function. If this limit is exceeded
15625 with variable tracking at assignments enabled, analysis for that
15626 function is retried without it, after removing all debug insns from
15627 the function. If the limit is exceeded even without debug insns, var
15628 tracking analysis is completely disabled for the function. Setting
15629 the parameter to zero makes it unlimited.
15630
15631 @item max-vartrack-expr-depth
15632 Sets a maximum number of recursion levels when attempting to map
15633 variable names or debug temporaries to value expressions. This trades
15634 compilation time for more complete debug information. If this is set too
15635 low, value expressions that are available and could be represented in
15636 debug information may end up not being used; setting this higher may
15637 enable the compiler to find more complex debug expressions, but compile
15638 time and memory use may grow.
15639
15640 @item max-debug-marker-count
15641 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15642 markers) to avoid complexity explosion at inlining or expanding to RTL.
15643 If a function has more such gimple stmts than the set limit, such stmts
15644 will be dropped from the inlined copy of a function, and from its RTL
15645 expansion.
15646
15647 @item min-nondebug-insn-uid
15648 Use uids starting at this parameter for nondebug insns. The range below
15649 the parameter is reserved exclusively for debug insns created by
15650 @option{-fvar-tracking-assignments}, but debug insns may get
15651 (non-overlapping) uids above it if the reserved range is exhausted.
15652
15653 @item ipa-sra-deref-prob-threshold
15654 IPA-SRA replaces a pointer which is known not be NULL with one or more
15655 new parameters only when the probability (in percent, relative to
15656 function entry) of it being dereferenced is higher than this parameter.
15657
15658 @item ipa-sra-ptr-growth-factor
15659 IPA-SRA replaces a pointer to an aggregate with one or more new
15660 parameters only when their cumulative size is less or equal to
15661 @option{ipa-sra-ptr-growth-factor} times the size of the original
15662 pointer parameter.
15663
15664 @item ipa-sra-ptrwrap-growth-factor
15665 Additional maximum allowed growth of total size of new parameters
15666 that ipa-sra replaces a pointer to an aggregate with,
15667 if it points to a local variable that the caller only writes to and
15668 passes it as an argument to other functions.
15669
15670 @item ipa-sra-max-replacements
15671 Maximum pieces of an aggregate that IPA-SRA tracks. As a
15672 consequence, it is also the maximum number of replacements of a formal
15673 parameter.
15674
15675 @item sra-max-scalarization-size-Ospeed
15676 @itemx sra-max-scalarization-size-Osize
15677 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15678 replace scalar parts of aggregates with uses of independent scalar
15679 variables. These parameters control the maximum size, in storage units,
15680 of aggregate which is considered for replacement when compiling for
15681 speed
15682 (@option{sra-max-scalarization-size-Ospeed}) or size
15683 (@option{sra-max-scalarization-size-Osize}) respectively.
15684
15685 @item sra-max-propagations
15686 The maximum number of artificial accesses that Scalar Replacement of
15687 Aggregates (SRA) will track, per one local variable, in order to
15688 facilitate copy propagation.
15689
15690 @item tm-max-aggregate-size
15691 When making copies of thread-local variables in a transaction, this
15692 parameter specifies the size in bytes after which variables are
15693 saved with the logging functions as opposed to save/restore code
15694 sequence pairs. This option only applies when using
15695 @option{-fgnu-tm}.
15696
15697 @item graphite-max-nb-scop-params
15698 To avoid exponential effects in the Graphite loop transforms, the
15699 number of parameters in a Static Control Part (SCoP) is bounded.
15700 A value of zero can be used to lift
15701 the bound. A variable whose value is unknown at compilation time and
15702 defined outside a SCoP is a parameter of the SCoP.
15703
15704 @item loop-block-tile-size
15705 Loop blocking or strip mining transforms, enabled with
15706 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15707 loop in the loop nest by a given number of iterations. The strip
15708 length can be changed using the @option{loop-block-tile-size}
15709 parameter.
15710
15711 @item ipa-jump-function-lookups
15712 Specifies number of statements visited during jump function offset discovery.
15713
15714 @item ipa-cp-value-list-size
15715 IPA-CP attempts to track all possible values and types passed to a function's
15716 parameter in order to propagate them and perform devirtualization.
15717 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15718 stores per one formal parameter of a function.
15719
15720 @item ipa-cp-eval-threshold
15721 IPA-CP calculates its own score of cloning profitability heuristics
15722 and performs those cloning opportunities with scores that exceed
15723 @option{ipa-cp-eval-threshold}.
15724
15725 @item ipa-cp-max-recursive-depth
15726 Maximum depth of recursive cloning for self-recursive function.
15727
15728 @item ipa-cp-min-recursive-probability
15729 Recursive cloning only when the probability of call being executed exceeds
15730 the parameter.
15731
15732 @item ipa-cp-profile-count-base
15733 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15734 execution count of a call graph edge at this percentage position in their
15735 histogram as the basis for its heuristics calculation.
15736
15737 @item ipa-cp-recursive-freq-factor
15738 The number of times interprocedural copy propagation expects recursive
15739 functions to call themselves.
15740
15741 @item ipa-cp-recursion-penalty
15742 Percentage penalty the recursive functions will receive when they
15743 are evaluated for cloning.
15744
15745 @item ipa-cp-single-call-penalty
15746 Percentage penalty functions containing a single call to another
15747 function will receive when they are evaluated for cloning.
15748
15749 @item ipa-max-agg-items
15750 IPA-CP is also capable to propagate a number of scalar values passed
15751 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15752 number of such values per one parameter.
15753
15754 @item ipa-cp-loop-hint-bonus
15755 When IPA-CP determines that a cloning candidate would make the number
15756 of iterations of a loop known, it adds a bonus of
15757 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15758 the candidate.
15759
15760 @item ipa-max-loop-predicates
15761 The maximum number of different predicates IPA will use to describe when
15762 loops in a function have known properties.
15763
15764 @item ipa-max-aa-steps
15765 During its analysis of function bodies, IPA-CP employs alias analysis
15766 in order to track values pointed to by function parameters. In order
15767 not spend too much time analyzing huge functions, it gives up and
15768 consider all memory clobbered after examining
15769 @option{ipa-max-aa-steps} statements modifying memory.
15770
15771 @item ipa-max-switch-predicate-bounds
15772 Maximal number of boundary endpoints of case ranges of switch statement.
15773 For switch exceeding this limit, IPA-CP will not construct cloning cost
15774 predicate, which is used to estimate cloning benefit, for default case
15775 of the switch statement.
15776
15777 @item ipa-max-param-expr-ops
15778 IPA-CP will analyze conditional statement that references some function
15779 parameter to estimate benefit for cloning upon certain constant value.
15780 But if number of operations in a parameter expression exceeds
15781 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
15782 one, and is not handled by IPA analysis.
15783
15784 @item lto-partitions
15785 Specify desired number of partitions produced during WHOPR compilation.
15786 The number of partitions should exceed the number of CPUs used for compilation.
15787
15788 @item lto-min-partition
15789 Size of minimal partition for WHOPR (in estimated instructions).
15790 This prevents expenses of splitting very small programs into too many
15791 partitions.
15792
15793 @item lto-max-partition
15794 Size of max partition for WHOPR (in estimated instructions).
15795 to provide an upper bound for individual size of partition.
15796 Meant to be used only with balanced partitioning.
15797
15798 @item lto-max-streaming-parallelism
15799 Maximal number of parallel processes used for LTO streaming.
15800
15801 @item cxx-max-namespaces-for-diagnostic-help
15802 The maximum number of namespaces to consult for suggestions when C++
15803 name lookup fails for an identifier.
15804
15805 @item sink-frequency-threshold
15806 The maximum relative execution frequency (in percents) of the target block
15807 relative to a statement's original block to allow statement sinking of a
15808 statement. Larger numbers result in more aggressive statement sinking.
15809 A small positive adjustment is applied for
15810 statements with memory operands as those are even more profitable so sink.
15811
15812 @item max-stores-to-sink
15813 The maximum number of conditional store pairs that can be sunk. Set to 0
15814 if either vectorization (@option{-ftree-vectorize}) or if-conversion
15815 (@option{-ftree-loop-if-convert}) is disabled.
15816
15817 @item case-values-threshold
15818 The smallest number of different values for which it is best to use a
15819 jump-table instead of a tree of conditional branches. If the value is
15820 0, use the default for the machine.
15821
15822 @item jump-table-max-growth-ratio-for-size
15823 The maximum code size growth ratio when expanding
15824 into a jump table (in percent). The parameter is used when
15825 optimizing for size.
15826
15827 @item jump-table-max-growth-ratio-for-speed
15828 The maximum code size growth ratio when expanding
15829 into a jump table (in percent). The parameter is used when
15830 optimizing for speed.
15831
15832 @item tree-reassoc-width
15833 Set the maximum number of instructions executed in parallel in
15834 reassociated tree. This parameter overrides target dependent
15835 heuristics used by default if has non zero value.
15836
15837 @item sched-pressure-algorithm
15838 Choose between the two available implementations of
15839 @option{-fsched-pressure}. Algorithm 1 is the original implementation
15840 and is the more likely to prevent instructions from being reordered.
15841 Algorithm 2 was designed to be a compromise between the relatively
15842 conservative approach taken by algorithm 1 and the rather aggressive
15843 approach taken by the default scheduler. It relies more heavily on
15844 having a regular register file and accurate register pressure classes.
15845 See @file{haifa-sched.cc} in the GCC sources for more details.
15846
15847 The default choice depends on the target.
15848
15849 @item max-slsr-cand-scan
15850 Set the maximum number of existing candidates that are considered when
15851 seeking a basis for a new straight-line strength reduction candidate.
15852
15853 @item asan-globals
15854 Enable buffer overflow detection for global objects. This kind
15855 of protection is enabled by default if you are using
15856 @option{-fsanitize=address} option.
15857 To disable global objects protection use @option{--param asan-globals=0}.
15858
15859 @item asan-stack
15860 Enable buffer overflow detection for stack objects. This kind of
15861 protection is enabled by default when using @option{-fsanitize=address}.
15862 To disable stack protection use @option{--param asan-stack=0} option.
15863
15864 @item asan-instrument-reads
15865 Enable buffer overflow detection for memory reads. This kind of
15866 protection is enabled by default when using @option{-fsanitize=address}.
15867 To disable memory reads protection use
15868 @option{--param asan-instrument-reads=0}.
15869
15870 @item asan-instrument-writes
15871 Enable buffer overflow detection for memory writes. This kind of
15872 protection is enabled by default when using @option{-fsanitize=address}.
15873 To disable memory writes protection use
15874 @option{--param asan-instrument-writes=0} option.
15875
15876 @item asan-memintrin
15877 Enable detection for built-in functions. This kind of protection
15878 is enabled by default when using @option{-fsanitize=address}.
15879 To disable built-in functions protection use
15880 @option{--param asan-memintrin=0}.
15881
15882 @item asan-use-after-return
15883 Enable detection of use-after-return. This kind of protection
15884 is enabled by default when using the @option{-fsanitize=address} option.
15885 To disable it use @option{--param asan-use-after-return=0}.
15886
15887 Note: By default the check is disabled at run time. To enable it,
15888 add @code{detect_stack_use_after_return=1} to the environment variable
15889 @env{ASAN_OPTIONS}.
15890
15891 @item asan-instrumentation-with-call-threshold
15892 If number of memory accesses in function being instrumented
15893 is greater or equal to this number, use callbacks instead of inline checks.
15894 E.g. to disable inline code use
15895 @option{--param asan-instrumentation-with-call-threshold=0}.
15896
15897 @item asan-kernel-mem-intrinsic-prefix
15898 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
15899 with @samp{__asan_} or @samp{__hwasan_}
15900 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
15901 respectively.
15902
15903 @item hwasan-instrument-stack
15904 Enable hwasan instrumentation of statically sized stack-allocated variables.
15905 This kind of instrumentation is enabled by default when using
15906 @option{-fsanitize=hwaddress} and disabled by default when using
15907 @option{-fsanitize=kernel-hwaddress}.
15908 To disable stack instrumentation use
15909 @option{--param hwasan-instrument-stack=0}, and to enable it use
15910 @option{--param hwasan-instrument-stack=1}.
15911
15912 @item hwasan-random-frame-tag
15913 When using stack instrumentation, decide tags for stack variables using a
15914 deterministic sequence beginning at a random tag for each frame. With this
15915 parameter unset tags are chosen using the same sequence but beginning from 1.
15916 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
15917 for @option{-fsanitize=kernel-hwaddress}.
15918 To disable it use @option{--param hwasan-random-frame-tag=0}.
15919
15920 @item hwasan-instrument-allocas
15921 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
15922 This kind of instrumentation is enabled by default when using
15923 @option{-fsanitize=hwaddress} and disabled by default when using
15924 @option{-fsanitize=kernel-hwaddress}.
15925 To disable instrumentation of such variables use
15926 @option{--param hwasan-instrument-allocas=0}, and to enable it use
15927 @option{--param hwasan-instrument-allocas=1}.
15928
15929 @item hwasan-instrument-reads
15930 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
15931 default for both @option{-fsanitize=hwaddress} and
15932 @option{-fsanitize=kernel-hwaddress}.
15933 To disable checking memory reads use
15934 @option{--param hwasan-instrument-reads=0}.
15935
15936 @item hwasan-instrument-writes
15937 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
15938 default for both @option{-fsanitize=hwaddress} and
15939 @option{-fsanitize=kernel-hwaddress}.
15940 To disable checking memory writes use
15941 @option{--param hwasan-instrument-writes=0}.
15942
15943 @item hwasan-instrument-mem-intrinsics
15944 Enable hwasan instrumentation of builtin functions. Instrumentation of these
15945 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
15946 and @option{-fsanitize=kernel-hwaddress}.
15947 To disable instrumentation of builtin functions use
15948 @option{--param hwasan-instrument-mem-intrinsics=0}.
15949
15950 @item use-after-scope-direct-emission-threshold
15951 If the size of a local variable in bytes is smaller or equal to this
15952 number, directly poison (or unpoison) shadow memory instead of using
15953 run-time callbacks.
15954
15955 @item tsan-distinguish-volatile
15956 Emit special instrumentation for accesses to volatiles.
15957
15958 @item tsan-instrument-func-entry-exit
15959 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
15960
15961 @item max-fsm-thread-path-insns
15962 Maximum number of instructions to copy when duplicating blocks on a
15963 finite state automaton jump thread path.
15964
15965 @item threader-debug
15966 threader-debug=[none|all] Enables verbose dumping of the threader solver.
15967
15968 @item parloops-chunk-size
15969 Chunk size of omp schedule for loops parallelized by parloops.
15970
15971 @item parloops-schedule
15972 Schedule type of omp schedule for loops parallelized by parloops (static,
15973 dynamic, guided, auto, runtime).
15974
15975 @item parloops-min-per-thread
15976 The minimum number of iterations per thread of an innermost parallelized
15977 loop for which the parallelized variant is preferred over the single threaded
15978 one. Note that for a parallelized loop nest the
15979 minimum number of iterations of the outermost loop per thread is two.
15980
15981 @item max-ssa-name-query-depth
15982 Maximum depth of recursion when querying properties of SSA names in things
15983 like fold routines. One level of recursion corresponds to following a
15984 use-def chain.
15985
15986 @item max-speculative-devirt-maydefs
15987 The maximum number of may-defs we analyze when looking for a must-def
15988 specifying the dynamic type of an object that invokes a virtual call
15989 we may be able to devirtualize speculatively.
15990
15991 @item ranger-debug
15992 Specifies the type of debug output to be issued for ranges.
15993
15994 @item unroll-jam-min-percent
15995 The minimum percentage of memory references that must be optimized
15996 away for the unroll-and-jam transformation to be considered profitable.
15997
15998 @item unroll-jam-max-unroll
15999 The maximum number of times the outer loop should be unrolled by
16000 the unroll-and-jam transformation.
16001
16002 @item max-rtl-if-conversion-unpredictable-cost
16003 Maximum permissible cost for the sequence that would be generated
16004 by the RTL if-conversion pass for a branch that is considered unpredictable.
16005
16006 @item max-variable-expansions-in-unroller
16007 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16008 of times that an individual variable will be expanded during loop unrolling.
16009
16010 @item partial-inlining-entry-probability
16011 Maximum probability of the entry BB of split region
16012 (in percent relative to entry BB of the function)
16013 to make partial inlining happen.
16014
16015 @item max-tracked-strlens
16016 Maximum number of strings for which strlen optimization pass will
16017 track string lengths.
16018
16019 @item gcse-after-reload-partial-fraction
16020 The threshold ratio for performing partial redundancy
16021 elimination after reload.
16022
16023 @item gcse-after-reload-critical-fraction
16024 The threshold ratio of critical edges execution count that
16025 permit performing redundancy elimination after reload.
16026
16027 @item max-loop-header-insns
16028 The maximum number of insns in loop header duplicated
16029 by the copy loop headers pass.
16030
16031 @item vect-epilogues-nomask
16032 Enable loop epilogue vectorization using smaller vector size.
16033
16034 @item vect-partial-vector-usage
16035 Controls when the loop vectorizer considers using partial vector loads
16036 and stores as an alternative to falling back to scalar code. 0 stops
16037 the vectorizer from ever using partial vector loads and stores. 1 allows
16038 partial vector loads and stores if vectorization removes the need for the
16039 code to iterate. 2 allows partial vector loads and stores in all loops.
16040 The parameter only has an effect on targets that support partial
16041 vector loads and stores.
16042
16043 @item vect-inner-loop-cost-factor
16044 The maximum factor which the loop vectorizer applies to the cost of statements
16045 in an inner loop relative to the loop being vectorized. The factor applied
16046 is the maximum of the estimated number of iterations of the inner loop and
16047 this parameter. The default value of this parameter is 50.
16048
16049 @item vect-induction-float
16050 Enable loop vectorization of floating point inductions.
16051
16052 @item vrp-sparse-threshold
16053 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16054
16055 @item vrp-switch-limit
16056 Maximum number of outgoing edges in a switch before VRP will not process it.
16057
16058 @item vrp-vector-threshold
16059 Maximum number of basic blocks for VRP to use a basic cache vector.
16060
16061 @item avoid-fma-max-bits
16062 Maximum number of bits for which we avoid creating FMAs.
16063
16064 @item sms-loop-average-count-threshold
16065 A threshold on the average loop count considered by the swing modulo scheduler.
16066
16067 @item sms-dfa-history
16068 The number of cycles the swing modulo scheduler considers when checking
16069 conflicts using DFA.
16070
16071 @item graphite-allow-codegen-errors
16072 Whether codegen errors should be ICEs when @option{-fchecking}.
16073
16074 @item sms-max-ii-factor
16075 A factor for tuning the upper bound that swing modulo scheduler
16076 uses for scheduling a loop.
16077
16078 @item lra-max-considered-reload-pseudos
16079 The max number of reload pseudos which are considered during
16080 spilling a non-reload pseudo.
16081
16082 @item max-pow-sqrt-depth
16083 Maximum depth of sqrt chains to use when synthesizing exponentiation
16084 by a real constant.
16085
16086 @item max-dse-active-local-stores
16087 Maximum number of active local stores in RTL dead store elimination.
16088
16089 @item asan-instrument-allocas
16090 Enable asan allocas/VLAs protection.
16091
16092 @item max-iterations-computation-cost
16093 Bound on the cost of an expression to compute the number of iterations.
16094
16095 @item max-isl-operations
16096 Maximum number of isl operations, 0 means unlimited.
16097
16098 @item graphite-max-arrays-per-scop
16099 Maximum number of arrays per scop.
16100
16101 @item max-vartrack-reverse-op-size
16102 Max. size of loc list for which reverse ops should be added.
16103
16104 @item fsm-scale-path-stmts
16105 Scale factor to apply to the number of statements in a threading path
16106 crossing a loop backedge when comparing to
16107 @option{--param=max-jump-thread-duplication-stmts}.
16108
16109 @item uninit-control-dep-attempts
16110 Maximum number of nested calls to search for control dependencies
16111 during uninitialized variable analysis.
16112
16113 @item sched-autopref-queue-depth
16114 Hardware autoprefetcher scheduler model control flag.
16115 Number of lookahead cycles the model looks into; at '
16116 ' only enable instruction sorting heuristic.
16117
16118 @item loop-versioning-max-inner-insns
16119 The maximum number of instructions that an inner loop can have
16120 before the loop versioning pass considers it too big to copy.
16121
16122 @item loop-versioning-max-outer-insns
16123 The maximum number of instructions that an outer loop can have
16124 before the loop versioning pass considers it too big to copy,
16125 discounting any instructions in inner loops that directly benefit
16126 from versioning.
16127
16128 @item ssa-name-def-chain-limit
16129 The maximum number of SSA_NAME assignments to follow in determining
16130 a property of a variable such as its value. This limits the number
16131 of iterations or recursive calls GCC performs when optimizing certain
16132 statements or when determining their validity prior to issuing
16133 diagnostics.
16134
16135 @item store-merging-max-size
16136 Maximum size of a single store merging region in bytes.
16137
16138 @item hash-table-verification-limit
16139 The number of elements for which hash table verification is done
16140 for each searched element.
16141
16142 @item max-find-base-term-values
16143 Maximum number of VALUEs handled during a single find_base_term call.
16144
16145 @item analyzer-max-enodes-per-program-point
16146 The maximum number of exploded nodes per program point within
16147 the analyzer, before terminating analysis of that point.
16148
16149 @item analyzer-max-constraints
16150 The maximum number of constraints per state.
16151
16152 @item analyzer-min-snodes-for-call-summary
16153 The minimum number of supernodes within a function for the
16154 analyzer to consider summarizing its effects at call sites.
16155
16156 @item analyzer-max-enodes-for-full-dump
16157 The maximum depth of exploded nodes that should appear in a dot dump
16158 before switching to a less verbose format.
16159
16160 @item analyzer-max-recursion-depth
16161 The maximum number of times a callsite can appear in a call stack
16162 within the analyzer, before terminating analysis of a call that would
16163 recurse deeper.
16164
16165 @item analyzer-max-svalue-depth
16166 The maximum depth of a symbolic value, before approximating
16167 the value as unknown.
16168
16169 @item analyzer-max-infeasible-edges
16170 The maximum number of infeasible edges to reject before declaring
16171 a diagnostic as infeasible.
16172
16173 @item gimple-fe-computed-hot-bb-threshold
16174 The number of executions of a basic block which is considered hot.
16175 The parameter is used only in GIMPLE FE.
16176
16177 @item analyzer-bb-explosion-factor
16178 The maximum number of 'after supernode' exploded nodes within the analyzer
16179 per supernode, before terminating analysis.
16180
16181 @item ranger-logical-depth
16182 Maximum depth of logical expression evaluation ranger will look through
16183 when evaluating outgoing edge ranges.
16184
16185 @item ranger-recompute-depth
16186 Maximum depth of instruction chains to consider for recomputation
16187 in the outgoing range calculator.
16188
16189 @item relation-block-limit
16190 Maximum number of relations the oracle will register in a basic block.
16191
16192 @item min-pagesize
16193 Minimum page size for warning purposes.
16194
16195 @item openacc-kernels
16196 Specify mode of OpenACC `kernels' constructs handling.
16197 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16198 constructs are decomposed into parts, a sequence of compute
16199 constructs, each then handled individually.
16200 This is work in progress.
16201 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16202 constructs are handled by the @samp{parloops} pass, en bloc.
16203 This is the current default.
16204
16205 @item openacc-privatization
16206 Control whether the @option{-fopt-info-omp-note} and applicable
16207 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16208 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16209 This is the current default.
16210 With @option{--param=openacc-privatization=noisy}, do diagnose.
16211
16212 @end table
16213
16214 The following choices of @var{name} are available on AArch64 targets:
16215
16216 @table @gcctabopt
16217 @item aarch64-sve-compare-costs
16218 When vectorizing for SVE, consider using ``unpacked'' vectors for
16219 smaller elements and use the cost model to pick the cheapest approach.
16220 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16221
16222 Using unpacked vectors includes storing smaller elements in larger
16223 containers and accessing elements with extending loads and truncating
16224 stores.
16225
16226 @item aarch64-float-recp-precision
16227 The number of Newton iterations for calculating the reciprocal for float type.
16228 The precision of division is proportional to this param when division
16229 approximation is enabled. The default value is 1.
16230
16231 @item aarch64-double-recp-precision
16232 The number of Newton iterations for calculating the reciprocal for double type.
16233 The precision of division is propotional to this param when division
16234 approximation is enabled. The default value is 2.
16235
16236 @item aarch64-autovec-preference
16237 Force an ISA selection strategy for auto-vectorization. Accepts values from
16238 0 to 4, inclusive.
16239 @table @samp
16240 @item 0
16241 Use the default heuristics.
16242 @item 1
16243 Use only Advanced SIMD for auto-vectorization.
16244 @item 2
16245 Use only SVE for auto-vectorization.
16246 @item 3
16247 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
16248 deemed equal.
16249 @item 4
16250 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
16251 @end table
16252 The default value is 0.
16253
16254 @item aarch64-loop-vect-issue-rate-niters
16255 The tuning for some AArch64 CPUs tries to take both latencies and issue
16256 rates into account when deciding whether a loop should be vectorized
16257 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16258 If this parameter is set to @var{n}, GCC will not use this heuristic
16259 for loops that are known to execute in fewer than @var{n} Advanced
16260 SIMD iterations.
16261
16262 @item aarch64-vect-unroll-limit
16263 The vectorizer will use available tuning information to determine whether it
16264 would be beneficial to unroll the main vectorized loop and by how much. This
16265 parameter set's the upper bound of how much the vectorizer will unroll the main
16266 loop. The default value is four.
16267
16268 @end table
16269
16270 The following choices of @var{name} are available on i386 and x86_64 targets:
16271
16272 @table @gcctabopt
16273 @item x86-stlf-window-ninsns
16274 Instructions number above which STFL stall penalty can be compensated.
16275
16276 @item x86-stv-max-visits
16277 The maximum number of use and def visits when discovering a STV chain before
16278 the discovery is aborted.
16279
16280 @end table
16281
16282 @end table
16283
16284 @node Instrumentation Options
16285 @section Program Instrumentation Options
16286 @cindex instrumentation options
16287 @cindex program instrumentation options
16288 @cindex run-time error checking options
16289 @cindex profiling options
16290 @cindex options, program instrumentation
16291 @cindex options, run-time error checking
16292 @cindex options, profiling
16293
16294 GCC supports a number of command-line options that control adding
16295 run-time instrumentation to the code it normally generates.
16296 For example, one purpose of instrumentation is collect profiling
16297 statistics for use in finding program hot spots, code coverage
16298 analysis, or profile-guided optimizations.
16299 Another class of program instrumentation is adding run-time checking
16300 to detect programming errors like invalid pointer
16301 dereferences or out-of-bounds array accesses, as well as deliberately
16302 hostile attacks such as stack smashing or C++ vtable hijacking.
16303 There is also a general hook which can be used to implement other
16304 forms of tracing or function-level instrumentation for debug or
16305 program analysis purposes.
16306
16307 @table @gcctabopt
16308 @cindex @command{prof}
16309 @cindex @command{gprof}
16310 @opindex p
16311 @opindex pg
16312 @item -p
16313 @itemx -pg
16314 Generate extra code to write profile information suitable for the
16315 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16316 (for @option{-pg}). You must use this option when compiling
16317 the source files you want data about, and you must also use it when
16318 linking.
16319
16320 You can use the function attribute @code{no_instrument_function} to
16321 suppress profiling of individual functions when compiling with these options.
16322 @xref{Common Function Attributes}.
16323
16324 @opindex fprofile-arcs
16325 @item -fprofile-arcs
16326 Add code so that program flow @dfn{arcs} are instrumented. During
16327 execution the program records how many times each branch and call is
16328 executed and how many times it is taken or returns. On targets that support
16329 constructors with priority support, profiling properly handles constructors,
16330 destructors and C++ constructors (and destructors) of classes which are used
16331 as a type of a global variable.
16332
16333 When the compiled
16334 program exits it saves this data to a file called
16335 @file{@var{auxname}.gcda} for each source file. The data may be used for
16336 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16337 test coverage analysis (@option{-ftest-coverage}). Each object file's
16338 @var{auxname} is generated from the name of the output file, if
16339 explicitly specified and it is not the final executable, otherwise it is
16340 the basename of the source file. In both cases any suffix is removed
16341 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16342 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16343
16344 Note that if a command line directly links source files, the corresponding
16345 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16346 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16347 @file{binary-b.gcda} files.
16348
16349 @xref{Cross-profiling}.
16350
16351 @cindex @command{gcov}
16352 @opindex coverage
16353 @item --coverage
16354
16355 This option is used to compile and link code instrumented for coverage
16356 analysis. The option is a synonym for @option{-fprofile-arcs}
16357 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16358 linking). See the documentation for those options for more details.
16359
16360 @itemize
16361
16362 @item
16363 Compile the source files with @option{-fprofile-arcs} plus optimization
16364 and code generation options. For test coverage analysis, use the
16365 additional @option{-ftest-coverage} option. You do not need to profile
16366 every source file in a program.
16367
16368 @item
16369 Compile the source files additionally with @option{-fprofile-abs-path}
16370 to create absolute path names in the @file{.gcno} files. This allows
16371 @command{gcov} to find the correct sources in projects where compilations
16372 occur with different working directories.
16373
16374 @item
16375 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16376 (the latter implies the former).
16377
16378 @item
16379 Run the program on a representative workload to generate the arc profile
16380 information. This may be repeated any number of times. You can run
16381 concurrent instances of your program, and provided that the file system
16382 supports locking, the data files will be correctly updated. Unless
16383 a strict ISO C dialect option is in effect, @code{fork} calls are
16384 detected and correctly handled without double counting.
16385
16386 Moreover, an object file can be recompiled multiple times
16387 and the corresponding @file{.gcda} file merges as long as
16388 the source file and the compiler options are unchanged.
16389
16390 @item
16391 For profile-directed optimizations, compile the source files again with
16392 the same optimization and code generation options plus
16393 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16394 Control Optimization}).
16395
16396 @item
16397 For test coverage analysis, use @command{gcov} to produce human readable
16398 information from the @file{.gcno} and @file{.gcda} files. Refer to the
16399 @command{gcov} documentation for further information.
16400
16401 @end itemize
16402
16403 With @option{-fprofile-arcs}, for each function of your program GCC
16404 creates a program flow graph, then finds a spanning tree for the graph.
16405 Only arcs that are not on the spanning tree have to be instrumented: the
16406 compiler adds code to count the number of times that these arcs are
16407 executed. When an arc is the only exit or only entrance to a block, the
16408 instrumentation code can be added to the block; otherwise, a new basic
16409 block must be created to hold the instrumentation code.
16410
16411 @need 2000
16412 @opindex ftest-coverage
16413 @item -ftest-coverage
16414 Produce a notes file that the @command{gcov} code-coverage utility
16415 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16416 show program coverage. Each source file's note file is called
16417 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
16418 above for a description of @var{auxname} and instructions on how to
16419 generate test coverage data. Coverage data matches the source files
16420 more closely if you do not optimize.
16421
16422 @opindex fprofile-abs-path
16423 @item -fprofile-abs-path
16424 Automatically convert relative source file names to absolute path names
16425 in the @file{.gcno} files. This allows @command{gcov} to find the correct
16426 sources in projects where compilations occur with different working
16427 directories.
16428
16429 @opindex fprofile-dir
16430 @item -fprofile-dir=@var{path}
16431
16432 Set the directory to search for the profile data files in to @var{path}.
16433 This option affects only the profile data generated by
16434 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16435 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16436 and its related options. Both absolute and relative paths can be used.
16437 By default, GCC uses the current directory as @var{path}, thus the
16438 profile data file appears in the same directory as the object file.
16439 In order to prevent the file name clashing, if the object file name is
16440 not an absolute path, we mangle the absolute path of the
16441 @file{@var{sourcename}.gcda} file and use it as the file name of a
16442 @file{.gcda} file. See details about the file naming in @option{-fprofile-arcs}.
16443 See similar option @option{-fprofile-note}.
16444
16445 When an executable is run in a massive parallel environment, it is recommended
16446 to save profile to different folders. That can be done with variables
16447 in @var{path} that are exported during run-time:
16448
16449 @table @gcctabopt
16450
16451 @item %p
16452 process ID.
16453
16454 @item %q@{VAR@}
16455 value of environment variable @var{VAR}
16456
16457 @end table
16458
16459 @opindex fprofile-generate
16460 @item -fprofile-generate
16461 @itemx -fprofile-generate=@var{path}
16462
16463 Enable options usually used for instrumenting application to produce
16464 profile useful for later recompilation with profile feedback based
16465 optimization. You must use @option{-fprofile-generate} both when
16466 compiling and when linking your program.
16467
16468 The following options are enabled:
16469 @option{-fprofile-arcs}, @option{-fprofile-values},
16470 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16471
16472 If @var{path} is specified, GCC looks at the @var{path} to find
16473 the profile feedback data files. See @option{-fprofile-dir}.
16474
16475 To optimize the program based on the collected profile information, use
16476 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
16477
16478 @opindex fprofile-info-section
16479 @item -fprofile-info-section
16480 @itemx -fprofile-info-section=@var{name}
16481
16482 Register the profile information in the specified section instead of using a
16483 constructor/destructor. The section name is @var{name} if it is specified,
16484 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
16485 profile information generated by @option{-fprofile-arcs} is placed in the
16486 specified section for each translation unit. This option disables the profile
16487 information registration through a constructor and it disables the profile
16488 information processing through a destructor. This option is not intended to be
16489 used in hosted environments such as GNU/Linux. It targets freestanding
16490 environments (for example embedded systems) with limited resources which do not
16491 support constructors/destructors or the C library file I/O.
16492
16493 The linker could collect the input sections in a continuous memory block and
16494 define start and end symbols. A GNU linker script example which defines a
16495 linker output section follows:
16496
16497 @smallexample
16498 .gcov_info :
16499 @{
16500 PROVIDE (__gcov_info_start = .);
16501 KEEP (*(.gcov_info))
16502 PROVIDE (__gcov_info_end = .);
16503 @}
16504 @end smallexample
16505
16506 The program could dump the profiling information registered in this linker set
16507 for example like this:
16508
16509 @smallexample
16510 #include <gcov.h>
16511 #include <stdio.h>
16512 #include <stdlib.h>
16513
16514 extern const struct gcov_info *const __gcov_info_start[];
16515 extern const struct gcov_info *const __gcov_info_end[];
16516
16517 static void
16518 dump (const void *d, unsigned n, void *arg)
16519 @{
16520 const unsigned char *c = d;
16521
16522 for (unsigned i = 0; i < n; ++i)
16523 printf ("%02x", c[i]);
16524 @}
16525
16526 static void
16527 filename (const char *f, void *arg)
16528 @{
16529 __gcov_filename_to_gcfn (f, dump, arg );
16530 @}
16531
16532 static void *
16533 allocate (unsigned length, void *arg)
16534 @{
16535 return malloc (length);
16536 @}
16537
16538 static void
16539 dump_gcov_info (void)
16540 @{
16541 const struct gcov_info *const *info = __gcov_info_start;
16542 const struct gcov_info *const *end = __gcov_info_end;
16543
16544 /* Obfuscate variable to prevent compiler optimizations. */
16545 __asm__ ("" : "+r" (info));
16546
16547 while (info != end)
16548 @{
16549 void *arg = NULL;
16550 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16551 putchar ('\n');
16552 ++info;
16553 @}
16554 @}
16555
16556 int
16557 main (void)
16558 @{
16559 dump_gcov_info ();
16560 return 0;
16561 @}
16562 @end smallexample
16563
16564 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16565 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16566 @code{__gcov_info_to_gcda} functions and merge the profile information into
16567 @file{.gcda} files on the host filesystem.
16568
16569 @opindex fprofile-note
16570 @item -fprofile-note=@var{path}
16571
16572 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16573 location. If you combine the option with multiple source files,
16574 the @file{.gcno} file will be overwritten.
16575
16576 @opindex fprofile-prefix-path
16577 @item -fprofile-prefix-path=@var{path}
16578
16579 This option can be used in combination with
16580 @option{profile-generate=}@var{profile_dir} and
16581 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16582 directory of built source tree. By default @var{profile_dir} will contain
16583 files with mangled absolute paths of all object files in the built project.
16584 This is not desirable when directory used to build the instrumented binary
16585 differs from the directory used to build the binary optimized with profile
16586 feedback because the profile data will not be found during the optimized build.
16587 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16588 pointing to the base directory of the build can be used to strip the irrelevant
16589 part of the path and keep all file names relative to the main build directory.
16590
16591 @opindex fprofile-prefix-map
16592 @item -fprofile-prefix-map=@var{old}=@var{new}
16593 When compiling files residing in directory @file{@var{old}}, record
16594 profiling information (with @option{--coverage})
16595 describing them as if the files resided in
16596 directory @file{@var{new}} instead.
16597 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
16598
16599 @opindex fprofile-update
16600 @item -fprofile-update=@var{method}
16601
16602 Alter the update method for an application instrumented for profile
16603 feedback based optimization. The @var{method} argument should be one of
16604 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16605 The first one is useful for single-threaded applications,
16606 while the second one prevents profile corruption by emitting thread-safe code.
16607
16608 @strong{Warning:} When an application does not properly join all threads
16609 (or creates an detached thread), a profile file can be still corrupted.
16610
16611 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16612 when supported by a target, or to @samp{single} otherwise. The GCC driver
16613 automatically selects @samp{prefer-atomic} when @option{-pthread}
16614 is present in the command line.
16615
16616 @opindex fprofile-filter-files
16617 @item -fprofile-filter-files=@var{regex}
16618
16619 Instrument only functions from files whose name matches
16620 any of the regular expressions (separated by semi-colons).
16621
16622 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16623 only @file{main.c} and all C files starting with 'module'.
16624
16625 @opindex fprofile-exclude-files
16626 @item -fprofile-exclude-files=@var{regex}
16627
16628 Instrument only functions from files whose name does not match
16629 any of the regular expressions (separated by semi-colons).
16630
16631 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16632 of all files that are located in the @file{/usr/} folder.
16633
16634 @opindex fprofile-reproducible
16635 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16636 Control level of reproducibility of profile gathered by
16637 @code{-fprofile-generate}. This makes it possible to rebuild program
16638 with same outcome which is useful, for example, for distribution
16639 packages.
16640
16641 With @option{-fprofile-reproducible=serial} the profile gathered by
16642 @option{-fprofile-generate} is reproducible provided the trained program
16643 behaves the same at each invocation of the train run, it is not
16644 multi-threaded and profile data streaming is always done in the same
16645 order. Note that profile streaming happens at the end of program run but
16646 also before @code{fork} function is invoked.
16647
16648 Note that it is quite common that execution counts of some part of
16649 programs depends, for example, on length of temporary file names or
16650 memory space randomization (that may affect hash-table collision rate).
16651 Such non-reproducible part of programs may be annotated by
16652 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16653 @option{-l} can be used to dump gathered data and verify that they are
16654 indeed reproducible.
16655
16656 With @option{-fprofile-reproducible=parallel-runs} collected profile
16657 stays reproducible regardless the order of streaming of the data into
16658 gcda files. This setting makes it possible to run multiple instances of
16659 instrumented program in parallel (such as with @code{make -j}). This
16660 reduces quality of gathered data, in particular of indirect call
16661 profiling.
16662
16663 @opindex fsanitize=address
16664 @item -fsanitize=address
16665 Enable AddressSanitizer, a fast memory error detector.
16666 Memory access instructions are instrumented to detect
16667 out-of-bounds and use-after-free bugs.
16668 The option enables @option{-fsanitize-address-use-after-scope}.
16669 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16670 more details. The run-time behavior can be influenced using the
16671 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
16672 the available options are shown at startup of the instrumented program. See
16673 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16674 for a list of supported options.
16675 The option cannot be combined with @option{-fsanitize=thread} or
16676 @option{-fsanitize=hwaddress}. Note that the only target
16677 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16678
16679 To get more accurate stack traces, it is possible to use options such as
16680 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16681 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16682 optimizing sibling and tail recursive calls; this option is implicit for
16683 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16684 disables Identical Code Folding for functions). Since multiple runs of the
16685 program may yield backtraces with different addresses due to ASLR (Address
16686 Space Layout Randomization), it may be desirable to turn ASLR off. On Linux,
16687 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16688
16689 @opindex fsanitize=kernel-address
16690 @item -fsanitize=kernel-address
16691 Enable AddressSanitizer for Linux kernel.
16692 See @uref{https://github.com/google/kernel-sanitizers} for more details.
16693
16694 @opindex fsanitize=hwaddress
16695 @item -fsanitize=hwaddress
16696 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16697 ignore the top byte of a pointer to allow the detection of memory errors with
16698 a low memory overhead.
16699 Memory access instructions are instrumented to detect out-of-bounds and
16700 use-after-free bugs.
16701 The option enables @option{-fsanitize-address-use-after-scope}.
16702 See
16703 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16704 for more details. The run-time behavior can be influenced using the
16705 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
16706 the available options are shown at startup of the instrumented program.
16707 The option cannot be combined with @option{-fsanitize=thread} or
16708 @option{-fsanitize=address}, and is currently only available on AArch64.
16709
16710 @opindex fsanitize=kernel-hwaddress
16711 @item -fsanitize=kernel-hwaddress
16712 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16713 Similar to @option{-fsanitize=kernel-address} but using an alternate
16714 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16715 instrumentation differences necessary for compiling the Linux kernel.
16716 These differences are to avoid hwasan library initialization calls and to
16717 account for the stack pointer having a different value in its top byte.
16718
16719 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16720 Instrumenting the stack and alloca calls are not on by default but are still
16721 possible by specifying the command-line options
16722 @option{--param hwasan-instrument-stack=1} and
16723 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16724 tag is not implemented for kernel instrumentation.
16725
16726 @opindex fsanitize=pointer-compare
16727 @item -fsanitize=pointer-compare
16728 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16729 The option must be combined with either @option{-fsanitize=kernel-address} or
16730 @option{-fsanitize=address}
16731 The option cannot be combined with @option{-fsanitize=thread}.
16732 Note: By default the check is disabled at run time. To enable it,
16733 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16734 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16735 invalid operation only when both pointers are non-null.
16736
16737 @opindex fsanitize=pointer-subtract
16738 @item -fsanitize=pointer-subtract
16739 Instrument subtraction with pointer operands.
16740 The option must be combined with either @option{-fsanitize=kernel-address} or
16741 @option{-fsanitize=address}
16742 The option cannot be combined with @option{-fsanitize=thread}.
16743 Note: By default the check is disabled at run time. To enable it,
16744 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16745 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16746 invalid operation only when both pointers are non-null.
16747
16748 @opindex fsanitize=shadow-call-stack
16749 @item -fsanitize=shadow-call-stack
16750 Enable ShadowCallStack, a security enhancement mechanism used to protect
16751 programs against return address overwrites (e.g. stack buffer overflows.)
16752 It works by saving a function's return address to a separately allocated
16753 shadow call stack in the function prologue and restoring the return address
16754 from the shadow call stack in the function epilogue. Instrumentation only
16755 occurs in functions that need to save the return address to the stack.
16756
16757 Currently it only supports the aarch64 platform. It is specifically
16758 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
16759 For the user space programs, runtime support is not currently provided
16760 in libc and libgcc. Users who want to use this feature in user space need
16761 to provide their own support for the runtime. It should be noted that
16762 this may cause the ABI rules to be broken.
16763
16764 On aarch64, the instrumentation makes use of the platform register @code{x18}.
16765 This generally means that any code that may run on the same thread as code
16766 compiled with ShadowCallStack must be compiled with the flag
16767 @option{-ffixed-x18}, otherwise functions compiled without
16768 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
16769 stack pointer.
16770
16771 Also, because there is no userspace runtime support, code compiled with
16772 ShadowCallStack cannot use exception handling. Use @option{-fno-exceptions}
16773 to turn off exceptions.
16774
16775 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
16776 details.
16777
16778 @opindex fsanitize=thread
16779 @item -fsanitize=thread
16780 Enable ThreadSanitizer, a fast data race detector.
16781 Memory access instructions are instrumented to detect
16782 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
16783 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
16784 environment variable; see
16785 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
16786 supported options.
16787 The option cannot be combined with @option{-fsanitize=address},
16788 @option{-fsanitize=leak}.
16789
16790 Note that sanitized atomic builtins cannot throw exceptions when
16791 operating on invalid memory addresses with non-call exceptions
16792 (@option{-fnon-call-exceptions}).
16793
16794 @opindex fsanitize=leak
16795 @item -fsanitize=leak
16796 Enable LeakSanitizer, a memory leak detector.
16797 This option only matters for linking of executables.
16798 The executable is linked against a library that overrides @code{malloc}
16799 and other allocator functions. See
16800 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
16801 details. The run-time behavior can be influenced using the
16802 @env{LSAN_OPTIONS} environment variable.
16803 The option cannot be combined with @option{-fsanitize=thread}.
16804
16805 @opindex fsanitize=undefined
16806 @item -fsanitize=undefined
16807 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
16808 Various computations are instrumented to detect undefined behavior
16809 at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the
16810 @env{UBSAN_OPTIONS} environment variable. Current suboptions are:
16811
16812 @table @gcctabopt
16813
16814 @opindex fsanitize=shift
16815 @item -fsanitize=shift
16816 This option enables checking that the result of a shift operation is
16817 not undefined. Note that what exactly is considered undefined differs
16818 slightly between C and C++, as well as between ISO C90 and C99, etc.
16819 This option has two suboptions, @option{-fsanitize=shift-base} and
16820 @option{-fsanitize=shift-exponent}.
16821
16822 @opindex fsanitize=shift-exponent
16823 @item -fsanitize=shift-exponent
16824 This option enables checking that the second argument of a shift operation
16825 is not negative and is smaller than the precision of the promoted first
16826 argument.
16827
16828 @opindex fsanitize=shift-base
16829 @item -fsanitize=shift-base
16830 If the second argument of a shift operation is within range, check that the
16831 result of a shift operation is not undefined. Note that what exactly is
16832 considered undefined differs slightly between C and C++, as well as between
16833 ISO C90 and C99, etc.
16834
16835 @opindex fsanitize=integer-divide-by-zero
16836 @item -fsanitize=integer-divide-by-zero
16837 Detect integer division by zero.
16838
16839 @opindex fsanitize=unreachable
16840 @item -fsanitize=unreachable
16841 With this option, the compiler turns the @code{__builtin_unreachable}
16842 call into a diagnostics message call instead. When reaching the
16843 @code{__builtin_unreachable} call, the behavior is undefined.
16844
16845 @opindex fsanitize=vla-bound
16846 @item -fsanitize=vla-bound
16847 This option instructs the compiler to check that the size of a variable
16848 length array is positive.
16849
16850 @opindex fsanitize=null
16851 @item -fsanitize=null
16852 This option enables pointer checking. Particularly, the application
16853 built with this option turned on will issue an error message when it
16854 tries to dereference a NULL pointer, or if a reference (possibly an
16855 rvalue reference) is bound to a NULL pointer, or if a method is invoked
16856 on an object pointed by a NULL pointer.
16857
16858 @opindex fsanitize=return
16859 @item -fsanitize=return
16860 This option enables return statement checking. Programs
16861 built with this option turned on will issue an error message
16862 when the end of a non-void function is reached without actually
16863 returning a value. This option works in C++ only.
16864
16865 @opindex fsanitize=signed-integer-overflow
16866 @item -fsanitize=signed-integer-overflow
16867 This option enables signed integer overflow checking. We check that
16868 the result of @code{+}, @code{*}, and both unary and binary @code{-}
16869 does not overflow in the signed arithmetics. This also detects
16870 @code{INT_MIN / -1} signed division. Note, integer promotion
16871 rules must be taken into account. That is, the following is not an
16872 overflow:
16873 @smallexample
16874 signed char a = SCHAR_MAX;
16875 a++;
16876 @end smallexample
16877
16878 @opindex fsanitize=bounds
16879 @item -fsanitize=bounds
16880 This option enables instrumentation of array bounds. Various out of bounds
16881 accesses are detected. Flexible array members, flexible array member-like
16882 arrays, and initializers of variables with static storage are not
16883 instrumented, with the exception of flexible array member-like arrays
16884 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
16885 options or @code{strict_flex_array} attributes say they shouldn't be treated
16886 like flexible array member-like arrays.
16887
16888 @opindex fsanitize=bounds-strict
16889 @item -fsanitize=bounds-strict
16890 This option enables strict instrumentation of array bounds. Most out of bounds
16891 accesses are detected, including flexible array member-like arrays.
16892 Initializers of variables with static storage are not instrumented.
16893
16894 @opindex fsanitize=alignment
16895 @item -fsanitize=alignment
16896
16897 This option enables checking of alignment of pointers when they are
16898 dereferenced, or when a reference is bound to insufficiently aligned target,
16899 or when a method or constructor is invoked on insufficiently aligned object.
16900
16901 @opindex fsanitize=object-size
16902 @item -fsanitize=object-size
16903 This option enables instrumentation of memory references using the
16904 @code{__builtin_dynamic_object_size} function. Various out of bounds
16905 pointer accesses are detected.
16906
16907 @opindex fsanitize=float-divide-by-zero
16908 @item -fsanitize=float-divide-by-zero
16909 Detect floating-point division by zero. Unlike other similar options,
16910 @option{-fsanitize=float-divide-by-zero} is not enabled by
16911 @option{-fsanitize=undefined}, since floating-point division by zero can
16912 be a legitimate way of obtaining infinities and NaNs.
16913
16914 @opindex fsanitize=float-cast-overflow
16915 @item -fsanitize=float-cast-overflow
16916 This option enables floating-point type to integer conversion checking.
16917 We check that the result of the conversion does not overflow.
16918 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
16919 not enabled by @option{-fsanitize=undefined}.
16920 This option does not work well with @code{FE_INVALID} exceptions enabled.
16921
16922 @opindex fsanitize=nonnull-attribute
16923 @item -fsanitize=nonnull-attribute
16924
16925 This option enables instrumentation of calls, checking whether null values
16926 are not passed to arguments marked as requiring a non-null value by the
16927 @code{nonnull} function attribute.
16928
16929 @opindex fsanitize=returns-nonnull-attribute
16930 @item -fsanitize=returns-nonnull-attribute
16931
16932 This option enables instrumentation of return statements in functions
16933 marked with @code{returns_nonnull} function attribute, to detect returning
16934 of null values from such functions.
16935
16936 @opindex fsanitize=bool
16937 @item -fsanitize=bool
16938
16939 This option enables instrumentation of loads from bool. If a value other
16940 than 0/1 is loaded, a run-time error is issued.
16941
16942 @opindex fsanitize=enum
16943 @item -fsanitize=enum
16944
16945 This option enables instrumentation of loads from an enum type. If
16946 a value outside the range of values for the enum type is loaded,
16947 a run-time error is issued.
16948
16949 @opindex fsanitize=vptr
16950 @item -fsanitize=vptr
16951
16952 This option enables instrumentation of C++ member function calls, member
16953 accesses and some conversions between pointers to base and derived classes,
16954 to verify the referenced object has the correct dynamic type.
16955
16956 @opindex fsanitize=pointer-overflow
16957 @item -fsanitize=pointer-overflow
16958
16959 This option enables instrumentation of pointer arithmetics. If the pointer
16960 arithmetics overflows, a run-time error is issued.
16961
16962 @opindex fsanitize=builtin
16963 @item -fsanitize=builtin
16964
16965 This option enables instrumentation of arguments to selected builtin
16966 functions. If an invalid value is passed to such arguments, a run-time
16967 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
16968 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
16969 by this option.
16970
16971 @end table
16972
16973 Note that sanitizers tend to increase the rate of false positive
16974 warnings, most notably those around @option{-Wmaybe-uninitialized}.
16975 We recommend against combining @option{-Werror} and [the use of]
16976 sanitizers.
16977
16978 While @option{-ftrapv} causes traps for signed overflows to be emitted,
16979 @option{-fsanitize=undefined} gives a diagnostic message.
16980 This currently works only for the C family of languages.
16981
16982 @opindex fno-sanitize=all
16983 @item -fno-sanitize=all
16984
16985 This option disables all previously enabled sanitizers.
16986 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
16987 together.
16988
16989 @opindex fasan-shadow-offset
16990 @item -fasan-shadow-offset=@var{number}
16991 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
16992 It is useful for experimenting with different shadow memory layouts in
16993 Kernel AddressSanitizer.
16994
16995 @opindex fsanitize-sections
16996 @item -fsanitize-sections=@var{s1},@var{s2},...
16997 Sanitize global variables in selected user-defined sections. @var{si} may
16998 contain wildcards.
16999
17000 @opindex fsanitize-recover
17001 @opindex fno-sanitize-recover
17002 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17003 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17004 mentioned in comma-separated list of @var{opts}. Enabling this option
17005 for a sanitizer component causes it to attempt to continue
17006 running the program as if no error happened. This means multiple
17007 runtime errors can be reported in a single program run, and the exit
17008 code of the program may indicate success even when errors
17009 have been reported. The @option{-fno-sanitize-recover=} option
17010 can be used to alter
17011 this behavior: only the first detected error is reported
17012 and program then exits with a non-zero exit code.
17013
17014 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17015 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17016 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17017 @option{-fsanitize=bounds-strict},
17018 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17019 For these sanitizers error recovery is turned on by default,
17020 except @option{-fsanitize=address}, for which this feature is experimental.
17021 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17022 accepted, the former enables recovery for all sanitizers that support it,
17023 the latter disables recovery for all sanitizers that support it.
17024
17025 Even if a recovery mode is turned on the compiler side, it needs to be also
17026 enabled on the runtime library side, otherwise the failures are still fatal.
17027 The runtime library defaults to @code{halt_on_error=0} for
17028 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17029 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17030 setting the @code{halt_on_error} flag in the corresponding environment variable.
17031
17032 Syntax without an explicit @var{opts} parameter is deprecated. It is
17033 equivalent to specifying an @var{opts} list of:
17034
17035 @smallexample
17036 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17037 @end smallexample
17038
17039 @opindex fsanitize-address-use-after-scope
17040 @item -fsanitize-address-use-after-scope
17041 Enable sanitization of local variables to detect use-after-scope bugs.
17042 The option sets @option{-fstack-reuse} to @samp{none}.
17043
17044 @opindex fsanitize-trap
17045 @opindex fno-sanitize-trap
17046 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17047 The @option{-fsanitize-trap=} option instructs the compiler to
17048 report for sanitizers mentioned in comma-separated list of @var{opts}
17049 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17050 library routine. If this option is enabled for certain sanitizer,
17051 it takes precedence over the @option{-fsanitizer-recover=} for that
17052 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17053 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17054
17055 The advantage of this is that the @code{libubsan} library is not needed
17056 and is not linked in, so this is usable even in freestanding environments.
17057
17058 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17059 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17060 @option{-fsanitize=float-divide-by-zero} and
17061 @option{-fsanitize=bounds-strict}. @code{-fsanitize-trap=all} can be also
17062 specified, which enables it for @code{undefined} suboptions,
17063 @option{-fsanitize=float-cast-overflow},
17064 @option{-fsanitize=float-divide-by-zero} and
17065 @option{-fsanitize=bounds-strict}.
17066 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17067 and @code{-fsanitize=vptr} is enabled on the command line, the
17068 instrumentation is silently ignored as the instrumentation always needs
17069 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17070
17071 @opindex fsanitize-undefined-trap-on-error
17072 @item -fsanitize-undefined-trap-on-error
17073 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17074 equivalent of @option{-fsanitize-trap=all}.
17075
17076 @opindex fsanitize-coverage=trace-pc
17077 @item -fsanitize-coverage=trace-pc
17078 Enable coverage-guided fuzzing code instrumentation.
17079 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17080
17081 @opindex fsanitize-coverage=trace-cmp
17082 @item -fsanitize-coverage=trace-cmp
17083 Enable dataflow guided fuzzing code instrumentation.
17084 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17085 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17086 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17087 variable or @code{__sanitizer_cov_trace_const_cmp1},
17088 @code{__sanitizer_cov_trace_const_cmp2},
17089 @code{__sanitizer_cov_trace_const_cmp4} or
17090 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17091 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17092 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17093 @code{__sanitizer_cov_trace_switch} for switch statements.
17094
17095 @opindex fcf-protection
17096 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17097 Enable code instrumentation of control-flow transfers to increase
17098 program security by checking that target addresses of control-flow
17099 transfer instructions (such as indirect function call, function return,
17100 indirect jump) are valid. This prevents diverting the flow of control
17101 to an unexpected target. This is intended to protect against such
17102 threats as Return-oriented Programming (ROP), and similarly
17103 call/jmp-oriented programming (COP/JOP).
17104
17105 The value @code{branch} tells the compiler to implement checking of
17106 validity of control-flow transfer at the point of indirect branch
17107 instructions, i.e.@: call/jmp instructions. The value @code{return}
17108 implements checking of validity at the point of returning from a
17109 function. The value @code{full} is an alias for specifying both
17110 @code{branch} and @code{return}. The value @code{none} turns off
17111 instrumentation.
17112
17113 The value @code{check} is used for the final link with link-time
17114 optimization (LTO). An error is issued if LTO object files are
17115 compiled with different @option{-fcf-protection} values. The
17116 value @code{check} is ignored at the compile time.
17117
17118 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17119 used. The first bit of @code{__CET__} is set to 1 for the value
17120 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17121 the @code{return}.
17122
17123 You can also use the @code{nocf_check} attribute to identify
17124 which functions and calls should be skipped from instrumentation
17125 (@pxref{Function Attributes}).
17126
17127 Currently the x86 GNU/Linux target provides an implementation based
17128 on Intel Control-flow Enforcement Technology (CET) which works for
17129 i686 processor or newer.
17130
17131 @opindex fharden-compares
17132 @item -fharden-compares
17133 For every logical test that survives gimple optimizations and is
17134 @emph{not} the condition in a conditional branch (for example,
17135 conditions tested for conditional moves, or to store in boolean
17136 variables), emit extra code to compute and verify the reversed
17137 condition, and to call @code{__builtin_trap} if the results do not
17138 match. Use with @samp{-fharden-conditional-branches} to cover all
17139 conditionals.
17140
17141 @opindex fharden-conditional-branches
17142 @item -fharden-conditional-branches
17143 For every non-vectorized conditional branch that survives gimple
17144 optimizations, emit extra code to compute and verify the reversed
17145 condition, and to call @code{__builtin_trap} if the result is
17146 unexpected. Use with @samp{-fharden-compares} to cover all
17147 conditionals.
17148
17149 @opindex fstack-protector
17150 @item -fstack-protector
17151 Emit extra code to check for buffer overflows, such as stack smashing
17152 attacks. This is done by adding a guard variable to functions with
17153 vulnerable objects. This includes functions that call @code{alloca}, and
17154 functions with buffers larger than or equal to 8 bytes. The guards are
17155 initialized when a function is entered and then checked when the function
17156 exits. If a guard check fails, an error message is printed and the program
17157 exits. Only variables that are actually allocated on the stack are
17158 considered, optimized away variables or variables allocated in registers
17159 don't count.
17160
17161 @opindex fstack-protector-all
17162 @item -fstack-protector-all
17163 Like @option{-fstack-protector} except that all functions are protected.
17164
17165 @opindex fstack-protector-strong
17166 @item -fstack-protector-strong
17167 Like @option{-fstack-protector} but includes additional functions to
17168 be protected --- those that have local array definitions, or have
17169 references to local frame addresses. Only variables that are actually
17170 allocated on the stack are considered, optimized away variables or variables
17171 allocated in registers don't count.
17172
17173 @opindex fstack-protector-explicit
17174 @item -fstack-protector-explicit
17175 Like @option{-fstack-protector} but only protects those functions which
17176 have the @code{stack_protect} attribute.
17177
17178 @opindex fstack-check
17179 @item -fstack-check
17180 Generate code to verify that you do not go beyond the boundary of the
17181 stack. You should specify this flag if you are running in an
17182 environment with multiple threads, but you only rarely need to specify it in
17183 a single-threaded environment since stack overflow is automatically
17184 detected on nearly all systems if there is only one stack.
17185
17186 Note that this switch does not actually cause checking to be done; the
17187 operating system or the language runtime must do that. The switch causes
17188 generation of code to ensure that they see the stack being extended.
17189
17190 You can additionally specify a string parameter: @samp{no} means no
17191 checking, @samp{generic} means force the use of old-style checking,
17192 @samp{specific} means use the best checking method and is equivalent
17193 to bare @option{-fstack-check}.
17194
17195 Old-style checking is a generic mechanism that requires no specific
17196 target support in the compiler but comes with the following drawbacks:
17197
17198 @enumerate
17199 @item
17200 Modified allocation strategy for large objects: they are always
17201 allocated dynamically if their size exceeds a fixed threshold. Note this
17202 may change the semantics of some code.
17203
17204 @item
17205 Fixed limit on the size of the static frame of functions: when it is
17206 topped by a particular function, stack checking is not reliable and
17207 a warning is issued by the compiler.
17208
17209 @item
17210 Inefficiency: because of both the modified allocation strategy and the
17211 generic implementation, code performance is hampered.
17212 @end enumerate
17213
17214 Note that old-style stack checking is also the fallback method for
17215 @samp{specific} if no target support has been added in the compiler.
17216
17217 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17218 and stack overflows. @samp{specific} is an excellent choice when compiling
17219 Ada code. It is not generally sufficient to protect against stack-clash
17220 attacks. To protect against those you want @samp{-fstack-clash-protection}.
17221
17222 @opindex fstack-clash-protection
17223 @item -fstack-clash-protection
17224 Generate code to prevent stack clash style attacks. When this option is
17225 enabled, the compiler will only allocate one page of stack space at a time
17226 and each page is accessed immediately after allocation. Thus, it prevents
17227 allocations from jumping over any stack guard page provided by the
17228 operating system.
17229
17230 Most targets do not fully support stack clash protection. However, on
17231 those targets @option{-fstack-clash-protection} will protect dynamic stack
17232 allocations. @option{-fstack-clash-protection} may also provide limited
17233 protection for static stack allocations if the target supports
17234 @option{-fstack-check=specific}.
17235
17236 @opindex fstack-limit-register
17237 @opindex fstack-limit-symbol
17238 @opindex fno-stack-limit
17239 @item -fstack-limit-register=@var{reg}
17240 @itemx -fstack-limit-symbol=@var{sym}
17241 @itemx -fno-stack-limit
17242 Generate code to ensure that the stack does not grow beyond a certain value,
17243 either the value of a register or the address of a symbol. If a larger
17244 stack is required, a signal is raised at run time. For most targets,
17245 the signal is raised before the stack overruns the boundary, so
17246 it is possible to catch the signal without taking special precautions.
17247
17248 For instance, if the stack starts at absolute address @samp{0x80000000}
17249 and grows downwards, you can use the flags
17250 @option{-fstack-limit-symbol=__stack_limit} and
17251 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17252 of 128KB@. Note that this may only work with the GNU linker.
17253
17254 You can locally override stack limit checking by using the
17255 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17256
17257 @opindex fsplit-stack
17258 @item -fsplit-stack
17259 Generate code to automatically split the stack before it overflows.
17260 The resulting program has a discontiguous stack which can only
17261 overflow if the program is unable to allocate any more memory. This
17262 is most useful when running threaded programs, as it is no longer
17263 necessary to calculate a good stack size to use for each thread. This
17264 is currently only implemented for the x86 targets running
17265 GNU/Linux.
17266
17267 When code compiled with @option{-fsplit-stack} calls code compiled
17268 without @option{-fsplit-stack}, there may not be much stack space
17269 available for the latter code to run. If compiling all code,
17270 including library code, with @option{-fsplit-stack} is not an option,
17271 then the linker can fix up these calls so that the code compiled
17272 without @option{-fsplit-stack} always has a large stack. Support for
17273 this is implemented in the gold linker in GNU binutils release 2.21
17274 and later.
17275
17276 @opindex fvtable-verify
17277 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17278 This option is only available when compiling C++ code.
17279 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17280 feature that verifies at run time, for every virtual call, that
17281 the vtable pointer through which the call is made is valid for the type of
17282 the object, and has not been corrupted or overwritten. If an invalid vtable
17283 pointer is detected at run time, an error is reported and execution of the
17284 program is immediately halted.
17285
17286 This option causes run-time data structures to be built at program startup,
17287 which are used for verifying the vtable pointers.
17288 The options @samp{std} and @samp{preinit}
17289 control the timing of when these data structures are built. In both cases the
17290 data structures are built before execution reaches @code{main}. Using
17291 @option{-fvtable-verify=std} causes the data structures to be built after
17292 shared libraries have been loaded and initialized.
17293 @option{-fvtable-verify=preinit} causes them to be built before shared
17294 libraries have been loaded and initialized.
17295
17296 If this option appears multiple times in the command line with different
17297 values specified, @samp{none} takes highest priority over both @samp{std} and
17298 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17299
17300 @opindex fvtv-debug
17301 @item -fvtv-debug
17302 When used in conjunction with @option{-fvtable-verify=std} or
17303 @option{-fvtable-verify=preinit}, causes debug versions of the
17304 runtime functions for the vtable verification feature to be called.
17305 This flag also causes the compiler to log information about which
17306 vtable pointers it finds for each class.
17307 This information is written to a file named @file{vtv_set_ptr_data.log}
17308 in the directory named by the environment variable @env{VTV_LOGS_DIR}
17309 if that is defined or the current working directory otherwise.
17310
17311 Note: This feature @emph{appends} data to the log file. If you want a fresh log
17312 file, be sure to delete any existing one.
17313
17314 @opindex fvtv-counts
17315 @item -fvtv-counts
17316 This is a debugging flag. When used in conjunction with
17317 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17318 causes the compiler to keep track of the total number of virtual calls
17319 it encounters and the number of verifications it inserts. It also
17320 counts the number of calls to certain run-time library functions
17321 that it inserts and logs this information for each compilation unit.
17322 The compiler writes this information to a file named
17323 @file{vtv_count_data.log} in the directory named by the environment
17324 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17325 directory otherwise. It also counts the size of the vtable pointer sets
17326 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17327 in the same directory.
17328
17329 Note: This feature @emph{appends} data to the log files. To get fresh log
17330 files, be sure to delete any existing ones.
17331
17332 @opindex finstrument-functions
17333 @item -finstrument-functions
17334 Generate instrumentation calls for entry and exit to functions. Just
17335 after function entry and just before function exit, the following
17336 profiling functions are called with the address of the current
17337 function and its call site. (On some platforms,
17338 @code{__builtin_return_address} does not work beyond the current
17339 function, so the call site information may not be available to the
17340 profiling functions otherwise.)
17341
17342 @smallexample
17343 void __cyg_profile_func_enter (void *this_fn,
17344 void *call_site);
17345 void __cyg_profile_func_exit (void *this_fn,
17346 void *call_site);
17347 @end smallexample
17348
17349 The first argument is the address of the start of the current function,
17350 which may be looked up exactly in the symbol table.
17351
17352 This instrumentation is also done for functions expanded inline in other
17353 functions. The profiling calls indicate where, conceptually, the
17354 inline function is entered and exited. This means that addressable
17355 versions of such functions must be available. If all your uses of a
17356 function are expanded inline, this may mean an additional expansion of
17357 code size. If you use @code{extern inline} in your C code, an
17358 addressable version of such functions must be provided. (This is
17359 normally the case anyway, but if you get lucky and the optimizer always
17360 expands the functions inline, you might have gotten away without
17361 providing static copies.)
17362
17363 A function may be given the attribute @code{no_instrument_function}, in
17364 which case this instrumentation is not done. This can be used, for
17365 example, for the profiling functions listed above, high-priority
17366 interrupt routines, and any functions from which the profiling functions
17367 cannot safely be called (perhaps signal handlers, if the profiling
17368 routines generate output or allocate memory).
17369 @xref{Common Function Attributes}.
17370
17371 @opindex finstrument-functions-once
17372 @item -finstrument-functions-once
17373 This is similar to @option{-finstrument-functions}, but the profiling
17374 functions are called only once per instrumented function, i.e. the first
17375 profiling function is called after the first entry into the instrumented
17376 function and the second profiling function is called before the exit
17377 corresponding to this first entry.
17378
17379 The definition of @code{once} for the purpose of this option is a little
17380 vague because the implementation is not protected against data races.
17381 As a result, the implementation only guarantees that the profiling
17382 functions are called at @emph{least} once per process and at @emph{most}
17383 once per thread, but the calls are always paired, that is to say, if a
17384 thread calls the first function, then it will call the second function,
17385 unless it never reaches the exit of the instrumented function.
17386
17387 @opindex finstrument-functions-exclude-file-list
17388 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17389
17390 Set the list of functions that are excluded from instrumentation (see
17391 the description of @option{-finstrument-functions}). If the file that
17392 contains a function definition matches with one of @var{file}, then
17393 that function is not instrumented. The match is done on substrings:
17394 if the @var{file} parameter is a substring of the file name, it is
17395 considered to be a match.
17396
17397 For example:
17398
17399 @smallexample
17400 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17401 @end smallexample
17402
17403 @noindent
17404 excludes any inline function defined in files whose pathnames
17405 contain @file{/bits/stl} or @file{include/sys}.
17406
17407 If, for some reason, you want to include letter @samp{,} in one of
17408 @var{sym}, write @samp{\,}. For example,
17409 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17410 (note the single quote surrounding the option).
17411
17412 @opindex finstrument-functions-exclude-function-list
17413 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17414
17415 This is similar to @option{-finstrument-functions-exclude-file-list},
17416 but this option sets the list of function names to be excluded from
17417 instrumentation. The function name to be matched is its user-visible
17418 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17419 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
17420 match is done on substrings: if the @var{sym} parameter is a substring
17421 of the function name, it is considered to be a match. For C99 and C++
17422 extended identifiers, the function name must be given in UTF-8, not
17423 using universal character names.
17424
17425 @opindex fpatchable-function-entry
17426 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17427 Generate @var{N} NOPs right at the beginning
17428 of each function, with the function entry point before the @var{M}th NOP.
17429 If @var{M} is omitted, it defaults to @code{0} so the
17430 function entry points to the address just at the first NOP.
17431 The NOP instructions reserve extra space which can be used to patch in
17432 any desired instrumentation at run time, provided that the code segment
17433 is writable. The amount of space is controllable indirectly via
17434 the number of NOPs; the NOP instruction used corresponds to the instruction
17435 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
17436 is target-specific and may also depend on the architecture variant and/or
17437 other compilation options.
17438
17439 For run-time identification, the starting addresses of these areas,
17440 which correspond to their respective function entries minus @var{M},
17441 are additionally collected in the @code{__patchable_function_entries}
17442 section of the resulting binary.
17443
17444 Note that the value of @code{__attribute__ ((patchable_function_entry
17445 (N,M)))} takes precedence over command-line option
17446 @option{-fpatchable-function-entry=N,M}. This can be used to increase
17447 the area size or to remove it completely on a single function.
17448 If @code{N=0}, no pad location is recorded.
17449
17450 The NOP instructions are inserted at---and maybe before, depending on
17451 @var{M}---the function entry address, even before the prologue. On
17452 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17453 the local entry point is this function entry address.
17454
17455 The maximum value of @var{N} and @var{M} is 65535. On PowerPC with the
17456 ELFv2 ABI, for a function with dual entry points, the supported values
17457 for @var{M} are 0, 2, 6 and 14.
17458 @end table
17459
17460
17461 @node Preprocessor Options
17462 @section Options Controlling the Preprocessor
17463 @cindex preprocessor options
17464 @cindex options, preprocessor
17465
17466 These options control the C preprocessor, which is run on each C source
17467 file before actual compilation.
17468
17469 If you use the @option{-E} option, nothing is done except preprocessing.
17470 Some of these options make sense only together with @option{-E} because
17471 they cause the preprocessor output to be unsuitable for actual
17472 compilation.
17473
17474 In addition to the options listed here, there are a number of options
17475 to control search paths for include files documented in
17476 @ref{Directory Options}.
17477 Options to control preprocessor diagnostics are listed in
17478 @ref{Warning Options}.
17479
17480 @table @gcctabopt
17481 @include cppopts.texi
17482
17483 @opindex Wp
17484 @item -Wp,@var{option}
17485 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17486 and pass @var{option} directly through to the preprocessor. If
17487 @var{option} contains commas, it is split into multiple options at the
17488 commas. However, many options are modified, translated or interpreted
17489 by the compiler driver before being passed to the preprocessor, and
17490 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
17491 interface is undocumented and subject to change, so whenever possible
17492 you should avoid using @option{-Wp} and let the driver handle the
17493 options instead.
17494
17495 @opindex Xpreprocessor
17496 @item -Xpreprocessor @var{option}
17497 Pass @var{option} as an option to the preprocessor. You can use this to
17498 supply system-specific preprocessor options that GCC does not
17499 recognize.
17500
17501 If you want to pass an option that takes an argument, you must use
17502 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17503
17504 @opindex no-integrated-cpp
17505 @item -no-integrated-cpp
17506 Perform preprocessing as a separate pass before compilation.
17507 By default, GCC performs preprocessing as an integrated part of
17508 input tokenization and parsing.
17509 If this option is provided, the appropriate language front end
17510 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17511 and Objective-C, respectively) is instead invoked twice,
17512 once for preprocessing only and once for actual compilation
17513 of the preprocessed input.
17514 This option may be useful in conjunction with the @option{-B} or
17515 @option{-wrapper} options to specify an alternate preprocessor or
17516 perform additional processing of the program source between
17517 normal preprocessing and compilation.
17518
17519 @opindex flarge-source-files
17520 @item -flarge-source-files
17521 Adjust GCC to expect large source files, at the expense of slower
17522 compilation and higher memory usage.
17523
17524 Specifically, GCC normally tracks both column numbers and line numbers
17525 within source files and it normally prints both of these numbers in
17526 diagnostics. However, once it has processed a certain number of source
17527 lines, it stops tracking column numbers and only tracks line numbers.
17528 This means that diagnostics for later lines do not include column numbers.
17529 It also means that options like @option{-Wmisleading-indentation} cease to work
17530 at that point, although the compiler prints a note if this happens.
17531 Passing @option{-flarge-source-files} significantly increases the number
17532 of source lines that GCC can process before it stops tracking columns.
17533
17534 @end table
17535
17536 @node Assembler Options
17537 @section Passing Options to the Assembler
17538
17539 @c prevent bad page break with this line
17540 You can pass options to the assembler.
17541
17542 @table @gcctabopt
17543 @opindex Wa
17544 @item -Wa,@var{option}
17545 Pass @var{option} as an option to the assembler. If @var{option}
17546 contains commas, it is split into multiple options at the commas.
17547
17548 @opindex Xassembler
17549 @item -Xassembler @var{option}
17550 Pass @var{option} as an option to the assembler. You can use this to
17551 supply system-specific assembler options that GCC does not
17552 recognize.
17553
17554 If you want to pass an option that takes an argument, you must use
17555 @option{-Xassembler} twice, once for the option and once for the argument.
17556
17557 @end table
17558
17559 @node Link Options
17560 @section Options for Linking
17561 @cindex link options
17562 @cindex options, linking
17563
17564 These options come into play when the compiler links object files into
17565 an executable output file. They are meaningless if the compiler is
17566 not doing a link step.
17567
17568 @table @gcctabopt
17569 @cindex file names
17570 @item @var{object-file-name}
17571 A file name that does not end in a special recognized suffix is
17572 considered to name an object file or library. (Object files are
17573 distinguished from libraries by the linker according to the file
17574 contents.) If linking is done, these object files are used as input
17575 to the linker.
17576
17577 @opindex c
17578 @opindex S
17579 @opindex E
17580 @item -c
17581 @itemx -S
17582 @itemx -E
17583 If any of these options is used, then the linker is not run, and
17584 object file names should not be used as arguments. @xref{Overall
17585 Options}.
17586
17587 @opindex flinker-output
17588 @item -flinker-output=@var{type}
17589 This option controls code generation of the link-time optimizer. By
17590 default the linker output is automatically determined by the linker
17591 plugin. For debugging the compiler and if incremental linking with a
17592 non-LTO object file is desired, it may be useful to control the type
17593 manually.
17594
17595 If @var{type} is @samp{exec}, code generation produces a static
17596 binary. In this case @option{-fpic} and @option{-fpie} are both
17597 disabled.
17598
17599 If @var{type} is @samp{dyn}, code generation produces a shared
17600 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
17601 but not enabled automatically. This allows to build shared libraries
17602 without position-independent code on architectures where this is
17603 possible, i.e.@: on x86.
17604
17605 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17606 executable. This results in similar optimizations as @samp{exec}
17607 except that @option{-fpie} is not disabled if specified at compilation
17608 time.
17609
17610 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17611 done. The sections containing intermediate code for link-time optimization are
17612 merged, pre-optimized, and output to the resulting object file. In addition, if
17613 @option{-ffat-lto-objects} is specified, binary code is produced for future
17614 non-LTO linking. The object file produced by incremental linking is smaller
17615 than a static library produced from the same object files. At link time the
17616 result of incremental linking also loads faster than a static
17617 library assuming that the majority of objects in the library are used.
17618
17619 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17620 code generation is forced, a final binary is produced, and the intermediate
17621 code for later link-time optimization is stripped. When multiple object files
17622 are linked together the resulting code is better optimized than with
17623 link-time optimizations disabled (for example, cross-module inlining
17624 happens), but most of benefits of whole program optimizations are lost.
17625
17626 During the incremental link (by @option{-r}) the linker plugin defaults to
17627 @option{rel}. With current interfaces to GNU Binutils it is however not
17628 possible to incrementally link LTO objects and non-LTO objects into a single
17629 mixed object file. If any of object files in incremental link cannot
17630 be used for link-time optimization, the linker plugin issues a warning and
17631 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17632 recommended to link such objects into static library instead. Alternatively it
17633 is possible to use H.J. Lu's binutils with support for mixed objects.
17634
17635 @opindex fuse-ld=bfd
17636 @item -fuse-ld=bfd
17637 Use the @command{bfd} linker instead of the default linker.
17638
17639 @opindex fuse-ld=gold
17640 @item -fuse-ld=gold
17641 Use the @command{gold} linker instead of the default linker.
17642
17643 @opindex fuse-ld=lld
17644 @item -fuse-ld=lld
17645 Use the LLVM @command{lld} linker instead of the default linker.
17646
17647 @opindex fuse-ld=mold
17648 @item -fuse-ld=mold
17649 Use the Modern Linker (@command{mold}) instead of the default linker.
17650
17651 @cindex Libraries
17652 @opindex l
17653 @item -l@var{library}
17654 @itemx -l @var{library}
17655 Search the library named @var{library} when linking. (The second
17656 alternative with the library as a separate argument is only for
17657 POSIX compliance and is not recommended.)
17658
17659 The @option{-l} option is passed directly to the linker by GCC. Refer
17660 to your linker documentation for exact details. The general
17661 description below applies to the GNU linker.
17662
17663 The linker searches a standard list of directories for the library.
17664 The directories searched include several standard system directories
17665 plus any that you specify with @option{-L}.
17666
17667 Static libraries are archives of object files, and have file names
17668 like @file{lib@var{library}.a}. Some targets also support shared
17669 libraries, which typically have names like @file{lib@var{library}.so}.
17670 If both static and shared libraries are found, the linker gives
17671 preference to linking with the shared library unless the
17672 @option{-static} option is used.
17673
17674 It makes a difference where in the command you write this option; the
17675 linker searches and processes libraries and object files in the order they
17676 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17677 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
17678 to functions in @samp{z}, those functions may not be loaded.
17679
17680 @opindex lobjc
17681 @item -lobjc
17682 You need this special case of the @option{-l} option in order to
17683 link an Objective-C or Objective-C++ program.
17684
17685 @opindex nostartfiles
17686 @item -nostartfiles
17687 Do not use the standard system startup files when linking.
17688 The standard system libraries are used normally, unless @option{-nostdlib},
17689 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17690
17691 @opindex nodefaultlibs
17692 @item -nodefaultlibs
17693 Do not use the standard system libraries when linking.
17694 Only the libraries you specify are passed to the linker, and options
17695 specifying linkage of the system libraries, such as @option{-static-libgcc}
17696 or @option{-shared-libgcc}, are ignored.
17697 The standard startup files are used normally, unless @option{-nostartfiles}
17698 is used.
17699
17700 The compiler may generate calls to @code{memcmp},
17701 @code{memset}, @code{memcpy} and @code{memmove}.
17702 These entries are usually resolved by entries in
17703 libc. These entry points should be supplied through some other
17704 mechanism when this option is specified.
17705
17706 @opindex nolibc
17707 @item -nolibc
17708 Do not use the C library or system libraries tightly coupled with it when
17709 linking. Still link with the startup files, @file{libgcc} or toolchain
17710 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17711 or @file{libstdc++} unless options preventing their inclusion are used as
17712 well. This typically removes @option{-lc} from the link command line, as well
17713 as system libraries that normally go with it and become meaningless when
17714 absence of a C library is assumed, for example @option{-lpthread} or
17715 @option{-lm} in some configurations. This is intended for bare-board
17716 targets when there is indeed no C library available.
17717
17718 @opindex nostdlib
17719 @item -nostdlib
17720 Do not use the standard system startup files or libraries when linking.
17721 No startup files and only the libraries you specify are passed to
17722 the linker, and options specifying linkage of the system libraries, such as
17723 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17724
17725 The compiler may generate calls to @code{memcmp}, @code{memset},
17726 @code{memcpy} and @code{memmove}.
17727 These entries are usually resolved by entries in
17728 libc. These entry points should be supplied through some other
17729 mechanism when this option is specified.
17730
17731 @cindex @option{-lgcc}, use with @option{-nostdlib}
17732 @cindex @option{-nostdlib} and unresolved references
17733 @cindex unresolved references and @option{-nostdlib}
17734 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17735 @cindex @option{-nodefaultlibs} and unresolved references
17736 @cindex unresolved references and @option{-nodefaultlibs}
17737 One of the standard libraries bypassed by @option{-nostdlib} and
17738 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17739 which GCC uses to overcome shortcomings of particular machines, or special
17740 needs for some languages.
17741 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17742 Collection (GCC) Internals},
17743 for more discussion of @file{libgcc.a}.)
17744 In most cases, you need @file{libgcc.a} even when you want to avoid
17745 other standard libraries. In other words, when you specify @option{-nostdlib}
17746 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17747 This ensures that you have no unresolved references to internal GCC
17748 library subroutines.
17749 (An example of such an internal subroutine is @code{__main}, used to ensure C++
17750 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
17751 GNU Compiler Collection (GCC) Internals}.)
17752
17753 @opindex nostdlib++
17754 @item -nostdlib++
17755 Do not implicitly link with standard C++ libraries.
17756
17757 @opindex e
17758 @opindex entry
17759 @item -e @var{entry}
17760 @itemx --entry=@var{entry}
17761
17762 Specify that the program entry point is @var{entry}. The argument is
17763 interpreted by the linker; the GNU linker accepts either a symbol name
17764 or an address.
17765
17766 @opindex pie
17767 @item -pie
17768 Produce a dynamically linked position independent executable on targets
17769 that support it. For predictable results, you must also specify the same
17770 set of options used for compilation (@option{-fpie}, @option{-fPIE},
17771 or model suboptions) when you specify this linker option.
17772
17773 @opindex no-pie
17774 @item -no-pie
17775 Don't produce a dynamically linked position independent executable.
17776
17777 @opindex static-pie
17778 @item -static-pie
17779 Produce a static position independent executable on targets that support
17780 it. A static position independent executable is similar to a static
17781 executable, but can be loaded at any address without a dynamic linker.
17782 For predictable results, you must also specify the same set of options
17783 used for compilation (@option{-fpie}, @option{-fPIE}, or model
17784 suboptions) when you specify this linker option.
17785
17786 @opindex pthread
17787 @item -pthread
17788 Link with the POSIX threads library. This option is supported on
17789 GNU/Linux targets, most other Unix derivatives, and also on
17790 x86 Cygwin and MinGW targets. On some targets this option also sets
17791 flags for the preprocessor, so it should be used consistently for both
17792 compilation and linking.
17793
17794 @opindex r
17795 @item -r
17796 Produce a relocatable object as output. This is also known as partial
17797 linking.
17798
17799 @opindex rdynamic
17800 @item -rdynamic
17801 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
17802 that support it. This instructs the linker to add all symbols, not
17803 only used ones, to the dynamic symbol table. This option is needed
17804 for some uses of @code{dlopen} or to allow obtaining backtraces
17805 from within a program.
17806
17807 @opindex s
17808 @item -s
17809 Remove all symbol table and relocation information from the executable.
17810
17811 @opindex static
17812 @item -static
17813 On systems that support dynamic linking, this overrides @option{-pie}
17814 and prevents linking with the shared libraries. On other systems, this
17815 option has no effect.
17816
17817 @opindex shared
17818 @item -shared
17819 Produce a shared object which can then be linked with other objects to
17820 form an executable. Not all systems support this option. For predictable
17821 results, you must also specify the same set of options used for compilation
17822 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
17823 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
17824 needs to build supplementary stub code for constructors to work. On
17825 multi-libbed systems, @samp{gcc -shared} must select the correct support
17826 libraries to link against. Failing to supply the correct flags may lead
17827 to subtle defects. Supplying them in cases where they are not necessary
17828 is innocuous. @option{-shared} suppresses the addition of startup code
17829 to alter the floating-point environment as done with @option{-ffast-math},
17830 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
17831
17832 @opindex shared-libgcc
17833 @opindex static-libgcc
17834 @item -shared-libgcc
17835 @itemx -static-libgcc
17836 On systems that provide @file{libgcc} as a shared library, these options
17837 force the use of either the shared or static version, respectively.
17838 If no shared version of @file{libgcc} was built when the compiler was
17839 configured, these options have no effect.
17840
17841 There are several situations in which an application should use the
17842 shared @file{libgcc} instead of the static version. The most common
17843 of these is when the application wishes to throw and catch exceptions
17844 across different shared libraries. In that case, each of the libraries
17845 as well as the application itself should use the shared @file{libgcc}.
17846
17847 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
17848 whenever you build a shared library or a main executable, because C++
17849 programs typically use exceptions, so this is the right thing to do.
17850
17851 If, instead, you use the GCC driver to create shared libraries, you may
17852 find that they are not always linked with the shared @file{libgcc}.
17853 If GCC finds, at its configuration time, that you have a non-GNU linker
17854 or a GNU linker that does not support option @option{--eh-frame-hdr},
17855 it links the shared version of @file{libgcc} into shared libraries
17856 by default. Otherwise, it takes advantage of the linker and optimizes
17857 away the linking with the shared version of @file{libgcc}, linking with
17858 the static version of libgcc by default. This allows exceptions to
17859 propagate through such shared libraries, without incurring relocation
17860 costs at library load time.
17861
17862 However, if a library or main executable is supposed to throw or catch
17863 exceptions, you must link it using the G++ driver, or using the option
17864 @option{-shared-libgcc}, such that it is linked with the shared
17865 @file{libgcc}.
17866
17867 @opindex static-libasan
17868 @item -static-libasan
17869 When the @option{-fsanitize=address} option is used to link a program,
17870 the GCC driver automatically links against @option{libasan}. If
17871 @file{libasan} is available as a shared library, and the @option{-static}
17872 option is not used, then this links against the shared version of
17873 @file{libasan}. The @option{-static-libasan} option directs the GCC
17874 driver to link @file{libasan} statically, without necessarily linking
17875 other libraries statically.
17876
17877 @opindex static-libtsan
17878 @item -static-libtsan
17879 When the @option{-fsanitize=thread} option is used to link a program,
17880 the GCC driver automatically links against @option{libtsan}. If
17881 @file{libtsan} is available as a shared library, and the @option{-static}
17882 option is not used, then this links against the shared version of
17883 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
17884 driver to link @file{libtsan} statically, without necessarily linking
17885 other libraries statically.
17886
17887 @opindex static-liblsan
17888 @item -static-liblsan
17889 When the @option{-fsanitize=leak} option is used to link a program,
17890 the GCC driver automatically links against @option{liblsan}. If
17891 @file{liblsan} is available as a shared library, and the @option{-static}
17892 option is not used, then this links against the shared version of
17893 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
17894 driver to link @file{liblsan} statically, without necessarily linking
17895 other libraries statically.
17896
17897 @opindex static-libubsan
17898 @item -static-libubsan
17899 When the @option{-fsanitize=undefined} option is used to link a program,
17900 the GCC driver automatically links against @option{libubsan}. If
17901 @file{libubsan} is available as a shared library, and the @option{-static}
17902 option is not used, then this links against the shared version of
17903 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
17904 driver to link @file{libubsan} statically, without necessarily linking
17905 other libraries statically.
17906
17907 @opindex static-libstdc++
17908 @item -static-libstdc++
17909 When the @command{g++} program is used to link a C++ program, it
17910 normally automatically links against @option{libstdc++}. If
17911 @file{libstdc++} is available as a shared library, and the
17912 @option{-static} option is not used, then this links against the
17913 shared version of @file{libstdc++}. That is normally fine. However, it
17914 is sometimes useful to freeze the version of @file{libstdc++} used by
17915 the program without going all the way to a fully static link. The
17916 @option{-static-libstdc++} option directs the @command{g++} driver to
17917 link @file{libstdc++} statically, without necessarily linking other
17918 libraries statically.
17919
17920 @opindex symbolic
17921 @item -symbolic
17922 Bind references to global symbols when building a shared object. Warn
17923 about any unresolved references (unless overridden by the link editor
17924 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
17925 this option.
17926
17927 @opindex T
17928 @cindex linker script
17929 @item -T @var{script}
17930 Use @var{script} as the linker script. This option is supported by most
17931 systems using the GNU linker. On some targets, such as bare-board
17932 targets without an operating system, the @option{-T} option may be required
17933 when linking to avoid references to undefined symbols.
17934
17935 @opindex Xlinker
17936 @item -Xlinker @var{option}
17937 Pass @var{option} as an option to the linker. You can use this to
17938 supply system-specific linker options that GCC does not recognize.
17939
17940 If you want to pass an option that takes a separate argument, you must use
17941 @option{-Xlinker} twice, once for the option and once for the argument.
17942 For example, to pass @option{-assert definitions}, you must write
17943 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
17944 @option{-Xlinker "-assert definitions"}, because this passes the entire
17945 string as a single argument, which is not what the linker expects.
17946
17947 When using the GNU linker, it is usually more convenient to pass
17948 arguments to linker options using the @option{@var{option}=@var{value}}
17949 syntax than as separate arguments. For example, you can specify
17950 @option{-Xlinker -Map=output.map} rather than
17951 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
17952 this syntax for command-line options.
17953
17954 @opindex Wl
17955 @item -Wl,@var{option}
17956 Pass @var{option} as an option to the linker. If @var{option} contains
17957 commas, it is split into multiple options at the commas. You can use this
17958 syntax to pass an argument to the option.
17959 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
17960 linker. When using the GNU linker, you can also get the same effect with
17961 @option{-Wl,-Map=output.map}.
17962
17963 @opindex u
17964 @item -u @var{symbol}
17965 Pretend the symbol @var{symbol} is undefined, to force linking of
17966 library modules to define it. You can use @option{-u} multiple times with
17967 different symbols to force loading of additional library modules.
17968
17969 @opindex z
17970 @item -z @var{keyword}
17971 @option{-z} is passed directly on to the linker along with the keyword
17972 @var{keyword}. See the section in the documentation of your linker for
17973 permitted values and their meanings.
17974 @end table
17975
17976 @node Directory Options
17977 @section Options for Directory Search
17978 @cindex directory options
17979 @cindex options, directory search
17980 @cindex search path
17981
17982 These options specify directories to search for header files, for
17983 libraries and for parts of the compiler:
17984
17985 @table @gcctabopt
17986 @include cppdiropts.texi
17987
17988 @opindex iplugindir=
17989 @item -iplugindir=@var{dir}
17990 Set the directory to search for plugins that are passed
17991 by @option{-fplugin=@var{name}} instead of
17992 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
17993 to be used by the user, but only passed by the driver.
17994
17995 @opindex L
17996 @item -L@var{dir}
17997 Add directory @var{dir} to the list of directories to be searched
17998 for @option{-l}.
17999
18000 @opindex B
18001 @item -B@var{prefix}
18002 This option specifies where to find the executables, libraries,
18003 include files, and data files of the compiler itself.
18004
18005 The compiler driver program runs one or more of the subprograms
18006 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
18007 @var{prefix} as a prefix for each program it tries to run, both with and
18008 without @samp{@var{machine}/@var{version}/} for the corresponding target
18009 machine and compiler version.
18010
18011 For each subprogram to be run, the compiler driver first tries the
18012 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
18013 is not specified, the driver tries two standard prefixes,
18014 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
18015 those results in a file name that is found, the unmodified program
18016 name is searched for using the directories specified in your
18017 @env{PATH} environment variable.
18018
18019 The compiler checks to see if the path provided by @option{-B}
18020 refers to a directory, and if necessary it adds a directory
18021 separator character at the end of the path.
18022
18023 @option{-B} prefixes that effectively specify directory names also apply
18024 to libraries in the linker, because the compiler translates these
18025 options into @option{-L} options for the linker. They also apply to
18026 include files in the preprocessor, because the compiler translates these
18027 options into @option{-isystem} options for the preprocessor. In this case,
18028 the compiler appends @samp{include} to the prefix.
18029
18030 The runtime support file @file{libgcc.a} can also be searched for using
18031 the @option{-B} prefix, if needed. If it is not found there, the two
18032 standard prefixes above are tried, and that is all. The file is left
18033 out of the link if it is not found by those means.
18034
18035 Another way to specify a prefix much like the @option{-B} prefix is to use
18036 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
18037 Variables}.
18038
18039 As a special kludge, if the path provided by @option{-B} is
18040 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18041 9, then it is replaced by @file{[dir/]include}. This is to help
18042 with boot-strapping the compiler.
18043
18044 @opindex no-canonical-prefixes
18045 @item -no-canonical-prefixes
18046 Do not expand any symbolic links, resolve references to @samp{/../}
18047 or @samp{/./}, or make the path absolute when generating a relative
18048 prefix.
18049
18050 @opindex sysroot
18051 @item --sysroot=@var{dir}
18052 Use @var{dir} as the logical root directory for headers and libraries.
18053 For example, if the compiler normally searches for headers in
18054 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18055 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18056
18057 If you use both this option and the @option{-isysroot} option, then
18058 the @option{--sysroot} option applies to libraries, but the
18059 @option{-isysroot} option applies to header files.
18060
18061 The GNU linker (beginning with version 2.16) has the necessary support
18062 for this option. If your linker does not support this option, the
18063 header file aspect of @option{--sysroot} still works, but the
18064 library aspect does not.
18065
18066 @opindex no-sysroot-suffix
18067 @item --no-sysroot-suffix
18068 For some targets, a suffix is added to the root directory specified
18069 with @option{--sysroot}, depending on the other options used, so that
18070 headers may for example be found in
18071 @file{@var{dir}/@var{suffix}/usr/include} instead of
18072 @file{@var{dir}/usr/include}. This option disables the addition of
18073 such a suffix.
18074
18075 @end table
18076
18077 @node Code Gen Options
18078 @section Options for Code Generation Conventions
18079 @cindex code generation conventions
18080 @cindex options, code generation
18081 @cindex run-time options
18082
18083 These machine-independent options control the interface conventions
18084 used in code generation.
18085
18086 Most of them have both positive and negative forms; the negative form
18087 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
18088 one of the forms is listed---the one that is not the default. You
18089 can figure out the other form by either removing @samp{no-} or adding
18090 it.
18091
18092 @table @gcctabopt
18093 @opindex fstack_reuse
18094 @item -fstack-reuse=@var{reuse-level}
18095 This option controls stack space reuse for user declared local/auto variables
18096 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
18097 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18098 local variables and temporaries, @samp{named_vars} enables the reuse only for
18099 user defined local variables with names, and @samp{none} disables stack reuse
18100 completely. The default value is @samp{all}. The option is needed when the
18101 program extends the lifetime of a scoped local variable or a compiler generated
18102 temporary beyond the end point defined by the language. When a lifetime of
18103 a variable ends, and if the variable lives in memory, the optimizing compiler
18104 has the freedom to reuse its stack space with other temporaries or scoped
18105 local variables whose live range does not overlap with it. Legacy code extending
18106 local lifetime is likely to break with the stack reuse optimization.
18107
18108 For example,
18109
18110 @smallexample
18111 int *p;
18112 @{
18113 int local1;
18114
18115 p = &local1;
18116 local1 = 10;
18117 ....
18118 @}
18119 @{
18120 int local2;
18121 local2 = 20;
18122 ...
18123 @}
18124
18125 if (*p == 10) // out of scope use of local1
18126 @{
18127
18128 @}
18129 @end smallexample
18130
18131 Another example:
18132 @smallexample
18133
18134 struct A
18135 @{
18136 A(int k) : i(k), j(k) @{ @}
18137 int i;
18138 int j;
18139 @};
18140
18141 A *ap;
18142
18143 void foo(const A& ar)
18144 @{
18145 ap = &ar;
18146 @}
18147
18148 void bar()
18149 @{
18150 foo(A(10)); // temp object's lifetime ends when foo returns
18151
18152 @{
18153 A a(20);
18154 ....
18155 @}
18156 ap->i+= 10; // ap references out of scope temp whose space
18157 // is reused with a. What is the value of ap->i?
18158 @}
18159
18160 @end smallexample
18161
18162 The lifetime of a compiler generated temporary is well defined by the C++
18163 standard. When a lifetime of a temporary ends, and if the temporary lives
18164 in memory, the optimizing compiler has the freedom to reuse its stack
18165 space with other temporaries or scoped local variables whose live range
18166 does not overlap with it. However some of the legacy code relies on
18167 the behavior of older compilers in which temporaries' stack space is
18168 not reused, the aggressive stack reuse can lead to runtime errors. This
18169 option is used to control the temporary stack reuse optimization.
18170
18171 @opindex ftrapv
18172 @item -ftrapv
18173 This option generates traps for signed overflow on addition, subtraction,
18174 multiplication operations.
18175 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18176 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18177 @option{-fwrapv} being effective. Note that only active options override, so
18178 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18179 results in @option{-ftrapv} being effective.
18180
18181 @opindex fwrapv
18182 @item -fwrapv
18183 This option instructs the compiler to assume that signed arithmetic
18184 overflow of addition, subtraction and multiplication wraps around
18185 using twos-complement representation. This flag enables some optimizations
18186 and disables others.
18187 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18188 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18189 @option{-fwrapv} being effective. Note that only active options override, so
18190 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18191 results in @option{-ftrapv} being effective.
18192
18193 @opindex fwrapv-pointer
18194 @item -fwrapv-pointer
18195 This option instructs the compiler to assume that pointer arithmetic
18196 overflow on addition and subtraction wraps around using twos-complement
18197 representation. This flag disables some optimizations which assume
18198 pointer overflow is invalid.
18199
18200 @opindex fstrict-overflow
18201 @item -fstrict-overflow
18202 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18203 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18204
18205 @opindex fexceptions
18206 @item -fexceptions
18207 Enable exception handling. Generates extra code needed to propagate
18208 exceptions. For some targets, this implies GCC generates frame
18209 unwind information for all functions, which can produce significant data
18210 size overhead, although it does not affect execution. If you do not
18211 specify this option, GCC enables it by default for languages like
18212 C++ that normally require exception handling, and disables it for
18213 languages like C that do not normally require it. However, you may need
18214 to enable this option when compiling C code that needs to interoperate
18215 properly with exception handlers written in C++. You may also wish to
18216 disable this option if you are compiling older C++ programs that don't
18217 use exception handling.
18218
18219 @opindex fnon-call-exceptions
18220 @item -fnon-call-exceptions
18221 Generate code that allows trapping instructions to throw exceptions.
18222 Note that this requires platform-specific runtime support that does
18223 not exist everywhere. Moreover, it only allows @emph{trapping}
18224 instructions to throw exceptions, i.e.@: memory references or floating-point
18225 instructions. It does not allow exceptions to be thrown from
18226 arbitrary signal handlers such as @code{SIGALRM}. This enables
18227 @option{-fexceptions}.
18228
18229 @opindex fdelete-dead-exceptions
18230 @item -fdelete-dead-exceptions
18231 Consider that instructions that may throw exceptions but don't otherwise
18232 contribute to the execution of the program can be optimized away.
18233 This does not affect calls to functions except those with the
18234 @code{pure} or @code{const} attributes.
18235 This option is enabled by default for the Ada and C++ compilers, as permitted by
18236 the language specifications.
18237 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18238
18239 @opindex funwind-tables
18240 @item -funwind-tables
18241 Similar to @option{-fexceptions}, except that it just generates any needed
18242 static data, but does not affect the generated code in any other way.
18243 You normally do not need to enable this option; instead, a language processor
18244 that needs this handling enables it on your behalf.
18245
18246 @opindex fasynchronous-unwind-tables
18247 @item -fasynchronous-unwind-tables
18248 Generate unwind table in DWARF format, if supported by target machine. The
18249 table is exact at each instruction boundary, so it can be used for stack
18250 unwinding from asynchronous events (such as debugger or garbage collector).
18251
18252 @opindex fno-gnu-unique
18253 @opindex fgnu-unique
18254 @item -fno-gnu-unique
18255 On systems with recent GNU assembler and C library, the C++ compiler
18256 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18257 of template static data members and static local variables in inline
18258 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18259 is necessary to avoid problems with a library used by two different
18260 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18261 therefore disagreeing with the other one about the binding of the
18262 symbol. But this causes @code{dlclose} to be ignored for affected
18263 DSOs; if your program relies on reinitialization of a DSO via
18264 @code{dlclose} and @code{dlopen}, you can use
18265 @option{-fno-gnu-unique}.
18266
18267 @opindex fpcc-struct-return
18268 @item -fpcc-struct-return
18269 Return ``short'' @code{struct} and @code{union} values in memory like
18270 longer ones, rather than in registers. This convention is less
18271 efficient, but it has the advantage of allowing intercallability between
18272 GCC-compiled files and files compiled with other compilers, particularly
18273 the Portable C Compiler (pcc).
18274
18275 The precise convention for returning structures in memory depends
18276 on the target configuration macros.
18277
18278 Short structures and unions are those whose size and alignment match
18279 that of some integer type.
18280
18281 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18282 switch is not binary compatible with code compiled with the
18283 @option{-freg-struct-return} switch.
18284 Use it to conform to a non-default application binary interface.
18285
18286 @opindex freg-struct-return
18287 @item -freg-struct-return
18288 Return @code{struct} and @code{union} values in registers when possible.
18289 This is more efficient for small structures than
18290 @option{-fpcc-struct-return}.
18291
18292 If you specify neither @option{-fpcc-struct-return} nor
18293 @option{-freg-struct-return}, GCC defaults to whichever convention is
18294 standard for the target. If there is no standard convention, GCC
18295 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18296 the principal compiler. In those cases, we can choose the standard, and
18297 we chose the more efficient register return alternative.
18298
18299 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18300 switch is not binary compatible with code compiled with the
18301 @option{-fpcc-struct-return} switch.
18302 Use it to conform to a non-default application binary interface.
18303
18304 @opindex fshort-enums
18305 @item -fshort-enums
18306 Allocate to an @code{enum} type only as many bytes as it needs for the
18307 declared range of possible values. Specifically, the @code{enum} type
18308 is equivalent to the smallest integer type that has enough room.
18309
18310 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18311 code that is not binary compatible with code generated without that switch.
18312 Use it to conform to a non-default application binary interface.
18313
18314 @opindex fshort-wchar
18315 @item -fshort-wchar
18316 Override the underlying type for @code{wchar_t} to be @code{short
18317 unsigned int} instead of the default for the target. This option is
18318 useful for building programs to run under WINE@.
18319
18320 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18321 code that is not binary compatible with code generated without that switch.
18322 Use it to conform to a non-default application binary interface.
18323
18324 @opindex fcommon
18325 @opindex fno-common
18326 @cindex tentative definitions
18327 @item -fcommon
18328 In C code, this option controls the placement of global variables
18329 defined without an initializer, known as @dfn{tentative definitions}
18330 in the C standard. Tentative definitions are distinct from declarations
18331 of a variable with the @code{extern} keyword, which do not allocate storage.
18332
18333 The default is @option{-fno-common}, which specifies that the compiler places
18334 uninitialized global variables in the BSS section of the object file.
18335 This inhibits the merging of tentative definitions by the linker so you get a
18336 multiple-definition error if the same variable is accidentally defined in more
18337 than one compilation unit.
18338
18339 The @option{-fcommon} places uninitialized global variables in a common block.
18340 This allows the linker to resolve all tentative definitions of the same variable
18341 in different compilation units to the same object, or to a non-tentative
18342 definition. This behavior is inconsistent with C++, and on many targets implies
18343 a speed and code size penalty on global variable references. It is mainly
18344 useful to enable legacy code to link without errors.
18345
18346 @opindex fno-ident
18347 @opindex fident
18348 @item -fno-ident
18349 Ignore the @code{#ident} directive.
18350
18351 @opindex finhibit-size-directive
18352 @item -finhibit-size-directive
18353 Don't output a @code{.size} assembler directive, or anything else that
18354 would cause trouble if the function is split in the middle, and the
18355 two halves are placed at locations far apart in memory. This option is
18356 used when compiling @file{crtstuff.c}; you should not need to use it
18357 for anything else.
18358
18359 @opindex fverbose-asm
18360 @item -fverbose-asm
18361 Put extra commentary information in the generated assembly code to
18362 make it more readable. This option is generally only of use to those
18363 who actually need to read the generated assembly code (perhaps while
18364 debugging the compiler itself).
18365
18366 @option{-fno-verbose-asm}, the default, causes the
18367 extra information to be omitted and is useful when comparing two assembler
18368 files.
18369
18370 The added comments include:
18371
18372 @itemize @bullet
18373
18374 @item
18375 information on the compiler version and command-line options,
18376
18377 @item
18378 the source code lines associated with the assembly instructions,
18379 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18380
18381 @item
18382 hints on which high-level expressions correspond to
18383 the various assembly instruction operands.
18384
18385 @end itemize
18386
18387 For example, given this C source file:
18388
18389 @smallexample
18390 int test (int n)
18391 @{
18392 int i;
18393 int total = 0;
18394
18395 for (i = 0; i < n; i++)
18396 total += i * i;
18397
18398 return total;
18399 @}
18400 @end smallexample
18401
18402 compiling to (x86_64) assembly via @option{-S} and emitting the result
18403 direct to stdout via @option{-o} @option{-}
18404
18405 @smallexample
18406 gcc -S test.c -fverbose-asm -Os -o -
18407 @end smallexample
18408
18409 gives output similar to this:
18410
18411 @smallexample
18412 .file "test.c"
18413 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18414 [...snip...]
18415 # options passed:
18416 [...snip...]
18417
18418 .text
18419 .globl test
18420 .type test, @@function
18421 test:
18422 .LFB0:
18423 .cfi_startproc
18424 # test.c:4: int total = 0;
18425 xorl %eax, %eax # <retval>
18426 # test.c:6: for (i = 0; i < n; i++)
18427 xorl %edx, %edx # i
18428 .L2:
18429 # test.c:6: for (i = 0; i < n; i++)
18430 cmpl %edi, %edx # n, i
18431 jge .L5 #,
18432 # test.c:7: total += i * i;
18433 movl %edx, %ecx # i, tmp92
18434 imull %edx, %ecx # i, tmp92
18435 # test.c:6: for (i = 0; i < n; i++)
18436 incl %edx # i
18437 # test.c:7: total += i * i;
18438 addl %ecx, %eax # tmp92, <retval>
18439 jmp .L2 #
18440 .L5:
18441 # test.c:10: @}
18442 ret
18443 .cfi_endproc
18444 .LFE0:
18445 .size test, .-test
18446 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
18447 .section .note.GNU-stack,"",@@progbits
18448 @end smallexample
18449
18450 The comments are intended for humans rather than machines and hence the
18451 precise format of the comments is subject to change.
18452
18453 @opindex frecord-gcc-switches
18454 @item -frecord-gcc-switches
18455 This switch causes the command line used to invoke the
18456 compiler to be recorded into the object file that is being created.
18457 This switch is only implemented on some targets and the exact format
18458 of the recording is target and binary file format dependent, but it
18459 usually takes the form of a section containing ASCII text. This
18460 switch is related to the @option{-fverbose-asm} switch, but that
18461 switch only records information in the assembler output file as
18462 comments, so it never reaches the object file.
18463 See also @option{-grecord-gcc-switches} for another
18464 way of storing compiler options into the object file.
18465
18466 @opindex fpic
18467 @cindex global offset table
18468 @cindex PIC
18469 @item -fpic
18470 Generate position-independent code (PIC) suitable for use in a shared
18471 library, if supported for the target machine. Such code accesses all
18472 constant addresses through a global offset table (GOT)@. The dynamic
18473 loader resolves the GOT entries when the program starts (the dynamic
18474 loader is not part of GCC; it is part of the operating system). If
18475 the GOT size for the linked executable exceeds a machine-specific
18476 maximum size, you get an error message from the linker indicating that
18477 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18478 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18479 on the m68k and RS/6000. The x86 has no such limit.)
18480
18481 Position-independent code requires special support, and therefore works
18482 only on certain machines. For the x86, GCC supports PIC for System V
18483 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
18484 position-independent.
18485
18486 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18487 are defined to 1.
18488
18489 @opindex fPIC
18490 @item -fPIC
18491 If supported for the target machine, emit position-independent code,
18492 suitable for dynamic linking and avoiding any limit on the size of the
18493 global offset table. This option makes a difference on AArch64, m68k,
18494 PowerPC and SPARC@.
18495
18496 Position-independent code requires special support, and therefore works
18497 only on certain machines.
18498
18499 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18500 are defined to 2.
18501
18502 @opindex fpie
18503 @opindex fPIE
18504 @item -fpie
18505 @itemx -fPIE
18506 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18507 generated position-independent code can be only linked into executables.
18508 Usually these options are used to compile code that will be linked using
18509 the @option{-pie} GCC option.
18510
18511 @option{-fpie} and @option{-fPIE} both define the macros
18512 @code{__pie__} and @code{__PIE__}. The macros have the value 1
18513 for @option{-fpie} and 2 for @option{-fPIE}.
18514
18515 @opindex fno-plt
18516 @opindex fplt
18517 @item -fno-plt
18518 Do not use the PLT for external function calls in position-independent code.
18519 Instead, load the callee address at call sites from the GOT and branch to it.
18520 This leads to more efficient code by eliminating PLT stubs and exposing
18521 GOT loads to optimizations. On architectures such as 32-bit x86 where
18522 PLT stubs expect the GOT pointer in a specific register, this gives more
18523 register allocation freedom to the compiler.
18524 Lazy binding requires use of the PLT;
18525 with @option{-fno-plt} all external symbols are resolved at load time.
18526
18527 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18528 through the PLT for specific external functions.
18529
18530 In position-dependent code, a few targets also convert calls to
18531 functions that are marked to not use the PLT to use the GOT instead.
18532
18533 @opindex fno-jump-tables
18534 @opindex fjump-tables
18535 @item -fno-jump-tables
18536 Do not use jump tables for switch statements even where it would be
18537 more efficient than other code generation strategies. This option is
18538 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18539 building code that forms part of a dynamic linker and cannot
18540 reference the address of a jump table. On some targets, jump tables
18541 do not require a GOT and this option is not needed.
18542
18543 @opindex fno-bit-tests
18544 @opindex fbit-tests
18545 @item -fno-bit-tests
18546 Do not use bit tests for switch statements even where it would be
18547 more efficient than other code generation strategies.
18548
18549 @opindex ffixed
18550 @item -ffixed-@var{reg}
18551 Treat the register named @var{reg} as a fixed register; generated code
18552 should never refer to it (except perhaps as a stack pointer, frame
18553 pointer or in some other fixed role).
18554
18555 @var{reg} must be the name of a register. The register names accepted
18556 are machine-specific and are defined in the @code{REGISTER_NAMES}
18557 macro in the machine description macro file.
18558
18559 This flag does not have a negative form, because it specifies a
18560 three-way choice.
18561
18562 @opindex fcall-used
18563 @item -fcall-used-@var{reg}
18564 Treat the register named @var{reg} as an allocable register that is
18565 clobbered by function calls. It may be allocated for temporaries or
18566 variables that do not live across a call. Functions compiled this way
18567 do not save and restore the register @var{reg}.
18568
18569 It is an error to use this flag with the frame pointer or stack pointer.
18570 Use of this flag for other registers that have fixed pervasive roles in
18571 the machine's execution model produces disastrous results.
18572
18573 This flag does not have a negative form, because it specifies a
18574 three-way choice.
18575
18576 @opindex fcall-saved
18577 @item -fcall-saved-@var{reg}
18578 Treat the register named @var{reg} as an allocable register saved by
18579 functions. It may be allocated even for temporaries or variables that
18580 live across a call. Functions compiled this way save and restore
18581 the register @var{reg} if they use it.
18582
18583 It is an error to use this flag with the frame pointer or stack pointer.
18584 Use of this flag for other registers that have fixed pervasive roles in
18585 the machine's execution model produces disastrous results.
18586
18587 A different sort of disaster results from the use of this flag for
18588 a register in which function values may be returned.
18589
18590 This flag does not have a negative form, because it specifies a
18591 three-way choice.
18592
18593 @opindex fpack-struct
18594 @item -fpack-struct[=@var{n}]
18595 Without a value specified, pack all structure members together without
18596 holes. When a value is specified (which must be a small power of two), pack
18597 structure members according to this value, representing the maximum
18598 alignment (that is, objects with default alignment requirements larger than
18599 this are output potentially unaligned at the next fitting location.
18600
18601 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18602 code that is not binary compatible with code generated without that switch.
18603 Additionally, it makes the code suboptimal.
18604 Use it to conform to a non-default application binary interface.
18605
18606 @opindex fleading-underscore
18607 @item -fleading-underscore
18608 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18609 change the way C symbols are represented in the object file. One use
18610 is to help link with legacy assembly code.
18611
18612 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18613 generate code that is not binary compatible with code generated without that
18614 switch. Use it to conform to a non-default application binary interface.
18615 Not all targets provide complete support for this switch.
18616
18617 @opindex ftls-model
18618 @item -ftls-model=@var{model}
18619 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18620 The @var{model} argument should be one of @samp{global-dynamic},
18621 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18622 Note that the choice is subject to optimization: the compiler may use
18623 a more efficient model for symbols not visible outside of the translation
18624 unit, or if @option{-fpic} is not given on the command line.
18625
18626 The default without @option{-fpic} is @samp{initial-exec}; with
18627 @option{-fpic} the default is @samp{global-dynamic}.
18628
18629 @opindex ftrampolines
18630 @item -ftrampolines
18631 For targets that normally need trampolines for nested functions, always
18632 generate them instead of using descriptors. Otherwise, for targets that
18633 do not need them, like for example HP-PA or IA-64, do nothing.
18634
18635 A trampoline is a small piece of code that is created at run time on the
18636 stack when the address of a nested function is taken, and is used to call
18637 the nested function indirectly. Therefore, it requires the stack to be
18638 made executable in order for the program to work properly.
18639
18640 @option{-fno-trampolines} is enabled by default on a language by language
18641 basis to let the compiler avoid generating them, if it computes that this
18642 is safe, and replace them with descriptors. Descriptors are made up of data
18643 only, but the generated code must be prepared to deal with them. As of this
18644 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18645
18646 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18647 @option{-fno-trampolines} are not binary compatible if nested functions are
18648 present. This option must therefore be used on a program-wide basis and be
18649 manipulated with extreme care.
18650
18651 For languages other than Ada, the @code{-ftrampolines} and
18652 @code{-fno-trampolines} options currently have no effect, and
18653 trampolines are always generated on platforms that need them
18654 for nested functions.
18655
18656 @opindex fvisibility
18657 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18658 Set the default ELF image symbol visibility to the specified option---all
18659 symbols are marked with this unless overridden within the code.
18660 Using this feature can very substantially improve linking and
18661 load times of shared object libraries, produce more optimized
18662 code, provide near-perfect API export and prevent symbol clashes.
18663 It is @strong{strongly} recommended that you use this in any shared objects
18664 you distribute.
18665
18666 Despite the nomenclature, @samp{default} always means public; i.e.,
18667 available to be linked against from outside the shared object.
18668 @samp{protected} and @samp{internal} are pretty useless in real-world
18669 usage so the only other commonly used option is @samp{hidden}.
18670 The default if @option{-fvisibility} isn't specified is
18671 @samp{default}, i.e., make every symbol public.
18672
18673 A good explanation of the benefits offered by ensuring ELF
18674 symbols have the correct visibility is given by ``How To Write
18675 Shared Libraries'' by Ulrich Drepper (which can be found at
18676 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18677 solution made possible by this option to marking things hidden when
18678 the default is public is to make the default hidden and mark things
18679 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18680 and @code{__attribute__ ((visibility("default")))} instead of
18681 @code{__declspec(dllexport)} you get almost identical semantics with
18682 identical syntax. This is a great boon to those working with
18683 cross-platform projects.
18684
18685 For those adding visibility support to existing code, you may find
18686 @code{#pragma GCC visibility} of use. This works by you enclosing
18687 the declarations you wish to set visibility for with (for example)
18688 @code{#pragma GCC visibility push(hidden)} and
18689 @code{#pragma GCC visibility pop}.
18690 Bear in mind that symbol visibility should be viewed @strong{as
18691 part of the API interface contract} and thus all new code should
18692 always specify visibility when it is not the default; i.e., declarations
18693 only for use within the local DSO should @strong{always} be marked explicitly
18694 as hidden as so to avoid PLT indirection overheads---making this
18695 abundantly clear also aids readability and self-documentation of the code.
18696 Note that due to ISO C++ specification requirements, @code{operator new} and
18697 @code{operator delete} must always be of default visibility.
18698
18699 Be aware that headers from outside your project, in particular system
18700 headers and headers from any other library you use, may not be
18701 expecting to be compiled with visibility other than the default. You
18702 may need to explicitly say @code{#pragma GCC visibility push(default)}
18703 before including any such headers.
18704
18705 @code{extern} declarations are not affected by @option{-fvisibility}, so
18706 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18707 no modifications. However, this means that calls to @code{extern}
18708 functions with no explicit visibility use the PLT, so it is more
18709 effective to use @code{__attribute ((visibility))} and/or
18710 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18711 declarations should be treated as hidden.
18712
18713 Note that @option{-fvisibility} does affect C++ vague linkage
18714 entities. This means that, for instance, an exception class that is
18715 be thrown between DSOs must be explicitly marked with default
18716 visibility so that the @samp{type_info} nodes are unified between
18717 the DSOs.
18718
18719 An overview of these techniques, their benefits and how to use them
18720 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18721
18722 @opindex fstrict-volatile-bitfields
18723 @item -fstrict-volatile-bitfields
18724 This option should be used if accesses to volatile bit-fields (or other
18725 structure fields, although the compiler usually honors those types
18726 anyway) should use a single access of the width of the
18727 field's type, aligned to a natural alignment if possible. For
18728 example, targets with memory-mapped peripheral registers might require
18729 all such accesses to be 16 bits wide; with this flag you can
18730 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18731 is 16 bits on these targets) to force GCC to use 16-bit accesses
18732 instead of, perhaps, a more efficient 32-bit access.
18733
18734 If this option is disabled, the compiler uses the most efficient
18735 instruction. In the previous example, that might be a 32-bit load
18736 instruction, even though that accesses bytes that do not contain
18737 any portion of the bit-field, or memory-mapped registers unrelated to
18738 the one being updated.
18739
18740 In some cases, such as when the @code{packed} attribute is applied to a
18741 structure field, it may not be possible to access the field with a single
18742 read or write that is correctly aligned for the target machine. In this
18743 case GCC falls back to generating multiple accesses rather than code that
18744 will fault or truncate the result at run time.
18745
18746 Note: Due to restrictions of the C/C++11 memory model, write accesses are
18747 not allowed to touch non bit-field members. It is therefore recommended
18748 to define all bits of the field's type as bit-field members.
18749
18750 The default value of this option is determined by the application binary
18751 interface for the target processor.
18752
18753 @opindex fsync-libcalls
18754 @item -fsync-libcalls
18755 This option controls whether any out-of-line instance of the @code{__sync}
18756 family of functions may be used to implement the C++11 @code{__atomic}
18757 family of functions.
18758
18759 The default value of this option is enabled, thus the only useful form
18760 of the option is @option{-fno-sync-libcalls}. This option is used in
18761 the implementation of the @file{libatomic} runtime library.
18762
18763 @end table
18764
18765 @node Developer Options
18766 @section GCC Developer Options
18767 @cindex developer options
18768 @cindex debugging GCC
18769 @cindex debug dump options
18770 @cindex dump options
18771 @cindex compilation statistics
18772
18773 This section describes command-line options that are primarily of
18774 interest to GCC developers, including options to support compiler
18775 testing and investigation of compiler bugs and compile-time
18776 performance problems. This includes options that produce debug dumps
18777 at various points in the compilation; that print statistics such as
18778 memory use and execution time; and that print information about GCC's
18779 configuration, such as where it searches for libraries. You should
18780 rarely need to use any of these options for ordinary compilation and
18781 linking tasks.
18782
18783 Many developer options that cause GCC to dump output to a file take an
18784 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
18785 or @samp{-} to dump to standard output, and @samp{stderr} for standard
18786 error.
18787
18788 If @samp{=@var{filename}} is omitted, a default dump file name is
18789 constructed by concatenating the base dump file name, a pass number,
18790 phase letter, and pass name. The base dump file name is the name of
18791 output file produced by the compiler if explicitly specified and not
18792 an executable; otherwise it is the source file name.
18793 The pass number is determined by the order passes are registered with
18794 the compiler's pass manager.
18795 This is generally the same as the order of execution, but passes
18796 registered by plugins, target-specific passes, or passes that are
18797 otherwise registered late are numbered higher than the pass named
18798 @samp{final}, even if they are executed earlier. The phase letter is
18799 one of @samp{i} (inter-procedural analysis), @samp{l}
18800 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
18801 The files are created in the directory of the output file.
18802
18803 @table @gcctabopt
18804
18805 @opindex fcallgraph-info
18806 @item -fcallgraph-info
18807 @itemx -fcallgraph-info=@var{MARKERS}
18808 Makes the compiler output callgraph information for the program, on a
18809 per-object-file basis. The information is generated in the common VCG
18810 format. It can be decorated with additional, per-node and/or per-edge
18811 information, if a list of comma-separated markers is additionally
18812 specified. When the @code{su} marker is specified, the callgraph is
18813 decorated with stack usage information; it is equivalent to
18814 @option{-fstack-usage}. When the @code{da} marker is specified, the
18815 callgraph is decorated with information about dynamically allocated
18816 objects.
18817
18818 When compiling with @option{-flto}, no callgraph information is output
18819 along with the object file. At LTO link time, @option{-fcallgraph-info}
18820 may generate multiple callgraph information files next to intermediate
18821 LTO output files.
18822
18823 @opindex d
18824 @opindex fdump-rtl-@var{pass}
18825 @item -d@var{letters}
18826 @itemx -fdump-rtl-@var{pass}
18827 @itemx -fdump-rtl-@var{pass}=@var{filename}
18828 Says to make debugging dumps during compilation at times specified by
18829 @var{letters}. This is used for debugging the RTL-based passes of the
18830 compiler.
18831
18832 Some @option{-d@var{letters}} switches have different meaning when
18833 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
18834 for information about preprocessor-specific dump options.
18835
18836 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
18837 @option{-d} option @var{letters}. Here are the possible
18838 letters for use in @var{pass} and @var{letters}, and their meanings:
18839
18840 @table @gcctabopt
18841
18842 @opindex fdump-rtl-alignments
18843 @item -fdump-rtl-alignments
18844 Dump after branch alignments have been computed.
18845
18846 @opindex fdump-rtl-asmcons
18847 @item -fdump-rtl-asmcons
18848 Dump after fixing rtl statements that have unsatisfied in/out constraints.
18849
18850 @opindex fdump-rtl-auto_inc_dec
18851 @item -fdump-rtl-auto_inc_dec
18852 Dump after auto-inc-dec discovery. This pass is only run on
18853 architectures that have auto inc or auto dec instructions.
18854
18855 @opindex fdump-rtl-barriers
18856 @item -fdump-rtl-barriers
18857 Dump after cleaning up the barrier instructions.
18858
18859 @opindex fdump-rtl-bbpart
18860 @item -fdump-rtl-bbpart
18861 Dump after partitioning hot and cold basic blocks.
18862
18863 @opindex fdump-rtl-bbro
18864 @item -fdump-rtl-bbro
18865 Dump after block reordering.
18866
18867 @opindex fdump-rtl-btl2
18868 @opindex fdump-rtl-btl2
18869 @item -fdump-rtl-btl1
18870 @itemx -fdump-rtl-btl2
18871 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
18872 after the two branch
18873 target load optimization passes.
18874
18875 @opindex fdump-rtl-bypass
18876 @item -fdump-rtl-bypass
18877 Dump after jump bypassing and control flow optimizations.
18878
18879 @opindex fdump-rtl-combine
18880 @item -fdump-rtl-combine
18881 Dump after the RTL instruction combination pass.
18882
18883 @opindex fdump-rtl-compgotos
18884 @item -fdump-rtl-compgotos
18885 Dump after duplicating the computed gotos.
18886
18887 @opindex fdump-rtl-ce1
18888 @opindex fdump-rtl-ce2
18889 @opindex fdump-rtl-ce3
18890 @item -fdump-rtl-ce1
18891 @itemx -fdump-rtl-ce2
18892 @itemx -fdump-rtl-ce3
18893 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
18894 @option{-fdump-rtl-ce3} enable dumping after the three
18895 if conversion passes.
18896
18897 @opindex fdump-rtl-cprop_hardreg
18898 @item -fdump-rtl-cprop_hardreg
18899 Dump after hard register copy propagation.
18900
18901 @opindex fdump-rtl-csa
18902 @item -fdump-rtl-csa
18903 Dump after combining stack adjustments.
18904
18905 @opindex fdump-rtl-cse1
18906 @opindex fdump-rtl-cse2
18907 @item -fdump-rtl-cse1
18908 @itemx -fdump-rtl-cse2
18909 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
18910 the two common subexpression elimination passes.
18911
18912 @opindex fdump-rtl-dce
18913 @item -fdump-rtl-dce
18914 Dump after the standalone dead code elimination passes.
18915
18916 @opindex fdump-rtl-dbr
18917 @item -fdump-rtl-dbr
18918 Dump after delayed branch scheduling.
18919
18920 @opindex fdump-rtl-dce1
18921 @opindex fdump-rtl-dce2
18922 @item -fdump-rtl-dce1
18923 @itemx -fdump-rtl-dce2
18924 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
18925 the two dead store elimination passes.
18926
18927 @opindex fdump-rtl-eh
18928 @item -fdump-rtl-eh
18929 Dump after finalization of EH handling code.
18930
18931 @opindex fdump-rtl-eh_ranges
18932 @item -fdump-rtl-eh_ranges
18933 Dump after conversion of EH handling range regions.
18934
18935 @opindex fdump-rtl-expand
18936 @item -fdump-rtl-expand
18937 Dump after RTL generation.
18938
18939 @opindex fdump-rtl-fwprop1
18940 @opindex fdump-rtl-fwprop2
18941 @item -fdump-rtl-fwprop1
18942 @itemx -fdump-rtl-fwprop2
18943 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
18944 dumping after the two forward propagation passes.
18945
18946 @opindex fdump-rtl-gcse1
18947 @opindex fdump-rtl-gcse2
18948 @item -fdump-rtl-gcse1
18949 @itemx -fdump-rtl-gcse2
18950 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
18951 after global common subexpression elimination.
18952
18953 @opindex fdump-rtl-init-regs
18954 @item -fdump-rtl-init-regs
18955 Dump after the initialization of the registers.
18956
18957 @opindex fdump-rtl-initvals
18958 @item -fdump-rtl-initvals
18959 Dump after the computation of the initial value sets.
18960
18961 @opindex fdump-rtl-into_cfglayout
18962 @item -fdump-rtl-into_cfglayout
18963 Dump after converting to cfglayout mode.
18964
18965 @opindex fdump-rtl-ira
18966 @item -fdump-rtl-ira
18967 Dump after iterated register allocation.
18968
18969 @opindex fdump-rtl-jump
18970 @item -fdump-rtl-jump
18971 Dump after the second jump optimization.
18972
18973 @opindex fdump-rtl-loop2
18974 @item -fdump-rtl-loop2
18975 @option{-fdump-rtl-loop2} enables dumping after the rtl
18976 loop optimization passes.
18977
18978 @opindex fdump-rtl-mach
18979 @item -fdump-rtl-mach
18980 Dump after performing the machine dependent reorganization pass, if that
18981 pass exists.
18982
18983 @opindex fdump-rtl-mode_sw
18984 @item -fdump-rtl-mode_sw
18985 Dump after removing redundant mode switches.
18986
18987 @opindex fdump-rtl-rnreg
18988 @item -fdump-rtl-rnreg
18989 Dump after register renumbering.
18990
18991 @opindex fdump-rtl-outof_cfglayout
18992 @item -fdump-rtl-outof_cfglayout
18993 Dump after converting from cfglayout mode.
18994
18995 @opindex fdump-rtl-peephole2
18996 @item -fdump-rtl-peephole2
18997 Dump after the peephole pass.
18998
18999 @opindex fdump-rtl-postreload
19000 @item -fdump-rtl-postreload
19001 Dump after post-reload optimizations.
19002
19003 @opindex fdump-rtl-pro_and_epilogue
19004 @item -fdump-rtl-pro_and_epilogue
19005 Dump after generating the function prologues and epilogues.
19006
19007 @opindex fdump-rtl-sched1
19008 @opindex fdump-rtl-sched2
19009 @item -fdump-rtl-sched1
19010 @itemx -fdump-rtl-sched2
19011 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19012 after the basic block scheduling passes.
19013
19014 @opindex fdump-rtl-ree
19015 @item -fdump-rtl-ree
19016 Dump after sign/zero extension elimination.
19017
19018 @opindex fdump-rtl-seqabstr
19019 @item -fdump-rtl-seqabstr
19020 Dump after common sequence discovery.
19021
19022 @opindex fdump-rtl-shorten
19023 @item -fdump-rtl-shorten
19024 Dump after shortening branches.
19025
19026 @opindex fdump-rtl-sibling
19027 @item -fdump-rtl-sibling
19028 Dump after sibling call optimizations.
19029
19030 @opindex fdump-rtl-split1
19031 @opindex fdump-rtl-split2
19032 @opindex fdump-rtl-split3
19033 @opindex fdump-rtl-split4
19034 @opindex fdump-rtl-split5
19035 @item -fdump-rtl-split1
19036 @itemx -fdump-rtl-split2
19037 @itemx -fdump-rtl-split3
19038 @itemx -fdump-rtl-split4
19039 @itemx -fdump-rtl-split5
19040 These options enable dumping after five rounds of
19041 instruction splitting.
19042
19043 @opindex fdump-rtl-sms
19044 @item -fdump-rtl-sms
19045 Dump after modulo scheduling. This pass is only run on some
19046 architectures.
19047
19048 @opindex fdump-rtl-stack
19049 @item -fdump-rtl-stack
19050 Dump after conversion from GCC's ``flat register file'' registers to the
19051 x87's stack-like registers. This pass is only run on x86 variants.
19052
19053 @opindex fdump-rtl-subreg1
19054 @opindex fdump-rtl-subreg2
19055 @item -fdump-rtl-subreg1
19056 @itemx -fdump-rtl-subreg2
19057 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19058 the two subreg expansion passes.
19059
19060 @opindex fdump-rtl-unshare
19061 @item -fdump-rtl-unshare
19062 Dump after all rtl has been unshared.
19063
19064 @opindex fdump-rtl-vartrack
19065 @item -fdump-rtl-vartrack
19066 Dump after variable tracking.
19067
19068 @opindex fdump-rtl-vregs
19069 @item -fdump-rtl-vregs
19070 Dump after converting virtual registers to hard registers.
19071
19072 @opindex fdump-rtl-web
19073 @item -fdump-rtl-web
19074 Dump after live range splitting.
19075
19076 @opindex fdump-rtl-regclass
19077 @opindex fdump-rtl-subregs_of_mode_init
19078 @opindex fdump-rtl-subregs_of_mode_finish
19079 @opindex fdump-rtl-dfinit
19080 @opindex fdump-rtl-dfinish
19081 @item -fdump-rtl-regclass
19082 @itemx -fdump-rtl-subregs_of_mode_init
19083 @itemx -fdump-rtl-subregs_of_mode_finish
19084 @itemx -fdump-rtl-dfinit
19085 @itemx -fdump-rtl-dfinish
19086 These dumps are defined but always produce empty files.
19087
19088 @opindex da
19089 @opindex fdump-rtl-all
19090 @item -da
19091 @itemx -fdump-rtl-all
19092 Produce all the dumps listed above.
19093
19094 @opindex dA
19095 @item -dA
19096 Annotate the assembler output with miscellaneous debugging information.
19097
19098 @opindex dD
19099 @item -dD
19100 Dump all macro definitions, at the end of preprocessing, in addition to
19101 normal output.
19102
19103 @opindex dH
19104 @item -dH
19105 Produce a core dump whenever an error occurs.
19106
19107 @opindex dp
19108 @item -dp
19109 Annotate the assembler output with a comment indicating which
19110 pattern and alternative is used. The length and cost of each instruction are
19111 also printed.
19112
19113 @opindex dP
19114 @item -dP
19115 Dump the RTL in the assembler output as a comment before each instruction.
19116 Also turns on @option{-dp} annotation.
19117
19118 @opindex dx
19119 @item -dx
19120 Just generate RTL for a function instead of compiling it. Usually used
19121 with @option{-fdump-rtl-expand}.
19122 @end table
19123
19124 @opindex fdump-debug
19125 @item -fdump-debug
19126 Dump debugging information generated during the debug
19127 generation phase.
19128
19129 @opindex fdump-earlydebug
19130 @item -fdump-earlydebug
19131 Dump debugging information generated during the early debug
19132 generation phase.
19133
19134 @opindex fdump-noaddr
19135 @item -fdump-noaddr
19136 When doing debugging dumps, suppress address output. This makes it more
19137 feasible to use diff on debugging dumps for compiler invocations with
19138 different compiler binaries and/or different
19139 text / bss / data / heap / stack / dso start locations.
19140
19141 @opindex freport-bug
19142 @item -freport-bug
19143 Collect and dump debug information into a temporary file if an
19144 internal compiler error (ICE) occurs.
19145
19146 @opindex fdump-unnumbered
19147 @item -fdump-unnumbered
19148 When doing debugging dumps, suppress instruction numbers and address output.
19149 This makes it more feasible to use diff on debugging dumps for compiler
19150 invocations with different options, in particular with and without
19151 @option{-g}.
19152
19153 @opindex fdump-unnumbered-links
19154 @item -fdump-unnumbered-links
19155 When doing debugging dumps (see @option{-d} option above), suppress
19156 instruction numbers for the links to the previous and next instructions
19157 in a sequence.
19158
19159 @opindex fdump-ipa
19160 @item -fdump-ipa-@var{switch}
19161 @itemx -fdump-ipa-@var{switch}-@var{options}
19162 Control the dumping at various stages of inter-procedural analysis
19163 language tree to a file. The file name is generated by appending a
19164 switch specific suffix to the source file name, and the file is created
19165 in the same directory as the output file. The following dumps are
19166 possible:
19167
19168 @table @samp
19169 @item all
19170 Enables all inter-procedural analysis dumps.
19171
19172 @item cgraph
19173 Dumps information about call-graph optimization, unused function removal,
19174 and inlining decisions.
19175
19176 @item inline
19177 Dump after function inlining.
19178
19179 @end table
19180
19181 Additionally, the options @option{-optimized}, @option{-missed},
19182 @option{-note}, and @option{-all} can be provided, with the same meaning
19183 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19184
19185 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19186 information on callsites that were inlined, along with callsites
19187 that were not inlined.
19188
19189 By default, the dump will contain messages about successful
19190 optimizations (equivalent to @option{-optimized}) together with
19191 low-level details about the analysis.
19192
19193 @opindex fdump-lang
19194 @item -fdump-lang
19195 Dump language-specific information. The file name is made by appending
19196 @file{.lang} to the source file name.
19197
19198 @opindex fdump-lang-all
19199 @opindex fdump-lang
19200 @item -fdump-lang-all
19201 @itemx -fdump-lang-@var{switch}
19202 @itemx -fdump-lang-@var{switch}-@var{options}
19203 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19204 Control the dumping of language-specific information. The @var{options}
19205 and @var{filename} portions behave as described in the
19206 @option{-fdump-tree} option. The following @var{switch} values are
19207 accepted:
19208
19209 @table @samp
19210 @item all
19211
19212 Enable all language-specific dumps.
19213
19214 @item class
19215 Dump class hierarchy information. Virtual table information is emitted
19216 unless '@option{slim}' is specified. This option is applicable to C++ only.
19217
19218 @item module
19219 Dump module information. Options @option{lineno} (locations),
19220 @option{graph} (reachability), @option{blocks} (clusters),
19221 @option{uid} (serialization), @option{alias} (mergeable),
19222 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19223 (macros) may provide additional information. This option is
19224 applicable to C++ only.
19225
19226 @item raw
19227 Dump the raw internal tree data. This option is applicable to C++ only.
19228
19229 @end table
19230
19231 @opindex fdump-passes
19232 @item -fdump-passes
19233 Print on @file{stderr} the list of optimization passes that are turned
19234 on and off by the current command-line options.
19235
19236 @opindex fdump-statistics
19237 @item -fdump-statistics-@var{option}
19238 Enable and control dumping of pass statistics in a separate file. The
19239 file name is generated by appending a suffix ending in
19240 @samp{.statistics} to the source file name, and the file is created in
19241 the same directory as the output file. If the @samp{-@var{option}}
19242 form is used, @samp{-stats} causes counters to be summed over the
19243 whole compilation unit while @samp{-details} dumps every event as
19244 the passes generate them. The default with no option is to sum
19245 counters for each function compiled.
19246
19247 @opindex fdump-tree-all
19248 @opindex fdump-tree
19249 @item -fdump-tree-all
19250 @itemx -fdump-tree-@var{switch}
19251 @itemx -fdump-tree-@var{switch}-@var{options}
19252 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19253 Control the dumping at various stages of processing the intermediate
19254 language tree to a file. If the @samp{-@var{options}}
19255 form is used, @var{options} is a list of @samp{-} separated options
19256 which control the details of the dump. Not all options are applicable
19257 to all dumps; those that are not meaningful are ignored. The
19258 following options are available
19259
19260 @table @samp
19261 @item address
19262 Print the address of each node. Usually this is not meaningful as it
19263 changes according to the environment and source file. Its primary use
19264 is for tying up a dump file with a debug environment.
19265 @item asmname
19266 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19267 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
19268 use working backward from mangled names in the assembly file.
19269 @item slim
19270 When dumping front-end intermediate representations, inhibit dumping
19271 of members of a scope or body of a function merely because that scope
19272 has been reached. Only dump such items when they are directly reachable
19273 by some other path.
19274
19275 When dumping pretty-printed trees, this option inhibits dumping the
19276 bodies of control structures.
19277
19278 When dumping RTL, print the RTL in slim (condensed) form instead of
19279 the default LISP-like representation.
19280 @item raw
19281 Print a raw representation of the tree. By default, trees are
19282 pretty-printed into a C-like representation.
19283 @item details
19284 Enable more detailed dumps (not honored by every dump option). Also
19285 include information from the optimization passes.
19286 @item stats
19287 Enable dumping various statistics about the pass (not honored by every dump
19288 option).
19289 @item blocks
19290 Enable showing basic block boundaries (disabled in raw dumps).
19291 @item graph
19292 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19293 dump a representation of the control flow graph suitable for viewing with
19294 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
19295 the file is pretty-printed as a subgraph, so that GraphViz can render them
19296 all in a single plot.
19297
19298 This option currently only works for RTL dumps, and the RTL is always
19299 dumped in slim form.
19300 @item vops
19301 Enable showing virtual operands for every statement.
19302 @item lineno
19303 Enable showing line numbers for statements.
19304 @item uid
19305 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19306 @item verbose
19307 Enable showing the tree dump for each statement.
19308 @item eh
19309 Enable showing the EH region number holding each statement.
19310 @item scev
19311 Enable showing scalar evolution analysis details.
19312 @item optimized
19313 Enable showing optimization information (only available in certain
19314 passes).
19315 @item missed
19316 Enable showing missed optimization information (only available in certain
19317 passes).
19318 @item note
19319 Enable other detailed optimization information (only available in
19320 certain passes).
19321 @item all
19322 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19323 and @option{lineno}.
19324 @item optall
19325 Turn on all optimization options, i.e., @option{optimized},
19326 @option{missed}, and @option{note}.
19327 @end table
19328
19329 To determine what tree dumps are available or find the dump for a pass
19330 of interest follow the steps below.
19331
19332 @enumerate
19333 @item
19334 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19335 look for a code that corresponds to the pass you are interested in.
19336 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19337 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19338 The number at the end distinguishes distinct invocations of the same pass.
19339 @item
19340 To enable the creation of the dump file, append the pass code to
19341 the @option{-fdump-} option prefix and invoke GCC with it. For example,
19342 to enable the dump from the Early Value Range Propagation pass, invoke
19343 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
19344 specify the name of the dump file. If you don't specify one, GCC
19345 creates as described below.
19346 @item
19347 Find the pass dump in a file whose name is composed of three components
19348 separated by a period: the name of the source file GCC was invoked to
19349 compile, a numeric suffix indicating the pass number followed by the
19350 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19351 and finally the pass code. For example, the Early VRP pass dump might
19352 be in a file named @file{myfile.c.038t.evrp} in the current working
19353 directory. Note that the numeric codes are not stable and may change
19354 from one version of GCC to another.
19355 @end enumerate
19356
19357 @opindex fopt-info
19358 @item -fopt-info
19359 @itemx -fopt-info-@var{options}
19360 @itemx -fopt-info-@var{options}=@var{filename}
19361 Controls optimization dumps from various optimization passes. If the
19362 @samp{-@var{options}} form is used, @var{options} is a list of
19363 @samp{-} separated option keywords to select the dump details and
19364 optimizations.
19365
19366 The @var{options} can be divided into three groups:
19367 @enumerate
19368 @item
19369 options describing what kinds of messages should be emitted,
19370 @item
19371 options describing the verbosity of the dump, and
19372 @item
19373 options describing which optimizations should be included.
19374 @end enumerate
19375 The options from each group can be freely mixed as they are
19376 non-overlapping. However, in case of any conflicts,
19377 the later options override the earlier options on the command
19378 line.
19379
19380 The following options control which kinds of messages should be emitted:
19381
19382 @table @samp
19383 @item optimized
19384 Print information when an optimization is successfully applied. It is
19385 up to a pass to decide which information is relevant. For example, the
19386 vectorizer passes print the source location of loops which are
19387 successfully vectorized.
19388 @item missed
19389 Print information about missed optimizations. Individual passes
19390 control which information to include in the output.
19391 @item note
19392 Print verbose information about optimizations, such as certain
19393 transformations, more detailed messages about decisions etc.
19394 @item all
19395 Print detailed optimization information. This includes
19396 @samp{optimized}, @samp{missed}, and @samp{note}.
19397 @end table
19398
19399 The following option controls the dump verbosity:
19400
19401 @table @samp
19402 @item internals
19403 By default, only ``high-level'' messages are emitted. This option enables
19404 additional, more detailed, messages, which are likely to only be of interest
19405 to GCC developers.
19406 @end table
19407
19408 One or more of the following option keywords can be used to describe a
19409 group of optimizations:
19410
19411 @table @samp
19412 @item ipa
19413 Enable dumps from all interprocedural optimizations.
19414 @item loop
19415 Enable dumps from all loop optimizations.
19416 @item inline
19417 Enable dumps from all inlining optimizations.
19418 @item omp
19419 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19420 @item vec
19421 Enable dumps from all vectorization optimizations.
19422 @item optall
19423 Enable dumps from all optimizations. This is a superset of
19424 the optimization groups listed above.
19425 @end table
19426
19427 If @var{options} is
19428 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19429 about successful optimizations from all the passes, omitting messages
19430 that are treated as ``internals''.
19431
19432 If the @var{filename} is provided, then the dumps from all the
19433 applicable optimizations are concatenated into the @var{filename}.
19434 Otherwise the dump is output onto @file{stderr}. Though multiple
19435 @option{-fopt-info} options are accepted, only one of them can include
19436 a @var{filename}. If other filenames are provided then all but the
19437 first such option are ignored.
19438
19439 Note that the output @var{filename} is overwritten
19440 in case of multiple translation units. If a combined output from
19441 multiple translation units is desired, @file{stderr} should be used
19442 instead.
19443
19444 In the following example, the optimization info is output to
19445 @file{stderr}:
19446
19447 @smallexample
19448 gcc -O3 -fopt-info
19449 @end smallexample
19450
19451 This example:
19452 @smallexample
19453 gcc -O3 -fopt-info-missed=missed.all
19454 @end smallexample
19455
19456 @noindent
19457 outputs missed optimization report from all the passes into
19458 @file{missed.all}, and this one:
19459
19460 @smallexample
19461 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19462 @end smallexample
19463
19464 @noindent
19465 prints information about missed optimization opportunities from
19466 vectorization passes on @file{stderr}.
19467 Note that @option{-fopt-info-vec-missed} is equivalent to
19468 @option{-fopt-info-missed-vec}. The order of the optimization group
19469 names and message types listed after @option{-fopt-info} does not matter.
19470
19471 As another example,
19472 @smallexample
19473 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19474 @end smallexample
19475
19476 @noindent
19477 outputs information about missed optimizations as well as
19478 optimized locations from all the inlining passes into
19479 @file{inline.txt}.
19480
19481 Finally, consider:
19482
19483 @smallexample
19484 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19485 @end smallexample
19486
19487 @noindent
19488 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19489 in conflict since only one output file is allowed. In this case, only
19490 the first option takes effect and the subsequent options are
19491 ignored. Thus only @file{vec.miss} is produced which contains
19492 dumps from the vectorizer about missed opportunities.
19493
19494 @opindex fsave-optimization-record
19495 @item -fsave-optimization-record
19496 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19497 were performed, for those optimizations that support @option{-fopt-info}.
19498
19499 This option is experimental and the format of the data within the
19500 compressed JSON file is subject to change.
19501
19502 It is roughly equivalent to a machine-readable version of
19503 @option{-fopt-info-all}, as a collection of messages with source file,
19504 line number and column number, with the following additional data for
19505 each message:
19506
19507 @itemize @bullet
19508
19509 @item
19510 the execution count of the code being optimized, along with metadata about
19511 whether this was from actual profile data, or just an estimate, allowing
19512 consumers to prioritize messages by code hotness,
19513
19514 @item
19515 the function name of the code being optimized, where applicable,
19516
19517 @item
19518 the ``inlining chain'' for the code being optimized, so that when
19519 a function is inlined into several different places (which might
19520 themselves be inlined), the reader can distinguish between the copies,
19521
19522 @item
19523 objects identifying those parts of the message that refer to expressions,
19524 statements or symbol-table nodes, which of these categories they are, and,
19525 when available, their source code location,
19526
19527 @item
19528 the GCC pass that emitted the message, and
19529
19530 @item
19531 the location in GCC's own code from which the message was emitted
19532
19533 @end itemize
19534
19535 Additionally, some messages are logically nested within other
19536 messages, reflecting implementation details of the optimization
19537 passes.
19538
19539 @opindex fsched-verbose
19540 @item -fsched-verbose=@var{n}
19541 On targets that use instruction scheduling, this option controls the
19542 amount of debugging output the scheduler prints to the dump files.
19543
19544 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19545 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19546 For @var{n} greater than one, it also output basic block probabilities,
19547 detailed ready list information and unit/insn info. For @var{n} greater
19548 than two, it includes RTL at abort point, control-flow and regions info.
19549 And for @var{n} over four, @option{-fsched-verbose} also includes
19550 dependence info.
19551
19552
19553
19554 @opindex fdisable-
19555 @opindex fenable-
19556 @item -fenable-@var{kind}-@var{pass}
19557 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19558
19559 This is a set of options that are used to explicitly disable/enable
19560 optimization passes. These options are intended for use for debugging GCC.
19561 Compiler users should use regular options for enabling/disabling
19562 passes instead.
19563
19564 @table @gcctabopt
19565
19566 @item -fdisable-ipa-@var{pass}
19567 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
19568 statically invoked in the compiler multiple times, the pass name should be
19569 appended with a sequential number starting from 1.
19570
19571 @item -fdisable-rtl-@var{pass}
19572 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19573 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
19574 statically invoked in the compiler multiple times, the pass name should be
19575 appended with a sequential number starting from 1. @var{range-list} is a
19576 comma-separated list of function ranges or assembler names. Each range is a number
19577 pair separated by a colon. The range is inclusive in both ends. If the range
19578 is trivial, the number pair can be simplified as a single number. If the
19579 function's call graph node's @var{uid} falls within one of the specified ranges,
19580 the @var{pass} is disabled for that function. The @var{uid} is shown in the
19581 function header of a dump file, and the pass names can be dumped by using
19582 option @option{-fdump-passes}.
19583
19584 @item -fdisable-tree-@var{pass}
19585 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19586 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
19587 option arguments.
19588
19589 @item -fenable-ipa-@var{pass}
19590 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
19591 statically invoked in the compiler multiple times, the pass name should be
19592 appended with a sequential number starting from 1.
19593
19594 @item -fenable-rtl-@var{pass}
19595 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19596 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
19597 description and examples.
19598
19599 @item -fenable-tree-@var{pass}
19600 @itemx -fenable-tree-@var{pass}=@var{range-list}
19601 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
19602 of option arguments.
19603
19604 @end table
19605
19606 Here are some examples showing uses of these options.
19607
19608 @smallexample
19609
19610 # disable ccp1 for all functions
19611 -fdisable-tree-ccp1
19612 # disable complete unroll for function whose cgraph node uid is 1
19613 -fenable-tree-cunroll=1
19614 # disable gcse2 for functions at the following ranges [1,1],
19615 # [300,400], and [400,1000]
19616 # disable gcse2 for functions foo and foo2
19617 -fdisable-rtl-gcse2=foo,foo2
19618 # disable early inlining
19619 -fdisable-tree-einline
19620 # disable ipa inlining
19621 -fdisable-ipa-inline
19622 # enable tree full unroll
19623 -fenable-tree-unroll
19624
19625 @end smallexample
19626
19627 @opindex fchecking
19628 @opindex fno-checking
19629 @item -fchecking
19630 @itemx -fchecking=@var{n}
19631 Enable internal consistency checking. The default depends on
19632 the compiler configuration. @option{-fchecking=2} enables further
19633 internal consistency checking that might affect code generation.
19634
19635 @opindex frandom-seed
19636 @item -frandom-seed=@var{string}
19637 This option provides a seed that GCC uses in place of
19638 random numbers in generating certain symbol names
19639 that have to be different in every compiled file. It is also used to
19640 place unique stamps in coverage data files and the object files that
19641 produce them. You can use the @option{-frandom-seed} option to produce
19642 reproducibly identical object files.
19643
19644 The @var{string} can either be a number (decimal, octal or hex) or an
19645 arbitrary string (in which case it's converted to a number by
19646 computing CRC32).
19647
19648 The @var{string} should be different for every file you compile.
19649
19650 @opindex save-temps
19651 @item -save-temps
19652 Store the usual ``temporary'' intermediate files permanently; name them
19653 as auxiliary output files, as specified described under
19654 @option{-dumpbase} and @option{-dumpdir}.
19655
19656 When used in combination with the @option{-x} command-line option,
19657 @option{-save-temps} is sensible enough to avoid overwriting an
19658 input source file with the same extension as an intermediate file.
19659 The corresponding intermediate file may be obtained by renaming the
19660 source file before using @option{-save-temps}.
19661
19662 @opindex save-temps=cwd
19663 @item -save-temps=cwd
19664 Equivalent to @option{-save-temps -dumpdir ./}.
19665
19666 @opindex save-temps=obj
19667 @item -save-temps=obj
19668 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19669 @file{outdir/} is the directory of the output file specified after the
19670 @option{-o} option, including any directory separators. If the
19671 @option{-o} option is not used, the @option{-save-temps=obj} switch
19672 behaves like @option{-save-temps=cwd}.
19673
19674 @opindex time
19675 @item -time@r{[}=@var{file}@r{]}
19676 Report the CPU time taken by each subprocess in the compilation
19677 sequence. For C source files, this is the compiler proper and assembler
19678 (plus the linker if linking is done).
19679
19680 Without the specification of an output file, the output looks like this:
19681
19682 @smallexample
19683 # cc1 0.12 0.01
19684 # as 0.00 0.01
19685 @end smallexample
19686
19687 The first number on each line is the ``user time'', that is time spent
19688 executing the program itself. The second number is ``system time'',
19689 time spent executing operating system routines on behalf of the program.
19690 Both numbers are in seconds.
19691
19692 With the specification of an output file, the output is appended to the
19693 named file, and it looks like this:
19694
19695 @smallexample
19696 0.12 0.01 cc1 @var{options}
19697 0.00 0.01 as @var{options}
19698 @end smallexample
19699
19700 The ``user time'' and the ``system time'' are moved before the program
19701 name, and the options passed to the program are displayed, so that one
19702 can later tell what file was being compiled, and with which options.
19703
19704 @opindex fdump-final-insns
19705 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19706 Dump the final internal representation (RTL) to @var{file}. If the
19707 optional argument is omitted (or if @var{file} is @code{.}), the name
19708 of the dump file is determined by appending @code{.gkd} to the
19709 dump base name, see @option{-dumpbase}.
19710
19711 @opindex fcompare-debug
19712 @opindex fno-compare-debug
19713 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19714 If no error occurs during compilation, run the compiler a second time,
19715 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19716 passed to the second compilation. Dump the final internal
19717 representation in both compilations, and print an error if they differ.
19718
19719 If the equal sign is omitted, the default @option{-gtoggle} is used.
19720
19721 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19722 and nonzero, implicitly enables @option{-fcompare-debug}. If
19723 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19724 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19725 is used.
19726
19727 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19728 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19729 of the final representation and the second compilation, preventing even
19730 @env{GCC_COMPARE_DEBUG} from taking effect.
19731
19732 To verify full coverage during @option{-fcompare-debug} testing, set
19733 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19734 which GCC rejects as an invalid option in any actual compilation
19735 (rather than preprocessing, assembly or linking). To get just a
19736 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19737 not overridden} will do.
19738
19739 @opindex fcompare-debug-second
19740 @item -fcompare-debug-second
19741 This option is implicitly passed to the compiler for the second
19742 compilation requested by @option{-fcompare-debug}, along with options to
19743 silence warnings, and omitting other options that would cause the compiler
19744 to produce output to files or to standard output as a side effect. Dump
19745 files and preserved temporary files are renamed so as to contain the
19746 @code{.gk} additional extension during the second compilation, to avoid
19747 overwriting those generated by the first.
19748
19749 When this option is passed to the compiler driver, it causes the
19750 @emph{first} compilation to be skipped, which makes it useful for little
19751 other than debugging the compiler proper.
19752
19753 @opindex gtoggle
19754 @item -gtoggle
19755 Turn off generation of debug info, if leaving out this option
19756 generates it, or turn it on at level 2 otherwise. The position of this
19757 argument in the command line does not matter; it takes effect after all
19758 other options are processed, and it does so only once, no matter how
19759 many times it is given. This is mainly intended to be used with
19760 @option{-fcompare-debug}.
19761
19762 @opindex fvar-tracking-assignments-toggle
19763 @opindex fno-var-tracking-assignments-toggle
19764 @item -fvar-tracking-assignments-toggle
19765 Toggle @option{-fvar-tracking-assignments}, in the same way that
19766 @option{-gtoggle} toggles @option{-g}.
19767
19768 @opindex Q
19769 @item -Q
19770 Makes the compiler print out each function name as it is compiled, and
19771 print some statistics about each pass when it finishes.
19772
19773 @opindex ftime-report
19774 @item -ftime-report
19775 Makes the compiler print some statistics about the time consumed by each
19776 pass when it finishes.
19777
19778 @opindex ftime-report-details
19779 @item -ftime-report-details
19780 Record the time consumed by infrastructure parts separately for each pass.
19781
19782 @opindex fira-verbose
19783 @item -fira-verbose=@var{n}
19784 Control the verbosity of the dump file for the integrated register allocator.
19785 The default value is 5. If the value @var{n} is greater or equal to 10,
19786 the dump output is sent to stderr using the same format as @var{n} minus 10.
19787
19788 @opindex flto-report
19789 @item -flto-report
19790 Prints a report with internal details on the workings of the link-time
19791 optimizer. The contents of this report vary from version to version.
19792 It is meant to be useful to GCC developers when processing object
19793 files in LTO mode (via @option{-flto}).
19794
19795 Disabled by default.
19796
19797 @opindex flto-report-wpa
19798 @item -flto-report-wpa
19799 Like @option{-flto-report}, but only print for the WPA phase of link-time
19800 optimization.
19801
19802 @opindex fmem-report
19803 @item -fmem-report
19804 Makes the compiler print some statistics about permanent memory
19805 allocation when it finishes.
19806
19807 @opindex fmem-report-wpa
19808 @item -fmem-report-wpa
19809 Makes the compiler print some statistics about permanent memory
19810 allocation for the WPA phase only.
19811
19812 @opindex fpre-ipa-mem-report
19813 @opindex fpost-ipa-mem-report
19814 @item -fpre-ipa-mem-report
19815 @item -fpost-ipa-mem-report
19816 Makes the compiler print some statistics about permanent memory
19817 allocation before or after interprocedural optimization.
19818
19819 @opindex fmultiflags
19820 @item -fmultiflags
19821 This option enables multilib-aware @code{TFLAGS} to be used to build
19822 target libraries with options different from those the compiler is
19823 configured to use by default, through the use of specs (@xref{Spec
19824 Files}) set up by compiler internals, by the target, or by builders at
19825 configure time.
19826
19827 Like @code{TFLAGS}, this allows the target libraries to be built for
19828 portable baseline environments, while the compiler defaults to more
19829 demanding ones. That's useful because users can easily override the
19830 defaults the compiler is configured to use to build their own programs,
19831 if the defaults are not ideal for their target environment, whereas
19832 rebuilding the runtime libraries is usually not as easy or desirable.
19833
19834 Unlike @code{TFLAGS}, the use of specs enables different flags to be
19835 selected for different multilibs. The way to accomplish that is to
19836 build with @samp{make TFLAGS=-fmultiflags}, after configuring
19837 @samp{--with-specs=%@{fmultiflags:...@}}.
19838
19839 This option is discarded by the driver once it's done processing driver
19840 self spec.
19841
19842 It is also useful to check that @code{TFLAGS} are being used to build
19843 all target libraries, by configuring a non-bootstrap compiler
19844 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
19845 the compiler and target libraries.
19846
19847 @opindex fprofile-report
19848 @item -fprofile-report
19849 Makes the compiler print some statistics about consistency of the
19850 (estimated) profile and effect of individual passes.
19851
19852 @opindex fstack-usage
19853 @item -fstack-usage
19854 Makes the compiler output stack usage information for the program, on a
19855 per-function basis. The filename for the dump is made by appending
19856 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
19857 the output file, if explicitly specified and it is not an executable,
19858 otherwise it is the basename of the source file. An entry is made up
19859 of three fields:
19860
19861 @itemize
19862 @item
19863 The name of the function.
19864 @item
19865 A number of bytes.
19866 @item
19867 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
19868 @end itemize
19869
19870 The qualifier @code{static} means that the function manipulates the stack
19871 statically: a fixed number of bytes are allocated for the frame on function
19872 entry and released on function exit; no stack adjustments are otherwise made
19873 in the function. The second field is this fixed number of bytes.
19874
19875 The qualifier @code{dynamic} means that the function manipulates the stack
19876 dynamically: in addition to the static allocation described above, stack
19877 adjustments are made in the body of the function, for example to push/pop
19878 arguments around function calls. If the qualifier @code{bounded} is also
19879 present, the amount of these adjustments is bounded at compile time and
19880 the second field is an upper bound of the total amount of stack used by
19881 the function. If it is not present, the amount of these adjustments is
19882 not bounded at compile time and the second field only represents the
19883 bounded part.
19884
19885 @opindex fstats
19886 @item -fstats
19887 Emit statistics about front-end processing at the end of the compilation.
19888 This option is supported only by the C++ front end, and
19889 the information is generally only useful to the G++ development team.
19890
19891 @opindex fdbg-cnt-list
19892 @item -fdbg-cnt-list
19893 Print the name and the counter upper bound for all debug counters.
19894
19895
19896 @opindex fdbg-cnt
19897 @item -fdbg-cnt=@var{counter-value-list}
19898 Set the internal debug counter lower and upper bound. @var{counter-value-list}
19899 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
19900 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
19901 the name of the counter and list of closed intervals.
19902 The @var{lower_bound} is optional and is zero
19903 initialized if not set.
19904 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
19905 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
19906 eleventh invocation.
19907 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
19908
19909 @opindex print-file-name
19910 @item -print-file-name=@var{library}
19911 Print the full absolute name of the library file @var{library} that
19912 would be used when linking---and don't do anything else. With this
19913 option, GCC does not compile or link anything; it just prints the
19914 file name.
19915
19916 @opindex print-multi-directory
19917 @item -print-multi-directory
19918 Print the directory name corresponding to the multilib selected by any
19919 other switches present in the command line. This directory is supposed
19920 to exist in @env{GCC_EXEC_PREFIX}.
19921
19922 @opindex print-multi-lib
19923 @item -print-multi-lib
19924 Print the mapping from multilib directory names to compiler switches
19925 that enable them. The directory name is separated from the switches by
19926 @samp{;}, and each switch starts with an @samp{@@} instead of the
19927 @samp{-}, without spaces between multiple switches. This is supposed to
19928 ease shell processing.
19929
19930 @opindex print-multi-os-directory
19931 @item -print-multi-os-directory
19932 Print the path to OS libraries for the selected
19933 multilib, relative to some @file{lib} subdirectory. If OS libraries are
19934 present in the @file{lib} subdirectory and no multilibs are used, this is
19935 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
19936 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
19937 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
19938 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
19939
19940 @opindex print-multiarch
19941 @item -print-multiarch
19942 Print the path to OS libraries for the selected multiarch,
19943 relative to some @file{lib} subdirectory.
19944
19945 @opindex print-prog-name
19946 @item -print-prog-name=@var{program}
19947 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
19948
19949 @opindex print-libgcc-file-name
19950 @item -print-libgcc-file-name
19951 Same as @option{-print-file-name=libgcc.a}.
19952
19953 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
19954 but you do want to link with @file{libgcc.a}. You can do:
19955
19956 @smallexample
19957 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
19958 @end smallexample
19959
19960 @opindex print-search-dirs
19961 @item -print-search-dirs
19962 Print the name of the configured installation directory and a list of
19963 program and library directories @command{gcc} searches---and don't do anything else.
19964
19965 This is useful when @command{gcc} prints the error message
19966 @samp{installation problem, cannot exec cpp0: No such file or directory}.
19967 To resolve this you either need to put @file{cpp0} and the other compiler
19968 components where @command{gcc} expects to find them, or you can set the environment
19969 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
19970 Don't forget the trailing @samp{/}.
19971 @xref{Environment Variables}.
19972
19973 @opindex print-sysroot
19974 @item -print-sysroot
19975 Print the target sysroot directory that is used during
19976 compilation. This is the target sysroot specified either at configure
19977 time or using the @option{--sysroot} option, possibly with an extra
19978 suffix that depends on compilation options. If no target sysroot is
19979 specified, the option prints nothing.
19980
19981 @opindex print-sysroot-headers-suffix
19982 @item -print-sysroot-headers-suffix
19983 Print the suffix added to the target sysroot when searching for
19984 headers, or give an error if the compiler is not configured with such
19985 a suffix---and don't do anything else.
19986
19987 @opindex dumpmachine
19988 @item -dumpmachine
19989 Print the compiler's target machine (for example,
19990 @samp{i686-pc-linux-gnu})---and don't do anything else.
19991
19992 @opindex dumpversion
19993 @item -dumpversion
19994 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
19995 anything else. This is the compiler version used in filesystem paths and
19996 specs. Depending on how the compiler has been configured it can be just
19997 a single number (major version), two numbers separated by a dot (major and
19998 minor version) or three numbers separated by dots (major, minor and patchlevel
19999 version).
20000
20001 @opindex dumpfullversion
20002 @item -dumpfullversion
20003 Print the full compiler version---and don't do anything else. The output is
20004 always three numbers separated by dots, major, minor and patchlevel version.
20005
20006 @opindex dumpspecs
20007 @item -dumpspecs
20008 Print the compiler's built-in specs---and don't do anything else. (This
20009 is used when GCC itself is being built.) @xref{Spec Files}.
20010 @end table
20011
20012 @node Submodel Options
20013 @section Machine-Dependent Options
20014 @cindex submodel options
20015 @cindex specifying hardware config
20016 @cindex hardware models and configurations, specifying
20017 @cindex target-dependent options
20018 @cindex machine-dependent options
20019
20020 Each target machine supported by GCC can have its own options---for
20021 example, to allow you to compile for a particular processor variant or
20022 ABI, or to control optimizations specific to that machine. By
20023 convention, the names of machine-specific options start with
20024 @samp{-m}.
20025
20026 Some configurations of the compiler also support additional target-specific
20027 options, usually for compatibility with other compilers on the same
20028 platform.
20029
20030 @c This list is ordered alphanumerically by subsection name.
20031 @c It should be the same order and spelling as these options are listed
20032 @c in Machine Dependent Options
20033
20034 @menu
20035 * AArch64 Options::
20036 * Adapteva Epiphany Options::
20037 * AMD GCN Options::
20038 * ARC Options::
20039 * ARM Options::
20040 * AVR Options::
20041 * Blackfin Options::
20042 * C6X Options::
20043 * CRIS Options::
20044 * C-SKY Options::
20045 * Darwin Options::
20046 * DEC Alpha Options::
20047 * eBPF Options::
20048 * FR30 Options::
20049 * FT32 Options::
20050 * FRV Options::
20051 * GNU/Linux Options::
20052 * H8/300 Options::
20053 * HPPA Options::
20054 * IA-64 Options::
20055 * LM32 Options::
20056 * LoongArch Options::
20057 * M32C Options::
20058 * M32R/D Options::
20059 * M680x0 Options::
20060 * MCore Options::
20061 * MicroBlaze Options::
20062 * MIPS Options::
20063 * MMIX Options::
20064 * MN10300 Options::
20065 * Moxie Options::
20066 * MSP430 Options::
20067 * NDS32 Options::
20068 * Nios II Options::
20069 * Nvidia PTX Options::
20070 * OpenRISC Options::
20071 * PDP-11 Options::
20072 * PowerPC Options::
20073 * PRU Options::
20074 * RISC-V Options::
20075 * RL78 Options::
20076 * RS/6000 and PowerPC Options::
20077 * RX Options::
20078 * S/390 and zSeries Options::
20079 * SH Options::
20080 * Solaris 2 Options::
20081 * SPARC Options::
20082 * System V Options::
20083 * V850 Options::
20084 * VAX Options::
20085 * Visium Options::
20086 * VMS Options::
20087 * VxWorks Options::
20088 * x86 Options::
20089 * x86 Windows Options::
20090 * Xstormy16 Options::
20091 * Xtensa Options::
20092 * zSeries Options::
20093 @end menu
20094
20095 @node AArch64 Options
20096 @subsection AArch64 Options
20097 @cindex AArch64 Options
20098
20099 These options are defined for AArch64 implementations:
20100
20101 @table @gcctabopt
20102
20103 @opindex mabi
20104 @item -mabi=@var{name}
20105 Generate code for the specified data model. Permissible values
20106 are @samp{ilp32} for SysV-like data model where int, long int and pointers
20107 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
20108 but long int and pointers are 64 bits.
20109
20110 The default depends on the specific target configuration. Note that
20111 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
20112 entire program with the same ABI, and link with a compatible set of libraries.
20113
20114 @opindex mbig-endian
20115 @item -mbig-endian
20116 Generate big-endian code. This is the default when GCC is configured for an
20117 @samp{aarch64_be-*-*} target.
20118
20119 @opindex mgeneral-regs-only
20120 @item -mgeneral-regs-only
20121 Generate code which uses only the general-purpose registers. This will prevent
20122 the compiler from using floating-point and Advanced SIMD registers but will not
20123 impose any restrictions on the assembler.
20124
20125 @opindex mlittle-endian
20126 @item -mlittle-endian
20127 Generate little-endian code. This is the default when GCC is configured for an
20128 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
20129
20130 @opindex mcmodel=tiny
20131 @item -mcmodel=tiny
20132 Generate code for the tiny code model. The program and its statically defined
20133 symbols must be within 1MB of each other. Programs can be statically or
20134 dynamically linked.
20135
20136 @opindex mcmodel=small
20137 @item -mcmodel=small
20138 Generate code for the small code model. The program and its statically defined
20139 symbols must be within 4GB of each other. Programs can be statically or
20140 dynamically linked. This is the default code model.
20141
20142 @opindex mcmodel=large
20143 @item -mcmodel=large
20144 Generate code for the large code model. This makes no assumptions about
20145 addresses and sizes of sections. Programs can be statically linked only. The
20146 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20147 @option{-fpic} and @option{-fPIC}.
20148
20149 @item -mtp=@var{name}
20150 @opindex mtp
20151 Specify the system register to use as a thread pointer. The valid values
20152 are @samp{el0}, @samp{el1}, @samp{el2}, @samp{el3}. These correspond to
20153 using the @samp{tpidr_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
20154 @samp{tpidr_el3} registers accordingly. The default setting is @samp{el0}.
20155 It is recommended to compile all code intended to interoperate with the same
20156 value of this option to avoid accessing a different thread pointer from the
20157 wrong exception level.
20158
20159 @opindex mstrict-align
20160 @opindex mno-strict-align
20161 @item -mstrict-align
20162 @itemx -mno-strict-align
20163 Avoid or allow generating memory accesses that may not be aligned on a natural
20164 object boundary as described in the architecture specification.
20165
20166 @opindex momit-leaf-frame-pointer
20167 @opindex mno-omit-leaf-frame-pointer
20168 @item -momit-leaf-frame-pointer
20169 @itemx -mno-omit-leaf-frame-pointer
20170 Omit or keep the frame pointer in leaf functions. The former behavior is the
20171 default.
20172
20173 @opindex mstack-protector-guard
20174 @opindex mstack-protector-guard-reg
20175 @opindex mstack-protector-guard-offset
20176 @item -mstack-protector-guard=@var{guard}
20177 @itemx -mstack-protector-guard-reg=@var{reg}
20178 @itemx -mstack-protector-guard-offset=@var{offset}
20179 Generate stack protection code using canary at @var{guard}. Supported
20180 locations are @samp{global} for a global canary or @samp{sysreg} for a
20181 canary in an appropriate system register.
20182
20183 With the latter choice the options
20184 @option{-mstack-protector-guard-reg=@var{reg}} and
20185 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20186 which system register to use as base register for reading the canary,
20187 and from what offset from that base register. There is no default
20188 register or offset as this is entirely for use within the Linux
20189 kernel.
20190
20191 @opindex mtls-dialect=desc
20192 @item -mtls-dialect=desc
20193 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20194 of TLS variables. This is the default.
20195
20196 @opindex mtls-dialect=traditional
20197 @item -mtls-dialect=traditional
20198 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20199 of TLS variables.
20200
20201 @opindex mtls-size
20202 @item -mtls-size=@var{size}
20203 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
20204 This option requires binutils 2.26 or newer.
20205
20206 @opindex mfix-cortex-a53-835769
20207 @opindex mno-fix-cortex-a53-835769
20208 @item -mfix-cortex-a53-835769
20209 @itemx -mno-fix-cortex-a53-835769
20210 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20211 This involves inserting a NOP instruction between memory instructions and
20212 64-bit integer multiply-accumulate instructions.
20213
20214 @opindex mfix-cortex-a53-843419
20215 @opindex mno-fix-cortex-a53-843419
20216 @item -mfix-cortex-a53-843419
20217 @itemx -mno-fix-cortex-a53-843419
20218 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20219 This erratum workaround is made at link time and this will only pass the
20220 corresponding flag to the linker.
20221
20222 @opindex mlow-precision-recip-sqrt
20223 @opindex mno-low-precision-recip-sqrt
20224 @item -mlow-precision-recip-sqrt
20225 @itemx -mno-low-precision-recip-sqrt
20226 Enable or disable the reciprocal square root approximation.
20227 This option only has an effect if @option{-ffast-math} or
20228 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20229 precision of reciprocal square root results to about 16 bits for
20230 single precision and to 32 bits for double precision.
20231
20232 @opindex mlow-precision-sqrt
20233 @opindex mno-low-precision-sqrt
20234 @item -mlow-precision-sqrt
20235 @itemx -mno-low-precision-sqrt
20236 Enable or disable the square root approximation.
20237 This option only has an effect if @option{-ffast-math} or
20238 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20239 precision of square root results to about 16 bits for
20240 single precision and to 32 bits for double precision.
20241 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20242
20243 @opindex mlow-precision-div
20244 @opindex mno-low-precision-div
20245 @item -mlow-precision-div
20246 @itemx -mno-low-precision-div
20247 Enable or disable the division approximation.
20248 This option only has an effect if @option{-ffast-math} or
20249 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20250 precision of division results to about 16 bits for
20251 single precision and to 32 bits for double precision.
20252
20253 @item -mtrack-speculation
20254 @itemx -mno-track-speculation
20255 Enable or disable generation of additional code to track speculative
20256 execution through conditional branches. The tracking state can then
20257 be used by the compiler when expanding calls to
20258 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20259 sequence to be generated.
20260
20261 @item -moutline-atomics
20262 @itemx -mno-outline-atomics
20263 Enable or disable calls to out-of-line helpers to implement atomic operations.
20264 These helpers will, at runtime, determine if the LSE instructions from
20265 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20266 instructions that are present in the base ARMv8.0 ISA.
20267
20268 This option is only applicable when compiling for the base ARMv8.0
20269 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
20270 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20271 used directly. The same applies when using @option{-mcpu=} when the
20272 selected cpu supports the @samp{lse} feature.
20273 This option is on by default.
20274
20275 @opindex march
20276 @item -march=@var{name}
20277 Specify the name of the target architecture and, optionally, one or
20278 more feature modifiers. This option has the form
20279 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20280
20281 The table below summarizes the permissible values for @var{arch}
20282 and the features that they enable by default:
20283
20284 @multitable @columnfractions 0.20 0.20 0.60
20285 @headitem @var{arch} value @tab Architecture @tab Includes by default
20286 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20287 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20288 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20289 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20290 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20291 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20292 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20293 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20294 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20295 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20296 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20297 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20298 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20299 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20300 @end multitable
20301
20302 The value @samp{native} is available on native AArch64 GNU/Linux and
20303 causes the compiler to pick the architecture of the host system. This
20304 option has no effect if the compiler is unable to recognize the
20305 architecture of the host system,
20306
20307 The permissible values for @var{feature} are listed in the sub-section
20308 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20309 Feature Modifiers}. Where conflicting feature modifiers are
20310 specified, the right-most feature is used.
20311
20312 GCC uses @var{name} to determine what kind of instructions it can emit
20313 when generating assembly code. If @option{-march} is specified
20314 without either of @option{-mtune} or @option{-mcpu} also being
20315 specified, the code is tuned to perform well across a range of target
20316 processors implementing the target architecture.
20317
20318 @opindex mtune
20319 @item -mtune=@var{name}
20320 Specify the name of the target processor for which GCC should tune the
20321 performance of the code. Permissible values for this option are:
20322 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20323 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20324 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20325 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20326 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20327 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20328 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20329 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20330 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20331 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
20332 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20333 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20334 @samp{octeontx2f95mm},
20335 @samp{a64fx},
20336 @samp{thunderx}, @samp{thunderxt88},
20337 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20338 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20339 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20340 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20341 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20342 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20343 @samp{cortex-x3}, @samp{cortex-a510}, @samp{cortex-a710}, @samp{cortex-a715},
20344 @samp{ampere1}, @samp{ampere1a}, and @samp{native}.
20345
20346 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20347 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20348 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20349 should tune for a big.LITTLE system.
20350
20351 The value @samp{neoverse-512tvb} specifies that GCC should tune
20352 for Neoverse cores that (a) implement SVE and (b) have a total vector
20353 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
20354 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20355 instructions a cycle and that can execute an equivalent number of SVE
20356 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20357 This is more general than tuning for a specific core like Neoverse V1
20358 but is more specific than the default tuning described below.
20359
20360 Additionally on native AArch64 GNU/Linux systems the value
20361 @samp{native} tunes performance to the host system. This option has no effect
20362 if the compiler is unable to recognize the processor of the host system.
20363
20364 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20365 are specified, the code is tuned to perform well across a range
20366 of target processors.
20367
20368 This option cannot be suffixed by feature modifiers.
20369
20370 @opindex mcpu
20371 @item -mcpu=@var{name}
20372 Specify the name of the target processor, optionally suffixed by one
20373 or more feature modifiers. This option has the form
20374 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20375 the permissible values for @var{cpu} are the same as those available
20376 for @option{-mtune}. The permissible values for @var{feature} are
20377 documented in the sub-section on
20378 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20379 Feature Modifiers}. Where conflicting feature modifiers are
20380 specified, the right-most feature is used.
20381
20382 GCC uses @var{name} to determine what kind of instructions it can emit when
20383 generating assembly code (as if by @option{-march}) and to determine
20384 the target processor for which to tune for performance (as if
20385 by @option{-mtune}). Where this option is used in conjunction
20386 with @option{-march} or @option{-mtune}, those options take precedence
20387 over the appropriate part of this option.
20388
20389 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20390 to a specific core, but instead refers to all Neoverse cores that
20391 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20392 a cycle. Unless overridden by @option{-march},
20393 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20394 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20395 these properties. Unless overridden by @option{-mtune},
20396 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20397 @option{-mtune=neoverse-512tvb}.
20398
20399 @opindex moverride
20400 @item -moverride=@var{string}
20401 Override tuning decisions made by the back-end in response to a
20402 @option{-mtune=} switch. The syntax, semantics, and accepted values
20403 for @var{string} in this option are not guaranteed to be consistent
20404 across releases.
20405
20406 This option is only intended to be useful when developing GCC.
20407
20408 @opindex mverbose-cost-dump
20409 @item -mverbose-cost-dump
20410 Enable verbose cost model dumping in the debug dump files. This option is
20411 provided for use in debugging the compiler.
20412
20413 @opindex mpc-relative-literal-loads
20414 @opindex mno-pc-relative-literal-loads
20415 @item -mpc-relative-literal-loads
20416 @itemx -mno-pc-relative-literal-loads
20417 Enable or disable PC-relative literal loads. With this option literal pools are
20418 accessed using a single instruction and emitted after each function. This
20419 limits the maximum size of functions to 1MB. This is enabled by default for
20420 @option{-mcmodel=tiny}.
20421
20422 @opindex msign-return-address
20423 @item -msign-return-address=@var{scope}
20424 Select the function scope on which return address signing will be applied.
20425 Permissible values are @samp{none}, which disables return address signing,
20426 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20427 functions, and @samp{all}, which enables pointer signing for all functions. The
20428 default value is @samp{none}. This option has been deprecated by
20429 -mbranch-protection.
20430
20431 @opindex mbranch-protection
20432 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20433 Select the branch protection features to use.
20434 @samp{none} is the default and turns off all types of branch protection.
20435 @samp{standard} turns on all types of branch protection features. If a feature
20436 has additional tuning options, then @samp{standard} sets it to its standard
20437 level.
20438 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20439 level: signing functions that save the return address to memory (non-leaf
20440 functions will practically always do this) using the a-key. The optional
20441 argument @samp{leaf} can be used to extend the signing to include leaf
20442 functions. The optional argument @samp{b-key} can be used to sign the functions
20443 with the B-key instead of the A-key.
20444 @samp{bti} turns on branch target identification mechanism.
20445
20446 @opindex mharden-sls
20447 @item -mharden-sls=@var{opts}
20448 Enable compiler hardening against straight line speculation (SLS).
20449 @var{opts} is a comma-separated list of the following options:
20450 @table @samp
20451 @item retbr
20452 @item blr
20453 @end table
20454 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20455 @samp{-mharden-sls=none} disables all SLS hardening.
20456
20457 @opindex msve-vector-bits
20458 @item -msve-vector-bits=@var{bits}
20459 Specify the number of bits in an SVE vector register. This option only has
20460 an effect when SVE is enabled.
20461
20462 GCC supports two forms of SVE code generation: ``vector-length
20463 agnostic'' output that works with any size of vector register and
20464 ``vector-length specific'' output that allows GCC to make assumptions
20465 about the vector length when it is useful for optimization reasons.
20466 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20467 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20468 Specifying @samp{scalable} selects vector-length agnostic
20469 output. At present @samp{-msve-vector-bits=128} also generates vector-length
20470 agnostic output for big-endian targets. All other values generate
20471 vector-length specific code. The behavior of these values may change
20472 in future releases and no value except @samp{scalable} should be
20473 relied on for producing code that is portable across different
20474 hardware SVE vector lengths.
20475
20476 The default is @samp{-msve-vector-bits=scalable}, which produces
20477 vector-length agnostic code.
20478 @end table
20479
20480 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20481 @anchor{aarch64-feature-modifiers}
20482 @cindex @option{-march} feature modifiers
20483 @cindex @option{-mcpu} feature modifiers
20484 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20485 the following and their inverses @option{no@var{feature}}:
20486
20487 @table @samp
20488 @item crc
20489 Enable CRC extension. This is on by default for
20490 @option{-march=armv8.1-a}.
20491 @item crypto
20492 Enable Crypto extension. This also enables Advanced SIMD and floating-point
20493 instructions.
20494 @item fp
20495 Enable floating-point instructions. This is on by default for all possible
20496 values for options @option{-march} and @option{-mcpu}.
20497 @item simd
20498 Enable Advanced SIMD instructions. This also enables floating-point
20499 instructions. This is on by default for all possible values for options
20500 @option{-march} and @option{-mcpu}.
20501 @item sve
20502 Enable Scalable Vector Extension instructions. This also enables Advanced
20503 SIMD and floating-point instructions.
20504 @item lse
20505 Enable Large System Extension instructions. This is on by default for
20506 @option{-march=armv8.1-a}.
20507 @item rdma
20508 Enable Round Double Multiply Accumulate instructions. This is on by default
20509 for @option{-march=armv8.1-a}.
20510 @item fp16
20511 Enable FP16 extension. This also enables floating-point instructions.
20512 @item fp16fml
20513 Enable FP16 fmla extension. This also enables FP16 extensions and
20514 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.
20515
20516 @item rcpc
20517 Enable the RCpc extension. This enables the use of the LDAPR instructions for
20518 load-acquire atomic semantics, and passes it on to the assembler, enabling
20519 inline asm statements to use instructions from the RCpc extension.
20520 @item dotprod
20521 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20522 @item aes
20523 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
20524 SIMD instructions.
20525 @item sha2
20526 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
20527 @item sha3
20528 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
20529 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20530 @item sm4
20531 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
20532 Use of this option with architectures prior to Armv8.2-A is not supported.
20533 @item profile
20534 Enable the Statistical Profiling extension. This option is only to enable the
20535 extension at the assembler level and does not affect code generation.
20536 @item rng
20537 Enable the Armv8.5-a Random Number instructions. This option is only to
20538 enable the extension at the assembler level and does not affect code
20539 generation.
20540 @item memtag
20541 Enable the Armv8.5-a Memory Tagging Extensions.
20542 Use of this option with architectures prior to Armv8.5-A is not supported.
20543 @item sb
20544 Enable the Armv8-a Speculation Barrier instruction. This option is only to
20545 enable the extension at the assembler level and does not affect code
20546 generation. This option is enabled by default for @option{-march=armv8.5-a}.
20547 @item ssbs
20548 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
20549 is only to enable the extension at the assembler level and does not affect code
20550 generation. This option is enabled by default for @option{-march=armv8.5-a}.
20551 @item predres
20552 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20553 This option is only to enable the extension at the assembler level and does
20554 not affect code generation. This option is enabled by default for
20555 @option{-march=armv8.5-a}.
20556 @item sve2
20557 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
20558 instructions.
20559 @item sve2-bitperm
20560 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
20561 @item sve2-sm4
20562 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
20563 @item sve2-aes
20564 Enable SVE2 aes instructions. This also enables SVE2 instructions.
20565 @item sve2-sha3
20566 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
20567 @item tme
20568 Enable the Transactional Memory Extension.
20569 @item i8mm
20570 Enable 8-bit Integer Matrix Multiply instructions. This also enables
20571 Advanced SIMD and floating-point instructions. This option is enabled by
20572 default for @option{-march=armv8.6-a}. Use of this option with architectures
20573 prior to Armv8.2-A is not supported.
20574 @item f32mm
20575 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
20576 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
20577 not supported.
20578 @item f64mm
20579 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
20580 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
20581 not supported.
20582 @item bf16
20583 Enable brain half-precision floating-point instructions. This also enables
20584 Advanced SIMD and floating-point instructions. This option is enabled by
20585 default for @option{-march=armv8.6-a}. Use of this option with architectures
20586 prior to Armv8.2-A is not supported.
20587 @item ls64
20588 Enable the 64-byte atomic load and store instructions for accelerators.
20589 This option is enabled by default for @option{-march=armv8.7-a}.
20590 @item mops
20591 Enable the instructions to accelerate memory operations like @code{memcpy},
20592 @code{memmove}, @code{memset}. This option is enabled by default for
20593 @option{-march=armv8.8-a}
20594 @item flagm
20595 Enable the Flag Manipulation instructions Extension.
20596 @item pauth
20597 Enable the Pointer Authentication Extension.
20598 @item cssc
20599 Enable the Common Short Sequence Compression instructions.
20600
20601 @end table
20602
20603 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20604 which implies @option{fp}.
20605 Conversely, @option{nofp} implies @option{nosimd}, which implies
20606 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20607
20608 @node Adapteva Epiphany Options
20609 @subsection Adapteva Epiphany Options
20610
20611 These @samp{-m} options are defined for Adapteva Epiphany:
20612
20613 @table @gcctabopt
20614 @opindex mhalf-reg-file
20615 @item -mhalf-reg-file
20616 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20617 That allows code to run on hardware variants that lack these registers.
20618
20619 @opindex mprefer-short-insn-regs
20620 @item -mprefer-short-insn-regs
20621 Preferentially allocate registers that allow short instruction generation.
20622 This can result in increased instruction count, so this may either reduce or
20623 increase overall code size.
20624
20625 @opindex mbranch-cost
20626 @item -mbranch-cost=@var{num}
20627 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20628 This cost is only a heuristic and is not guaranteed to produce
20629 consistent results across releases.
20630
20631 @opindex mcmove
20632 @item -mcmove
20633 Enable the generation of conditional moves.
20634
20635 @opindex mnops
20636 @item -mnops=@var{num}
20637 Emit @var{num} NOPs before every other generated instruction.
20638
20639 @opindex mno-soft-cmpsf
20640 @opindex msoft-cmpsf
20641 @item -mno-soft-cmpsf
20642 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20643 and test the flags. This is faster than a software comparison, but can
20644 get incorrect results in the presence of NaNs, or when two different small
20645 numbers are compared such that their difference is calculated as zero.
20646 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20647 software comparisons.
20648
20649 @opindex mstack-offset
20650 @item -mstack-offset=@var{num}
20651 Set the offset between the top of the stack and the stack pointer.
20652 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20653 can be used by leaf functions without stack allocation.
20654 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20655 Note also that this option changes the ABI; compiling a program with a
20656 different stack offset than the libraries have been compiled with
20657 generally does not work.
20658 This option can be useful if you want to evaluate if a different stack
20659 offset would give you better code, but to actually use a different stack
20660 offset to build working programs, it is recommended to configure the
20661 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20662
20663 @opindex mno-round-nearest
20664 @opindex mround-nearest
20665 @item -mno-round-nearest
20666 Make the scheduler assume that the rounding mode has been set to
20667 truncating. The default is @option{-mround-nearest}.
20668
20669 @opindex mlong-calls
20670 @item -mlong-calls
20671 If not otherwise specified by an attribute, assume all calls might be beyond
20672 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20673 function address into a register before performing a (otherwise direct) call.
20674 This is the default.
20675
20676 @opindex short-calls
20677 @item -mshort-calls
20678 If not otherwise specified by an attribute, assume all direct calls are
20679 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20680 for direct calls. The default is @option{-mlong-calls}.
20681
20682 @opindex msmall16
20683 @item -msmall16
20684 Assume addresses can be loaded as 16-bit unsigned values. This does not
20685 apply to function addresses for which @option{-mlong-calls} semantics
20686 are in effect.
20687
20688 @opindex mfp-mode
20689 @item -mfp-mode=@var{mode}
20690 Set the prevailing mode of the floating-point unit.
20691 This determines the floating-point mode that is provided and expected
20692 at function call and return time. Making this mode match the mode you
20693 predominantly need at function start can make your programs smaller and
20694 faster by avoiding unnecessary mode switches.
20695
20696 @var{mode} can be set to one the following values:
20697
20698 @table @samp
20699 @item caller
20700 Any mode at function entry is valid, and retained or restored when
20701 the function returns, and when it calls other functions.
20702 This mode is useful for compiling libraries or other compilation units
20703 you might want to incorporate into different programs with different
20704 prevailing FPU modes, and the convenience of being able to use a single
20705 object file outweighs the size and speed overhead for any extra
20706 mode switching that might be needed, compared with what would be needed
20707 with a more specific choice of prevailing FPU mode.
20708
20709 @item truncate
20710 This is the mode used for floating-point calculations with
20711 truncating (i.e.@: round towards zero) rounding mode. That includes
20712 conversion from floating point to integer.
20713
20714 @item round-nearest
20715 This is the mode used for floating-point calculations with
20716 round-to-nearest-or-even rounding mode.
20717
20718 @item int
20719 This is the mode used to perform integer calculations in the FPU, e.g.@:
20720 integer multiply, or integer multiply-and-accumulate.
20721 @end table
20722
20723 The default is @option{-mfp-mode=caller}
20724
20725 @opindex mno-split-lohi
20726 @opindex msplit-lohi
20727 @opindex mno-postinc
20728 @opindex mpostinc
20729 @opindex mno-postmodify
20730 @opindex mpostmodify
20731 @item -mno-split-lohi
20732 @itemx -mno-postinc
20733 @itemx -mno-postmodify
20734 Code generation tweaks that disable, respectively, splitting of 32-bit
20735 loads, generation of post-increment addresses, and generation of
20736 post-modify addresses. The defaults are @option{msplit-lohi},
20737 @option{-mpost-inc}, and @option{-mpost-modify}.
20738
20739 @opindex mno-vect-double
20740 @opindex mvect-double
20741 @item -mnovect-double
20742 Change the preferred SIMD mode to SImode. The default is
20743 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
20744
20745 @opindex max-vect-align
20746 @item -max-vect-align=@var{num}
20747 The maximum alignment for SIMD vector mode types.
20748 @var{num} may be 4 or 8. The default is 8.
20749 Note that this is an ABI change, even though many library function
20750 interfaces are unaffected if they don't use SIMD vector modes
20751 in places that affect size and/or alignment of relevant types.
20752
20753 @opindex msplit-vecmove-early
20754 @item -msplit-vecmove-early
20755 Split vector moves into single word moves before reload. In theory this
20756 can give better register allocation, but so far the reverse seems to be
20757 generally the case.
20758
20759 @opindex m1reg-
20760 @item -m1reg-@var{reg}
20761 Specify a register to hold the constant @minus{}1, which makes loading small negative
20762 constants and certain bitmasks faster.
20763 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
20764 which specify use of that register as a fixed register,
20765 and @samp{none}, which means that no register is used for this
20766 purpose. The default is @option{-m1reg-none}.
20767
20768 @end table
20769
20770 @node AMD GCN Options
20771 @subsection AMD GCN Options
20772 @cindex AMD GCN Options
20773
20774 These options are defined specifically for the AMD GCN port.
20775
20776 @table @gcctabopt
20777
20778 @opindex march
20779 @opindex mtune
20780 @item -march=@var{gpu}
20781 @itemx -mtune=@var{gpu}
20782 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
20783 are
20784
20785 @table @samp
20786 @item fiji
20787 Compile for GCN3 Fiji devices (gfx803).
20788
20789 @item gfx900
20790 Compile for GCN5 Vega 10 devices (gfx900).
20791
20792 @item gfx906
20793 Compile for GCN5 Vega 20 devices (gfx906).
20794
20795 @item gfx908
20796 Compile for CDNA1 Instinct MI100 series devices (gfx908).
20797
20798 @item gfx90a
20799 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
20800
20801 @end table
20802
20803 @opindex msram-ecc
20804 @item -msram-ecc=on
20805 @itemx -msram-ecc=off
20806 @itemx -msram-ecc=any
20807 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
20808 disabled, or either mode. This feature can be enabled per-process on some
20809 devices. The compiled code must match the device mode. The default is
20810 @samp{any}, for devices that support it.
20811
20812 @opindex mstack-size
20813 @item -mstack-size=@var{bytes}
20814 Specify how many @var{bytes} of stack space will be requested for each GPU
20815 thread (wave-front). Beware that there may be many threads and limited memory
20816 available. The size of the stack allocation may also have an impact on
20817 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
20818 1MB otherwise.
20819
20820 @opindex mxnack
20821 @item -mxnack
20822 Compile binaries suitable for devices with the XNACK feature enabled. Some
20823 devices always require XNACK and some allow the user to configure XNACK. The
20824 compiled code must match the device mode. The default is @samp{-mno-xnack}.
20825 At present this option is a placeholder for support that is not yet
20826 implemented.
20827
20828 @end table
20829
20830 @node ARC Options
20831 @subsection ARC Options
20832 @cindex ARC options
20833
20834 The following options control the architecture variant for which code
20835 is being compiled:
20836
20837 @c architecture variants
20838 @table @gcctabopt
20839
20840 @opindex mbarrel-shifter
20841 @item -mbarrel-shifter
20842 Generate instructions supported by barrel shifter. This is the default
20843 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
20844
20845 @opindex mjli-always
20846 @item -mjli-always
20847 Force to call a function using jli_s instruction. This option is
20848 valid only for ARCv2 architecture.
20849
20850 @opindex mcpu
20851 @item -mcpu=@var{cpu}
20852 Set architecture type, register usage, and instruction scheduling
20853 parameters for @var{cpu}. There are also shortcut alias options
20854 available for backward compatibility and convenience. Supported
20855 values for @var{cpu} are
20856
20857 @table @samp
20858 @opindex mA6
20859 @opindex mARC600
20860 @item arc600
20861 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
20862
20863 @opindex mARC601
20864 @item arc601
20865 Compile for ARC601. Alias: @option{-mARC601}.
20866
20867 @opindex mA7
20868 @opindex mARC700
20869 @item arc700
20870 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
20871 This is the default when configured with @option{--with-cpu=arc700}@.
20872
20873 @item arcem
20874 Compile for ARC EM.
20875
20876 @item archs
20877 Compile for ARC HS.
20878
20879 @item em
20880 Compile for ARC EM CPU with no hardware extensions.
20881
20882 @item em4
20883 Compile for ARC EM4 CPU.
20884
20885 @item em4_dmips
20886 Compile for ARC EM4 DMIPS CPU.
20887
20888 @item em4_fpus
20889 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
20890 extension.
20891
20892 @item em4_fpuda
20893 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
20894 double assist instructions.
20895
20896 @item hs
20897 Compile for ARC HS CPU with no hardware extensions except the atomic
20898 instructions.
20899
20900 @item hs34
20901 Compile for ARC HS34 CPU.
20902
20903 @item hs38
20904 Compile for ARC HS38 CPU.
20905
20906 @item hs38_linux
20907 Compile for ARC HS38 CPU with all hardware extensions on.
20908
20909 @item hs4x
20910 Compile for ARC HS4x CPU.
20911
20912 @item hs4xd
20913 Compile for ARC HS4xD CPU.
20914
20915 @item hs4x_rel31
20916 Compile for ARC HS4x CPU release 3.10a.
20917
20918 @item arc600_norm
20919 Compile for ARC 600 CPU with @code{norm} instructions enabled.
20920
20921 @item arc600_mul32x16
20922 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
20923 instructions enabled.
20924
20925 @item arc600_mul64
20926 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
20927 instructions enabled.
20928
20929 @item arc601_norm
20930 Compile for ARC 601 CPU with @code{norm} instructions enabled.
20931
20932 @item arc601_mul32x16
20933 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
20934 instructions enabled.
20935
20936 @item arc601_mul64
20937 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
20938 instructions enabled.
20939
20940 @item nps400
20941 Compile for ARC 700 on NPS400 chip.
20942
20943 @item em_mini
20944 Compile for ARC EM minimalist configuration featuring reduced register
20945 set.
20946
20947 @end table
20948
20949 @opindex mdpfp
20950 @opindex mdpfp-compact
20951 @item -mdpfp
20952 @itemx -mdpfp-compact
20953 Generate double-precision FPX instructions, tuned for the compact
20954 implementation.
20955
20956 @opindex mdpfp-fast
20957 @item -mdpfp-fast
20958 Generate double-precision FPX instructions, tuned for the fast
20959 implementation.
20960
20961 @opindex mno-dpfp-lrsr
20962 @item -mno-dpfp-lrsr
20963 Disable @code{lr} and @code{sr} instructions from using FPX extension
20964 aux registers.
20965
20966 @opindex mea
20967 @item -mea
20968 Generate extended arithmetic instructions. Currently only
20969 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
20970 supported. Only valid for @option{-mcpu=ARC700}.
20971
20972 @opindex mno-mpy
20973 @opindex mmpy
20974 @item -mno-mpy
20975 Do not generate @code{mpy}-family instructions for ARC700. This option is
20976 deprecated.
20977
20978 @opindex mmul32x16
20979 @item -mmul32x16
20980 Generate 32x16-bit multiply and multiply-accumulate instructions.
20981
20982 @opindex mmul64
20983 @item -mmul64
20984 Generate @code{mul64} and @code{mulu64} instructions.
20985 Only valid for @option{-mcpu=ARC600}.
20986
20987 @opindex mnorm
20988 @item -mnorm
20989 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
20990 is in effect.
20991
20992 @opindex mspfp
20993 @opindex mspfp-compact
20994 @item -mspfp
20995 @itemx -mspfp-compact
20996 Generate single-precision FPX instructions, tuned for the compact
20997 implementation.
20998
20999 @opindex mspfp-fast
21000 @item -mspfp-fast
21001 Generate single-precision FPX instructions, tuned for the fast
21002 implementation.
21003
21004 @opindex msimd
21005 @item -msimd
21006 Enable generation of ARC SIMD instructions via target-specific
21007 builtins. Only valid for @option{-mcpu=ARC700}.
21008
21009 @opindex msoft-float
21010 @item -msoft-float
21011 This option ignored; it is provided for compatibility purposes only.
21012 Software floating-point code is emitted by default, and this default
21013 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21014 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21015 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21016
21017 @opindex mswap
21018 @item -mswap
21019 Generate @code{swap} instructions.
21020
21021 @opindex matomic
21022 @item -matomic
21023 This enables use of the locked load/store conditional extension to implement
21024 atomic memory built-in functions. Not available for ARC 6xx or ARC
21025 EM cores.
21026
21027 @opindex mdiv-rem
21028 @item -mdiv-rem
21029 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21030
21031 @opindex mcode-density
21032 @item -mcode-density
21033 Enable code density instructions for ARC EM.
21034 This option is on by default for ARC HS.
21035
21036 @opindex mll64
21037 @item -mll64
21038 Enable double load/store operations for ARC HS cores.
21039
21040 @opindex mtp-regno
21041 @item -mtp-regno=@var{regno}
21042 Specify thread pointer register number.
21043
21044 @opindex mmpy-option
21045 @item -mmpy-option=@var{multo}
21046 Compile ARCv2 code with a multiplier design option. You can specify
21047 the option using either a string or numeric value for @var{multo}.
21048 @samp{wlh1} is the default value. The recognized values are:
21049
21050 @table @samp
21051 @item 0
21052 @itemx none
21053 No multiplier available.
21054
21055 @item 1
21056 @itemx w
21057 16x16 multiplier, fully pipelined.
21058 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
21059
21060 @item 2
21061 @itemx wlh1
21062 32x32 multiplier, fully
21063 pipelined (1 stage). The following instructions are additionally
21064 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21065
21066 @item 3
21067 @itemx wlh2
21068 32x32 multiplier, fully pipelined
21069 (2 stages). The following instructions are additionally enabled: @code{mpy},
21070 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21071
21072 @item 4
21073 @itemx wlh3
21074 Two 16x16 multipliers, blocking,
21075 sequential. The following instructions are additionally enabled: @code{mpy},
21076 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21077
21078 @item 5
21079 @itemx wlh4
21080 One 16x16 multiplier, blocking,
21081 sequential. The following instructions are additionally enabled: @code{mpy},
21082 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21083
21084 @item 6
21085 @itemx wlh5
21086 One 32x4 multiplier, blocking,
21087 sequential. The following instructions are additionally enabled: @code{mpy},
21088 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21089
21090 @item 7
21091 @itemx plus_dmpy
21092 ARC HS SIMD support.
21093
21094 @item 8
21095 @itemx plus_macd
21096 ARC HS SIMD support.
21097
21098 @item 9
21099 @itemx plus_qmacw
21100 ARC HS SIMD support.
21101
21102 @end table
21103
21104 This option is only available for ARCv2 cores@.
21105
21106 @opindex mfpu
21107 @item -mfpu=@var{fpu}
21108 Enables support for specific floating-point hardware extensions for ARCv2
21109 cores. Supported values for @var{fpu} are:
21110
21111 @table @samp
21112
21113 @item fpus
21114 Enables support for single-precision floating-point hardware
21115 extensions@.
21116
21117 @item fpud
21118 Enables support for double-precision floating-point hardware
21119 extensions. The single-precision floating-point extension is also
21120 enabled. Not available for ARC EM@.
21121
21122 @item fpuda
21123 Enables support for double-precision floating-point hardware
21124 extensions using double-precision assist instructions. The single-precision
21125 floating-point extension is also enabled. This option is
21126 only available for ARC EM@.
21127
21128 @item fpuda_div
21129 Enables support for double-precision floating-point hardware
21130 extensions using double-precision assist instructions.
21131 The single-precision floating-point, square-root, and divide
21132 extensions are also enabled. This option is
21133 only available for ARC EM@.
21134
21135 @item fpuda_fma
21136 Enables support for double-precision floating-point hardware
21137 extensions using double-precision assist instructions.
21138 The single-precision floating-point and fused multiply and add
21139 hardware extensions are also enabled. This option is
21140 only available for ARC EM@.
21141
21142 @item fpuda_all
21143 Enables support for double-precision floating-point hardware
21144 extensions using double-precision assist instructions.
21145 All single-precision floating-point hardware extensions are also
21146 enabled. This option is only available for ARC EM@.
21147
21148 @item fpus_div
21149 Enables support for single-precision floating-point, square-root and divide
21150 hardware extensions@.
21151
21152 @item fpud_div
21153 Enables support for double-precision floating-point, square-root and divide
21154 hardware extensions. This option
21155 includes option @samp{fpus_div}. Not available for ARC EM@.
21156
21157 @item fpus_fma
21158 Enables support for single-precision floating-point and
21159 fused multiply and add hardware extensions@.
21160
21161 @item fpud_fma
21162 Enables support for double-precision floating-point and
21163 fused multiply and add hardware extensions. This option
21164 includes option @samp{fpus_fma}. Not available for ARC EM@.
21165
21166 @item fpus_all
21167 Enables support for all single-precision floating-point hardware
21168 extensions@.
21169
21170 @item fpud_all
21171 Enables support for all single- and double-precision floating-point
21172 hardware extensions. Not available for ARC EM@.
21173
21174 @end table
21175
21176 @opindex mirq-ctrl-saved
21177 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21178 Specifies general-purposes registers that the processor automatically
21179 saves/restores on interrupt entry and exit. @var{register-range} is
21180 specified as two registers separated by a dash. The register range
21181 always starts with @code{r0}, the upper limit is @code{fp} register.
21182 @var{blink} and @var{lp_count} are optional. This option is only
21183 valid for ARC EM and ARC HS cores.
21184
21185 @opindex mrgf-banked-regs
21186 @item -mrgf-banked-regs=@var{number}
21187 Specifies the number of registers replicated in second register bank
21188 on entry to fast interrupt. Fast interrupts are interrupts with the
21189 highest priority level P0. These interrupts save only PC and STATUS32
21190 registers to avoid memory transactions during interrupt entry and exit
21191 sequences. Use this option when you are using fast interrupts in an
21192 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
21193
21194 @opindex mlpc-width
21195 @item -mlpc-width=@var{width}
21196 Specify the width of the @code{lp_count} register. Valid values for
21197 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
21198 fixed to 32 bits. If the width is less than 32, the compiler does not
21199 attempt to transform loops in your program to use the zero-delay loop
21200 mechanism unless it is known that the @code{lp_count} register can
21201 hold the required loop-counter value. Depending on the width
21202 specified, the compiler and run-time library might continue to use the
21203 loop mechanism for various needs. This option defines macro
21204 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21205
21206 @opindex mrf16
21207 @item -mrf16
21208 This option instructs the compiler to generate code for a 16-entry
21209 register file. This option defines the @code{__ARC_RF16__}
21210 preprocessor macro.
21211
21212 @opindex mbranch-index
21213 @item -mbranch-index
21214 Enable use of @code{bi} or @code{bih} instructions to implement jump
21215 tables.
21216
21217 @end table
21218
21219 The following options are passed through to the assembler, and also
21220 define preprocessor macro symbols.
21221
21222 @c Flags used by the assembler, but for which we define preprocessor
21223 @c macro symbols as well.
21224 @table @gcctabopt
21225 @opindex mdsp-packa
21226 @item -mdsp-packa
21227 Passed down to the assembler to enable the DSP Pack A extensions.
21228 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
21229 deprecated.
21230
21231 @opindex mdvbf
21232 @item -mdvbf
21233 Passed down to the assembler to enable the dual Viterbi butterfly
21234 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
21235 option is deprecated.
21236
21237 @c ARC700 4.10 extension instruction
21238 @opindex mlock
21239 @item -mlock
21240 Passed down to the assembler to enable the locked load/store
21241 conditional extension. Also sets the preprocessor symbol
21242 @code{__Xlock}.
21243
21244 @opindex mmac-d16
21245 @item -mmac-d16
21246 Passed down to the assembler. Also sets the preprocessor symbol
21247 @code{__Xxmac_d16}. This option is deprecated.
21248
21249 @opindex mmac-24
21250 @item -mmac-24
21251 Passed down to the assembler. Also sets the preprocessor symbol
21252 @code{__Xxmac_24}. This option is deprecated.
21253
21254 @c ARC700 4.10 extension instruction
21255 @opindex mrtsc
21256 @item -mrtsc
21257 Passed down to the assembler to enable the 64-bit time-stamp counter
21258 extension instruction. Also sets the preprocessor symbol
21259 @code{__Xrtsc}. This option is deprecated.
21260
21261 @c ARC700 4.10 extension instruction
21262 @opindex mswape
21263 @item -mswape
21264 Passed down to the assembler to enable the swap byte ordering
21265 extension instruction. Also sets the preprocessor symbol
21266 @code{__Xswape}.
21267
21268 @opindex mtelephony
21269 @item -mtelephony
21270 Passed down to the assembler to enable dual- and single-operand
21271 instructions for telephony. Also sets the preprocessor symbol
21272 @code{__Xtelephony}. This option is deprecated.
21273
21274 @opindex mxy
21275 @item -mxy
21276 Passed down to the assembler to enable the XY memory extension. Also
21277 sets the preprocessor symbol @code{__Xxy}.
21278
21279 @end table
21280
21281 The following options control how the assembly code is annotated:
21282
21283 @c Assembly annotation options
21284 @table @gcctabopt
21285 @opindex misize
21286 @item -misize
21287 Annotate assembler instructions with estimated addresses.
21288
21289 @opindex mannotate-align
21290 @item -mannotate-align
21291 Explain what alignment considerations lead to the decision to make an
21292 instruction short or long.
21293
21294 @end table
21295
21296 The following options are passed through to the linker:
21297
21298 @c options passed through to the linker
21299 @table @gcctabopt
21300 @opindex marclinux
21301 @item -marclinux
21302 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21303 This option is enabled by default in tool chains built for
21304 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21305 when profiling is not requested.
21306
21307 @opindex marclinux_prof
21308 @item -marclinux_prof
21309 Passed through to the linker, to specify use of the
21310 @code{arclinux_prof} emulation. This option is enabled by default in
21311 tool chains built for @w{@code{arc-linux-uclibc}} and
21312 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21313
21314 @end table
21315
21316 The following options control the semantics of generated code:
21317
21318 @c semantically relevant code generation options
21319 @table @gcctabopt
21320 @opindex mlong-calls
21321 @item -mlong-calls
21322 Generate calls as register indirect calls, thus providing access
21323 to the full 32-bit address range.
21324
21325 @opindex mmedium-calls
21326 @item -mmedium-calls
21327 Don't use less than 25-bit addressing range for calls, which is the
21328 offset available for an unconditional branch-and-link
21329 instruction. Conditional execution of function calls is suppressed, to
21330 allow use of the 25-bit range, rather than the 21-bit range with
21331 conditional branch-and-link. This is the default for tool chains built
21332 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21333
21334 @opindex G
21335 @item -G @var{num}
21336 Put definitions of externally-visible data in a small data section if
21337 that data is no bigger than @var{num} bytes. The default value of
21338 @var{num} is 4 for any ARC configuration, or 8 when we have double
21339 load/store operations.
21340
21341 @opindex mno-sdata
21342 @opindex msdata
21343 @item -mno-sdata
21344 Do not generate sdata references. This is the default for tool chains
21345 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21346 targets.
21347
21348 @opindex mvolatile-cache
21349 @item -mvolatile-cache
21350 Use ordinarily cached memory accesses for volatile references. This is the
21351 default.
21352
21353 @opindex mno-volatile-cache
21354 @opindex mvolatile-cache
21355 @item -mno-volatile-cache
21356 Enable cache bypass for volatile references.
21357
21358 @end table
21359
21360 The following options fine tune code generation:
21361 @c code generation tuning options
21362 @table @gcctabopt
21363 @opindex malign-call
21364 @item -malign-call
21365 Does nothing. Preserved for backward compatibility.
21366
21367 @opindex mauto-modify-reg
21368 @item -mauto-modify-reg
21369 Enable the use of pre/post modify with register displacement.
21370
21371 @opindex mbbit-peephole
21372 @item -mbbit-peephole
21373 Enable bbit peephole2.
21374
21375 @opindex mno-brcc
21376 @item -mno-brcc
21377 This option disables a target-specific pass in @file{arc_reorg} to
21378 generate compare-and-branch (@code{br@var{cc}}) instructions.
21379 It has no effect on
21380 generation of these instructions driven by the combiner pass.
21381
21382 @opindex mcase-vector-pcrel
21383 @item -mcase-vector-pcrel
21384 Use PC-relative switch case tables to enable case table shortening.
21385 This is the default for @option{-Os}.
21386
21387 @opindex mcompact-casesi
21388 @item -mcompact-casesi
21389 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
21390 and only available for ARCv1 cores. This option is deprecated.
21391
21392 @opindex mno-cond-exec
21393 @item -mno-cond-exec
21394 Disable the ARCompact-specific pass to generate conditional
21395 execution instructions.
21396
21397 Due to delay slot scheduling and interactions between operand numbers,
21398 literal sizes, instruction lengths, and the support for conditional execution,
21399 the target-independent pass to generate conditional execution is often lacking,
21400 so the ARC port has kept a special pass around that tries to find more
21401 conditional execution generation opportunities after register allocation,
21402 branch shortening, and delay slot scheduling have been done. This pass
21403 generally, but not always, improves performance and code size, at the cost of
21404 extra compilation time, which is why there is an option to switch it off.
21405 If you have a problem with call instructions exceeding their allowable
21406 offset range because they are conditionalized, you should consider using
21407 @option{-mmedium-calls} instead.
21408
21409 @opindex mearly-cbranchsi
21410 @item -mearly-cbranchsi
21411 Enable pre-reload use of the @code{cbranchsi} pattern.
21412
21413 @opindex mexpand-adddi
21414 @item -mexpand-adddi
21415 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21416 @code{add.f}, @code{adc} etc. This option is deprecated.
21417
21418 @opindex mindexed-loads
21419 @item -mindexed-loads
21420 Enable the use of indexed loads. This can be problematic because some
21421 optimizers then assume that indexed stores exist, which is not
21422 the case.
21423
21424 @opindex mlra
21425 @item -mlra
21426 Enable Local Register Allocation. This is still experimental for ARC,
21427 so by default the compiler uses standard reload
21428 (i.e.@: @option{-mno-lra}).
21429
21430 @opindex mlra-priority-none
21431 @item -mlra-priority-none
21432 Don't indicate any priority for target registers.
21433
21434 @opindex mlra-priority-compact
21435 @item -mlra-priority-compact
21436 Indicate target register priority for r0..r3 / r12..r15.
21437
21438 @opindex mlra-priority-noncompact
21439 @item -mlra-priority-noncompact
21440 Reduce target register priority for r0..r3 / r12..r15.
21441
21442 @opindex mmillicode
21443 @item -mmillicode
21444 When optimizing for size (using @option{-Os}), prologues and epilogues
21445 that have to save or restore a large number of registers are often
21446 shortened by using call to a special function in libgcc; this is
21447 referred to as a @emph{millicode} call. As these calls can pose
21448 performance issues, and/or cause linking issues when linking in a
21449 nonstandard way, this option is provided to turn on or off millicode
21450 call generation.
21451
21452 @opindex mcode-density-frame
21453 @item -mcode-density-frame
21454 This option enable the compiler to emit @code{enter} and @code{leave}
21455 instructions. These instructions are only valid for CPUs with
21456 code-density feature.
21457
21458 @opindex mmixed-code
21459 @item -mmixed-code
21460 Does nothing. Preserved for backward compatibility.
21461
21462 @opindex mq-class
21463 @item -mq-class
21464 Ths option is deprecated. Enable @samp{q} instruction alternatives.
21465 This is the default for @option{-Os}.
21466
21467 @opindex mRcq
21468 @item -mRcq
21469 Does nothing. Preserved for backward compatibility.
21470
21471 @opindex mRcw
21472 @item -mRcw
21473 Does nothing. Preserved for backward compatibility.
21474
21475 @opindex msize-level
21476 @item -msize-level=@var{level}
21477 Fine-tune size optimization with regards to instruction lengths and alignment.
21478 The recognized values for @var{level} are:
21479 @table @samp
21480 @item 0
21481 No size optimization. This level is deprecated and treated like @samp{1}.
21482
21483 @item 1
21484 Short instructions are used opportunistically.
21485
21486 @item 2
21487 In addition, alignment of loops and of code after barriers are dropped.
21488
21489 @item 3
21490 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21491
21492 @end table
21493
21494 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
21495 the behavior when this is not set is equivalent to level @samp{1}.
21496
21497 @opindex mtune
21498 @item -mtune=@var{cpu}
21499 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21500 by @option{-mcpu=}.
21501
21502 Supported values for @var{cpu} are
21503
21504 @table @samp
21505 @item ARC600
21506 Tune for ARC600 CPU.
21507
21508 @item ARC601
21509 Tune for ARC601 CPU.
21510
21511 @item ARC700
21512 Tune for ARC700 CPU with standard multiplier block.
21513
21514 @item ARC700-xmac
21515 Tune for ARC700 CPU with XMAC block.
21516
21517 @item ARC725D
21518 Tune for ARC725D CPU.
21519
21520 @item ARC750D
21521 Tune for ARC750D CPU.
21522
21523 @item core3
21524 Tune for ARCv2 core3 type CPU. This option enable usage of
21525 @code{dbnz} instruction.
21526
21527 @item release31a
21528 Tune for ARC4x release 3.10a.
21529
21530 @end table
21531
21532 @opindex mmultcost
21533 @item -mmultcost=@var{num}
21534 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21535 normal instruction.
21536
21537 @opindex munalign-prob-threshold
21538 @item -munalign-prob-threshold=@var{probability}
21539 Does nothing. Preserved for backward compatibility.
21540
21541 @end table
21542
21543 The following options are maintained for backward compatibility, but
21544 are now deprecated and will be removed in a future release:
21545
21546 @c Deprecated options
21547 @table @gcctabopt
21548
21549 @opindex margonaut
21550 @item -margonaut
21551 Obsolete FPX.
21552
21553 @opindex mbig-endian
21554 @opindex EB
21555 @item -mbig-endian
21556 @itemx -EB
21557 Compile code for big-endian targets. Use of these options is now
21558 deprecated. Big-endian code is supported by configuring GCC to build
21559 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21560 for which big endian is the default.
21561
21562 @opindex mlittle-endian
21563 @opindex EL
21564 @item -mlittle-endian
21565 @itemx -EL
21566 Compile code for little-endian targets. Use of these options is now
21567 deprecated. Little-endian code is supported by configuring GCC to build
21568 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21569 for which little endian is the default.
21570
21571 @opindex mbarrel_shifter
21572 @item -mbarrel_shifter
21573 Replaced by @option{-mbarrel-shifter}.
21574
21575 @opindex mdpfp_compact
21576 @item -mdpfp_compact
21577 Replaced by @option{-mdpfp-compact}.
21578
21579 @opindex mdpfp_fast
21580 @item -mdpfp_fast
21581 Replaced by @option{-mdpfp-fast}.
21582
21583 @opindex mdsp_packa
21584 @item -mdsp_packa
21585 Replaced by @option{-mdsp-packa}.
21586
21587 @opindex mEA
21588 @item -mEA
21589 Replaced by @option{-mea}.
21590
21591 @opindex mmac_24
21592 @item -mmac_24
21593 Replaced by @option{-mmac-24}.
21594
21595 @opindex mmac_d16
21596 @item -mmac_d16
21597 Replaced by @option{-mmac-d16}.
21598
21599 @opindex mspfp_compact
21600 @item -mspfp_compact
21601 Replaced by @option{-mspfp-compact}.
21602
21603 @opindex mspfp_fast
21604 @item -mspfp_fast
21605 Replaced by @option{-mspfp-fast}.
21606
21607 @opindex mtune
21608 @item -mtune=@var{cpu}
21609 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21610 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21611 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21612
21613 @opindex multcost
21614 @item -multcost=@var{num}
21615 Replaced by @option{-mmultcost}.
21616
21617 @end table
21618
21619 @node ARM Options
21620 @subsection ARM Options
21621 @cindex ARM options
21622
21623 These @samp{-m} options are defined for the ARM port:
21624
21625 @table @gcctabopt
21626 @opindex mabi
21627 @item -mabi=@var{name}
21628 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
21629 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21630
21631 @opindex mapcs-frame
21632 @item -mapcs-frame
21633 Generate a stack frame that is compliant with the ARM Procedure Call
21634 Standard for all functions, even if this is not strictly necessary for
21635 correct execution of the code. Specifying @option{-fomit-frame-pointer}
21636 with this option causes the stack frames not to be generated for
21637 leaf functions. The default is @option{-mno-apcs-frame}.
21638 This option is deprecated.
21639
21640 @opindex mapcs
21641 @item -mapcs
21642 This is a synonym for @option{-mapcs-frame} and is deprecated.
21643
21644 @ignore
21645 @c not currently implemented
21646 @opindex mapcs-stack-check
21647 @item -mapcs-stack-check
21648 Generate code to check the amount of stack space available upon entry to
21649 every function (that actually uses some stack space). If there is
21650 insufficient space available then either the function
21651 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21652 called, depending upon the amount of stack space required. The runtime
21653 system is required to provide these functions. The default is
21654 @option{-mno-apcs-stack-check}, since this produces smaller code.
21655
21656 @c not currently implemented
21657 @opindex mapcs-reentrant
21658 @item -mapcs-reentrant
21659 Generate reentrant, position-independent code. The default is
21660 @option{-mno-apcs-reentrant}.
21661 @end ignore
21662
21663 @opindex mthumb-interwork
21664 @item -mthumb-interwork
21665 Generate code that supports calling between the ARM and Thumb
21666 instruction sets. Without this option, on pre-v5 architectures, the
21667 two instruction sets cannot be reliably used inside one program. The
21668 default is @option{-mno-thumb-interwork}, since slightly larger code
21669 is generated when @option{-mthumb-interwork} is specified. In AAPCS
21670 configurations this option is meaningless.
21671
21672 @opindex mno-sched-prolog
21673 @opindex msched-prolog
21674 @item -mno-sched-prolog
21675 Prevent the reordering of instructions in the function prologue, or the
21676 merging of those instruction with the instructions in the function's
21677 body. This means that all functions start with a recognizable set
21678 of instructions (or in fact one of a choice from a small set of
21679 different function prologues), and this information can be used to
21680 locate the start of functions inside an executable piece of code. The
21681 default is @option{-msched-prolog}.
21682
21683 @opindex mfloat-abi
21684 @item -mfloat-abi=@var{name}
21685 Specifies which floating-point ABI to use. Permissible values
21686 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21687
21688 Specifying @samp{soft} causes GCC to generate output containing
21689 library calls for floating-point operations.
21690 @samp{softfp} allows the generation of code using hardware floating-point
21691 instructions, but still uses the soft-float calling conventions.
21692 @samp{hard} allows generation of floating-point instructions
21693 and uses FPU-specific calling conventions.
21694
21695 The default depends on the specific target configuration. Note that
21696 the hard-float and soft-float ABIs are not link-compatible; you must
21697 compile your entire program with the same ABI, and link with a
21698 compatible set of libraries.
21699
21700 @opindex mgeneral-regs-only
21701 @item -mgeneral-regs-only
21702 Generate code which uses only the general-purpose registers. This will prevent
21703 the compiler from using floating-point and Advanced SIMD registers but will not
21704 impose any restrictions on the assembler.
21705
21706 @opindex mlittle-endian
21707 @item -mlittle-endian
21708 Generate code for a processor running in little-endian mode. This is
21709 the default for all standard configurations.
21710
21711 @opindex mbig-endian
21712 @item -mbig-endian
21713 Generate code for a processor running in big-endian mode; the default is
21714 to compile code for a little-endian processor.
21715
21716 @opindex mbe8
21717 @item -mbe8
21718 @itemx -mbe32
21719 When linking a big-endian image select between BE8 and BE32 formats.
21720 The option has no effect for little-endian images and is ignored. The
21721 default is dependent on the selected target architecture. For ARMv6
21722 and later architectures the default is BE8, for older architectures
21723 the default is BE32. BE32 format has been deprecated by ARM.
21724
21725 @opindex march
21726 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21727 This specifies the name of the target ARM architecture. GCC uses this
21728 name to determine what kind of instructions it can emit when generating
21729 assembly code. This option can be used in conjunction with or instead
21730 of the @option{-mcpu=} option.
21731
21732 Permissible names are:
21733 @samp{armv4t},
21734 @samp{armv5t}, @samp{armv5te},
21735 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21736 @samp{armv6z}, @samp{armv6zk},
21737 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
21738 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
21739 @samp{armv8.4-a},
21740 @samp{armv8.5-a},
21741 @samp{armv8.6-a},
21742 @samp{armv9-a},
21743 @samp{armv7-r},
21744 @samp{armv8-r},
21745 @samp{armv6-m}, @samp{armv6s-m},
21746 @samp{armv7-m}, @samp{armv7e-m},
21747 @samp{armv8-m.base}, @samp{armv8-m.main},
21748 @samp{armv8.1-m.main},
21749 @samp{armv9-a},
21750 @samp{iwmmxt} and @samp{iwmmxt2}.
21751
21752 Additionally, the following architectures, which lack support for the
21753 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
21754
21755 Many of the architectures support extensions. These can be added by
21756 appending @samp{+@var{extension}} to the architecture name. Extension
21757 options are processed in order and capabilities accumulate. An extension
21758 will also enable any necessary base extensions
21759 upon which it depends. For example, the @samp{+crypto} extension
21760 will always enable the @samp{+simd} extension. The exception to the
21761 additive construction is for extensions that are prefixed with
21762 @samp{+no@dots{}}: these extensions disable the specified option and
21763 any other extensions that may depend on the presence of that
21764 extension.
21765
21766 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
21767 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
21768 entirely disabled by the @samp{+nofp} option that follows it.
21769
21770 Most extension names are generically named, but have an effect that is
21771 dependent upon the architecture to which it is applied. For example,
21772 the @samp{+simd} option can be applied to both @samp{armv7-a} and
21773 @samp{armv8-a} architectures, but will enable the original ARMv7-A
21774 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
21775 variant for @samp{armv8-a}.
21776
21777 The table below lists the supported extensions for each architecture.
21778 Architectures not mentioned do not support any extensions.
21779
21780 @table @samp
21781 @item armv5te
21782 @itemx armv6
21783 @itemx armv6j
21784 @itemx armv6k
21785 @itemx armv6kz
21786 @itemx armv6t2
21787 @itemx armv6z
21788 @itemx armv6zk
21789 @table @samp
21790 @item +fp
21791 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
21792 used as an alias for this extension.
21793
21794 @item +nofp
21795 Disable the floating-point instructions.
21796 @end table
21797
21798 @item armv7
21799 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
21800 @table @samp
21801 @item +fp
21802 The VFPv3 floating-point instructions, with 16 double-precision
21803 registers. The extension @samp{+vfpv3-d16} can be used as an alias
21804 for this extension. Note that floating-point is not supported by the
21805 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
21806 ARMv7-R architectures.
21807
21808 @item +nofp
21809 Disable the floating-point instructions.
21810 @end table
21811
21812 @item armv7-a
21813 @table @samp
21814 @item +mp
21815 The multiprocessing extension.
21816
21817 @item +sec
21818 The security extension.
21819
21820 @item +fp
21821 The VFPv3 floating-point instructions, with 16 double-precision
21822 registers. The extension @samp{+vfpv3-d16} can be used as an alias
21823 for this extension.
21824
21825 @item +simd
21826 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21827 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
21828 for this extension.
21829
21830 @item +vfpv3
21831 The VFPv3 floating-point instructions, with 32 double-precision
21832 registers.
21833
21834 @item +vfpv3-d16-fp16
21835 The VFPv3 floating-point instructions, with 16 double-precision
21836 registers and the half-precision floating-point conversion operations.
21837
21838 @item +vfpv3-fp16
21839 The VFPv3 floating-point instructions, with 32 double-precision
21840 registers and the half-precision floating-point conversion operations.
21841
21842 @item +vfpv4-d16
21843 The VFPv4 floating-point instructions, with 16 double-precision
21844 registers.
21845
21846 @item +vfpv4
21847 The VFPv4 floating-point instructions, with 32 double-precision
21848 registers.
21849
21850 @item +neon-fp16
21851 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21852 the half-precision floating-point conversion operations.
21853
21854 @item +neon-vfpv4
21855 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
21856
21857 @item +nosimd
21858 Disable the Advanced SIMD instructions (does not disable floating point).
21859
21860 @item +nofp
21861 Disable the floating-point and Advanced SIMD instructions.
21862 @end table
21863
21864 @item armv7ve
21865 The extended version of the ARMv7-A architecture with support for
21866 virtualization.
21867 @table @samp
21868 @item +fp
21869 The VFPv4 floating-point instructions, with 16 double-precision registers.
21870 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
21871
21872 @item +simd
21873 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
21874 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
21875
21876 @item +vfpv3-d16
21877 The VFPv3 floating-point instructions, with 16 double-precision
21878 registers.
21879
21880 @item +vfpv3
21881 The VFPv3 floating-point instructions, with 32 double-precision
21882 registers.
21883
21884 @item +vfpv3-d16-fp16
21885 The VFPv3 floating-point instructions, with 16 double-precision
21886 registers and the half-precision floating-point conversion operations.
21887
21888 @item +vfpv3-fp16
21889 The VFPv3 floating-point instructions, with 32 double-precision
21890 registers and the half-precision floating-point conversion operations.
21891
21892 @item +vfpv4-d16
21893 The VFPv4 floating-point instructions, with 16 double-precision
21894 registers.
21895
21896 @item +vfpv4
21897 The VFPv4 floating-point instructions, with 32 double-precision
21898 registers.
21899
21900 @item +neon
21901 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21902 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
21903
21904 @item +neon-fp16
21905 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21906 the half-precision floating-point conversion operations.
21907
21908 @item +nosimd
21909 Disable the Advanced SIMD instructions (does not disable floating point).
21910
21911 @item +nofp
21912 Disable the floating-point and Advanced SIMD instructions.
21913 @end table
21914
21915 @item armv8-a
21916 @table @samp
21917 @item +crc
21918 The Cyclic Redundancy Check (CRC) instructions.
21919 @item +simd
21920 The ARMv8-A Advanced SIMD and floating-point instructions.
21921 @item +crypto
21922 The cryptographic instructions.
21923 @item +nocrypto
21924 Disable the cryptographic instructions.
21925 @item +nofp
21926 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21927 @item +sb
21928 Speculation Barrier Instruction.
21929 @item +predres
21930 Execution and Data Prediction Restriction Instructions.
21931 @end table
21932
21933 @item armv8.1-a
21934 @table @samp
21935 @item +simd
21936 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21937
21938 @item +crypto
21939 The cryptographic instructions. This also enables the Advanced SIMD and
21940 floating-point instructions.
21941
21942 @item +nocrypto
21943 Disable the cryptographic instructions.
21944
21945 @item +nofp
21946 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21947
21948 @item +sb
21949 Speculation Barrier Instruction.
21950
21951 @item +predres
21952 Execution and Data Prediction Restriction Instructions.
21953 @end table
21954
21955 @item armv8.2-a
21956 @itemx armv8.3-a
21957 @table @samp
21958 @item +fp16
21959 The half-precision floating-point data processing instructions.
21960 This also enables the Advanced SIMD and floating-point instructions.
21961
21962 @item +fp16fml
21963 The half-precision floating-point fmla extension. This also enables
21964 the half-precision floating-point extension and Advanced SIMD and
21965 floating-point instructions.
21966
21967 @item +simd
21968 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21969
21970 @item +crypto
21971 The cryptographic instructions. This also enables the Advanced SIMD and
21972 floating-point instructions.
21973
21974 @item +dotprod
21975 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
21976
21977 @item +nocrypto
21978 Disable the cryptographic extension.
21979
21980 @item +nofp
21981 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21982
21983 @item +sb
21984 Speculation Barrier Instruction.
21985
21986 @item +predres
21987 Execution and Data Prediction Restriction Instructions.
21988
21989 @item +i8mm
21990 8-bit Integer Matrix Multiply instructions.
21991 This also enables Advanced SIMD and floating-point instructions.
21992
21993 @item +bf16
21994 Brain half-precision floating-point instructions.
21995 This also enables Advanced SIMD and floating-point instructions.
21996 @end table
21997
21998 @item armv8.4-a
21999 @table @samp
22000 @item +fp16
22001 The half-precision floating-point data processing instructions.
22002 This also enables the Advanced SIMD and floating-point instructions as well
22003 as the Dot Product extension and the half-precision floating-point fmla
22004 extension.
22005
22006 @item +simd
22007 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22008 Dot Product extension.
22009
22010 @item +crypto
22011 The cryptographic instructions. This also enables the Advanced SIMD and
22012 floating-point instructions as well as the Dot Product extension.
22013
22014 @item +nocrypto
22015 Disable the cryptographic extension.
22016
22017 @item +nofp
22018 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22019
22020 @item +sb
22021 Speculation Barrier Instruction.
22022
22023 @item +predres
22024 Execution and Data Prediction Restriction Instructions.
22025
22026 @item +i8mm
22027 8-bit Integer Matrix Multiply instructions.
22028 This also enables Advanced SIMD and floating-point instructions.
22029
22030 @item +bf16
22031 Brain half-precision floating-point instructions.
22032 This also enables Advanced SIMD and floating-point instructions.
22033 @end table
22034
22035 @item armv8.5-a
22036 @table @samp
22037 @item +fp16
22038 The half-precision floating-point data processing instructions.
22039 This also enables the Advanced SIMD and floating-point instructions as well
22040 as the Dot Product extension and the half-precision floating-point fmla
22041 extension.
22042
22043 @item +simd
22044 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22045 Dot Product extension.
22046
22047 @item +crypto
22048 The cryptographic instructions. This also enables the Advanced SIMD and
22049 floating-point instructions as well as the Dot Product extension.
22050
22051 @item +nocrypto
22052 Disable the cryptographic extension.
22053
22054 @item +nofp
22055 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22056
22057 @item +i8mm
22058 8-bit Integer Matrix Multiply instructions.
22059 This also enables Advanced SIMD and floating-point instructions.
22060
22061 @item +bf16
22062 Brain half-precision floating-point instructions.
22063 This also enables Advanced SIMD and floating-point instructions.
22064 @end table
22065
22066 @item armv8.6-a
22067 @table @samp
22068 @item +fp16
22069 The half-precision floating-point data processing instructions.
22070 This also enables the Advanced SIMD and floating-point instructions as well
22071 as the Dot Product extension and the half-precision floating-point fmla
22072 extension.
22073
22074 @item +simd
22075 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22076 Dot Product extension.
22077
22078 @item +crypto
22079 The cryptographic instructions. This also enables the Advanced SIMD and
22080 floating-point instructions as well as the Dot Product extension.
22081
22082 @item +nocrypto
22083 Disable the cryptographic extension.
22084
22085 @item +nofp
22086 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22087
22088 @item +i8mm
22089 8-bit Integer Matrix Multiply instructions.
22090 This also enables Advanced SIMD and floating-point instructions.
22091
22092 @item +bf16
22093 Brain half-precision floating-point instructions.
22094 This also enables Advanced SIMD and floating-point instructions.
22095 @end table
22096
22097 @item armv7-r
22098 @table @samp
22099 @item +fp.sp
22100 The single-precision VFPv3 floating-point instructions. The extension
22101 @samp{+vfpv3xd} can be used as an alias for this extension.
22102
22103 @item +fp
22104 The VFPv3 floating-point instructions with 16 double-precision registers.
22105 The extension +vfpv3-d16 can be used as an alias for this extension.
22106
22107 @item +vfpv3xd-d16-fp16
22108 The single-precision VFPv3 floating-point instructions with 16 double-precision
22109 registers and the half-precision floating-point conversion operations.
22110
22111 @item +vfpv3-d16-fp16
22112 The VFPv3 floating-point instructions with 16 double-precision
22113 registers and the half-precision floating-point conversion operations.
22114
22115 @item +nofp
22116 Disable the floating-point extension.
22117
22118 @item +idiv
22119 The ARM-state integer division instructions.
22120
22121 @item +noidiv
22122 Disable the ARM-state integer division extension.
22123 @end table
22124
22125 @item armv7e-m
22126 @table @samp
22127 @item +fp
22128 The single-precision VFPv4 floating-point instructions.
22129
22130 @item +fpv5
22131 The single-precision FPv5 floating-point instructions.
22132
22133 @item +fp.dp
22134 The single- and double-precision FPv5 floating-point instructions.
22135
22136 @item +nofp
22137 Disable the floating-point extensions.
22138 @end table
22139
22140 @item armv8.1-m.main
22141 @table @samp
22142
22143 @item +dsp
22144 The DSP instructions.
22145
22146 @item +mve
22147 The M-Profile Vector Extension (MVE) integer instructions.
22148
22149 @item +mve.fp
22150 The M-Profile Vector Extension (MVE) integer and single precision
22151 floating-point instructions.
22152
22153 @item +fp
22154 The single-precision floating-point instructions.
22155
22156 @item +fp.dp
22157 The single- and double-precision floating-point instructions.
22158
22159 @item +nofp
22160 Disable the floating-point extension.
22161
22162 @item +cdecp0, +cdecp1, ... , +cdecp7
22163 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22164 to the numbers given in the options in the range 0 to 7.
22165
22166 @item +pacbti
22167 Enable the Pointer Authentication and Branch Target Identification Extension.
22168 @end table
22169
22170 @item armv8-m.main
22171 @table @samp
22172 @item +dsp
22173 The DSP instructions.
22174
22175 @item +nodsp
22176 Disable the DSP extension.
22177
22178 @item +fp
22179 The single-precision floating-point instructions.
22180
22181 @item +fp.dp
22182 The single- and double-precision floating-point instructions.
22183
22184 @item +nofp
22185 Disable the floating-point extension.
22186
22187 @item +cdecp0, +cdecp1, ... , +cdecp7
22188 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22189 to the numbers given in the options in the range 0 to 7.
22190 @end table
22191
22192 @item armv8-r
22193 @table @samp
22194 @item +crc
22195 The Cyclic Redundancy Check (CRC) instructions.
22196 @item +fp.sp
22197 The single-precision FPv5 floating-point instructions.
22198 @item +simd
22199 The ARMv8-A Advanced SIMD and floating-point instructions.
22200 @item +crypto
22201 The cryptographic instructions.
22202 @item +nocrypto
22203 Disable the cryptographic instructions.
22204 @item +nofp
22205 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22206 @end table
22207
22208 @end table
22209
22210 @option{-march=native} causes the compiler to auto-detect the architecture
22211 of the build computer. At present, this feature is only supported on
22212 GNU/Linux, and not all architectures are recognized. If the auto-detect
22213 is unsuccessful the option has no effect.
22214
22215 @opindex mtune
22216 @item -mtune=@var{name}
22217 This option specifies the name of the target ARM processor for
22218 which GCC should tune the performance of the code.
22219 For some ARM implementations better performance can be obtained by using
22220 this option.
22221 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22222 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22223 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22224 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22225 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22226 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22227 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22228 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22229 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22230 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22231 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22232 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22233 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22234 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22235 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22236 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22237 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22238 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22239 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22240 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
22241 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22242 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22243 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22244 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22245 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22246 @samp{xgene1}.
22247
22248 Additionally, this option can specify that GCC should tune the performance
22249 of the code for a big.LITTLE system. Permissible names are:
22250 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22251 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22252 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22253 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22254
22255 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22256 performance for a blend of processors within architecture @var{arch}.
22257 The aim is to generate code that run well on the current most popular
22258 processors, balancing between optimizations that benefit some CPUs in the
22259 range, and avoiding performance pitfalls of other CPUs. The effects of
22260 this option may change in future GCC versions as CPU models come and go.
22261
22262 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22263 the extension options do not affect the tuning of the generated code.
22264
22265 @option{-mtune=native} causes the compiler to auto-detect the CPU
22266 of the build computer. At present, this feature is only supported on
22267 GNU/Linux, and not all architectures are recognized. If the auto-detect is
22268 unsuccessful the option has no effect.
22269
22270 @opindex mcpu
22271 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22272 This specifies the name of the target ARM processor. GCC uses this name
22273 to derive the name of the target ARM architecture (as if specified
22274 by @option{-march}) and the ARM processor type for which to tune for
22275 performance (as if specified by @option{-mtune}). Where this option
22276 is used in conjunction with @option{-march} or @option{-mtune},
22277 those options take precedence over the appropriate part of this option.
22278
22279 Many of the supported CPUs implement optional architectural
22280 extensions. Where this is so the architectural extensions are
22281 normally enabled by default. If implementations that lack the
22282 extension exist, then the extension syntax can be used to disable
22283 those extensions that have been omitted. For floating-point and
22284 Advanced SIMD (Neon) instructions, the settings of the options
22285 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22286 floating-point and Advanced SIMD instructions will only be used if
22287 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22288 @option{-mfpu} other than @samp{auto} will override the available
22289 floating-point and SIMD extension instructions.
22290
22291 For example, @samp{cortex-a9} can be found in three major
22292 configurations: integer only, with just a floating-point unit or with
22293 floating-point and Advanced SIMD. The default is to enable all the
22294 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22295 be used to disable just the SIMD or both the SIMD and floating-point
22296 instructions respectively.
22297
22298 Permissible names for this option are the same as those for
22299 @option{-mtune}.
22300
22301 The following extension options are common to the listed CPUs:
22302
22303 @table @samp
22304 @item +nodsp
22305 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
22306 @samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector
22307 Extension (MVE) integer and single precision floating-point instructions on
22308 @samp{cortex-m55} and @samp{cortex-m85}.
22309
22310 @item +nopacbti
22311 Disable the Pointer Authentication and Branch Target Identification Extension
22312 on @samp{cortex-m85}.
22313
22314 @item +nomve
22315 Disable the M-Profile Vector Extension (MVE) integer and single precision
22316 floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22317
22318 @item +nomve.fp
22319 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22320 instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22321
22322 @item +cdecp0, +cdecp1, ... , +cdecp7
22323 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22324 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22325
22326 @item +nofp
22327 Disables the floating-point instructions on @samp{arm9e},
22328 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22329 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22330 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22331 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22332 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
22333 @samp{cortex-m55} and @samp{cortex-m85}.
22334 Disables the floating-point and SIMD instructions on
22335 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22336 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22337 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22338 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22339 @samp{cortex-a53} and @samp{cortex-a55}.
22340
22341 @item +nofp.dp
22342 Disables the double-precision component of the floating-point instructions
22343 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22344 @samp{cortex-r52plus} and @samp{cortex-m7}.
22345
22346 @item +nosimd
22347 Disables the SIMD (but not floating-point) instructions on
22348 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22349 and @samp{cortex-a9}.
22350
22351 @item +crypto
22352 Enables the cryptographic instructions on @samp{cortex-a32},
22353 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22354 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22355 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22356 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22357 @samp{cortex-a75.cortex-a55}.
22358 @end table
22359
22360 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22361 VFPv3 with 16 double-precision registers. It supports the following
22362 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22363 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22364 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22365 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
22366 the extensions to @option{-march=armv7-a}.
22367
22368 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22369 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22370 See @option{-mtune} for more information.
22371
22372 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22373 of the build computer. At present, this feature is only supported on
22374 GNU/Linux, and not all architectures are recognized. If the auto-detect
22375 is unsuccessful the option has no effect.
22376
22377 @opindex mfpu
22378 @item -mfpu=@var{name}
22379 This specifies what floating-point hardware (or hardware emulation) is
22380 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
22381 @samp{vfpv3},
22382 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22383 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22384 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22385 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22386 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22387 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22388 is an alias for @samp{vfpv2}.
22389
22390 The setting @samp{auto} is the default and is special. It causes the
22391 compiler to select the floating-point and Advanced SIMD instructions
22392 based on the settings of @option{-mcpu} and @option{-march}.
22393
22394 If the selected floating-point hardware includes the NEON extension
22395 (e.g.@: @option{-mfpu=neon}), note that floating-point
22396 operations are not generated by GCC's auto-vectorization pass unless
22397 @option{-funsafe-math-optimizations} is also specified. This is
22398 because NEON hardware does not fully implement the IEEE 754 standard for
22399 floating-point arithmetic (in particular denormal values are treated as
22400 zero), so the use of NEON instructions may lead to a loss of precision.
22401
22402 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}).
22403
22404 @opindex mfp16-format
22405 @item -mfp16-format=@var{name}
22406 Specify the format of the @code{__fp16} half-precision floating-point type.
22407 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22408 the default is @samp{none}, in which case the @code{__fp16} type is not
22409 defined. @xref{Half-Precision}, for more information.
22410
22411 @opindex mstructure-size-boundary
22412 @item -mstructure-size-boundary=@var{n}
22413 The sizes of all structures and unions are rounded up to a multiple
22414 of the number of bits set by this option. Permissible values are 8, 32
22415 and 64. The default value varies for different toolchains. For the COFF
22416 targeted toolchain the default value is 8. A value of 64 is only allowed
22417 if the underlying ABI supports it.
22418
22419 Specifying a larger number can produce faster, more efficient code, but
22420 can also increase the size of the program. Different values are potentially
22421 incompatible. Code compiled with one value cannot necessarily expect to
22422 work with code or libraries compiled with another value, if they exchange
22423 information using structures or unions.
22424
22425 This option is deprecated.
22426
22427 @opindex mabort-on-noreturn
22428 @item -mabort-on-noreturn
22429 Generate a call to the function @code{abort} at the end of a
22430 @code{noreturn} function. It is executed if the function tries to
22431 return.
22432
22433 @opindex mlong-calls
22434 @opindex mno-long-calls
22435 @item -mlong-calls
22436 @itemx -mno-long-calls
22437 Tells the compiler to perform function calls by first loading the
22438 address of the function into a register and then performing a subroutine
22439 call on this register. This switch is needed if the target function
22440 lies outside of the 64-megabyte addressing range of the offset-based
22441 version of subroutine call instruction.
22442
22443 Even if this switch is enabled, not all function calls are turned
22444 into long calls. The heuristic is that static functions, functions
22445 that have the @code{short_call} attribute, functions that are inside
22446 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22447 definitions have already been compiled within the current compilation
22448 unit are not turned into long calls. The exceptions to this rule are
22449 that weak function definitions, functions with the @code{long_call}
22450 attribute or the @code{section} attribute, and functions that are within
22451 the scope of a @code{#pragma long_calls} directive are always
22452 turned into long calls.
22453
22454 This feature is not enabled by default. Specifying
22455 @option{-mno-long-calls} restores the default behavior, as does
22456 placing the function calls within the scope of a @code{#pragma
22457 long_calls_off} directive. Note these switches have no effect on how
22458 the compiler generates code to handle function calls via function
22459 pointers.
22460
22461 @opindex msingle-pic-base
22462 @item -msingle-pic-base
22463 Treat the register used for PIC addressing as read-only, rather than
22464 loading it in the prologue for each function. The runtime system is
22465 responsible for initializing this register with an appropriate value
22466 before execution begins.
22467
22468 @opindex mpic-register
22469 @item -mpic-register=@var{reg}
22470 Specify the register to be used for PIC addressing.
22471 For standard PIC base case, the default is any suitable register
22472 determined by compiler. For single PIC base case, the default is
22473 @samp{R9} if target is EABI based or stack-checking is enabled,
22474 otherwise the default is @samp{R10}.
22475
22476 @opindex mpic-data-is-text-relative
22477 @item -mpic-data-is-text-relative
22478 Assume that the displacement between the text and data segments is fixed
22479 at static link time. This permits using PC-relative addressing
22480 operations to access data known to be in the data segment. For
22481 non-VxWorks RTP targets, this option is enabled by default. When
22482 disabled on such targets, it will enable @option{-msingle-pic-base} by
22483 default.
22484
22485 @opindex mpoke-function-name
22486 @item -mpoke-function-name
22487 Write the name of each function into the text section, directly
22488 preceding the function prologue. The generated code is similar to this:
22489
22490 @smallexample
22491 t0
22492 .ascii "arm_poke_function_name", 0
22493 .align
22494 t1
22495 .word 0xff000000 + (t1 - t0)
22496 arm_poke_function_name
22497 mov ip, sp
22498 stmfd sp!, @{fp, ip, lr, pc@}
22499 sub fp, ip, #4
22500 @end smallexample
22501
22502 When performing a stack backtrace, code can inspect the value of
22503 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
22504 location @code{pc - 12} and the top 8 bits are set, then we know that
22505 there is a function name embedded immediately preceding this location
22506 and has length @code{((pc[-3]) & 0xff000000)}.
22507
22508 @opindex marm
22509 @opindex mthumb
22510 @item -mthumb
22511 @itemx -marm
22512
22513 Select between generating code that executes in ARM and Thumb
22514 states. The default for most configurations is to generate code
22515 that executes in ARM state, but the default can be changed by
22516 configuring GCC with the @option{--with-mode=}@var{state}
22517 configure option.
22518
22519 You can also override the ARM and Thumb mode for each function
22520 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22521 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22522
22523 @opindex mflip-thumb
22524 @item -mflip-thumb
22525 Switch ARM/Thumb modes on alternating functions.
22526 This option is provided for regression testing of mixed Thumb/ARM code
22527 generation, and is not intended for ordinary use in compiling code.
22528
22529 @opindex mtpcs-frame
22530 @item -mtpcs-frame
22531 Generate a stack frame that is compliant with the Thumb Procedure Call
22532 Standard for all non-leaf functions. (A leaf function is one that does
22533 not call any other functions.) The default is @option{-mno-tpcs-frame}.
22534
22535 @opindex mtpcs-leaf-frame
22536 @item -mtpcs-leaf-frame
22537 Generate a stack frame that is compliant with the Thumb Procedure Call
22538 Standard for all leaf functions. (A leaf function is one that does
22539 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
22540
22541 @opindex mcallee-super-interworking
22542 @item -mcallee-super-interworking
22543 Gives all externally visible functions in the file being compiled an ARM
22544 instruction set header which switches to Thumb mode before executing the
22545 rest of the function. This allows these functions to be called from
22546 non-interworking code. This option is not valid in AAPCS configurations
22547 because interworking is enabled by default.
22548
22549 @opindex mcaller-super-interworking
22550 @item -mcaller-super-interworking
22551 Allows calls via function pointers (including virtual functions) to
22552 execute correctly regardless of whether the target code has been
22553 compiled for interworking or not. There is a small overhead in the cost
22554 of executing a function pointer if this option is enabled. This option
22555 is not valid in AAPCS configurations because interworking is enabled
22556 by default.
22557
22558 @opindex mtp
22559 @item -mtp=@var{name}
22560 Specify the access model for the thread local storage pointer. The valid
22561 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
22562 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
22563 (supported in the arm6k architecture), and @samp{auto}, which uses the
22564 best available method for the selected processor. The default setting is
22565 @samp{auto}.
22566
22567 @opindex mtls-dialect
22568 @item -mtls-dialect=@var{dialect}
22569 Specify the dialect to use for accessing thread local storage. Two
22570 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
22571 @samp{gnu} dialect selects the original GNU scheme for supporting
22572 local and global dynamic TLS models. The @samp{gnu2} dialect
22573 selects the GNU descriptor scheme, which provides better performance
22574 for shared libraries. The GNU descriptor scheme is compatible with
22575 the original scheme, but does require new assembler, linker and
22576 library support. Initial and local exec TLS models are unaffected by
22577 this option and always use the original scheme.
22578
22579 @opindex mword-relocations
22580 @item -mword-relocations
22581 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22582 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22583 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22584 is specified. This option conflicts with @option{-mslow-flash-data}.
22585
22586 @opindex mfix-cortex-m3-ldrd
22587 @item -mfix-cortex-m3-ldrd
22588 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22589 with overlapping destination and base registers are used. This option avoids
22590 generating these instructions. This option is enabled by default when
22591 @option{-mcpu=cortex-m3} is specified.
22592
22593 @item -mfix-cortex-a57-aes-1742098
22594 @itemx -mno-fix-cortex-a57-aes-1742098
22595 @itemx -mfix-cortex-a72-aes-1655431
22596 @itemx -mno-fix-cortex-a72-aes-1655431
22597 Enable (disable) mitigation for an erratum on Cortex-A57 and
22598 Cortex-A72 that affects the AES cryptographic instructions. This
22599 option is enabled by default when either @option{-mcpu=cortex-a57} or
22600 @option{-mcpu=cortex-a72} is specified.
22601
22602 @opindex munaligned-access
22603 @opindex mno-unaligned-access
22604 @item -munaligned-access
22605 @itemx -mno-unaligned-access
22606 Enables (or disables) reading and writing of 16- and 32- bit values
22607 from addresses that are not 16- or 32- bit aligned. By default
22608 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22609 ARMv8-M Baseline architectures, and enabled for all other
22610 architectures. If unaligned access is not enabled then words in packed
22611 data structures are accessed a byte at a time.
22612
22613 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22614 generated object file to either true or false, depending upon the
22615 setting of this option. If unaligned access is enabled then the
22616 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22617 defined.
22618
22619 @opindex mneon-for-64bits
22620 @item -mneon-for-64bits
22621 This option is deprecated and has no effect.
22622
22623 @opindex mslow-flash-data
22624 @item -mslow-flash-data
22625 Assume loading data from flash is slower than fetching instruction.
22626 Therefore literal load is minimized for better performance.
22627 This option is only supported when compiling for ARMv7 M-profile and
22628 off by default. It conflicts with @option{-mword-relocations}.
22629
22630 @opindex masm-syntax-unified
22631 @item -masm-syntax-unified
22632 Assume inline assembler is using unified asm syntax. The default is
22633 currently off which implies divided syntax. This option has no impact
22634 on Thumb2. However, this may change in future releases of GCC.
22635 Divided syntax should be considered deprecated.
22636
22637 @opindex mrestrict-it
22638 @item -mrestrict-it
22639 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22640 IT blocks can only contain a single 16-bit instruction from a select
22641 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22642
22643 @opindex mprint-tune-info
22644 @item -mprint-tune-info
22645 Print CPU tuning information as comment in assembler file. This is
22646 an option used only for regression testing of the compiler and not
22647 intended for ordinary use in compiling code. This option is disabled
22648 by default.
22649
22650 @opindex mverbose-cost-dump
22651 @item -mverbose-cost-dump
22652 Enable verbose cost model dumping in the debug dump files. This option is
22653 provided for use in debugging the compiler.
22654
22655 @opindex mpure-code
22656 @item -mpure-code
22657 Do not allow constant data to be placed in code sections.
22658 Additionally, when compiling for ELF object format give all text sections the
22659 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
22660 is only available when generating non-pic code for M-profile targets.
22661
22662 @opindex mcmse
22663 @item -mcmse
22664 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22665 Development Tools Engineering Specification", which can be found on
22666 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22667
22668 @opindex mfix-cmse-cve-2021-35465
22669 @item -mfix-cmse-cve-2021-35465
22670 Mitigate against a potential security issue with the @code{VLLDM} instruction
22671 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
22672 enabled by default when the option @option{-mcpu=} is used with
22673 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85}
22674 or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used
22675 to disable the mitigation.
22676
22677 @opindex mstack-protector-guard
22678 @opindex mstack-protector-guard-offset
22679 @item -mstack-protector-guard=@var{guard}
22680 @itemx -mstack-protector-guard-offset=@var{offset}
22681 Generate stack protection code using canary at @var{guard}. Supported
22682 locations are @samp{global} for a global canary or @samp{tls} for a
22683 canary accessible via the TLS register. The option
22684 @option{-mstack-protector-guard-offset=} is for use with
22685 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22686
22687 @opindex mfdpic
22688 @opindex mno-fdpic
22689 @item -mfdpic
22690 @itemx -mno-fdpic
22691 Select the FDPIC ABI, which uses 64-bit function descriptors to
22692 represent pointers to functions. When the compiler is configured for
22693 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22694 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22695 provided. On other targets, it only enables the FDPIC-specific code
22696 generation features, and the user should explicitly provide the
22697 PIC/PIE-related options as needed.
22698
22699 Note that static linking is not supported because it would still
22700 involve the dynamic linker when the program self-relocates. If such
22701 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22702
22703 The opposite @option{-mno-fdpic} option is useful (and required) to
22704 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22705 toolchain as the one used to build the userland programs.
22706
22707 @opindex mbranch-protection
22708 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
22709 Enable branch protection features (armv8.1-m.main only).
22710 @samp{none} generate code without branch protection or return address
22711 signing.
22712 @samp{standard[+@var{leaf}]} generate code with all branch protection
22713 features enabled at their standard level.
22714 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
22715 set to its standard level, which is to sign all functions that save
22716 the return address to memory.
22717 @samp{leaf} When return address signing is enabled, also sign leaf
22718 functions even if they do not write the return address to memory.
22719 +@samp{bti} Add landing-pad instructions at the permitted targets of
22720 indirect branch instructions.
22721
22722 If the @samp{+pacbti} architecture extension is not enabled, then all
22723 branch protection and return address signing operations are
22724 constrained to use only the instructions defined in the
22725 architectural-NOP space. The generated code will remain
22726 backwards-compatible with earlier versions of the architecture, but
22727 the additional security can be enabled at run time on processors that
22728 support the @samp{PACBTI} extension.
22729
22730 Branch target enforcement using BTI can only be enabled at runtime if
22731 all code in the application has been compiled with at least
22732 @samp{-mbranch-protection=bti}.
22733
22734 Any setting other than @samp{none} is supported only on armv8-m.main
22735 or later.
22736
22737 The default is to generate code without branch protection or return
22738 address signing.
22739
22740 @end table
22741
22742 @node AVR Options
22743 @subsection AVR Options
22744 @cindex AVR Options
22745
22746 These options are defined for AVR implementations:
22747
22748 @table @gcctabopt
22749 @opindex mmcu
22750 @item -mmcu=@var{mcu}
22751 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
22752
22753 The default for this option is@tie{}@samp{avr2}.
22754
22755 GCC supports the following AVR devices and ISAs:
22756
22757 @include avr-mmcu.texi
22758
22759 @opindex mabsdata
22760 @item -mabsdata
22761
22762 Assume that all data in static storage can be accessed by LDS / STS
22763 instructions. This option has only an effect on reduced Tiny devices like
22764 ATtiny40. See also the @code{absdata}
22765 @ref{AVR Variable Attributes,variable attribute}.
22766
22767 @opindex maccumulate-args
22768 @item -maccumulate-args
22769 Accumulate outgoing function arguments and acquire/release the needed
22770 stack space for outgoing function arguments once in function
22771 prologue/epilogue. Without this option, outgoing arguments are pushed
22772 before calling a function and popped afterwards.
22773
22774 Popping the arguments after the function call can be expensive on
22775 AVR so that accumulating the stack space might lead to smaller
22776 executables because arguments need not be removed from the
22777 stack after such a function call.
22778
22779 This option can lead to reduced code size for functions that perform
22780 several calls to functions that get their arguments on the stack like
22781 calls to printf-like functions.
22782
22783 @opindex mbranch-cost
22784 @item -mbranch-cost=@var{cost}
22785 Set the branch costs for conditional branch instructions to
22786 @var{cost}. Reasonable values for @var{cost} are small, non-negative
22787 integers. The default branch cost is 0.
22788
22789 @opindex mcall-prologues
22790 @item -mcall-prologues
22791 Functions prologues/epilogues are expanded as calls to appropriate
22792 subroutines. Code size is smaller.
22793
22794 @opindex mdouble
22795 @opindex mlong-double
22796 @item -mdouble=@var{bits}
22797 @itemx -mlong-double=@var{bits}
22798 Set the size (in bits) of the @code{double} or @code{long double} type,
22799 respectively. Possible values for @var{bits} are 32 and 64.
22800 Whether or not a specific value for @var{bits} is allowed depends on
22801 the @code{--with-double=} and @code{--with-long-double=}
22802 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
22803 and the same applies for the default values of the options.
22804
22805 @opindex mgas-isr-prologues
22806 @item -mgas-isr-prologues
22807 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
22808 instruction supported by GNU Binutils.
22809 If this option is on, the feature can still be disabled for individual
22810 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
22811 function attribute. This feature is activated per default
22812 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
22813 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
22814
22815 @opindex mint8
22816 @item -mint8
22817 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
22818 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
22819 and @code{long long} is 4 bytes. Please note that this option does not
22820 conform to the C standards, but it results in smaller code
22821 size.
22822
22823 @opindex mmain-is-OS_task
22824 @item -mmain-is-OS_task
22825 Do not save registers in @code{main}. The effect is the same like
22826 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
22827 to @code{main}. It is activated per default if optimization is on.
22828
22829 @opindex mn-flash
22830 @item -mn-flash=@var{num}
22831 Assume that the flash memory has a size of
22832 @var{num} times 64@tie{}KiB.
22833
22834 @opindex mno-interrupts
22835 @item -mno-interrupts
22836 Generated code is not compatible with hardware interrupts.
22837 Code size is smaller.
22838
22839 @opindex mrelax
22840 @item -mrelax
22841 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
22842 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
22843 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
22844 the assembler's command line and the @option{--relax} option to the
22845 linker's command line.
22846
22847 Jump relaxing is performed by the linker because jump offsets are not
22848 known before code is located. Therefore, the assembler code generated by the
22849 compiler is the same, but the instructions in the executable may
22850 differ from instructions in the assembler code.
22851
22852 Relaxing must be turned on if linker stubs are needed, see the
22853 section on @code{EIND} and linker stubs below.
22854
22855 @opindex mrmw
22856 @item -mrmw
22857 Assume that the device supports the Read-Modify-Write
22858 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
22859
22860 @opindex mshort-calls
22861 @item -mshort-calls
22862
22863 Assume that @code{RJMP} and @code{RCALL} can target the whole
22864 program memory.
22865
22866 This option is used internally for multilib selection. It is
22867 not an optimization option, and you don't need to set it by hand.
22868
22869 @opindex msp8
22870 @item -msp8
22871 Treat the stack pointer register as an 8-bit register,
22872 i.e.@: assume the high byte of the stack pointer is zero.
22873 In general, you don't need to set this option by hand.
22874
22875 This option is used internally by the compiler to select and
22876 build multilibs for architectures @code{avr2} and @code{avr25}.
22877 These architectures mix devices with and without @code{SPH}.
22878 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
22879 the compiler driver adds or removes this option from the compiler
22880 proper's command line, because the compiler then knows if the device
22881 or architecture has an 8-bit stack pointer and thus no @code{SPH}
22882 register or not.
22883
22884 @opindex mstrict-X
22885 @item -mstrict-X
22886 Use address register @code{X} in a way proposed by the hardware. This means
22887 that @code{X} is only used in indirect, post-increment or
22888 pre-decrement addressing.
22889
22890 Without this option, the @code{X} register may be used in the same way
22891 as @code{Y} or @code{Z} which then is emulated by additional
22892 instructions.
22893 For example, loading a value with @code{X+const} addressing with a
22894 small non-negative @code{const < 64} to a register @var{Rn} is
22895 performed as
22896
22897 @example
22898 adiw r26, const ; X += const
22899 ld @var{Rn}, X ; @var{Rn} = *X
22900 sbiw r26, const ; X -= const
22901 @end example
22902
22903 @opindex mtiny-stack
22904 @item -mtiny-stack
22905 Only change the lower 8@tie{}bits of the stack pointer.
22906
22907 @opindex mfract-convert-truncate
22908 @item -mfract-convert-truncate
22909 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
22910
22911 @opindex nodevicelib
22912 @item -nodevicelib
22913 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
22914
22915 @opindex nodevicespecs
22916 @item -nodevicespecs
22917 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
22918 command line. The user takes responsibility for supplying the sub-processes
22919 like compiler proper, assembler and linker with appropriate command line
22920 options. This means that the user has to supply her private device specs
22921 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
22922 more need for option @option{-mmcu=@var{mcu}}.
22923
22924 This option can also serve as a replacement for the older way of
22925 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
22926 which contains a folder named @code{device-specs} which contains a specs file named
22927 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
22928
22929 @opindex Waddr-space-convert
22930 @opindex Wno-addr-space-convert
22931 @item -Waddr-space-convert
22932 Warn about conversions between address spaces in the case where the
22933 resulting address space is not contained in the incoming address space.
22934
22935 @opindex Wmisspelled-isr
22936 @opindex Wno-misspelled-isr
22937 @item -Wmisspelled-isr
22938 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
22939 Enabled by default.
22940 @end table
22941
22942 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
22943 @cindex @code{EIND}
22944 Pointers in the implementation are 16@tie{}bits wide.
22945 The address of a function or label is represented as word address so
22946 that indirect jumps and calls can target any code address in the
22947 range of 64@tie{}Ki words.
22948
22949 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
22950 bytes of program memory space, there is a special function register called
22951 @code{EIND} that serves as most significant part of the target address
22952 when @code{EICALL} or @code{EIJMP} instructions are used.
22953
22954 Indirect jumps and calls on these devices are handled as follows by
22955 the compiler and are subject to some limitations:
22956
22957 @itemize @bullet
22958
22959 @item
22960 The compiler never sets @code{EIND}.
22961
22962 @item
22963 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
22964 instructions or might read @code{EIND} directly in order to emulate an
22965 indirect call/jump by means of a @code{RET} instruction.
22966
22967 @item
22968 The compiler assumes that @code{EIND} never changes during the startup
22969 code or during the application. In particular, @code{EIND} is not
22970 saved/restored in function or interrupt service routine
22971 prologue/epilogue.
22972
22973 @item
22974 For indirect calls to functions and computed goto, the linker
22975 generates @emph{stubs}. Stubs are jump pads sometimes also called
22976 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
22977 The stub contains a direct jump to the desired address.
22978
22979 @item
22980 Linker relaxation must be turned on so that the linker generates
22981 the stubs correctly in all situations. See the compiler option
22982 @option{-mrelax} and the linker option @option{--relax}.
22983 There are corner cases where the linker is supposed to generate stubs
22984 but aborts without relaxation and without a helpful error message.
22985
22986 @item
22987 The default linker script is arranged for code with @code{EIND = 0}.
22988 If code is supposed to work for a setup with @code{EIND != 0}, a custom
22989 linker script has to be used in order to place the sections whose
22990 name start with @code{.trampolines} into the segment where @code{EIND}
22991 points to.
22992
22993 @item
22994 The startup code from libgcc never sets @code{EIND}.
22995 Notice that startup code is a blend of code from libgcc and AVR-LibC.
22996 For the impact of AVR-LibC on @code{EIND}, see the
22997 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
22998
22999 @item
23000 It is legitimate for user-specific startup code to set up @code{EIND}
23001 early, for example by means of initialization code located in
23002 section @code{.init3}. Such code runs prior to general startup code
23003 that initializes RAM and calls constructors, but after the bit
23004 of startup code from AVR-LibC that sets @code{EIND} to the segment
23005 where the vector table is located.
23006 @example
23007 #include <avr/io.h>
23008
23009 static void
23010 __attribute__((section(".init3"),naked,used,no_instrument_function))
23011 init3_set_eind (void)
23012 @{
23013 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23014 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23015 @}
23016 @end example
23017
23018 @noindent
23019 The @code{__trampolines_start} symbol is defined in the linker script.
23020
23021 @item
23022 Stubs are generated automatically by the linker if
23023 the following two conditions are met:
23024 @itemize @minus
23025
23026 @item The address of a label is taken by means of the @code{gs} modifier
23027 (short for @emph{generate stubs}) like so:
23028 @example
23029 LDI r24, lo8(gs(@var{func}))
23030 LDI r25, hi8(gs(@var{func}))
23031 @end example
23032 @item The final location of that label is in a code segment
23033 @emph{outside} the segment where the stubs are located.
23034 @end itemize
23035
23036 @item
23037 The compiler emits such @code{gs} modifiers for code labels in the
23038 following situations:
23039 @itemize @minus
23040 @item Taking address of a function or code label.
23041 @item Computed goto.
23042 @item If prologue-save function is used, see @option{-mcall-prologues}
23043 command-line option.
23044 @item Switch/case dispatch tables. If you do not want such dispatch
23045 tables you can specify the @option{-fno-jump-tables} command-line option.
23046 @item C and C++ constructors/destructors called during startup/shutdown.
23047 @item If the tools hit a @code{gs()} modifier explained above.
23048 @end itemize
23049
23050 @item
23051 Jumping to non-symbolic addresses like so is @emph{not} supported:
23052
23053 @example
23054 int main (void)
23055 @{
23056 /* Call function at word address 0x2 */
23057 return ((int(*)(void)) 0x2)();
23058 @}
23059 @end example
23060
23061 Instead, a stub has to be set up, i.e.@: the function has to be called
23062 through a symbol (@code{func_4} in the example):
23063
23064 @example
23065 int main (void)
23066 @{
23067 extern int func_4 (void);
23068
23069 /* Call function at byte address 0x4 */
23070 return func_4();
23071 @}
23072 @end example
23073
23074 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
23075 Alternatively, @code{func_4} can be defined in the linker script.
23076 @end itemize
23077
23078 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
23079 @cindex @code{RAMPD}
23080 @cindex @code{RAMPX}
23081 @cindex @code{RAMPY}
23082 @cindex @code{RAMPZ}
23083 Some AVR devices support memories larger than the 64@tie{}KiB range
23084 that can be accessed with 16-bit pointers. To access memory locations
23085 outside this 64@tie{}KiB range, the content of a @code{RAMP}
23086 register is used as high part of the address:
23087 The @code{X}, @code{Y}, @code{Z} address register is concatenated
23088 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
23089 register, respectively, to get a wide address. Similarly,
23090 @code{RAMPD} is used together with direct addressing.
23091
23092 @itemize
23093 @item
23094 The startup code initializes the @code{RAMP} special function
23095 registers with zero.
23096
23097 @item
23098 If a @ref{AVR Named Address Spaces,named address space} other than
23099 generic or @code{__flash} is used, then @code{RAMPZ} is set
23100 as needed before the operation.
23101
23102 @item
23103 If the device supports RAM larger than 64@tie{}KiB and the compiler
23104 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
23105 is reset to zero after the operation.
23106
23107 @item
23108 If the device comes with a specific @code{RAMP} register, the ISR
23109 prologue/epilogue saves/restores that SFR and initializes it with
23110 zero in case the ISR code might (implicitly) use it.
23111
23112 @item
23113 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
23114 If you use inline assembler to read from locations outside the
23115 16-bit address range and change one of the @code{RAMP} registers,
23116 you must reset it to zero after the access.
23117
23118 @end itemize
23119
23120 @subsubsection AVR Built-in Macros
23121
23122 GCC defines several built-in macros so that the user code can test
23123 for the presence or absence of features. Almost any of the following
23124 built-in macros are deduced from device capabilities and thus
23125 triggered by the @option{-mmcu=} command-line option.
23126
23127 For even more AVR-specific built-in macros see
23128 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
23129
23130 @table @code
23131
23132 @item __AVR_ARCH__
23133 Build-in macro that resolves to a decimal number that identifies the
23134 architecture and depends on the @option{-mmcu=@var{mcu}} option.
23135 Possible values are:
23136
23137 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
23138 @code{4}, @code{5}, @code{51}, @code{6}
23139
23140 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
23141 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
23142
23143 respectively and
23144
23145 @code{100},
23146 @code{102}, @code{103}, @code{104},
23147 @code{105}, @code{106}, @code{107}
23148
23149 for @var{mcu}=@code{avrtiny},
23150 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
23151 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
23152 If @var{mcu} specifies a device, this built-in macro is set
23153 accordingly. For example, with @option{-mmcu=atmega8} the macro is
23154 defined to @code{4}.
23155
23156 @item __AVR_@var{Device}__
23157 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
23158 the device's name. For example, @option{-mmcu=atmega8} defines the
23159 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
23160 @code{__AVR_ATtiny261A__}, etc.
23161
23162 The built-in macros' names follow
23163 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
23164 the device name as from the AVR user manual. The difference between
23165 @var{Device} in the built-in macro and @var{device} in
23166 @option{-mmcu=@var{device}} is that the latter is always lowercase.
23167
23168 If @var{device} is not a device but only a core architecture like
23169 @samp{avr51}, this macro is not defined.
23170
23171 @item __AVR_DEVICE_NAME__
23172 Setting @option{-mmcu=@var{device}} defines this built-in macro to
23173 the device's name. For example, with @option{-mmcu=atmega8} the macro
23174 is defined to @code{atmega8}.
23175
23176 If @var{device} is not a device but only a core architecture like
23177 @samp{avr51}, this macro is not defined.
23178
23179 @item __AVR_XMEGA__
23180 The device / architecture belongs to the XMEGA family of devices.
23181
23182 @item __AVR_HAVE_ELPM__
23183 The device has the @code{ELPM} instruction.
23184
23185 @item __AVR_HAVE_ELPMX__
23186 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23187 R@var{n},Z+} instructions.
23188
23189 @item __AVR_HAVE_MOVW__
23190 The device has the @code{MOVW} instruction to perform 16-bit
23191 register-register moves.
23192
23193 @item __AVR_HAVE_LPMX__
23194 The device has the @code{LPM R@var{n},Z} and
23195 @code{LPM R@var{n},Z+} instructions.
23196
23197 @item __AVR_HAVE_MUL__
23198 The device has a hardware multiplier.
23199
23200 @item __AVR_HAVE_JMP_CALL__
23201 The device has the @code{JMP} and @code{CALL} instructions.
23202 This is the case for devices with more than 8@tie{}KiB of program
23203 memory.
23204
23205 @item __AVR_HAVE_EIJMP_EICALL__
23206 @itemx __AVR_3_BYTE_PC__
23207 The device has the @code{EIJMP} and @code{EICALL} instructions.
23208 This is the case for devices with more than 128@tie{}KiB of program memory.
23209 This also means that the program counter
23210 (PC) is 3@tie{}bytes wide.
23211
23212 @item __AVR_2_BYTE_PC__
23213 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23214 with up to 128@tie{}KiB of program memory.
23215
23216 @item __AVR_HAVE_8BIT_SP__
23217 @itemx __AVR_HAVE_16BIT_SP__
23218 The stack pointer (SP) register is treated as 8-bit respectively
23219 16-bit register by the compiler.
23220 The definition of these macros is affected by @option{-mtiny-stack}.
23221
23222 @item __AVR_HAVE_SPH__
23223 @itemx __AVR_SP8__
23224 The device has the SPH (high part of stack pointer) special function
23225 register or has an 8-bit stack pointer, respectively.
23226 The definition of these macros is affected by @option{-mmcu=} and
23227 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23228 by @option{-msp8}.
23229
23230 @item __AVR_HAVE_RAMPD__
23231 @itemx __AVR_HAVE_RAMPX__
23232 @itemx __AVR_HAVE_RAMPY__
23233 @itemx __AVR_HAVE_RAMPZ__
23234 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23235 @code{RAMPZ} special function register, respectively.
23236
23237 @item __NO_INTERRUPTS__
23238 This macro reflects the @option{-mno-interrupts} command-line option.
23239
23240 @item __AVR_ERRATA_SKIP__
23241 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23242 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23243 instructions because of a hardware erratum. Skip instructions are
23244 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23245 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23246 set.
23247
23248 @item __AVR_ISA_RMW__
23249 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23250
23251 @item __AVR_SFR_OFFSET__=@var{offset}
23252 Instructions that can address I/O special function registers directly
23253 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23254 address as if addressed by an instruction to access RAM like @code{LD}
23255 or @code{STS}. This offset depends on the device architecture and has
23256 to be subtracted from the RAM address in order to get the
23257 respective I/O@tie{}address.
23258
23259 @item __AVR_SHORT_CALLS__
23260 The @option{-mshort-calls} command line option is set.
23261
23262 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23263 Some devices support reading from flash memory by means of @code{LD*}
23264 instructions. The flash memory is seen in the data address space
23265 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
23266 is not defined, this feature is not available. If defined,
23267 the address space is linear and there is no need to put
23268 @code{.rodata} into RAM. This is handled by the default linker
23269 description file, and is currently available for
23270 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
23271 there is no need to use address spaces like @code{__flash} or
23272 features like attribute @code{progmem} and @code{pgm_read_*}.
23273
23274 @item __WITH_AVRLIBC__
23275 The compiler is configured to be used together with AVR-Libc.
23276 See the @option{--with-avrlibc} configure option.
23277
23278 @item __HAVE_DOUBLE_MULTILIB__
23279 Defined if @option{-mdouble=} acts as a multilib option.
23280
23281 @item __HAVE_DOUBLE32__
23282 @itemx __HAVE_DOUBLE64__
23283 Defined if the compiler supports 32-bit double resp. 64-bit double.
23284 The actual layout is specified by option @option{-mdouble=}.
23285
23286 @item __DEFAULT_DOUBLE__
23287 The size in bits of @code{double} if @option{-mdouble=} is not set.
23288 To test the layout of @code{double} in a program, use the built-in
23289 macro @code{__SIZEOF_DOUBLE__}.
23290
23291 @item __HAVE_LONG_DOUBLE32__
23292 @itemx __HAVE_LONG_DOUBLE64__
23293 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23294 @itemx __DEFAULT_LONG_DOUBLE__
23295 Same as above, but for @code{long double} instead of @code{double}.
23296
23297 @item __WITH_DOUBLE_COMPARISON__
23298 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23299 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23300 and is defined to @code{2} or @code{3}.
23301
23302 @item __WITH_LIBF7_LIBGCC__
23303 @itemx __WITH_LIBF7_MATH__
23304 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23305 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23306 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23307
23308 @end table
23309
23310 @node Blackfin Options
23311 @subsection Blackfin Options
23312 @cindex Blackfin Options
23313
23314 @table @gcctabopt
23315 @opindex mcpu=
23316 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23317 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
23318 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23319 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23320 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23321 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23322 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23323 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23324 @samp{bf561}, @samp{bf592}.
23325
23326 The optional @var{sirevision} specifies the silicon revision of the target
23327 Blackfin processor. Any workarounds available for the targeted silicon revision
23328 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
23329 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23330 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
23331 hexadecimal digits representing the major and minor numbers in the silicon
23332 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23333 is not defined. If @var{sirevision} is @samp{any}, the
23334 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23335 If this optional @var{sirevision} is not used, GCC assumes the latest known
23336 silicon revision of the targeted Blackfin processor.
23337
23338 GCC defines a preprocessor macro for the specified @var{cpu}.
23339 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23340 provided by libgloss to be linked in if @option{-msim} is not given.
23341
23342 Without this option, @samp{bf532} is used as the processor by default.
23343
23344 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
23345 only the preprocessor macro is defined.
23346
23347 @opindex msim
23348 @item -msim
23349 Specifies that the program will be run on the simulator. This causes
23350 the simulator BSP provided by libgloss to be linked in. This option
23351 has effect only for @samp{bfin-elf} toolchain.
23352 Certain other options, such as @option{-mid-shared-library} and
23353 @option{-mfdpic}, imply @option{-msim}.
23354
23355 @opindex momit-leaf-frame-pointer
23356 @item -momit-leaf-frame-pointer
23357 Don't keep the frame pointer in a register for leaf functions. This
23358 avoids the instructions to save, set up and restore frame pointers and
23359 makes an extra register available in leaf functions.
23360
23361 @opindex mspecld-anomaly
23362 @item -mspecld-anomaly
23363 When enabled, the compiler ensures that the generated code does not
23364 contain speculative loads after jump instructions. If this option is used,
23365 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23366
23367 @opindex mno-specld-anomaly
23368 @opindex mspecld-anomaly
23369 @item -mno-specld-anomaly
23370 Don't generate extra code to prevent speculative loads from occurring.
23371
23372 @opindex mcsync-anomaly
23373 @item -mcsync-anomaly
23374 When enabled, the compiler ensures that the generated code does not
23375 contain CSYNC or SSYNC instructions too soon after conditional branches.
23376 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23377
23378 @opindex mno-csync-anomaly
23379 @opindex mcsync-anomaly
23380 @item -mno-csync-anomaly
23381 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23382 occurring too soon after a conditional branch.
23383
23384 @opindex mlow64k
23385 @item -mlow64k
23386 When enabled, the compiler is free to take advantage of the knowledge that
23387 the entire program fits into the low 64k of memory.
23388
23389 @opindex mno-low64k
23390 @item -mno-low64k
23391 Assume that the program is arbitrarily large. This is the default.
23392
23393 @opindex mstack-check-l1
23394 @item -mstack-check-l1
23395 Do stack checking using information placed into L1 scratchpad memory by the
23396 uClinux kernel.
23397
23398 @opindex mid-shared-library
23399 @item -mid-shared-library
23400 Generate code that supports shared libraries via the library ID method.
23401 This allows for execute in place and shared libraries in an environment
23402 without virtual memory management. This option implies @option{-fPIC}.
23403 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23404
23405 @opindex mno-id-shared-library
23406 @opindex mid-shared-library
23407 @item -mno-id-shared-library
23408 Generate code that doesn't assume ID-based shared libraries are being used.
23409 This is the default.
23410
23411 @opindex mleaf-id-shared-library
23412 @item -mleaf-id-shared-library
23413 Generate code that supports shared libraries via the library ID method,
23414 but assumes that this library or executable won't link against any other
23415 ID shared libraries. That allows the compiler to use faster code for jumps
23416 and calls.
23417
23418 @opindex mno-leaf-id-shared-library
23419 @opindex mleaf-id-shared-library
23420 @item -mno-leaf-id-shared-library
23421 Do not assume that the code being compiled won't link against any ID shared
23422 libraries. Slower code is generated for jump and call insns.
23423
23424 @opindex mshared-library-id
23425 @item -mshared-library-id=n
23426 Specifies the identification number of the ID-based shared library being
23427 compiled. Specifying a value of 0 generates more compact code; specifying
23428 other values forces the allocation of that number to the current
23429 library but is no more space- or time-efficient than omitting this option.
23430
23431 @opindex msep-data
23432 @item -msep-data
23433 Generate code that allows the data segment to be located in a different
23434 area of memory from the text segment. This allows for execute in place in
23435 an environment without virtual memory management by eliminating relocations
23436 against the text section.
23437
23438 @opindex mno-sep-data
23439 @opindex msep-data
23440 @item -mno-sep-data
23441 Generate code that assumes that the data segment follows the text segment.
23442 This is the default.
23443
23444 @opindex mlong-calls
23445 @opindex mno-long-calls
23446 @item -mlong-calls
23447 @itemx -mno-long-calls
23448 Tells the compiler to perform function calls by first loading the
23449 address of the function into a register and then performing a subroutine
23450 call on this register. This switch is needed if the target function
23451 lies outside of the 24-bit addressing range of the offset-based
23452 version of subroutine call instruction.
23453
23454 This feature is not enabled by default. Specifying
23455 @option{-mno-long-calls} restores the default behavior. Note these
23456 switches have no effect on how the compiler generates code to handle
23457 function calls via function pointers.
23458
23459 @opindex mfast-fp
23460 @item -mfast-fp
23461 Link with the fast floating-point library. This library relaxes some of
23462 the IEEE floating-point standard's rules for checking inputs against
23463 Not-a-Number (NAN), in the interest of performance.
23464
23465 @opindex minline-plt
23466 @item -minline-plt
23467 Enable inlining of PLT entries in function calls to functions that are
23468 not known to bind locally. It has no effect without @option{-mfdpic}.
23469
23470 @opindex mmulticore
23471 @item -mmulticore
23472 Build a standalone application for multicore Blackfin processors.
23473 This option causes proper start files and link scripts supporting
23474 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
23475 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
23476
23477 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23478 selects the one-application-per-core programming model. Without
23479 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23480 programming model is used. In this model, the main function of Core B
23481 should be named as @code{coreb_main}.
23482
23483 If this option is not used, the single-core application programming
23484 model is used.
23485
23486 @opindex mcorea
23487 @item -mcorea
23488 Build a standalone application for Core A of BF561 when using
23489 the one-application-per-core programming model. Proper start files
23490 and link scripts are used to support Core A, and the macro
23491 @code{__BFIN_COREA} is defined.
23492 This option can only be used in conjunction with @option{-mmulticore}.
23493
23494 @opindex mcoreb
23495 @item -mcoreb
23496 Build a standalone application for Core B of BF561 when using
23497 the one-application-per-core programming model. Proper start files
23498 and link scripts are used to support Core B, and the macro
23499 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23500 should be used instead of @code{main}.
23501 This option can only be used in conjunction with @option{-mmulticore}.
23502
23503 @opindex msdram
23504 @item -msdram
23505 Build a standalone application for SDRAM. Proper start files and
23506 link scripts are used to put the application into SDRAM, and the macro
23507 @code{__BFIN_SDRAM} is defined.
23508 The loader should initialize SDRAM before loading the application.
23509
23510 @opindex micplb
23511 @item -micplb
23512 Assume that ICPLBs are enabled at run time. This has an effect on certain
23513 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
23514 are enabled; for standalone applications the default is off.
23515 @end table
23516
23517 @node C6X Options
23518 @subsection C6X Options
23519 @cindex C6X Options
23520
23521 @table @gcctabopt
23522 @opindex march
23523 @item -march=@var{name}
23524 This specifies the name of the target architecture. GCC uses this
23525 name to determine what kind of instructions it can emit when generating
23526 assembly code. Permissible names are: @samp{c62x},
23527 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23528
23529 @opindex mbig-endian
23530 @item -mbig-endian
23531 Generate code for a big-endian target.
23532
23533 @opindex mlittle-endian
23534 @item -mlittle-endian
23535 Generate code for a little-endian target. This is the default.
23536
23537 @opindex msim
23538 @item -msim
23539 Choose startup files and linker script suitable for the simulator.
23540
23541 @opindex msdata=default
23542 @item -msdata=default
23543 Put small global and static data in the @code{.neardata} section,
23544 which is pointed to by register @code{B14}. Put small uninitialized
23545 global and static data in the @code{.bss} section, which is adjacent
23546 to the @code{.neardata} section. Put small read-only data into the
23547 @code{.rodata} section. The corresponding sections used for large
23548 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23549
23550 @opindex msdata=all
23551 @item -msdata=all
23552 Put all data, not just small objects, into the sections reserved for
23553 small data, and use addressing relative to the @code{B14} register to
23554 access them.
23555
23556 @opindex msdata=none
23557 @item -msdata=none
23558 Make no use of the sections reserved for small data, and use absolute
23559 addresses to access all data. Put all initialized global and static
23560 data in the @code{.fardata} section, and all uninitialized data in the
23561 @code{.far} section. Put all constant data into the @code{.const}
23562 section.
23563 @end table
23564
23565 @node CRIS Options
23566 @subsection CRIS Options
23567 @cindex CRIS Options
23568
23569 These options are defined specifically for the CRIS ports.
23570
23571 @table @gcctabopt
23572 @opindex march
23573 @opindex mcpu
23574 @item -march=@var{architecture-type}
23575 @itemx -mcpu=@var{architecture-type}
23576 Generate code for the specified architecture. The choices for
23577 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23578 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23579 Default is @samp{v0}.
23580
23581 @opindex mtune
23582 @item -mtune=@var{architecture-type}
23583 Tune to @var{architecture-type} everything applicable about the generated
23584 code, except for the ABI and the set of available instructions. The
23585 choices for @var{architecture-type} are the same as for
23586 @option{-march=@var{architecture-type}}.
23587
23588 @opindex mmax-stack-frame
23589 @item -mmax-stack-frame=@var{n}
23590 Warn when the stack frame of a function exceeds @var{n} bytes.
23591
23592 @opindex metrax4
23593 @opindex metrax100
23594 @item -metrax4
23595 @itemx -metrax100
23596 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23597 @option{-march=v3} and @option{-march=v8} respectively.
23598
23599 @opindex mmul-bug-workaround
23600 @opindex mno-mul-bug-workaround
23601 @item -mmul-bug-workaround
23602 @itemx -mno-mul-bug-workaround
23603 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23604 models where it applies. This option is disabled by default.
23605
23606 @opindex mpdebug
23607 @item -mpdebug
23608 Enable CRIS-specific verbose debug-related information in the assembly
23609 code. This option also has the effect of turning off the @samp{#NO_APP}
23610 formatted-code indicator to the assembler at the beginning of the
23611 assembly file.
23612
23613 @opindex mcc-init
23614 @item -mcc-init
23615 Do not use condition-code results from previous instruction; always emit
23616 compare and test instructions before use of condition codes.
23617
23618 @opindex mno-side-effects
23619 @opindex mside-effects
23620 @item -mno-side-effects
23621 Do not emit instructions with side effects in addressing modes other than
23622 post-increment.
23623
23624 @opindex mstack-align
23625 @opindex mno-stack-align
23626 @opindex mdata-align
23627 @opindex mno-data-align
23628 @opindex mconst-align
23629 @opindex mno-const-align
23630 @item -mstack-align
23631 @itemx -mno-stack-align
23632 @itemx -mdata-align
23633 @itemx -mno-data-align
23634 @itemx -mconst-align
23635 @itemx -mno-const-align
23636 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23637 stack frame, individual data and constants to be aligned for the maximum
23638 single data access size for the chosen CPU model. The default is to
23639 arrange for 32-bit alignment. ABI details such as structure layout are
23640 not affected by these options.
23641
23642 @opindex m32-bit
23643 @opindex m16-bit
23644 @opindex m8-bit
23645 @item -m32-bit
23646 @itemx -m16-bit
23647 @itemx -m8-bit
23648 Similar to the stack- data- and const-align options above, these options
23649 arrange for stack frame, writable data and constants to all be 32-bit,
23650 16-bit or 8-bit aligned. The default is 32-bit alignment.
23651
23652 @opindex mno-prologue-epilogue
23653 @opindex mprologue-epilogue
23654 @item -mno-prologue-epilogue
23655 @itemx -mprologue-epilogue
23656 With @option{-mno-prologue-epilogue}, the normal function prologue and
23657 epilogue which set up the stack frame are omitted and no return
23658 instructions or return sequences are generated in the code. Use this
23659 option only together with visual inspection of the compiled code: no
23660 warnings or errors are generated when call-saved registers must be saved,
23661 or storage for local variables needs to be allocated.
23662
23663 @opindex melf
23664 @item -melf
23665 Legacy no-op option.
23666
23667 @opindex sim
23668 @item -sim
23669 This option arranges
23670 to link with input-output functions from a simulator library. Code,
23671 initialized data and zero-initialized data are allocated consecutively.
23672
23673 @opindex sim2
23674 @item -sim2
23675 Like @option{-sim}, but pass linker options to locate initialized data at
23676 0x40000000 and zero-initialized data at 0x80000000.
23677 @end table
23678
23679 @node C-SKY Options
23680 @subsection C-SKY Options
23681 @cindex C-SKY Options
23682
23683 GCC supports these options when compiling for C-SKY V2 processors.
23684
23685 @table @gcctabopt
23686
23687 @opindex march=
23688 @item -march=@var{arch}
23689 Specify the C-SKY target architecture. Valid values for @var{arch} are:
23690 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23691 The default is @samp{ck810}.
23692
23693 @opindex mcpu=
23694 @item -mcpu=@var{cpu}
23695 Specify the C-SKY target processor. Valid values for @var{cpu} are:
23696 @samp{ck801}, @samp{ck801t},
23697 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23698 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23699 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23700 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23701 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23702 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23703 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23704 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23705 @samp{ck803eftr1}, @samp{ck803efhtr1},
23706 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23707 @samp{ck803sef}, @samp{ck803seft},
23708 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23709 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23710 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23711 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23712
23713 @opindex mbig-endian
23714 @opindex EB
23715 @opindex mlittle-endian
23716 @opindex EL
23717 @item -mbig-endian
23718 @itemx -EB
23719 @itemx -mlittle-endian
23720 @itemx -EL
23721
23722 Select big- or little-endian code. The default is little-endian.
23723
23724 @opindex mfloat-abi
23725 @item -mfloat-abi=@var{name}
23726 Specifies which floating-point ABI to use. Permissible values
23727 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23728
23729 Specifying @samp{soft} causes GCC to generate output containing
23730 library calls for floating-point operations.
23731 @samp{softfp} allows the generation of code using hardware floating-point
23732 instructions, but still uses the soft-float calling conventions.
23733 @samp{hard} allows generation of floating-point instructions
23734 and uses FPU-specific calling conventions.
23735
23736 The default depends on the specific target configuration. Note that
23737 the hard-float and soft-float ABIs are not link-compatible; you must
23738 compile your entire program with the same ABI, and link with a
23739 compatible set of libraries.
23740
23741 @opindex mhard-float
23742 @opindex msoft-float
23743 @item -mhard-float
23744 @itemx -msoft-float
23745
23746 Select hardware or software floating-point implementations.
23747 The default is soft float.
23748
23749 @opindex mdouble-float
23750 @item -mdouble-float
23751 @itemx -mno-double-float
23752 When @option{-mhard-float} is in effect, enable generation of
23753 double-precision float instructions. This is the default except
23754 when compiling for CK803.
23755
23756 @opindex mfdivdu
23757 @item -mfdivdu
23758 @itemx -mno-fdivdu
23759 When @option{-mhard-float} is in effect, enable generation of
23760 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
23761 This is the default except when compiling for CK803.
23762
23763 @opindex mfpu=
23764 @item -mfpu=@var{fpu}
23765 Select the floating-point processor. This option can only be used with
23766 @option{-mhard-float}.
23767 Values for @var{fpu} are
23768 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
23769 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
23770 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
23771
23772 @opindex melrw
23773 @item -melrw
23774 @itemx -mno-elrw
23775 Enable the extended @code{lrw} instruction. This option defaults to on
23776 for CK801 and off otherwise.
23777
23778 @opindex mistack
23779 @item -mistack
23780 @itemx -mno-istack
23781 Enable interrupt stack instructions; the default is off.
23782
23783 The @option{-mistack} option is required to handle the
23784 @code{interrupt} and @code{isr} function attributes
23785 (@pxref{C-SKY Function Attributes}).
23786
23787 @opindex mmp
23788 @item -mmp
23789 Enable multiprocessor instructions; the default is off.
23790
23791 @opindex mcp
23792 @item -mcp
23793 Enable coprocessor instructions; the default is off.
23794
23795 @opindex mcache
23796 @item -mcache
23797 Enable coprocessor instructions; the default is off.
23798
23799 @opindex msecurity
23800 @item -msecurity
23801 Enable C-SKY security instructions; the default is off.
23802
23803 @opindex mtrust
23804 @item -mtrust
23805 Enable C-SKY trust instructions; the default is off.
23806
23807 @opindex mdsp
23808 @opindex medsp
23809 @opindex mvdsp
23810 @item -mdsp
23811 @itemx -medsp
23812 @itemx -mvdsp
23813 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
23814 All of these options default to off.
23815
23816 @opindex mdiv
23817 @item -mdiv
23818 @itemx -mno-div
23819 Generate divide instructions. Default is off.
23820
23821 @opindex msmart
23822 @item -msmart
23823 @itemx -mno-smart
23824 Generate code for Smart Mode, using only registers numbered 0-7 to allow
23825 use of 16-bit instructions. This option is ignored for CK801 where this
23826 is the required behavior, and it defaults to on for CK802.
23827 For other targets, the default is off.
23828
23829 @opindex mhigh-registers
23830 @item -mhigh-registers
23831 @itemx -mno-high-registers
23832 Generate code using the high registers numbered 16-31. This option
23833 is not supported on CK801, CK802, or CK803, and is enabled by default
23834 for other processors.
23835
23836 @opindex manchor
23837 @item -manchor
23838 @itemx -mno-anchor
23839 Generate code using global anchor symbol addresses.
23840
23841 @opindex mpushpop
23842 @item -mpushpop
23843 @itemx -mno-pushpop
23844 Generate code using @code{push} and @code{pop} instructions. This option
23845 defaults to on.
23846
23847 @opindex mmultiple-stld
23848 @item -mmultiple-stld
23849 @itemx -mstm
23850 @itemx -mno-multiple-stld
23851 @itemx -mno-stm
23852 Generate code using @code{stm} and @code{ldm} instructions. This option
23853 isn't supported on CK801 but is enabled by default on other processors.
23854
23855 @opindex mconstpool
23856 @item -mconstpool
23857 @itemx -mno-constpool
23858 Create constant pools in the compiler instead of deferring it to the
23859 assembler. This option is the default and required for correct code
23860 generation on CK801 and CK802, and is optional on other processors.
23861
23862 @opindex mstack-size
23863 @item -mstack-size
23864 @item -mno-stack-size
23865 Emit @code{.stack_size} directives for each function in the assembly
23866 output. This option defaults to off.
23867
23868 @opindex mccrt
23869 @item -mccrt
23870 @itemx -mno-ccrt
23871 Generate code for the C-SKY compiler runtime instead of libgcc. This
23872 option defaults to off.
23873
23874 @opindex mbranch-cost=
23875 @item -mbranch-cost=@var{n}
23876 Set the branch costs to roughly @code{n} instructions. The default is 1.
23877
23878 @opindex msched-prolog
23879 @item -msched-prolog
23880 @itemx -mno-sched-prolog
23881 Permit scheduling of function prologue and epilogue sequences. Using
23882 this option can result in code that is not compliant with the C-SKY V2 ABI
23883 prologue requirements and that cannot be debugged or backtraced.
23884 It is disabled by default.
23885
23886 @opindex msim
23887 @item -msim
23888 Links the library libsemi.a which is in compatible with simulator. Applicable
23889 to ELF compiler only.
23890
23891 @end table
23892
23893 @node Darwin Options
23894 @subsection Darwin Options
23895 @cindex Darwin options
23896
23897 These options are defined for all architectures running the Darwin operating
23898 system.
23899
23900 FSF GCC on Darwin does not create ``fat'' object files; it creates
23901 an object file for the single architecture that GCC was built to
23902 target. Apple's GCC on Darwin does create ``fat'' files if multiple
23903 @option{-arch} options are used; it does so by running the compiler or
23904 linker multiple times and joining the results together with
23905 @file{lipo}.
23906
23907 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
23908 @samp{i686}) is determined by the flags that specify the ISA
23909 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
23910 @option{-force_cpusubtype_ALL} option can be used to override this.
23911
23912 The Darwin tools vary in their behavior when presented with an ISA
23913 mismatch. The assembler, @file{as}, only permits instructions to
23914 be used that are valid for the subtype of the file it is generating,
23915 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
23916 The linker for shared libraries, @file{/usr/bin/libtool}, fails
23917 and prints an error if asked to create a shared library with a less
23918 restrictive subtype than its input files (for instance, trying to put
23919 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
23920 for executables, @command{ld}, quietly gives the executable the most
23921 restrictive subtype of any of its input files.
23922
23923 @table @gcctabopt
23924 @opindex F
23925 @item -F@var{dir}
23926 Add the framework directory @var{dir} to the head of the list of
23927 directories to be searched for header files. These directories are
23928 interleaved with those specified by @option{-I} options and are
23929 scanned in a left-to-right order.
23930
23931 A framework directory is a directory with frameworks in it. A
23932 framework is a directory with a @file{Headers} and/or
23933 @file{PrivateHeaders} directory contained directly in it that ends
23934 in @file{.framework}. The name of a framework is the name of this
23935 directory excluding the @file{.framework}. Headers associated with
23936 the framework are found in one of those two directories, with
23937 @file{Headers} being searched first. A subframework is a framework
23938 directory that is in a framework's @file{Frameworks} directory.
23939 Includes of subframework headers can only appear in a header of a
23940 framework that contains the subframework, or in a sibling subframework
23941 header. Two subframeworks are siblings if they occur in the same
23942 framework. A subframework should not have the same name as a
23943 framework; a warning is issued if this is violated. Currently a
23944 subframework cannot have subframeworks; in the future, the mechanism
23945 may be extended to support this. The standard frameworks can be found
23946 in @file{/System/Library/Frameworks} and
23947 @file{/Library/Frameworks}. An example include looks like
23948 @code{#include <Framework/header.h>}, where @file{Framework} denotes
23949 the name of the framework and @file{header.h} is found in the
23950 @file{PrivateHeaders} or @file{Headers} directory.
23951
23952 @opindex iframework
23953 @item -iframework@var{dir}
23954 Like @option{-F} except the directory is a treated as a system
23955 directory. The main difference between this @option{-iframework} and
23956 @option{-F} is that with @option{-iframework} the compiler does not
23957 warn about constructs contained within header files found via
23958 @var{dir}. This option is valid only for the C family of languages.
23959
23960 @opindex gused
23961 @item -gused
23962 Emit debugging information for symbols that are used. For stabs
23963 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
23964 This is by default ON@.
23965
23966 @opindex gfull
23967 @item -gfull
23968 Emit debugging information for all symbols and types.
23969
23970 @item -mmacosx-version-min=@var{version}
23971 The earliest version of MacOS X that this executable will run on
23972 is @var{version}. Typical values of @var{version} include @code{10.1},
23973 @code{10.2}, and @code{10.3.9}.
23974
23975 If the compiler was built to use the system's headers by default,
23976 then the default for this option is the system version on which the
23977 compiler is running, otherwise the default is to make choices that
23978 are compatible with as many systems and code bases as possible.
23979
23980 @opindex mkernel
23981 @item -mkernel
23982 Enable kernel development mode. The @option{-mkernel} option sets
23983 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
23984 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
23985 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
23986 applicable. This mode also sets @option{-mno-altivec},
23987 @option{-msoft-float}, @option{-fno-builtin} and
23988 @option{-mlong-branch} for PowerPC targets.
23989
23990 @opindex mone-byte-bool
23991 @item -mone-byte-bool
23992 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
23993 By default @code{sizeof(bool)} is @code{4} when compiling for
23994 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
23995 option has no effect on x86.
23996
23997 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
23998 to generate code that is not binary compatible with code generated
23999 without that switch. Using this switch may require recompiling all
24000 other modules in a program, including system libraries. Use this
24001 switch to conform to a non-default data model.
24002
24003 @opindex mfix-and-continue
24004 @opindex ffix-and-continue
24005 @opindex findirect-data
24006 @item -mfix-and-continue
24007 @itemx -ffix-and-continue
24008 @itemx -findirect-data
24009 Generate code suitable for fast turnaround development, such as to
24010 allow GDB to dynamically load @file{.o} files into already-running
24011 programs. @option{-findirect-data} and @option{-ffix-and-continue}
24012 are provided for backwards compatibility.
24013
24014 @opindex all_load
24015 @item -all_load
24016 Loads all members of static archive libraries.
24017 See man ld(1) for more information.
24018
24019 @opindex arch_errors_fatal
24020 @item -arch_errors_fatal
24021 Cause the errors having to do with files that have the wrong architecture
24022 to be fatal.
24023
24024 @opindex bind_at_load
24025 @item -bind_at_load
24026 Causes the output file to be marked such that the dynamic linker will
24027 bind all undefined references when the file is loaded or launched.
24028
24029 @opindex bundle
24030 @item -bundle
24031 Produce a Mach-o bundle format file.
24032 See man ld(1) for more information.
24033
24034 @opindex bundle_loader
24035 @item -bundle_loader @var{executable}
24036 This option specifies the @var{executable} that will load the build
24037 output file being linked. See man ld(1) for more information.
24038
24039 @opindex dynamiclib
24040 @item -dynamiclib
24041 When passed this option, GCC produces a dynamic library instead of
24042 an executable when linking, using the Darwin @file{libtool} command.
24043
24044 @opindex force_cpusubtype_ALL
24045 @item -force_cpusubtype_ALL
24046 This causes GCC's output file to have the @samp{ALL} subtype, instead of
24047 one controlled by the @option{-mcpu} or @option{-march} option.
24048
24049 @item -allowable_client @var{client_name}
24050 @itemx -client_name
24051 @itemx -compatibility_version
24052 @itemx -current_version
24053 @itemx -dead_strip
24054 @itemx -dependency-file
24055 @itemx -dylib_file
24056 @itemx -dylinker_install_name
24057 @itemx -dynamic
24058 @itemx -exported_symbols_list
24059 @itemx -filelist
24060 @need 800
24061 @itemx -flat_namespace
24062 @itemx -force_flat_namespace
24063 @itemx -headerpad_max_install_names
24064 @itemx -image_base
24065 @itemx -init
24066 @itemx -install_name
24067 @itemx -keep_private_externs
24068 @itemx -multi_module
24069 @itemx -multiply_defined
24070 @itemx -multiply_defined_unused
24071 @need 800
24072 @itemx -noall_load
24073 @itemx -no_dead_strip_inits_and_terms
24074 @itemx -nofixprebinding
24075 @itemx -nomultidefs
24076 @itemx -noprebind
24077 @itemx -noseglinkedit
24078 @itemx -pagezero_size
24079 @itemx -prebind
24080 @itemx -prebind_all_twolevel_modules
24081 @itemx -private_bundle
24082 @need 800
24083 @itemx -read_only_relocs
24084 @itemx -sectalign
24085 @itemx -sectobjectsymbols
24086 @itemx -whyload
24087 @itemx -seg1addr
24088 @itemx -sectcreate
24089 @itemx -sectobjectsymbols
24090 @itemx -sectorder
24091 @itemx -segaddr
24092 @itemx -segs_read_only_addr
24093 @need 800
24094 @itemx -segs_read_write_addr
24095 @itemx -seg_addr_table
24096 @itemx -seg_addr_table_filename
24097 @itemx -seglinkedit
24098 @itemx -segprot
24099 @itemx -segs_read_only_addr
24100 @itemx -segs_read_write_addr
24101 @itemx -single_module
24102 @itemx -static
24103 @itemx -sub_library
24104 @need 800
24105 @opindex allowable_client
24106 @opindex client_name
24107 @opindex compatibility_version
24108 @opindex current_version
24109 @opindex dead_strip
24110 @opindex dependency-file
24111 @opindex dylib_file
24112 @opindex dylinker_install_name
24113 @opindex dynamic
24114 @opindex exported_symbols_list
24115 @opindex filelist
24116 @opindex flat_namespace
24117 @opindex force_flat_namespace
24118 @opindex headerpad_max_install_names
24119 @opindex image_base
24120 @opindex init
24121 @opindex install_name
24122 @opindex keep_private_externs
24123 @opindex multi_module
24124 @opindex multiply_defined
24125 @opindex multiply_defined_unused
24126 @opindex noall_load
24127 @opindex no_dead_strip_inits_and_terms
24128 @opindex nofixprebinding
24129 @opindex nomultidefs
24130 @opindex noprebind
24131 @opindex noseglinkedit
24132 @opindex pagezero_size
24133 @opindex prebind
24134 @opindex prebind_all_twolevel_modules
24135 @opindex private_bundle
24136 @opindex read_only_relocs
24137 @opindex sectalign
24138 @opindex sectobjectsymbols
24139 @opindex whyload
24140 @opindex seg1addr
24141 @opindex sectcreate
24142 @opindex sectobjectsymbols
24143 @opindex sectorder
24144 @opindex segaddr
24145 @opindex segs_read_only_addr
24146 @opindex segs_read_write_addr
24147 @opindex seg_addr_table
24148 @opindex seg_addr_table_filename
24149 @opindex seglinkedit
24150 @opindex segprot
24151 @opindex segs_read_only_addr
24152 @opindex segs_read_write_addr
24153 @opindex single_module
24154 @opindex static
24155 @opindex sub_library
24156 @opindex sub_umbrella
24157 @opindex twolevel_namespace
24158 @opindex umbrella
24159 @opindex undefined
24160 @opindex unexported_symbols_list
24161 @opindex weak_reference_mismatches
24162 @opindex whatsloaded
24163 @itemx -sub_umbrella
24164 @itemx -twolevel_namespace
24165 @itemx -umbrella
24166 @itemx -undefined
24167 @itemx -unexported_symbols_list
24168 @itemx -weak_reference_mismatches
24169 @itemx -whatsloaded
24170 These options are passed to the Darwin linker. The Darwin linker man page
24171 describes them in detail.
24172 @end table
24173
24174 @node DEC Alpha Options
24175 @subsection DEC Alpha Options
24176
24177 These @samp{-m} options are defined for the DEC Alpha implementations:
24178
24179 @table @gcctabopt
24180 @opindex mno-soft-float
24181 @opindex msoft-float
24182 @item -mno-soft-float
24183 @itemx -msoft-float
24184 Use (do not use) the hardware floating-point instructions for
24185 floating-point operations. When @option{-msoft-float} is specified,
24186 functions in @file{libgcc.a} are used to perform floating-point
24187 operations. Unless they are replaced by routines that emulate the
24188 floating-point operations, or compiled in such a way as to call such
24189 emulations routines, these routines issue floating-point
24190 operations. If you are compiling for an Alpha without floating-point
24191 operations, you must ensure that the library is built so as not to call
24192 them.
24193
24194 Note that Alpha implementations without floating-point operations are
24195 required to have floating-point registers.
24196
24197 @opindex mfp-reg
24198 @opindex mno-fp-regs
24199 @item -mfp-reg
24200 @itemx -mno-fp-regs
24201 Generate code that uses (does not use) the floating-point register set.
24202 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
24203 register set is not used, floating-point operands are passed in integer
24204 registers as if they were integers and floating-point results are passed
24205 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
24206 so any function with a floating-point argument or return value called by code
24207 compiled with @option{-mno-fp-regs} must also be compiled with that
24208 option.
24209
24210 A typical use of this option is building a kernel that does not use,
24211 and hence need not save and restore, any floating-point registers.
24212
24213 @opindex mieee
24214 @item -mieee
24215 The Alpha architecture implements floating-point hardware optimized for
24216 maximum performance. It is mostly compliant with the IEEE floating-point
24217 standard. However, for full compliance, software assistance is
24218 required. This option generates code fully IEEE-compliant code
24219 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24220 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24221 defined during compilation. The resulting code is less efficient but is
24222 able to correctly support denormalized numbers and exceptional IEEE
24223 values such as not-a-number and plus/minus infinity. Other Alpha
24224 compilers call this option @option{-ieee_with_no_inexact}.
24225
24226 @opindex mieee-with-inexact
24227 @item -mieee-with-inexact
24228 This is like @option{-mieee} except the generated code also maintains
24229 the IEEE @var{inexact-flag}. Turning on this option causes the
24230 generated code to implement fully-compliant IEEE math. In addition to
24231 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24232 macro. On some Alpha implementations the resulting code may execute
24233 significantly slower than the code generated by default. Since there is
24234 very little code that depends on the @var{inexact-flag}, you should
24235 normally not specify this option. Other Alpha compilers call this
24236 option @option{-ieee_with_inexact}.
24237
24238 @opindex mfp-trap-mode
24239 @item -mfp-trap-mode=@var{trap-mode}
24240 This option controls what floating-point related traps are enabled.
24241 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24242 The trap mode can be set to one of four values:
24243
24244 @table @samp
24245 @item n
24246 This is the default (normal) setting. The only traps that are enabled
24247 are the ones that cannot be disabled in software (e.g., division by zero
24248 trap).
24249
24250 @item u
24251 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24252 as well.
24253
24254 @item su
24255 Like @samp{u}, but the instructions are marked to be safe for software
24256 completion (see Alpha architecture manual for details).
24257
24258 @item sui
24259 Like @samp{su}, but inexact traps are enabled as well.
24260 @end table
24261
24262 @opindex mfp-rounding-mode
24263 @item -mfp-rounding-mode=@var{rounding-mode}
24264 Selects the IEEE rounding mode. Other Alpha compilers call this option
24265 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
24266 of:
24267
24268 @table @samp
24269 @item n
24270 Normal IEEE rounding mode. Floating-point numbers are rounded towards
24271 the nearest machine number or towards the even machine number in case
24272 of a tie.
24273
24274 @item m
24275 Round towards minus infinity.
24276
24277 @item c
24278 Chopped rounding mode. Floating-point numbers are rounded towards zero.
24279
24280 @item d
24281 Dynamic rounding mode. A field in the floating-point control register
24282 (@var{fpcr}, see Alpha architecture reference manual) controls the
24283 rounding mode in effect. The C library initializes this register for
24284 rounding towards plus infinity. Thus, unless your program modifies the
24285 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24286 @end table
24287
24288 @opindex mtrap-precision
24289 @item -mtrap-precision=@var{trap-precision}
24290 In the Alpha architecture, floating-point traps are imprecise. This
24291 means without software assistance it is impossible to recover from a
24292 floating trap and program execution normally needs to be terminated.
24293 GCC can generate code that can assist operating system trap handlers
24294 in determining the exact location that caused a floating-point trap.
24295 Depending on the requirements of an application, different levels of
24296 precisions can be selected:
24297
24298 @table @samp
24299 @item p
24300 Program precision. This option is the default and means a trap handler
24301 can only identify which program caused a floating-point exception.
24302
24303 @item f
24304 Function precision. The trap handler can determine the function that
24305 caused a floating-point exception.
24306
24307 @item i
24308 Instruction precision. The trap handler can determine the exact
24309 instruction that caused a floating-point exception.
24310 @end table
24311
24312 Other Alpha compilers provide the equivalent options called
24313 @option{-scope_safe} and @option{-resumption_safe}.
24314
24315 @opindex mieee-conformant
24316 @item -mieee-conformant
24317 This option marks the generated code as IEEE conformant. You must not
24318 use this option unless you also specify @option{-mtrap-precision=i} and either
24319 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
24320 is to emit the line @samp{.eflag 48} in the function prologue of the
24321 generated assembly file.
24322
24323 @opindex mbuild-constants
24324 @item -mbuild-constants
24325 Normally GCC examines a 32- or 64-bit integer constant to
24326 see if it can construct it from smaller constants in two or three
24327 instructions. If it cannot, it outputs the constant as a literal and
24328 generates code to load it from the data segment at run time.
24329
24330 Use this option to require GCC to construct @emph{all} integer constants
24331 using code, even if it takes more instructions (the maximum is six).
24332
24333 You typically use this option to build a shared library dynamic
24334 loader. Itself a shared library, it must relocate itself in memory
24335 before it can find the variables and constants in its own data segment.
24336
24337 @opindex mbwx
24338 @opindex mno-bwx
24339 @opindex mcix
24340 @opindex mno-cix
24341 @opindex mfix
24342 @opindex mno-fix
24343 @opindex mmax
24344 @opindex mno-max
24345 @item -mbwx
24346 @itemx -mno-bwx
24347 @itemx -mcix
24348 @itemx -mno-cix
24349 @itemx -mfix
24350 @itemx -mno-fix
24351 @itemx -mmax
24352 @itemx -mno-max
24353 Indicate whether GCC should generate code to use the optional BWX,
24354 CIX, FIX and MAX instruction sets. The default is to use the instruction
24355 sets supported by the CPU type specified via @option{-mcpu=} option or that
24356 of the CPU on which GCC was built if none is specified.
24357
24358 @opindex mfloat-vax
24359 @opindex mfloat-ieee
24360 @item -mfloat-vax
24361 @itemx -mfloat-ieee
24362 Generate code that uses (does not use) VAX F and G floating-point
24363 arithmetic instead of IEEE single and double precision.
24364
24365 @opindex mexplicit-relocs
24366 @opindex mno-explicit-relocs
24367 @item -mexplicit-relocs
24368 @itemx -mno-explicit-relocs
24369 Older Alpha assemblers provided no way to generate symbol relocations
24370 except via assembler macros. Use of these macros does not allow
24371 optimal instruction scheduling. GNU binutils as of version 2.12
24372 supports a new syntax that allows the compiler to explicitly mark
24373 which relocations should apply to which instructions. This option
24374 is mostly useful for debugging, as GCC detects the capabilities of
24375 the assembler when it is built and sets the default accordingly.
24376
24377 @opindex msmall-data
24378 @opindex mlarge-data
24379 @item -msmall-data
24380 @itemx -mlarge-data
24381 When @option{-mexplicit-relocs} is in effect, static data is
24382 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
24383 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24384 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24385 16-bit relocations off of the @code{$gp} register. This limits the
24386 size of the small data area to 64KB, but allows the variables to be
24387 directly accessed via a single instruction.
24388
24389 The default is @option{-mlarge-data}. With this option the data area
24390 is limited to just below 2GB@. Programs that require more than 2GB of
24391 data must use @code{malloc} or @code{mmap} to allocate the data in the
24392 heap instead of in the program's data segment.
24393
24394 When generating code for shared libraries, @option{-fpic} implies
24395 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24396
24397 @opindex msmall-text
24398 @opindex mlarge-text
24399 @item -msmall-text
24400 @itemx -mlarge-text
24401 When @option{-msmall-text} is used, the compiler assumes that the
24402 code of the entire program (or shared library) fits in 4MB, and is
24403 thus reachable with a branch instruction. When @option{-msmall-data}
24404 is used, the compiler can assume that all local symbols share the
24405 same @code{$gp} value, and thus reduce the number of instructions
24406 required for a function call from 4 to 1.
24407
24408 The default is @option{-mlarge-text}.
24409
24410 @opindex mcpu
24411 @item -mcpu=@var{cpu_type}
24412 Set the instruction set and instruction scheduling parameters for
24413 machine type @var{cpu_type}. You can specify either the @samp{EV}
24414 style name or the corresponding chip number. GCC supports scheduling
24415 parameters for the EV4, EV5 and EV6 family of processors and
24416 chooses the default values for the instruction set from the processor
24417 you specify. If you do not specify a processor type, GCC defaults
24418 to the processor on which the compiler was built.
24419
24420 Supported values for @var{cpu_type} are
24421
24422 @table @samp
24423 @item ev4
24424 @itemx ev45
24425 @itemx 21064
24426 Schedules as an EV4 and has no instruction set extensions.
24427
24428 @item ev5
24429 @itemx 21164
24430 Schedules as an EV5 and has no instruction set extensions.
24431
24432 @item ev56
24433 @itemx 21164a
24434 Schedules as an EV5 and supports the BWX extension.
24435
24436 @item pca56
24437 @itemx 21164pc
24438 @itemx 21164PC
24439 Schedules as an EV5 and supports the BWX and MAX extensions.
24440
24441 @item ev6
24442 @itemx 21264
24443 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24444
24445 @item ev67
24446 @itemx 21264a
24447 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24448 @end table
24449
24450 Native toolchains also support the value @samp{native},
24451 which selects the best architecture option for the host processor.
24452 @option{-mcpu=native} has no effect if GCC does not recognize
24453 the processor.
24454
24455 @opindex mtune
24456 @item -mtune=@var{cpu_type}
24457 Set only the instruction scheduling parameters for machine type
24458 @var{cpu_type}. The instruction set is not changed.
24459
24460 Native toolchains also support the value @samp{native},
24461 which selects the best architecture option for the host processor.
24462 @option{-mtune=native} has no effect if GCC does not recognize
24463 the processor.
24464
24465 @opindex mmemory-latency
24466 @item -mmemory-latency=@var{time}
24467 Sets the latency the scheduler should assume for typical memory
24468 references as seen by the application. This number is highly
24469 dependent on the memory access patterns used by the application
24470 and the size of the external cache on the machine.
24471
24472 Valid options for @var{time} are
24473
24474 @table @samp
24475 @item @var{number}
24476 A decimal number representing clock cycles.
24477
24478 @item L1
24479 @itemx L2
24480 @itemx L3
24481 @itemx main
24482 The compiler contains estimates of the number of clock cycles for
24483 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24484 (also called Dcache, Scache, and Bcache), as well as to main memory.
24485 Note that L3 is only valid for EV5.
24486
24487 @end table
24488 @end table
24489
24490 @node eBPF Options
24491 @subsection eBPF Options
24492 @cindex eBPF Options
24493
24494 @table @gcctabopt
24495 @item -mframe-limit=@var{bytes}
24496 This specifies the hard limit for frame sizes, in bytes. Currently,
24497 the value that can be specified should be less than or equal to
24498 @samp{32767}. Defaults to whatever limit is imposed by the version of
24499 the Linux kernel targeted.
24500
24501 @opindex mkernel
24502 @item -mkernel=@var{version}
24503 This specifies the minimum version of the kernel that will run the
24504 compiled program. GCC uses this version to determine which
24505 instructions to use, what kernel helpers to allow, etc. Currently,
24506 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
24507 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
24508 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
24509 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
24510 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
24511 @samp{5.2}, @samp{latest} and @samp{native}.
24512
24513 @opindex mbig-endian
24514 @item -mbig-endian
24515 Generate code for a big-endian target.
24516
24517 @opindex mlittle-endian
24518 @item -mlittle-endian
24519 Generate code for a little-endian target. This is the default.
24520
24521 @opindex mjmpext
24522 @item -mjmpext
24523 Enable generation of extra conditional-branch instructions.
24524 Enabled for CPU v2 and above.
24525
24526 @opindex mjmp32
24527 @item -mjmp32
24528 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
24529
24530 @opindex malu32
24531 @item -malu32
24532 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
24533
24534 @opindex mcpu
24535 @item -mcpu=@var{version}
24536 This specifies which version of the eBPF ISA to target. Newer versions
24537 may not be supported by all kernels. The default is @samp{v3}.
24538
24539 Supported values for @var{version} are:
24540
24541 @table @samp
24542 @item v1
24543 The first stable eBPF ISA with no special features or extensions.
24544
24545 @item v2
24546 Supports the jump extensions, as in @option{-mjmpext}.
24547
24548 @item v3
24549 All features of v2, plus:
24550 @itemize @minus
24551 @item 32-bit jump operations, as in @option{-mjmp32}
24552 @item 32-bit ALU operations, as in @option{-malu32}
24553 @end itemize
24554
24555 @end table
24556
24557 @opindex mco-re
24558 @item -mco-re
24559 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24560 is implied by @option{-gbtf}.
24561
24562 @opindex mno-co-re
24563 @item -mno-co-re
24564 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24565 support is enabled by default when generating BTF debug information for
24566 the BPF target.
24567
24568 @item -mxbpf
24569 Generate code for an expanded version of BPF, which relaxes some of
24570 the restrictions imposed by the BPF architecture:
24571 @itemize @minus
24572 @item Save and restore callee-saved registers at function entry and
24573 exit, respectively.
24574 @end itemize
24575 @end table
24576
24577 @node FR30 Options
24578 @subsection FR30 Options
24579 @cindex FR30 Options
24580
24581 These options are defined specifically for the FR30 port.
24582
24583 @table @gcctabopt
24584
24585 @opindex msmall-model
24586 @item -msmall-model
24587 Use the small address space model. This can produce smaller code, but
24588 it does assume that all symbolic values and addresses fit into a
24589 20-bit range.
24590
24591 @opindex mno-lsim
24592 @item -mno-lsim
24593 Assume that runtime support has been provided and so there is no need
24594 to include the simulator library (@file{libsim.a}) on the linker
24595 command line.
24596
24597 @end table
24598
24599 @node FT32 Options
24600 @subsection FT32 Options
24601 @cindex FT32 Options
24602
24603 These options are defined specifically for the FT32 port.
24604
24605 @table @gcctabopt
24606
24607 @opindex msim
24608 @item -msim
24609 Specifies that the program will be run on the simulator. This causes
24610 an alternate runtime startup and library to be linked.
24611 You must not use this option when generating programs that will run on
24612 real hardware; you must provide your own runtime library for whatever
24613 I/O functions are needed.
24614
24615 @opindex mlra
24616 @item -mlra
24617 Enable Local Register Allocation. This is still experimental for FT32,
24618 so by default the compiler uses standard reload.
24619
24620 @opindex mnodiv
24621 @item -mnodiv
24622 Do not use div and mod instructions.
24623
24624 @opindex mft32b
24625 @item -mft32b
24626 Enable use of the extended instructions of the FT32B processor.
24627
24628 @opindex mcompress
24629 @item -mcompress
24630 Compress all code using the Ft32B code compression scheme.
24631
24632 @opindex mnopm
24633 @item -mnopm
24634 Do not generate code that reads program memory.
24635
24636 @end table
24637
24638 @node FRV Options
24639 @subsection FRV Options
24640 @cindex FRV Options
24641
24642 @table @gcctabopt
24643 @opindex mgpr-32
24644 @item -mgpr-32
24645
24646 Only use the first 32 general-purpose registers.
24647
24648 @opindex mgpr-64
24649 @item -mgpr-64
24650
24651 Use all 64 general-purpose registers.
24652
24653 @opindex mfpr-32
24654 @item -mfpr-32
24655
24656 Use only the first 32 floating-point registers.
24657
24658 @opindex mfpr-64
24659 @item -mfpr-64
24660
24661 Use all 64 floating-point registers.
24662
24663 @opindex mhard-float
24664 @item -mhard-float
24665
24666 Use hardware instructions for floating-point operations.
24667
24668 @opindex msoft-float
24669 @item -msoft-float
24670
24671 Use library routines for floating-point operations.
24672
24673 @opindex malloc-cc
24674 @item -malloc-cc
24675
24676 Dynamically allocate condition code registers.
24677
24678 @opindex mfixed-cc
24679 @item -mfixed-cc
24680
24681 Do not try to dynamically allocate condition code registers, only
24682 use @code{icc0} and @code{fcc0}.
24683
24684 @opindex mdword
24685 @item -mdword
24686
24687 Change ABI to use double word insns.
24688
24689 @opindex mno-dword
24690 @opindex mdword
24691 @item -mno-dword
24692
24693 Do not use double word instructions.
24694
24695 @opindex mdouble
24696 @item -mdouble
24697
24698 Use floating-point double instructions.
24699
24700 @opindex mno-double
24701 @item -mno-double
24702
24703 Do not use floating-point double instructions.
24704
24705 @opindex mmedia
24706 @item -mmedia
24707
24708 Use media instructions.
24709
24710 @opindex mno-media
24711 @item -mno-media
24712
24713 Do not use media instructions.
24714
24715 @opindex mmuladd
24716 @item -mmuladd
24717
24718 Use multiply and add/subtract instructions.
24719
24720 @opindex mno-muladd
24721 @item -mno-muladd
24722
24723 Do not use multiply and add/subtract instructions.
24724
24725 @opindex mfdpic
24726 @item -mfdpic
24727
24728 Select the FDPIC ABI, which uses function descriptors to represent
24729 pointers to functions. Without any PIC/PIE-related options, it
24730 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
24731 assumes GOT entries and small data are within a 12-bit range from the
24732 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
24733 are computed with 32 bits.
24734 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24735
24736 @opindex minline-plt
24737 @item -minline-plt
24738
24739 Enable inlining of PLT entries in function calls to functions that are
24740 not known to bind locally. It has no effect without @option{-mfdpic}.
24741 It's enabled by default if optimizing for speed and compiling for
24742 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
24743 optimization option such as @option{-O3} or above is present in the
24744 command line.
24745
24746 @opindex mTLS
24747 @item -mTLS
24748
24749 Assume a large TLS segment when generating thread-local code.
24750
24751 @opindex mtls
24752 @item -mtls
24753
24754 Do not assume a large TLS segment when generating thread-local code.
24755
24756 @opindex mgprel-ro
24757 @item -mgprel-ro
24758
24759 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
24760 that is known to be in read-only sections. It's enabled by default,
24761 except for @option{-fpic} or @option{-fpie}: even though it may help
24762 make the global offset table smaller, it trades 1 instruction for 4.
24763 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
24764 one of which may be shared by multiple symbols, and it avoids the need
24765 for a GOT entry for the referenced symbol, so it's more likely to be a
24766 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
24767
24768 @opindex multilib-library-pic
24769 @item -multilib-library-pic
24770
24771 Link with the (library, not FD) pic libraries. It's implied by
24772 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
24773 @option{-fpic} without @option{-mfdpic}. You should never have to use
24774 it explicitly.
24775
24776 @opindex mlinked-fp
24777 @item -mlinked-fp
24778
24779 Follow the EABI requirement of always creating a frame pointer whenever
24780 a stack frame is allocated. This option is enabled by default and can
24781 be disabled with @option{-mno-linked-fp}.
24782
24783 @opindex mlong-calls
24784 @item -mlong-calls
24785
24786 Use indirect addressing to call functions outside the current
24787 compilation unit. This allows the functions to be placed anywhere
24788 within the 32-bit address space.
24789
24790 @opindex malign-labels
24791 @item -malign-labels
24792
24793 Try to align labels to an 8-byte boundary by inserting NOPs into the
24794 previous packet. This option only has an effect when VLIW packing
24795 is enabled. It doesn't create new packets; it merely adds NOPs to
24796 existing ones.
24797
24798 @opindex mlibrary-pic
24799 @item -mlibrary-pic
24800
24801 Generate position-independent EABI code.
24802
24803 @opindex macc-4
24804 @item -macc-4
24805
24806 Use only the first four media accumulator registers.
24807
24808 @opindex macc-8
24809 @item -macc-8
24810
24811 Use all eight media accumulator registers.
24812
24813 @opindex mpack
24814 @item -mpack
24815
24816 Pack VLIW instructions.
24817
24818 @opindex mno-pack
24819 @item -mno-pack
24820
24821 Do not pack VLIW instructions.
24822
24823 @opindex mno-eflags
24824 @item -mno-eflags
24825
24826 Do not mark ABI switches in e_flags.
24827
24828 @opindex mcond-move
24829 @item -mcond-move
24830
24831 Enable the use of conditional-move instructions (default).
24832
24833 This switch is mainly for debugging the compiler and will likely be removed
24834 in a future version.
24835
24836 @opindex mno-cond-move
24837 @item -mno-cond-move
24838
24839 Disable the use of conditional-move instructions.
24840
24841 This switch is mainly for debugging the compiler and will likely be removed
24842 in a future version.
24843
24844 @opindex mscc
24845 @item -mscc
24846
24847 Enable the use of conditional set instructions (default).
24848
24849 This switch is mainly for debugging the compiler and will likely be removed
24850 in a future version.
24851
24852 @opindex mno-scc
24853 @item -mno-scc
24854
24855 Disable the use of conditional set instructions.
24856
24857 This switch is mainly for debugging the compiler and will likely be removed
24858 in a future version.
24859
24860 @opindex mcond-exec
24861 @item -mcond-exec
24862
24863 Enable the use of conditional execution (default).
24864
24865 This switch is mainly for debugging the compiler and will likely be removed
24866 in a future version.
24867
24868 @opindex mno-cond-exec
24869 @item -mno-cond-exec
24870
24871 Disable the use of conditional execution.
24872
24873 This switch is mainly for debugging the compiler and will likely be removed
24874 in a future version.
24875
24876 @opindex mvliw-branch
24877 @item -mvliw-branch
24878
24879 Run a pass to pack branches into VLIW instructions (default).
24880
24881 This switch is mainly for debugging the compiler and will likely be removed
24882 in a future version.
24883
24884 @opindex mno-vliw-branch
24885 @item -mno-vliw-branch
24886
24887 Do not run a pass to pack branches into VLIW instructions.
24888
24889 This switch is mainly for debugging the compiler and will likely be removed
24890 in a future version.
24891
24892 @opindex mmulti-cond-exec
24893 @item -mmulti-cond-exec
24894
24895 Enable optimization of @code{&&} and @code{||} in conditional execution
24896 (default).
24897
24898 This switch is mainly for debugging the compiler and will likely be removed
24899 in a future version.
24900
24901 @opindex mno-multi-cond-exec
24902 @item -mno-multi-cond-exec
24903
24904 Disable optimization of @code{&&} and @code{||} in conditional execution.
24905
24906 This switch is mainly for debugging the compiler and will likely be removed
24907 in a future version.
24908
24909 @opindex mnested-cond-exec
24910 @item -mnested-cond-exec
24911
24912 Enable nested conditional execution optimizations (default).
24913
24914 This switch is mainly for debugging the compiler and will likely be removed
24915 in a future version.
24916
24917 @opindex mno-nested-cond-exec
24918 @item -mno-nested-cond-exec
24919
24920 Disable nested conditional execution optimizations.
24921
24922 This switch is mainly for debugging the compiler and will likely be removed
24923 in a future version.
24924
24925 @opindex moptimize-membar
24926 @item -moptimize-membar
24927
24928 This switch removes redundant @code{membar} instructions from the
24929 compiler-generated code. It is enabled by default.
24930
24931 @opindex mno-optimize-membar
24932 @opindex moptimize-membar
24933 @item -mno-optimize-membar
24934
24935 This switch disables the automatic removal of redundant @code{membar}
24936 instructions from the generated code.
24937
24938 @opindex mtomcat-stats
24939 @item -mtomcat-stats
24940
24941 Cause gas to print out tomcat statistics.
24942
24943 @opindex mcpu
24944 @item -mcpu=@var{cpu}
24945
24946 Select the processor type for which to generate code. Possible values are
24947 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
24948 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
24949
24950 @end table
24951
24952 @node GNU/Linux Options
24953 @subsection GNU/Linux Options
24954
24955 These @samp{-m} options are defined for GNU/Linux targets:
24956
24957 @table @gcctabopt
24958 @opindex mglibc
24959 @item -mglibc
24960 Use the GNU C library. This is the default except
24961 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
24962 @samp{*-*-linux-*android*} targets.
24963
24964 @opindex muclibc
24965 @item -muclibc
24966 Use uClibc C library. This is the default on
24967 @samp{*-*-linux-*uclibc*} targets.
24968
24969 @opindex mmusl
24970 @item -mmusl
24971 Use the musl C library. This is the default on
24972 @samp{*-*-linux-*musl*} targets.
24973
24974 @opindex mbionic
24975 @item -mbionic
24976 Use Bionic C library. This is the default on
24977 @samp{*-*-linux-*android*} targets.
24978
24979 @opindex mandroid
24980 @item -mandroid
24981 Compile code compatible with Android platform. This is the default on
24982 @samp{*-*-linux-*android*} targets.
24983
24984 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
24985 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
24986 this option makes the GCC driver pass Android-specific options to the linker.
24987 Finally, this option causes the preprocessor macro @code{__ANDROID__}
24988 to be defined.
24989
24990 @opindex tno-android-cc
24991 @item -tno-android-cc
24992 Disable compilation effects of @option{-mandroid}, i.e., do not enable
24993 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
24994 @option{-fno-rtti} by default.
24995
24996 @opindex tno-android-ld
24997 @item -tno-android-ld
24998 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
24999 linking options to the linker.
25000
25001 @end table
25002
25003 @node H8/300 Options
25004 @subsection H8/300 Options
25005
25006 These @samp{-m} options are defined for the H8/300 implementations:
25007
25008 @table @gcctabopt
25009 @opindex mrelax
25010 @item -mrelax
25011 Shorten some address references at link time, when possible; uses the
25012 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
25013 ld, Using ld}, for a fuller description.
25014
25015 @opindex mh
25016 @item -mh
25017 Generate code for the H8/300H@.
25018
25019 @opindex ms
25020 @item -ms
25021 Generate code for the H8S@.
25022
25023 @opindex mn
25024 @item -mn
25025 Generate code for the H8S and H8/300H in the normal mode. This switch
25026 must be used either with @option{-mh} or @option{-ms}.
25027
25028 @opindex ms2600
25029 @item -ms2600
25030 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
25031
25032 @opindex mexr
25033 @item -mexr
25034 Extended registers are stored on stack before execution of function
25035 with monitor attribute. Default option is @option{-mexr}.
25036 This option is valid only for H8S targets.
25037
25038 @opindex mno-exr
25039 @opindex mexr
25040 @item -mno-exr
25041 Extended registers are not stored on stack before execution of function
25042 with monitor attribute. Default option is @option{-mno-exr}.
25043 This option is valid only for H8S targets.
25044
25045 @opindex mint32
25046 @item -mint32
25047 Make @code{int} data 32 bits by default.
25048
25049 @opindex malign-300
25050 @item -malign-300
25051 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
25052 The default for the H8/300H and H8S is to align longs and floats on
25053 4-byte boundaries.
25054 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
25055 This option has no effect on the H8/300.
25056 @end table
25057
25058 @node HPPA Options
25059 @subsection HPPA Options
25060 @cindex HPPA Options
25061
25062 These @samp{-m} options are defined for the HPPA family of computers:
25063
25064 @table @gcctabopt
25065 @opindex march
25066 @item -march=@var{architecture-type}
25067 Generate code for the specified architecture. The choices for
25068 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
25069 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
25070 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
25071 architecture option for your machine. Code compiled for lower numbered
25072 architectures runs on higher numbered architectures, but not the
25073 other way around.
25074
25075 @opindex mpa-risc-1-0
25076 @opindex mpa-risc-1-1
25077 @opindex mpa-risc-2-0
25078 @item -mpa-risc-1-0
25079 @itemx -mpa-risc-1-1
25080 @itemx -mpa-risc-2-0
25081 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
25082
25083 @opindex matomic-libcalls
25084 @opindex mno-atomic-libcalls
25085 @item -matomic-libcalls
25086 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
25087 This option is enabled by default. It only affects the generation of
25088 atomic libcalls by the HPPA backend.
25089
25090 Both the sync and @file{libatomic} libcall implementations use locking.
25091 As a result, processor stores are not atomic with respect to other
25092 atomic operations. Processor loads up to DImode are atomic with
25093 respect to other atomic operations provided they are implemented as
25094 a single access.
25095
25096 The PA-RISC architecture does not support any atomic operations in
25097 hardware except for the @code{ldcw} instruction. Thus, all atomic
25098 support is implemented using sync and atomic libcalls. Sync libcall
25099 support is in @file{libgcc.a}. Atomic libcall support is in
25100 @file{libatomic}.
25101
25102 This option generates @code{__atomic_exchange} calls for atomic stores.
25103 It also provides special handling for atomic DImode accesses on 32-bit
25104 targets.
25105
25106 @opindex mbig-switch
25107 @item -mbig-switch
25108 Does nothing. Preserved for backward compatibility.
25109
25110 @opindex mcaller-copies
25111 @item -mcaller-copies
25112 The caller copies function arguments passed by hidden reference. This
25113 option should be used with care as it is not compatible with the default
25114 32-bit runtime. However, only aggregates larger than eight bytes are
25115 passed by hidden reference and the option provides better compatibility
25116 with OpenMP.
25117
25118 @opindex mcoherent-ldcw
25119 @item -mcoherent-ldcw
25120 Use ldcw/ldcd coherent cache-control hint.
25121
25122 @opindex mdisable-fpregs
25123 @item -mdisable-fpregs
25124 Disable floating-point registers. Equivalent to @code{-msoft-float}.
25125
25126 @opindex mdisable-indexing
25127 @item -mdisable-indexing
25128 Prevent the compiler from using indexing address modes. This avoids some
25129 rather obscure problems when compiling MIG generated code under MACH@.
25130
25131 @opindex mfast-indirect-calls
25132 @item -mfast-indirect-calls
25133 Generate code that assumes calls never cross space boundaries. This
25134 allows GCC to emit code that performs faster indirect calls.
25135
25136 This option does not work in the presence of shared libraries or nested
25137 functions.
25138
25139 @opindex mfixed-range
25140 @item -mfixed-range=@var{register-range}
25141 Generate code treating the given register range as fixed registers.
25142 A fixed register is one that the register allocator cannot use. This is
25143 useful when compiling kernel code. A register range is specified as
25144 two registers separated by a dash. Multiple register ranges can be
25145 specified separated by a comma.
25146
25147 @opindex mgas
25148 @item -mgas
25149 Enable the use of assembler directives only GAS understands.
25150
25151 @opindex mgnu-ld
25152 @item -mgnu-ld
25153 Use options specific to GNU @command{ld}.
25154 This passes @option{-shared} to @command{ld} when
25155 building a shared library. It is the default when GCC is configured,
25156 explicitly or implicitly, with the GNU linker. This option does not
25157 affect which @command{ld} is called; it only changes what parameters
25158 are passed to that @command{ld}.
25159 The @command{ld} that is called is determined by the
25160 @option{--with-ld} configure option, GCC's program search path, and
25161 finally by the user's @env{PATH}. The linker used by GCC can be printed
25162 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
25163 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25164
25165 @opindex mhp-ld
25166 @item -mhp-ld
25167 Use options specific to HP @command{ld}.
25168 This passes @option{-b} to @command{ld} when building
25169 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25170 links. It is the default when GCC is configured, explicitly or
25171 implicitly, with the HP linker. This option does not affect
25172 which @command{ld} is called; it only changes what parameters are passed to that
25173 @command{ld}.
25174 The @command{ld} that is called is determined by the @option{--with-ld}
25175 configure option, GCC's program search path, and finally by the user's
25176 @env{PATH}. The linker used by GCC can be printed using @samp{which
25177 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
25178 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25179
25180 @opindex mlinker-opt
25181 @item -mlinker-opt
25182 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
25183 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
25184 linkers in which they give bogus error messages when linking some programs.
25185
25186 @opindex mno-long-calls
25187 @opindex mlong-calls
25188 @item -mlong-calls
25189 Generate code that uses long call sequences. This ensures that a call
25190 is always able to reach linker generated stubs. The default is to generate
25191 long calls only when the distance from the call site to the beginning
25192 of the function or translation unit, as the case may be, exceeds a
25193 predefined limit set by the branch type being used. The limits for
25194 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25195 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
25196 240,000 bytes.
25197
25198 Distances are measured from the beginning of functions when using the
25199 @option{-ffunction-sections} option, or when using the @option{-mgas}
25200 and @option{-mno-portable-runtime} options together under HP-UX with
25201 the SOM linker.
25202
25203 It is normally not desirable to use this option as it degrades
25204 performance. However, it may be useful in large applications,
25205 particularly when partial linking is used to build the application.
25206
25207 The types of long calls used depends on the capabilities of the
25208 assembler and linker, and the type of code being generated. The
25209 impact on systems that support long absolute calls, and long pic
25210 symbol-difference or pc-relative calls should be relatively small.
25211 However, an indirect call is used on 32-bit ELF systems in pic code
25212 and it is quite long.
25213
25214 @opindex mlong-load-store
25215 @item -mlong-load-store
25216 Generate 3-instruction load and store sequences as sometimes required by
25217 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
25218 the HP compilers.
25219
25220 @opindex mjump-in-delay
25221 @item -mjump-in-delay
25222 This option is ignored and provided for compatibility purposes only.
25223
25224 @opindex mno-space-regs
25225 @opindex mspace-regs
25226 @item -mno-space-regs
25227 Generate code that assumes the target has no space registers. This allows
25228 GCC to generate faster indirect calls and use unscaled index address modes.
25229
25230 Such code is suitable for level 0 PA systems and kernels.
25231
25232 @opindex mordered
25233 @item -mordered
25234 Assume memory references are ordered and barriers are not needed.
25235
25236 @opindex mportable-runtime
25237 @item -mportable-runtime
25238 Use the portable calling conventions proposed by HP for ELF systems.
25239
25240 @opindex mschedule
25241 @item -mschedule=@var{cpu-type}
25242 Schedule code according to the constraints for the machine type
25243 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
25244 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
25245 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25246 proper scheduling option for your machine. The default scheduling is
25247 @samp{8000}.
25248
25249 @opindex msio
25250 @item -msio
25251 Generate the predefine, @code{_SIO}, for server IO@. The default is
25252 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
25253 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
25254 options are available under HP-UX and HI-UX@.
25255
25256 @opindex msoft-float
25257 @item -msoft-float
25258 Generate output containing library calls for floating point.
25259 @strong{Warning:} the requisite libraries are not available for all HPPA
25260 targets. Normally the facilities of the machine's usual C compiler are
25261 used, but this cannot be done directly in cross-compilation. You must make
25262 your own arrangements to provide suitable library functions for
25263 cross-compilation.
25264
25265 @option{-msoft-float} changes the calling convention in the output file;
25266 therefore, it is only useful if you compile @emph{all} of a program with
25267 this option. In particular, you need to compile @file{libgcc.a}, the
25268 library that comes with GCC, with @option{-msoft-float} in order for
25269 this to work.
25270
25271 @opindex msoft-mult
25272 @item -msoft-mult
25273 Use software integer multiplication.
25274
25275 This disables the use of the @code{xmpyu} instruction.
25276
25277 @opindex march
25278 @item -munix=@var{unix-std}
25279 Generate compiler predefines and select a startfile for the specified
25280 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
25281 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
25282 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
25283 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
25284 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25285 and later.
25286
25287 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25288 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25289 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25290 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25291 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25292 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25293
25294 It is @emph{important} to note that this option changes the interfaces
25295 for various library routines. It also affects the operational behavior
25296 of the C library. Thus, @emph{extreme} care is needed in using this
25297 option.
25298
25299 Library code that is intended to operate with more than one UNIX
25300 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25301 as appropriate. Most GNU software doesn't provide this capability.
25302
25303 @opindex nolibdld
25304 @item -nolibdld
25305 Suppress the generation of link options to search libdld.sl when the
25306 @option{-static} option is specified on HP-UX 10 and later.
25307
25308 @opindex static
25309 @item -static
25310 The HP-UX implementation of setlocale in libc has a dependency on
25311 libdld.sl. There isn't an archive version of libdld.sl. Thus,
25312 when the @option{-static} option is specified, special link options
25313 are needed to resolve this dependency.
25314
25315 On HP-UX 10 and later, the GCC driver adds the necessary options to
25316 link with libdld.sl when the @option{-static} option is specified.
25317 This causes the resulting binary to be dynamic. On the 64-bit port,
25318 the linkers generate dynamic binaries by default in any case. The
25319 @option{-nolibdld} option can be used to prevent the GCC driver from
25320 adding these link options.
25321
25322 @opindex threads
25323 @item -threads
25324 Add support for multithreading with the @dfn{dce thread} library
25325 under HP-UX@. This option sets flags for both the preprocessor and
25326 linker.
25327 @end table
25328
25329 @node IA-64 Options
25330 @subsection IA-64 Options
25331 @cindex IA-64 Options
25332
25333 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25334
25335 @table @gcctabopt
25336 @opindex mbig-endian
25337 @item -mbig-endian
25338 Generate code for a big-endian target. This is the default for HP-UX@.
25339
25340 @opindex mlittle-endian
25341 @item -mlittle-endian
25342 Generate code for a little-endian target. This is the default for AIX5
25343 and GNU/Linux.
25344
25345 @opindex mgnu-as
25346 @opindex mno-gnu-as
25347 @item -mgnu-as
25348 @itemx -mno-gnu-as
25349 Generate (or don't) code for the GNU assembler. This is the default.
25350 @c Also, this is the default if the configure option @option{--with-gnu-as}
25351 @c is used.
25352
25353 @opindex mgnu-ld
25354 @opindex mno-gnu-ld
25355 @item -mgnu-ld
25356 @itemx -mno-gnu-ld
25357 Generate (or don't) code for the GNU linker. This is the default.
25358 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25359 @c is used.
25360
25361 @opindex mno-pic
25362 @item -mno-pic
25363 Generate code that does not use a global pointer register. The result
25364 is not position independent code, and violates the IA-64 ABI@.
25365
25366 @opindex mvolatile-asm-stop
25367 @opindex mno-volatile-asm-stop
25368 @item -mvolatile-asm-stop
25369 @itemx -mno-volatile-asm-stop
25370 Generate (or don't) a stop bit immediately before and after volatile asm
25371 statements.
25372
25373 @opindex mregister-names
25374 @opindex mno-register-names
25375 @item -mregister-names
25376 @itemx -mno-register-names
25377 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25378 the stacked registers. This may make assembler output more readable.
25379
25380 @opindex mno-sdata
25381 @opindex msdata
25382 @item -mno-sdata
25383 @itemx -msdata
25384 Disable (or enable) optimizations that use the small data section. This may
25385 be useful for working around optimizer bugs.
25386
25387 @opindex mconstant-gp
25388 @item -mconstant-gp
25389 Generate code that uses a single constant global pointer value. This is
25390 useful when compiling kernel code.
25391
25392 @opindex mauto-pic
25393 @item -mauto-pic
25394 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
25395 This is useful when compiling firmware code.
25396
25397 @opindex minline-float-divide-min-latency
25398 @item -minline-float-divide-min-latency
25399 Generate code for inline divides of floating-point values
25400 using the minimum latency algorithm.
25401
25402 @opindex minline-float-divide-max-throughput
25403 @item -minline-float-divide-max-throughput
25404 Generate code for inline divides of floating-point values
25405 using the maximum throughput algorithm.
25406
25407 @opindex mno-inline-float-divide
25408 @item -mno-inline-float-divide
25409 Do not generate inline code for divides of floating-point values.
25410
25411 @opindex minline-int-divide-min-latency
25412 @item -minline-int-divide-min-latency
25413 Generate code for inline divides of integer values
25414 using the minimum latency algorithm.
25415
25416 @opindex minline-int-divide-max-throughput
25417 @item -minline-int-divide-max-throughput
25418 Generate code for inline divides of integer values
25419 using the maximum throughput algorithm.
25420
25421 @opindex mno-inline-int-divide
25422 @opindex minline-int-divide
25423 @item -mno-inline-int-divide
25424 Do not generate inline code for divides of integer values.
25425
25426 @opindex minline-sqrt-min-latency
25427 @item -minline-sqrt-min-latency
25428 Generate code for inline square roots
25429 using the minimum latency algorithm.
25430
25431 @opindex minline-sqrt-max-throughput
25432 @item -minline-sqrt-max-throughput
25433 Generate code for inline square roots
25434 using the maximum throughput algorithm.
25435
25436 @opindex mno-inline-sqrt
25437 @item -mno-inline-sqrt
25438 Do not generate inline code for @code{sqrt}.
25439
25440 @opindex mfused-madd
25441 @opindex mno-fused-madd
25442 @item -mfused-madd
25443 @itemx -mno-fused-madd
25444 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25445 instructions. The default is to use these instructions.
25446
25447 @opindex mno-dwarf2-asm
25448 @opindex mdwarf2-asm
25449 @item -mno-dwarf2-asm
25450 @itemx -mdwarf2-asm
25451 Don't (or do) generate assembler code for the DWARF line number debugging
25452 info. This may be useful when not using the GNU assembler.
25453
25454 @opindex mearly-stop-bits
25455 @opindex mno-early-stop-bits
25456 @item -mearly-stop-bits
25457 @itemx -mno-early-stop-bits
25458 Allow stop bits to be placed earlier than immediately preceding the
25459 instruction that triggered the stop bit. This can improve instruction
25460 scheduling, but does not always do so.
25461
25462 @opindex mfixed-range
25463 @item -mfixed-range=@var{register-range}
25464 Generate code treating the given register range as fixed registers.
25465 A fixed register is one that the register allocator cannot use. This is
25466 useful when compiling kernel code. A register range is specified as
25467 two registers separated by a dash. Multiple register ranges can be
25468 specified separated by a comma.
25469
25470 @opindex mtls-size
25471 @item -mtls-size=@var{tls-size}
25472 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
25473 64.
25474
25475 @opindex mtune
25476 @item -mtune=@var{cpu-type}
25477 Tune the instruction scheduling for a particular CPU, Valid values are
25478 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25479 and @samp{mckinley}.
25480
25481 @opindex milp32
25482 @opindex mlp64
25483 @item -milp32
25484 @itemx -mlp64
25485 Generate code for a 32-bit or 64-bit environment.
25486 The 32-bit environment sets int, long and pointer to 32 bits.
25487 The 64-bit environment sets int to 32 bits and long and pointer
25488 to 64 bits. These are HP-UX specific flags.
25489
25490 @opindex mno-sched-br-data-spec
25491 @opindex msched-br-data-spec
25492 @item -mno-sched-br-data-spec
25493 @itemx -msched-br-data-spec
25494 (Dis/En)able data speculative scheduling before reload.
25495 This results in generation of @code{ld.a} instructions and
25496 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25497 The default setting is disabled.
25498
25499 @opindex msched-ar-data-spec
25500 @opindex mno-sched-ar-data-spec
25501 @item -msched-ar-data-spec
25502 @itemx -mno-sched-ar-data-spec
25503 (En/Dis)able data speculative scheduling after reload.
25504 This results in generation of @code{ld.a} instructions and
25505 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25506 The default setting is enabled.
25507
25508 @opindex mno-sched-control-spec
25509 @opindex msched-control-spec
25510 @item -mno-sched-control-spec
25511 @itemx -msched-control-spec
25512 (Dis/En)able control speculative scheduling. This feature is
25513 available only during region scheduling (i.e.@: before reload).
25514 This results in generation of the @code{ld.s} instructions and
25515 the corresponding check instructions @code{chk.s}.
25516 The default setting is disabled.
25517
25518 @opindex msched-br-in-data-spec
25519 @opindex mno-sched-br-in-data-spec
25520 @item -msched-br-in-data-spec
25521 @itemx -mno-sched-br-in-data-spec
25522 (En/Dis)able speculative scheduling of the instructions that
25523 are dependent on the data speculative loads before reload.
25524 This is effective only with @option{-msched-br-data-spec} enabled.
25525 The default setting is enabled.
25526
25527 @opindex msched-ar-in-data-spec
25528 @opindex mno-sched-ar-in-data-spec
25529 @item -msched-ar-in-data-spec
25530 @itemx -mno-sched-ar-in-data-spec
25531 (En/Dis)able speculative scheduling of the instructions that
25532 are dependent on the data speculative loads after reload.
25533 This is effective only with @option{-msched-ar-data-spec} enabled.
25534 The default setting is enabled.
25535
25536 @opindex msched-in-control-spec
25537 @opindex mno-sched-in-control-spec
25538 @item -msched-in-control-spec
25539 @itemx -mno-sched-in-control-spec
25540 (En/Dis)able speculative scheduling of the instructions that
25541 are dependent on the control speculative loads.
25542 This is effective only with @option{-msched-control-spec} enabled.
25543 The default setting is enabled.
25544
25545 @opindex mno-sched-prefer-non-data-spec-insns
25546 @opindex msched-prefer-non-data-spec-insns
25547 @item -mno-sched-prefer-non-data-spec-insns
25548 @itemx -msched-prefer-non-data-spec-insns
25549 If enabled, data-speculative instructions are chosen for schedule
25550 only if there are no other choices at the moment. This makes
25551 the use of the data speculation much more conservative.
25552 The default setting is disabled.
25553
25554 @opindex mno-sched-prefer-non-control-spec-insns
25555 @opindex msched-prefer-non-control-spec-insns
25556 @item -mno-sched-prefer-non-control-spec-insns
25557 @itemx -msched-prefer-non-control-spec-insns
25558 If enabled, control-speculative instructions are chosen for schedule
25559 only if there are no other choices at the moment. This makes
25560 the use of the control speculation much more conservative.
25561 The default setting is disabled.
25562
25563 @opindex mno-sched-count-spec-in-critical-path
25564 @opindex msched-count-spec-in-critical-path
25565 @item -mno-sched-count-spec-in-critical-path
25566 @itemx -msched-count-spec-in-critical-path
25567 If enabled, speculative dependencies are considered during
25568 computation of the instructions priorities. This makes the use of the
25569 speculation a bit more conservative.
25570 The default setting is disabled.
25571
25572 @opindex msched-spec-ldc
25573 @item -msched-spec-ldc
25574 Use a simple data speculation check. This option is on by default.
25575
25576 @opindex msched-spec-ldc
25577 @item -msched-control-spec-ldc
25578 Use a simple check for control speculation. This option is on by default.
25579
25580 @opindex msched-stop-bits-after-every-cycle
25581 @item -msched-stop-bits-after-every-cycle
25582 Place a stop bit after every cycle when scheduling. This option is on
25583 by default.
25584
25585 @opindex msched-fp-mem-deps-zero-cost
25586 @item -msched-fp-mem-deps-zero-cost
25587 Assume that floating-point stores and loads are not likely to cause a conflict
25588 when placed into the same instruction group. This option is disabled by
25589 default.
25590
25591 @opindex msel-sched-dont-check-control-spec
25592 @item -msel-sched-dont-check-control-spec
25593 Generate checks for control speculation in selective scheduling.
25594 This flag is disabled by default.
25595
25596 @opindex msched-max-memory-insns
25597 @item -msched-max-memory-insns=@var{max-insns}
25598 Limit on the number of memory insns per instruction group, giving lower
25599 priority to subsequent memory insns attempting to schedule in the same
25600 instruction group. Frequently useful to prevent cache bank conflicts.
25601 The default value is 1.
25602
25603 @opindex msched-max-memory-insns-hard-limit
25604 @item -msched-max-memory-insns-hard-limit
25605 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25606 disallowing more than that number in an instruction group.
25607 Otherwise, the limit is ``soft'', meaning that non-memory operations
25608 are preferred when the limit is reached, but memory operations may still
25609 be scheduled.
25610
25611 @end table
25612
25613 @node LM32 Options
25614 @subsection LM32 Options
25615 @cindex LM32 options
25616
25617 These @option{-m} options are defined for the LatticeMico32 architecture:
25618
25619 @table @gcctabopt
25620 @opindex mbarrel-shift-enabled
25621 @item -mbarrel-shift-enabled
25622 Enable barrel-shift instructions.
25623
25624 @opindex mdivide-enabled
25625 @item -mdivide-enabled
25626 Enable divide and modulus instructions.
25627
25628 @opindex multiply-enabled
25629 @item -mmultiply-enabled
25630 Enable multiply instructions.
25631
25632 @opindex msign-extend-enabled
25633 @item -msign-extend-enabled
25634 Enable sign extend instructions.
25635
25636 @opindex muser-enabled
25637 @item -muser-enabled
25638 Enable user-defined instructions.
25639
25640 @end table
25641
25642 @node LoongArch Options
25643 @subsection LoongArch Options
25644 @cindex LoongArch Options
25645
25646 These command-line options are defined for LoongArch targets:
25647
25648 @table @gcctabopt
25649 @opindex march
25650 @item -march=@var{cpu-type}
25651 Generate instructions for the machine type @var{cpu-type}. In contrast to
25652 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25653 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25654 to generate code that may not run at all on processors other than the one
25655 indicated. Specifying @option{-march=@var{cpu-type}} implies
25656 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25657
25658 The choices for @var{cpu-type} are:
25659
25660 @table @samp
25661 @item native
25662 This selects the CPU to generate code for at compilation time by determining
25663 the processor type of the compiling machine. Using @option{-march=native}
25664 enables all instruction subsets supported by the local machine (hence
25665 the result might not run on different machines). Using @option{-mtune=native}
25666 produces code optimized for the local machine under the constraints
25667 of the selected instruction set.
25668 @item loongarch64
25669 A generic CPU with 64-bit extensions.
25670 @item la464
25671 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25672 @end table
25673
25674 @opindex mtune
25675 @item -mtune=@var{cpu-type}
25676 Optimize the output for the given processor, specified by microarchitecture
25677 name.
25678
25679 @opindex mabi
25680 @item -mabi=@var{base-abi-type}
25681 Generate code for the specified calling convention.
25682 @var{base-abi-type} can be one of:
25683 @table @samp
25684 @item lp64d
25685 Uses 64-bit general purpose registers and 32/64-bit floating-point
25686 registers for parameter passing. Data model is LP64, where @samp{int}
25687 is 32 bits, while @samp{long int} and pointers are 64 bits.
25688 @item lp64f
25689 Uses 64-bit general purpose registers and 32-bit floating-point
25690 registers for parameter passing. Data model is LP64, where @samp{int}
25691 is 32 bits, while @samp{long int} and pointers are 64 bits.
25692 @item lp64s
25693 Uses 64-bit general purpose registers and no floating-point
25694 registers for parameter passing. Data model is LP64, where @samp{int}
25695 is 32 bits, while @samp{long int} and pointers are 64 bits.
25696 @end table
25697
25698 @opindex mfpu
25699 @item -mfpu=@var{fpu-type}
25700 Generate code for the specified FPU type, which can be one of:
25701 @table @samp
25702 @item 64
25703 Allow the use of hardware floating-point instructions for 32-bit
25704 and 64-bit operations.
25705 @item 32
25706 Allow the use of hardware floating-point instructions for 32-bit
25707 operations.
25708 @item none
25709 @item 0
25710 Prevent the use of hardware floating-point instructions.
25711 @end table
25712
25713 @opindex msoft-float
25714 @item -msoft-float
25715 Force @option{-mfpu=none} and prevents the use of floating-point
25716 registers for parameter passing. This option may change the target
25717 ABI.
25718
25719 @opindex msingle-float
25720 @item -msingle-float
25721 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
25722 registers for parameter passing. This option may change the target
25723 ABI.
25724
25725 @opindex mdouble-float
25726 @item -mdouble-float
25727 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
25728 registers for parameter passing. This option may change the target
25729 ABI.
25730
25731 @opindex mbranch-cost
25732 @item -mbranch-cost=@var{n}
25733 Set the cost of branches to roughly @var{n} instructions.
25734
25735 @opindex mcheck-zero-division
25736 @item -mcheck-zero-division
25737 @itemx -mno-check-zero-divison
25738 Trap (do not trap) on integer division by zero. The default is
25739 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
25740 @option{-mno-check-zero-division} for other optimization levels.
25741
25742 @opindex mcond-move-int
25743 @item -mcond-move-int
25744 @itemx -mno-cond-move-int
25745 Conditional moves for integral data in general-purpose registers
25746 are enabled (disabled). The default is @option{-mcond-move-int}.
25747
25748 @opindex mcond-move-float
25749 @item -mcond-move-float
25750 @itemx -mno-cond-move-float
25751 Conditional moves for floating-point registers are enabled (disabled).
25752 The default is @option{-mcond-move-float}.
25753
25754 @opindex mmemcpy
25755 @item -mmemcpy
25756 @itemx -mno-memcpy
25757 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
25758 The default is @option{-mno-memcpy}, which allows GCC to inline most
25759 constant-sized copies. Setting optimization level to @option{-Os} also
25760 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
25761 behavior if explicitly specified, regardless of the order these options on
25762 the command line.
25763
25764 @opindex mstrict-align
25765 @item -mstrict-align
25766 @itemx -mno-strict-align
25767 Avoid or allow generating memory accesses that may not be aligned on a natural
25768 object boundary as described in the architecture specification. The default is
25769 @option{-mno-strict-align}.
25770
25771 @opindex msmall-data-limit
25772 @item -msmall-data-limit=@var{number}
25773 Put global and static data smaller than @var{number} bytes into a special
25774 section (on some targets). The default value is 0.
25775
25776 @opindex mmax-inline-memcpy-size
25777 @item -mmax-inline-memcpy-size=@var{n}
25778 Inline all block moves (such as calls to @code{memcpy} or structure copies)
25779 less than or equal to @var{n} bytes. The default value of @var{n} is 1024.
25780
25781 @item -mcmodel=@var{code-model}
25782 Set the code model to one of:
25783 @table @samp
25784 @item tiny-static (Not implemented yet)
25785 @item tiny (Not implemented yet)
25786
25787 @item normal
25788 The text segment must be within 128MB addressing space. The data segment must
25789 be within 2GB addressing space.
25790
25791 @item medium
25792 The text segment and data segment must be within 2GB addressing space.
25793
25794 @item large (Not implemented yet)
25795
25796 @item extreme
25797 This mode does not limit the size of the code segment and data segment.
25798 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
25799 @option{-mno-explicit-relocs}.
25800 @end table
25801 The default code model is @code{normal}.
25802
25803 @opindex mexplicit-relocs
25804 @opindex mno-explicit-relocs
25805 @item -mexplicit-relocs
25806 @itemx -mno-explicit-relocs
25807 Use or do not use assembler relocation operators when dealing with symbolic
25808 addresses. The alternative is to use assembler macros instead, which may
25809 limit optimization. The default value for the option is determined during
25810 GCC build-time by detecting corresponding assembler support:
25811 @code{-mexplicit-relocs} if said support is present,
25812 @code{-mno-explicit-relocs} otherwise. This option is mostly useful for
25813 debugging, or interoperation with assemblers different from the build-time
25814 one.
25815
25816 @opindex mdirect-extern-access
25817 @item -mdirect-extern-access
25818 @itemx -mno-direct-extern-access
25819 Do not use or use GOT to access external symbols. The default is
25820 @option{-mno-direct-extern-access}: GOT is used for external symbols with
25821 default visibility, but not used for other external symbols.
25822
25823 With @option{-mdirect-extern-access}, GOT is not used and all external
25824 symbols are PC-relatively addressed. It is @strong{only} suitable for
25825 environments where no dynamic link is performed, like firmwares, OS
25826 kernels, executables linked with @option{-static} or @option{-static-pie}.
25827 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
25828 @option{-fpic}.
25829 @end table
25830
25831 @node M32C Options
25832 @subsection M32C Options
25833 @cindex M32C options
25834
25835 @table @gcctabopt
25836 @opindex mcpu=
25837 @item -mcpu=@var{name}
25838 Select the CPU for which code is generated. @var{name} may be one of
25839 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
25840 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
25841 the M32C/80 series.
25842
25843 @opindex msim
25844 @item -msim
25845 Specifies that the program will be run on the simulator. This causes
25846 an alternate runtime library to be linked in which supports, for
25847 example, file I/O@. You must not use this option when generating
25848 programs that will run on real hardware; you must provide your own
25849 runtime library for whatever I/O functions are needed.
25850
25851 @opindex memregs=
25852 @item -memregs=@var{number}
25853 Specifies the number of memory-based pseudo-registers GCC uses
25854 during code generation. These pseudo-registers are used like real
25855 registers, so there is a tradeoff between GCC's ability to fit the
25856 code into available registers, and the performance penalty of using
25857 memory instead of registers. Note that all modules in a program must
25858 be compiled with the same value for this option. Because of that, you
25859 must not use this option with GCC's default runtime libraries.
25860
25861 @end table
25862
25863 @node M32R/D Options
25864 @subsection M32R/D Options
25865 @cindex M32R/D options
25866
25867 These @option{-m} options are defined for Renesas M32R/D architectures:
25868
25869 @table @gcctabopt
25870 @opindex m32r2
25871 @item -m32r2
25872 Generate code for the M32R/2@.
25873
25874 @opindex m32rx
25875 @item -m32rx
25876 Generate code for the M32R/X@.
25877
25878 @opindex m32r
25879 @item -m32r
25880 Generate code for the M32R@. This is the default.
25881
25882 @opindex mmodel=small
25883 @item -mmodel=small
25884 Assume all objects live in the lower 16MB of memory (so that their addresses
25885 can be loaded with the @code{ld24} instruction), and assume all subroutines
25886 are reachable with the @code{bl} instruction.
25887 This is the default.
25888
25889 The addressability of a particular object can be set with the
25890 @code{model} attribute.
25891
25892 @opindex mmodel=medium
25893 @item -mmodel=medium
25894 Assume objects may be anywhere in the 32-bit address space (the compiler
25895 generates @code{seth/add3} instructions to load their addresses), and
25896 assume all subroutines are reachable with the @code{bl} instruction.
25897
25898 @opindex mmodel=large
25899 @item -mmodel=large
25900 Assume objects may be anywhere in the 32-bit address space (the compiler
25901 generates @code{seth/add3} instructions to load their addresses), and
25902 assume subroutines may not be reachable with the @code{bl} instruction
25903 (the compiler generates the much slower @code{seth/add3/jl}
25904 instruction sequence).
25905
25906 @opindex msdata=none
25907 @item -msdata=none
25908 Disable use of the small data area. Variables are put into
25909 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
25910 @code{section} attribute has been specified).
25911 This is the default.
25912
25913 The small data area consists of sections @code{.sdata} and @code{.sbss}.
25914 Objects may be explicitly put in the small data area with the
25915 @code{section} attribute using one of these sections.
25916
25917 @opindex msdata=sdata
25918 @item -msdata=sdata
25919 Put small global and static data in the small data area, but do not
25920 generate special code to reference them.
25921
25922 @opindex msdata=use
25923 @item -msdata=use
25924 Put small global and static data in the small data area, and generate
25925 special instructions to reference them.
25926
25927 @opindex G
25928 @cindex smaller data references
25929 @item -G @var{num}
25930 Put global and static objects less than or equal to @var{num} bytes
25931 into the small data or BSS sections instead of the normal data or BSS
25932 sections. The default value of @var{num} is 8.
25933 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
25934 for this option to have any effect.
25935
25936 All modules should be compiled with the same @option{-G @var{num}} value.
25937 Compiling with different values of @var{num} may or may not work; if it
25938 doesn't the linker gives an error message---incorrect code is not
25939 generated.
25940
25941 @opindex mdebug
25942 @item -mdebug
25943 Makes the M32R-specific code in the compiler display some statistics
25944 that might help in debugging programs.
25945
25946 @opindex malign-loops
25947 @item -malign-loops
25948 Align all loops to a 32-byte boundary.
25949
25950 @opindex mno-align-loops
25951 @item -mno-align-loops
25952 Do not enforce a 32-byte alignment for loops. This is the default.
25953
25954 @opindex missue-rate=@var{number}
25955 @item -missue-rate=@var{number}
25956 Issue @var{number} instructions per cycle. @var{number} can only be 1
25957 or 2.
25958
25959 @opindex mbranch-cost=@var{number}
25960 @item -mbranch-cost=@var{number}
25961 @var{number} can only be 1 or 2. If it is 1 then branches are
25962 preferred over conditional code, if it is 2, then the opposite applies.
25963
25964 @opindex mflush-trap=@var{number}
25965 @item -mflush-trap=@var{number}
25966 Specifies the trap number to use to flush the cache. The default is
25967 12. Valid numbers are between 0 and 15 inclusive.
25968
25969 @opindex mno-flush-trap
25970 @item -mno-flush-trap
25971 Specifies that the cache cannot be flushed by using a trap.
25972
25973 @opindex mflush-func=@var{name}
25974 @item -mflush-func=@var{name}
25975 Specifies the name of the operating system function to call to flush
25976 the cache. The default is @samp{_flush_cache}, but a function call
25977 is only used if a trap is not available.
25978
25979 @opindex mno-flush-func
25980 @item -mno-flush-func
25981 Indicates that there is no OS function for flushing the cache.
25982
25983 @end table
25984
25985 @node M680x0 Options
25986 @subsection M680x0 Options
25987 @cindex M680x0 options
25988
25989 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
25990 The default settings depend on which architecture was selected when
25991 the compiler was configured; the defaults for the most common choices
25992 are given below.
25993
25994 @table @gcctabopt
25995 @opindex march
25996 @item -march=@var{arch}
25997 Generate code for a specific M680x0 or ColdFire instruction set
25998 architecture. Permissible values of @var{arch} for M680x0
25999 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
26000 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
26001 architectures are selected according to Freescale's ISA classification
26002 and the permissible values are: @samp{isaa}, @samp{isaaplus},
26003 @samp{isab} and @samp{isac}.
26004
26005 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
26006 code for a ColdFire target. The @var{arch} in this macro is one of the
26007 @option{-march} arguments given above.
26008
26009 When used together, @option{-march} and @option{-mtune} select code
26010 that runs on a family of similar processors but that is optimized
26011 for a particular microarchitecture.
26012
26013 @opindex mcpu
26014 @item -mcpu=@var{cpu}
26015 Generate code for a specific M680x0 or ColdFire processor.
26016 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
26017 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
26018 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
26019 below, which also classifies the CPUs into families:
26020
26021 @multitable @columnfractions 0.20 0.80
26022 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
26023 @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}
26024 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
26025 @item @samp{5206e} @tab @samp{5206e}
26026 @item @samp{5208} @tab @samp{5207} @samp{5208}
26027 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
26028 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
26029 @item @samp{5216} @tab @samp{5214} @samp{5216}
26030 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
26031 @item @samp{5225} @tab @samp{5224} @samp{5225}
26032 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
26033 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
26034 @item @samp{5249} @tab @samp{5249}
26035 @item @samp{5250} @tab @samp{5250}
26036 @item @samp{5271} @tab @samp{5270} @samp{5271}
26037 @item @samp{5272} @tab @samp{5272}
26038 @item @samp{5275} @tab @samp{5274} @samp{5275}
26039 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
26040 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
26041 @item @samp{5307} @tab @samp{5307}
26042 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
26043 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
26044 @item @samp{5407} @tab @samp{5407}
26045 @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}
26046 @end multitable
26047
26048 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
26049 @var{arch} is compatible with @var{cpu}. Other combinations of
26050 @option{-mcpu} and @option{-march} are rejected.
26051
26052 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
26053 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
26054 where the value of @var{family} is given by the table above.
26055
26056 @opindex mtune
26057 @item -mtune=@var{tune}
26058 Tune the code for a particular microarchitecture within the
26059 constraints set by @option{-march} and @option{-mcpu}.
26060 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
26061 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
26062 and @samp{cpu32}. The ColdFire microarchitectures
26063 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
26064
26065 You can also use @option{-mtune=68020-40} for code that needs
26066 to run relatively well on 68020, 68030 and 68040 targets.
26067 @option{-mtune=68020-60} is similar but includes 68060 targets
26068 as well. These two options select the same tuning decisions as
26069 @option{-m68020-40} and @option{-m68020-60} respectively.
26070
26071 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
26072 when tuning for 680x0 architecture @var{arch}. It also defines
26073 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
26074 option is used. If GCC is tuning for a range of architectures,
26075 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
26076 it defines the macros for every architecture in the range.
26077
26078 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
26079 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
26080 of the arguments given above.
26081
26082 @opindex m68000
26083 @opindex mc68000
26084 @item -m68000
26085 @itemx -mc68000
26086 Generate output for a 68000. This is the default
26087 when the compiler is configured for 68000-based systems.
26088 It is equivalent to @option{-march=68000}.
26089
26090 Use this option for microcontrollers with a 68000 or EC000 core,
26091 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
26092
26093 @opindex m68010
26094 @item -m68010
26095 Generate output for a 68010. This is the default
26096 when the compiler is configured for 68010-based systems.
26097 It is equivalent to @option{-march=68010}.
26098
26099 @opindex m68020
26100 @opindex mc68020
26101 @item -m68020
26102 @itemx -mc68020
26103 Generate output for a 68020. This is the default
26104 when the compiler is configured for 68020-based systems.
26105 It is equivalent to @option{-march=68020}.
26106
26107 @opindex m68030
26108 @item -m68030
26109 Generate output for a 68030. This is the default when the compiler is
26110 configured for 68030-based systems. It is equivalent to
26111 @option{-march=68030}.
26112
26113 @opindex m68040
26114 @item -m68040
26115 Generate output for a 68040. This is the default when the compiler is
26116 configured for 68040-based systems. It is equivalent to
26117 @option{-march=68040}.
26118
26119 This option inhibits the use of 68881/68882 instructions that have to be
26120 emulated by software on the 68040. Use this option if your 68040 does not
26121 have code to emulate those instructions.
26122
26123 @opindex m68060
26124 @item -m68060
26125 Generate output for a 68060. This is the default when the compiler is
26126 configured for 68060-based systems. It is equivalent to
26127 @option{-march=68060}.
26128
26129 This option inhibits the use of 68020 and 68881/68882 instructions that
26130 have to be emulated by software on the 68060. Use this option if your 68060
26131 does not have code to emulate those instructions.
26132
26133 @opindex mcpu32
26134 @item -mcpu32
26135 Generate output for a CPU32. This is the default
26136 when the compiler is configured for CPU32-based systems.
26137 It is equivalent to @option{-march=cpu32}.
26138
26139 Use this option for microcontrollers with a
26140 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
26141 68336, 68340, 68341, 68349 and 68360.
26142
26143 @opindex m5200
26144 @item -m5200
26145 Generate output for a 520X ColdFire CPU@. This is the default
26146 when the compiler is configured for 520X-based systems.
26147 It is equivalent to @option{-mcpu=5206}, and is now deprecated
26148 in favor of that option.
26149
26150 Use this option for microcontroller with a 5200 core, including
26151 the MCF5202, MCF5203, MCF5204 and MCF5206.
26152
26153 @opindex m5206e
26154 @item -m5206e
26155 Generate output for a 5206e ColdFire CPU@. The option is now
26156 deprecated in favor of the equivalent @option{-mcpu=5206e}.
26157
26158 @opindex m528x
26159 @item -m528x
26160 Generate output for a member of the ColdFire 528X family.
26161 The option is now deprecated in favor of the equivalent
26162 @option{-mcpu=528x}.
26163
26164 @opindex m5307
26165 @item -m5307
26166 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
26167 in favor of the equivalent @option{-mcpu=5307}.
26168
26169 @opindex m5407
26170 @item -m5407
26171 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
26172 in favor of the equivalent @option{-mcpu=5407}.
26173
26174 @opindex mcfv4e
26175 @item -mcfv4e
26176 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
26177 This includes use of hardware floating-point instructions.
26178 The option is equivalent to @option{-mcpu=547x}, and is now
26179 deprecated in favor of that option.
26180
26181 @opindex m68020-40
26182 @item -m68020-40
26183 Generate output for a 68040, without using any of the new instructions.
26184 This results in code that can run relatively efficiently on either a
26185 68020/68881 or a 68030 or a 68040. The generated code does use the
26186 68881 instructions that are emulated on the 68040.
26187
26188 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26189
26190 @opindex m68020-60
26191 @item -m68020-60
26192 Generate output for a 68060, without using any of the new instructions.
26193 This results in code that can run relatively efficiently on either a
26194 68020/68881 or a 68030 or a 68040. The generated code does use the
26195 68881 instructions that are emulated on the 68060.
26196
26197 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26198
26199 @opindex mhard-float
26200 @opindex m68881
26201 @item -mhard-float
26202 @itemx -m68881
26203 Generate floating-point instructions. This is the default for 68020
26204 and above, and for ColdFire devices that have an FPU@. It defines the
26205 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26206 on ColdFire targets.
26207
26208 @opindex msoft-float
26209 @item -msoft-float
26210 Do not generate floating-point instructions; use library calls instead.
26211 This is the default for 68000, 68010, and 68832 targets. It is also
26212 the default for ColdFire devices that have no FPU.
26213
26214 @opindex mdiv
26215 @opindex mno-div
26216 @item -mdiv
26217 @itemx -mno-div
26218 Generate (do not generate) ColdFire hardware divide and remainder
26219 instructions. If @option{-march} is used without @option{-mcpu},
26220 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26221 architectures. Otherwise, the default is taken from the target CPU
26222 (either the default CPU, or the one specified by @option{-mcpu}). For
26223 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26224 @option{-mcpu=5206e}.
26225
26226 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26227
26228 @opindex mshort
26229 @item -mshort
26230 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26231 Additionally, parameters passed on the stack are also aligned to a
26232 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26233
26234 @opindex mno-short
26235 @item -mno-short
26236 Do not consider type @code{int} to be 16 bits wide. This is the default.
26237
26238 @opindex mnobitfield
26239 @opindex mno-bitfield
26240 @item -mnobitfield
26241 @itemx -mno-bitfield
26242 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
26243 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26244
26245 @opindex mbitfield
26246 @item -mbitfield
26247 Do use the bit-field instructions. The @option{-m68020} option implies
26248 @option{-mbitfield}. This is the default if you use a configuration
26249 designed for a 68020.
26250
26251 @opindex mrtd
26252 @item -mrtd
26253 Use a different function-calling convention, in which functions
26254 that take a fixed number of arguments return with the @code{rtd}
26255 instruction, which pops their arguments while returning. This
26256 saves one instruction in the caller since there is no need to pop
26257 the arguments there.
26258
26259 This calling convention is incompatible with the one normally
26260 used on Unix, so you cannot use it if you need to call libraries
26261 compiled with the Unix compiler.
26262
26263 Also, you must provide function prototypes for all functions that
26264 take variable numbers of arguments (including @code{printf});
26265 otherwise incorrect code is generated for calls to those
26266 functions.
26267
26268 In addition, seriously incorrect code results if you call a
26269 function with too many arguments. (Normally, extra arguments are
26270 harmlessly ignored.)
26271
26272 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26273 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26274
26275 The default is @option{-mno-rtd}.
26276
26277 @opindex malign-int
26278 @opindex mno-align-int
26279 @item -malign-int
26280 @itemx -mno-align-int
26281 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26282 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26283 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26284 Aligning variables on 32-bit boundaries produces code that runs somewhat
26285 faster on processors with 32-bit busses at the expense of more memory.
26286
26287 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26288 aligns structures containing the above types differently than
26289 most published application binary interface specifications for the m68k.
26290
26291 @opindex mpcrel
26292 Use the pc-relative addressing mode of the 68000 directly, instead of
26293 using a global offset table. At present, this option implies @option{-fpic},
26294 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
26295 not presently supported with @option{-mpcrel}, though this could be supported for
26296 68020 and higher processors.
26297
26298 @opindex mno-strict-align
26299 @opindex mstrict-align
26300 @item -mno-strict-align
26301 @itemx -mstrict-align
26302 Do not (do) assume that unaligned memory references are handled by
26303 the system.
26304
26305 @item -msep-data
26306 Generate code that allows the data segment to be located in a different
26307 area of memory from the text segment. This allows for execute-in-place in
26308 an environment without virtual memory management. This option implies
26309 @option{-fPIC}.
26310
26311 @item -mno-sep-data
26312 Generate code that assumes that the data segment follows the text segment.
26313 This is the default.
26314
26315 @item -mid-shared-library
26316 Generate code that supports shared libraries via the library ID method.
26317 This allows for execute-in-place and shared libraries in an environment
26318 without virtual memory management. This option implies @option{-fPIC}.
26319
26320 @item -mno-id-shared-library
26321 Generate code that doesn't assume ID-based shared libraries are being used.
26322 This is the default.
26323
26324 @item -mshared-library-id=n
26325 Specifies the identification number of the ID-based shared library being
26326 compiled. Specifying a value of 0 generates more compact code; specifying
26327 other values forces the allocation of that number to the current
26328 library, but is no more space- or time-efficient than omitting this option.
26329
26330 @opindex mxgot
26331 @opindex mno-xgot
26332 @item -mxgot
26333 @itemx -mno-xgot
26334 When generating position-independent code for ColdFire, generate code
26335 that works if the GOT has more than 8192 entries. This code is
26336 larger and slower than code generated without this option. On M680x0
26337 processors, this option is not needed; @option{-fPIC} suffices.
26338
26339 GCC normally uses a single instruction to load values from the GOT@.
26340 While this is relatively efficient, it only works if the GOT
26341 is smaller than about 64k. Anything larger causes the linker
26342 to report an error such as:
26343
26344 @cindex relocation truncated to fit (ColdFire)
26345 @smallexample
26346 relocation truncated to fit: R_68K_GOT16O foobar
26347 @end smallexample
26348
26349 If this happens, you should recompile your code with @option{-mxgot}.
26350 It should then work with very large GOTs. However, code generated with
26351 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26352 the value of a global symbol.
26353
26354 Note that some linkers, including newer versions of the GNU linker,
26355 can create multiple GOTs and sort GOT entries. If you have such a linker,
26356 you should only need to use @option{-mxgot} when compiling a single
26357 object file that accesses more than 8192 GOT entries. Very few do.
26358
26359 These options have no effect unless GCC is generating
26360 position-independent code.
26361
26362 @opindex mlong-jump-table-offsets
26363 @item -mlong-jump-table-offsets
26364 Use 32-bit offsets in @code{switch} tables. The default is to use
26365 16-bit offsets.
26366
26367 @end table
26368
26369 @node MCore Options
26370 @subsection MCore Options
26371 @cindex MCore options
26372
26373 These are the @samp{-m} options defined for the Motorola M*Core
26374 processors.
26375
26376 @table @gcctabopt
26377
26378 @opindex mhardlit
26379 @opindex mno-hardlit
26380 @item -mhardlit
26381 @itemx -mno-hardlit
26382 Inline constants into the code stream if it can be done in two
26383 instructions or less.
26384
26385 @opindex mdiv
26386 @opindex mno-div
26387 @item -mdiv
26388 @itemx -mno-div
26389 Use the divide instruction. (Enabled by default).
26390
26391 @opindex mrelax-immediate
26392 @opindex mno-relax-immediate
26393 @item -mrelax-immediate
26394 @itemx -mno-relax-immediate
26395 Allow arbitrary-sized immediates in bit operations.
26396
26397 @opindex mwide-bitfields
26398 @opindex mno-wide-bitfields
26399 @item -mwide-bitfields
26400 @itemx -mno-wide-bitfields
26401 Always treat bit-fields as @code{int}-sized.
26402
26403 @opindex m4byte-functions
26404 @opindex mno-4byte-functions
26405 @item -m4byte-functions
26406 @itemx -mno-4byte-functions
26407 Force all functions to be aligned to a 4-byte boundary.
26408
26409 @opindex mcallgraph-data
26410 @opindex mno-callgraph-data
26411 @item -mcallgraph-data
26412 @itemx -mno-callgraph-data
26413 Emit callgraph information.
26414
26415 @opindex mslow-bytes
26416 @opindex mno-slow-bytes
26417 @item -mslow-bytes
26418 @itemx -mno-slow-bytes
26419 Prefer word access when reading byte quantities.
26420
26421 @opindex mlittle-endian
26422 @opindex mbig-endian
26423 @item -mlittle-endian
26424 @itemx -mbig-endian
26425 Generate code for a little-endian target.
26426
26427 @opindex m210
26428 @opindex m340
26429 @item -m210
26430 @itemx -m340
26431 Generate code for the 210 processor.
26432
26433 @opindex mno-lsim
26434 @item -mno-lsim
26435 Assume that runtime support has been provided and so omit the
26436 simulator library (@file{libsim.a)} from the linker command line.
26437
26438 @opindex mstack-increment
26439 @item -mstack-increment=@var{size}
26440 Set the maximum amount for a single stack increment operation. Large
26441 values can increase the speed of programs that contain functions
26442 that need a large amount of stack space, but they can also trigger a
26443 segmentation fault if the stack is extended too much. The default
26444 value is 0x1000.
26445
26446 @end table
26447
26448 @node MicroBlaze Options
26449 @subsection MicroBlaze Options
26450 @cindex MicroBlaze Options
26451
26452 @table @gcctabopt
26453
26454 @opindex msoft-float
26455 @item -msoft-float
26456 Use software emulation for floating point (default).
26457
26458 @opindex mhard-float
26459 @item -mhard-float
26460 Use hardware floating-point instructions.
26461
26462 @opindex mmemcpy
26463 @item -mmemcpy
26464 Do not optimize block moves, use @code{memcpy}.
26465
26466 @opindex mno-clearbss
26467 @item -mno-clearbss
26468 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
26469
26470 @opindex mcpu=
26471 @item -mcpu=@var{cpu-type}
26472 Use features of, and schedule code for, the given CPU.
26473 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26474 where @var{X} is a major version, @var{YY} is the minor version, and
26475 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
26476 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26477
26478 @opindex mxl-soft-mul
26479 @item -mxl-soft-mul
26480 Use software multiply emulation (default).
26481
26482 @opindex mxl-soft-div
26483 @item -mxl-soft-div
26484 Use software emulation for divides (default).
26485
26486 @opindex mxl-barrel-shift
26487 @item -mxl-barrel-shift
26488 Use the hardware barrel shifter.
26489
26490 @opindex mxl-pattern-compare
26491 @item -mxl-pattern-compare
26492 Use pattern compare instructions.
26493
26494 @opindex msmall-divides
26495 @item -msmall-divides
26496 Use table lookup optimization for small signed integer divisions.
26497
26498 @opindex mxl-stack-check
26499 @item -mxl-stack-check
26500 This option is deprecated. Use @option{-fstack-check} instead.
26501
26502 @opindex mxl-gp-opt
26503 @item -mxl-gp-opt
26504 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26505
26506 @opindex mxl-multiply-high
26507 @item -mxl-multiply-high
26508 Use multiply high instructions for high part of 32x32 multiply.
26509
26510 @opindex mxl-float-convert
26511 @item -mxl-float-convert
26512 Use hardware floating-point conversion instructions.
26513
26514 @opindex mxl-float-sqrt
26515 @item -mxl-float-sqrt
26516 Use hardware floating-point square root instruction.
26517
26518 @opindex mbig-endian
26519 @item -mbig-endian
26520 Generate code for a big-endian target.
26521
26522 @opindex mlittle-endian
26523 @item -mlittle-endian
26524 Generate code for a little-endian target.
26525
26526 @opindex mxl-reorder
26527 @item -mxl-reorder
26528 Use reorder instructions (swap and byte reversed load/store).
26529
26530 @item -mxl-mode-@var{app-model}
26531 Select application model @var{app-model}. Valid models are
26532 @table @samp
26533 @item executable
26534 normal executable (default), uses startup code @file{crt0.o}.
26535
26536 @item xmdstub
26537 for use with Xilinx Microprocessor Debugger (XMD) based
26538 software intrusive debug agent called xmdstub. This uses startup file
26539 @file{crt1.o} and sets the start address of the program to 0x800.
26540
26541 @item bootstrap
26542 for applications that are loaded using a bootloader.
26543 This model uses startup file @file{crt2.o} which does not contain a processor
26544 reset vector handler. This is suitable for transferring control on a
26545 processor reset to the bootloader rather than the application.
26546
26547 @item novectors
26548 for applications that do not require any of the
26549 MicroBlaze vectors. This option may be useful for applications running
26550 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26551 @end table
26552
26553 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26554 @option{-mxl-mode-@var{app-model}}.
26555
26556 @opindex mpic-data-is-text-relative
26557 @item -mpic-data-is-text-relative
26558 Assume that the displacement between the text and data segments is fixed
26559 at static link time. This allows data to be referenced by offset from start of
26560 text address instead of GOT since PC-relative addressing is not supported.
26561
26562 @end table
26563
26564 @node MIPS Options
26565 @subsection MIPS Options
26566 @cindex MIPS options
26567
26568 @table @gcctabopt
26569
26570 @opindex EB
26571 @item -EB
26572 Generate big-endian code.
26573
26574 @opindex EL
26575 @item -EL
26576 Generate little-endian code. This is the default for @samp{mips*el-*-*}
26577 configurations.
26578
26579 @opindex march
26580 @item -march=@var{arch}
26581 Generate code that runs on @var{arch}, which can be the name of a
26582 generic MIPS ISA, or the name of a particular processor.
26583 The ISA names are:
26584 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26585 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26586 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26587 @samp{mips64r5} and @samp{mips64r6}.
26588 The processor names are:
26589 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26590 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26591 @samp{5kc}, @samp{5kf},
26592 @samp{20kc},
26593 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26594 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26595 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26596 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26597 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26598 @samp{i6400}, @samp{i6500},
26599 @samp{interaptiv},
26600 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26601 @samp{gs464e}, @samp{gs264e},
26602 @samp{m4k},
26603 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26604 @samp{m5100}, @samp{m5101},
26605 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26606 @samp{orion},
26607 @samp{p5600}, @samp{p6600},
26608 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26609 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26610 @samp{r6000}, @samp{r8000},
26611 @samp{rm7000}, @samp{rm9000},
26612 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26613 @samp{sb1},
26614 @samp{sr71000},
26615 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26616 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26617 @samp{xlr} and @samp{xlp}.
26618 The special value @samp{from-abi} selects the
26619 most compatible architecture for the selected ABI (that is,
26620 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26621
26622 The native Linux/GNU toolchain also supports the value @samp{native},
26623 which selects the best architecture option for the host processor.
26624 @option{-march=native} has no effect if GCC does not recognize
26625 the processor.
26626
26627 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26628 (for example, @option{-march=r2k}). Prefixes are optional, and
26629 @samp{vr} may be written @samp{r}.
26630
26631 Names of the form @samp{@var{n}f2_1} refer to processors with
26632 FPUs clocked at half the rate of the core, names of the form
26633 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26634 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26635 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26636 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26637 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26638 accepted as synonyms for @samp{@var{n}f1_1}.
26639
26640 GCC defines two macros based on the value of this option. The first
26641 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26642 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
26643 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26644 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26645 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26646
26647 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26648 above. In other words, it has the full prefix and does not
26649 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
26650 the macro names the resolved architecture (either @code{"mips1"} or
26651 @code{"mips3"}). It names the default architecture when no
26652 @option{-march} option is given.
26653
26654 @opindex mtune
26655 @item -mtune=@var{arch}
26656 Optimize for @var{arch}. Among other things, this option controls
26657 the way instructions are scheduled, and the perceived cost of arithmetic
26658 operations. The list of @var{arch} values is the same as for
26659 @option{-march}.
26660
26661 When this option is not used, GCC optimizes for the processor
26662 specified by @option{-march}. By using @option{-march} and
26663 @option{-mtune} together, it is possible to generate code that
26664 runs on a family of processors, but optimize the code for one
26665 particular member of that family.
26666
26667 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
26668 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
26669 @option{-march} ones described above.
26670
26671 @opindex mips1
26672 @item -mips1
26673 Equivalent to @option{-march=mips1}.
26674
26675 @opindex mips2
26676 @item -mips2
26677 Equivalent to @option{-march=mips2}.
26678
26679 @opindex mips3
26680 @item -mips3
26681 Equivalent to @option{-march=mips3}.
26682
26683 @opindex mips4
26684 @item -mips4
26685 Equivalent to @option{-march=mips4}.
26686
26687 @opindex mips32
26688 @item -mips32
26689 Equivalent to @option{-march=mips32}.
26690
26691 @opindex mips32r3
26692 @item -mips32r3
26693 Equivalent to @option{-march=mips32r3}.
26694
26695 @opindex mips32r5
26696 @item -mips32r5
26697 Equivalent to @option{-march=mips32r5}.
26698
26699 @opindex mips32r6
26700 @item -mips32r6
26701 Equivalent to @option{-march=mips32r6}.
26702
26703 @opindex mips64
26704 @item -mips64
26705 Equivalent to @option{-march=mips64}.
26706
26707 @opindex mips64r2
26708 @item -mips64r2
26709 Equivalent to @option{-march=mips64r2}.
26710
26711 @opindex mips64r3
26712 @item -mips64r3
26713 Equivalent to @option{-march=mips64r3}.
26714
26715 @opindex mips64r5
26716 @item -mips64r5
26717 Equivalent to @option{-march=mips64r5}.
26718
26719 @opindex mips64r6
26720 @item -mips64r6
26721 Equivalent to @option{-march=mips64r6}.
26722
26723 @opindex mips16
26724 @opindex mno-mips16
26725 @item -mips16
26726 @itemx -mno-mips16
26727 Generate (do not generate) MIPS16 code. If GCC is targeting a
26728 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
26729
26730 MIPS16 code generation can also be controlled on a per-function basis
26731 by means of @code{mips16} and @code{nomips16} attributes.
26732 @xref{Function Attributes}, for more information.
26733
26734 @opindex mflip-mips16
26735 @item -mflip-mips16
26736 Generate MIPS16 code on alternating functions. This option is provided
26737 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
26738 not intended for ordinary use in compiling user code.
26739
26740 @opindex minterlink-compressed
26741 @opindex mno-interlink-compressed
26742 @item -minterlink-compressed
26743 @itemx -mno-interlink-compressed
26744 Require (do not require) that code using the standard (uncompressed) MIPS ISA
26745 be link-compatible with MIPS16 and microMIPS code, and vice versa.
26746
26747 For example, code using the standard ISA encoding cannot jump directly
26748 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
26749 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
26750 knows that the target of the jump is not compressed.
26751
26752 @opindex minterlink-mips16
26753 @opindex mno-interlink-mips16
26754 @item -minterlink-mips16
26755 @itemx -mno-interlink-mips16
26756 Aliases of @option{-minterlink-compressed} and
26757 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
26758 and are retained for backwards compatibility.
26759
26760 @opindex mabi=32
26761 @opindex mabi=o64
26762 @opindex mabi=n32
26763 @opindex mabi=64
26764 @opindex mabi=eabi
26765 @item -mabi=32
26766 @itemx -mabi=o64
26767 @itemx -mabi=n32
26768 @itemx -mabi=64
26769 @itemx -mabi=eabi
26770 Generate code for the given ABI@.
26771
26772 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
26773 generates 64-bit code when you select a 64-bit architecture, but you
26774 can use @option{-mgp32} to get 32-bit code instead.
26775
26776 For information about the O64 ABI, see
26777 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
26778
26779 GCC supports a variant of the o32 ABI in which floating-point registers
26780 are 64 rather than 32 bits wide. You can select this combination with
26781 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
26782 and @code{mfhc1} instructions and is therefore only supported for
26783 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
26784
26785 The register assignments for arguments and return values remain the
26786 same, but each scalar value is passed in a single 64-bit register
26787 rather than a pair of 32-bit registers. For example, scalar
26788 floating-point values are returned in @samp{$f0} only, not a
26789 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
26790 remains the same in that the even-numbered double-precision registers
26791 are saved.
26792
26793 Two additional variants of the o32 ABI are supported to enable
26794 a transition from 32-bit to 64-bit registers. These are FPXX
26795 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
26796 The FPXX extension mandates that all code must execute correctly
26797 when run using 32-bit or 64-bit registers. The code can be interlinked
26798 with either FP32 or FP64, but not both.
26799 The FP64A extension is similar to the FP64 extension but forbids the
26800 use of odd-numbered single-precision registers. This can be used
26801 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
26802 processors and allows both FP32 and FP64A code to interlink and
26803 run in the same process without changing FPU modes.
26804
26805 @opindex mabicalls
26806 @opindex mno-abicalls
26807 @item -mabicalls
26808 @itemx -mno-abicalls
26809 Generate (do not generate) code that is suitable for SVR4-style
26810 dynamic objects. @option{-mabicalls} is the default for SVR4-based
26811 systems.
26812
26813 @item -mshared
26814 @itemx -mno-shared
26815 Generate (do not generate) code that is fully position-independent,
26816 and that can therefore be linked into shared libraries. This option
26817 only affects @option{-mabicalls}.
26818
26819 All @option{-mabicalls} code has traditionally been position-independent,
26820 regardless of options like @option{-fPIC} and @option{-fpic}. However,
26821 as an extension, the GNU toolchain allows executables to use absolute
26822 accesses for locally-binding symbols. It can also use shorter GP
26823 initialization sequences and generate direct calls to locally-defined
26824 functions. This mode is selected by @option{-mno-shared}.
26825
26826 @option{-mno-shared} depends on binutils 2.16 or higher and generates
26827 objects that can only be linked by the GNU linker. However, the option
26828 does not affect the ABI of the final executable; it only affects the ABI
26829 of relocatable objects. Using @option{-mno-shared} generally makes
26830 executables both smaller and quicker.
26831
26832 @option{-mshared} is the default.
26833
26834 @opindex mplt
26835 @opindex mno-plt
26836 @item -mplt
26837 @itemx -mno-plt
26838 Assume (do not assume) that the static and dynamic linkers
26839 support PLTs and copy relocations. This option only affects
26840 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
26841 has no effect without @option{-msym32}.
26842
26843 You can make @option{-mplt} the default by configuring
26844 GCC with @option{--with-mips-plt}. The default is
26845 @option{-mno-plt} otherwise.
26846
26847 @opindex mxgot
26848 @opindex mno-xgot
26849 @item -mxgot
26850 @itemx -mno-xgot
26851 Lift (do not lift) the usual restrictions on the size of the global
26852 offset table.
26853
26854 GCC normally uses a single instruction to load values from the GOT@.
26855 While this is relatively efficient, it only works if the GOT
26856 is smaller than about 64k. Anything larger causes the linker
26857 to report an error such as:
26858
26859 @cindex relocation truncated to fit (MIPS)
26860 @smallexample
26861 relocation truncated to fit: R_MIPS_GOT16 foobar
26862 @end smallexample
26863
26864 If this happens, you should recompile your code with @option{-mxgot}.
26865 This works with very large GOTs, although the code is also
26866 less efficient, since it takes three instructions to fetch the
26867 value of a global symbol.
26868
26869 Note that some linkers can create multiple GOTs. If you have such a
26870 linker, you should only need to use @option{-mxgot} when a single object
26871 file accesses more than 64k's worth of GOT entries. Very few do.
26872
26873 These options have no effect unless GCC is generating position
26874 independent code.
26875
26876 @opindex mgp32
26877 @item -mgp32
26878 Assume that general-purpose registers are 32 bits wide.
26879
26880 @opindex mgp64
26881 @item -mgp64
26882 Assume that general-purpose registers are 64 bits wide.
26883
26884 @opindex mfp32
26885 @item -mfp32
26886 Assume that floating-point registers are 32 bits wide.
26887
26888 @opindex mfp64
26889 @item -mfp64
26890 Assume that floating-point registers are 64 bits wide.
26891
26892 @opindex mfpxx
26893 @item -mfpxx
26894 Do not assume the width of floating-point registers.
26895
26896 @opindex mhard-float
26897 @item -mhard-float
26898 Use floating-point coprocessor instructions.
26899
26900 @opindex msoft-float
26901 @item -msoft-float
26902 Do not use floating-point coprocessor instructions. Implement
26903 floating-point calculations using library calls instead.
26904
26905 @opindex mno-float
26906 @item -mno-float
26907 Equivalent to @option{-msoft-float}, but additionally asserts that the
26908 program being compiled does not perform any floating-point operations.
26909 This option is presently supported only by some bare-metal MIPS
26910 configurations, where it may select a special set of libraries
26911 that lack all floating-point support (including, for example, the
26912 floating-point @code{printf} formats).
26913 If code compiled with @option{-mno-float} accidentally contains
26914 floating-point operations, it is likely to suffer a link-time
26915 or run-time failure.
26916
26917 @opindex msingle-float
26918 @item -msingle-float
26919 Assume that the floating-point coprocessor only supports single-precision
26920 operations.
26921
26922 @opindex mdouble-float
26923 @item -mdouble-float
26924 Assume that the floating-point coprocessor supports double-precision
26925 operations. This is the default.
26926
26927 @opindex modd-spreg
26928 @opindex mno-odd-spreg
26929 @item -modd-spreg
26930 @itemx -mno-odd-spreg
26931 Enable the use of odd-numbered single-precision floating-point registers
26932 for the o32 ABI. This is the default for processors that are known to
26933 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
26934 is set by default.
26935
26936 @opindex mabs=2008
26937 @opindex mabs=legacy
26938 @item -mabs=2008
26939 @itemx -mabs=legacy
26940 These options control the treatment of the special not-a-number (NaN)
26941 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
26942 @code{neg.@i{fmt}} machine instructions.
26943
26944 By default or when @option{-mabs=legacy} is used the legacy
26945 treatment is selected. In this case these instructions are considered
26946 arithmetic and avoided where correct operation is required and the
26947 input operand might be a NaN. A longer sequence of instructions that
26948 manipulate the sign bit of floating-point datum manually is used
26949 instead unless the @option{-ffinite-math-only} option has also been
26950 specified.
26951
26952 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
26953 this case these instructions are considered non-arithmetic and therefore
26954 operating correctly in all cases, including in particular where the
26955 input operand is a NaN. These instructions are therefore always used
26956 for the respective operations.
26957
26958 @opindex mnan=2008
26959 @opindex mnan=legacy
26960 @item -mnan=2008
26961 @itemx -mnan=legacy
26962 These options control the encoding of the special not-a-number (NaN)
26963 IEEE 754 floating-point data.
26964
26965 The @option{-mnan=legacy} option selects the legacy encoding. In this
26966 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
26967 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
26968 by the first bit of their trailing significand field being 1.
26969
26970 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
26971 this case qNaNs are denoted by the first bit of their trailing
26972 significand field being 1, whereas sNaNs are denoted by the first bit of
26973 their trailing significand field being 0.
26974
26975 The default is @option{-mnan=legacy} unless GCC has been configured with
26976 @option{--with-nan=2008}.
26977
26978 @opindex mllsc
26979 @opindex mno-llsc
26980 @item -mllsc
26981 @itemx -mno-llsc
26982 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
26983 implement atomic memory built-in functions. When neither option is
26984 specified, GCC uses the instructions if the target architecture
26985 supports them.
26986
26987 @option{-mllsc} is useful if the runtime environment can emulate the
26988 instructions and @option{-mno-llsc} can be useful when compiling for
26989 nonstandard ISAs. You can make either option the default by
26990 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
26991 respectively. @option{--with-llsc} is the default for some
26992 configurations; see the installation documentation for details.
26993
26994 @opindex mdsp
26995 @opindex mno-dsp
26996 @item -mdsp
26997 @itemx -mno-dsp
26998 Use (do not use) revision 1 of the MIPS DSP ASE@.
26999 @xref{MIPS DSP Built-in Functions}. This option defines the
27000 preprocessor macro @code{__mips_dsp}. It also defines
27001 @code{__mips_dsp_rev} to 1.
27002
27003 @opindex mdspr2
27004 @opindex mno-dspr2
27005 @item -mdspr2
27006 @itemx -mno-dspr2
27007 Use (do not use) revision 2 of the MIPS DSP ASE@.
27008 @xref{MIPS DSP Built-in Functions}. This option defines the
27009 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
27010 It also defines @code{__mips_dsp_rev} to 2.
27011
27012 @opindex msmartmips
27013 @opindex mno-smartmips
27014 @item -msmartmips
27015 @itemx -mno-smartmips
27016 Use (do not use) the MIPS SmartMIPS ASE.
27017
27018 @opindex mpaired-single
27019 @opindex mno-paired-single
27020 @item -mpaired-single
27021 @itemx -mno-paired-single
27022 Use (do not use) paired-single floating-point instructions.
27023 @xref{MIPS Paired-Single Support}. This option requires
27024 hardware floating-point support to be enabled.
27025
27026 @opindex mdmx
27027 @opindex mno-mdmx
27028 @item -mdmx
27029 @itemx -mno-mdmx
27030 Use (do not use) MIPS Digital Media Extension instructions.
27031 This option can only be used when generating 64-bit code and requires
27032 hardware floating-point support to be enabled.
27033
27034 @opindex mips3d
27035 @opindex mno-mips3d
27036 @item -mips3d
27037 @itemx -mno-mips3d
27038 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
27039 The option @option{-mips3d} implies @option{-mpaired-single}.
27040
27041 @opindex mmicromips
27042 @opindex mno-mmicromips
27043 @item -mmicromips
27044 @itemx -mno-micromips
27045 Generate (do not generate) microMIPS code.
27046
27047 MicroMIPS code generation can also be controlled on a per-function basis
27048 by means of @code{micromips} and @code{nomicromips} attributes.
27049 @xref{Function Attributes}, for more information.
27050
27051 @opindex mmt
27052 @opindex mno-mt
27053 @item -mmt
27054 @itemx -mno-mt
27055 Use (do not use) MT Multithreading instructions.
27056
27057 @opindex mmcu
27058 @opindex mno-mcu
27059 @item -mmcu
27060 @itemx -mno-mcu
27061 Use (do not use) the MIPS MCU ASE instructions.
27062
27063 @opindex meva
27064 @opindex mno-eva
27065 @item -meva
27066 @itemx -mno-eva
27067 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
27068
27069 @opindex mvirt
27070 @opindex mno-virt
27071 @item -mvirt
27072 @itemx -mno-virt
27073 Use (do not use) the MIPS Virtualization (VZ) instructions.
27074
27075 @opindex mxpa
27076 @opindex mno-xpa
27077 @item -mxpa
27078 @itemx -mno-xpa
27079 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
27080
27081 @opindex mcrc
27082 @opindex mno-crc
27083 @item -mcrc
27084 @itemx -mno-crc
27085 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
27086
27087 @opindex mginv
27088 @opindex mno-ginv
27089 @item -mginv
27090 @itemx -mno-ginv
27091 Use (do not use) the MIPS Global INValidate (GINV) instructions.
27092
27093 @opindex mloongson-mmi
27094 @opindex mno-loongson-mmi
27095 @item -mloongson-mmi
27096 @itemx -mno-loongson-mmi
27097 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
27098
27099 @opindex mloongson-ext
27100 @opindex mno-loongson-ext
27101 @item -mloongson-ext
27102 @itemx -mno-loongson-ext
27103 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
27104
27105 @opindex mloongson-ext2
27106 @opindex mno-loongson-ext2
27107 @item -mloongson-ext2
27108 @itemx -mno-loongson-ext2
27109 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
27110
27111 @opindex mlong64
27112 @item -mlong64
27113 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
27114 an explanation of the default and the way that the pointer size is
27115 determined.
27116
27117 @opindex mlong32
27118 @item -mlong32
27119 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
27120
27121 The default size of @code{int}s, @code{long}s and pointers depends on
27122 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
27123 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
27124 32-bit @code{long}s. Pointers are the same size as @code{long}s,
27125 or the same size as integer registers, whichever is smaller.
27126
27127 @opindex msym32
27128 @opindex mno-sym32
27129 @item -msym32
27130 @itemx -mno-sym32
27131 Assume (do not assume) that all symbols have 32-bit values, regardless
27132 of the selected ABI@. This option is useful in combination with
27133 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
27134 to generate shorter and faster references to symbolic addresses.
27135
27136 @opindex G
27137 @item -G @var{num}
27138 Put definitions of externally-visible data in a small data section
27139 if that data is no bigger than @var{num} bytes. GCC can then generate
27140 more efficient accesses to the data; see @option{-mgpopt} for details.
27141
27142 The default @option{-G} option depends on the configuration.
27143
27144 @opindex mlocal-sdata
27145 @opindex mno-local-sdata
27146 @item -mlocal-sdata
27147 @itemx -mno-local-sdata
27148 Extend (do not extend) the @option{-G} behavior to local data too,
27149 such as to static variables in C@. @option{-mlocal-sdata} is the
27150 default for all configurations.
27151
27152 If the linker complains that an application is using too much small data,
27153 you might want to try rebuilding the less performance-critical parts with
27154 @option{-mno-local-sdata}. You might also want to build large
27155 libraries with @option{-mno-local-sdata}, so that the libraries leave
27156 more room for the main program.
27157
27158 @opindex mextern-sdata
27159 @opindex mno-extern-sdata
27160 @item -mextern-sdata
27161 @itemx -mno-extern-sdata
27162 Assume (do not assume) that externally-defined data is in
27163 a small data section if the size of that data is within the @option{-G} limit.
27164 @option{-mextern-sdata} is the default for all configurations.
27165
27166 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
27167 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
27168 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
27169 is placed in a small data section. If @var{Var} is defined by another
27170 module, you must either compile that module with a high-enough
27171 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
27172 definition. If @var{Var} is common, you must link the application
27173 with a high-enough @option{-G} setting.
27174
27175 The easiest way of satisfying these restrictions is to compile
27176 and link every module with the same @option{-G} option. However,
27177 you may wish to build a library that supports several different
27178 small data limits. You can do this by compiling the library with
27179 the highest supported @option{-G} setting and additionally using
27180 @option{-mno-extern-sdata} to stop the library from making assumptions
27181 about externally-defined data.
27182
27183 @opindex mgpopt
27184 @opindex mno-gpopt
27185 @item -mgpopt
27186 @itemx -mno-gpopt
27187 Use (do not use) GP-relative accesses for symbols that are known to be
27188 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27189 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
27190 configurations.
27191
27192 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27193 might not hold the value of @code{_gp}. For example, if the code is
27194 part of a library that might be used in a boot monitor, programs that
27195 call boot monitor routines pass an unknown value in @code{$gp}.
27196 (In such situations, the boot monitor itself is usually compiled
27197 with @option{-G0}.)
27198
27199 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27200 @option{-mno-extern-sdata}.
27201
27202 @opindex membedded-data
27203 @opindex mno-embedded-data
27204 @item -membedded-data
27205 @itemx -mno-embedded-data
27206 Allocate variables to the read-only data section first if possible, then
27207 next in the small data section if possible, otherwise in data. This gives
27208 slightly slower code than the default, but reduces the amount of RAM required
27209 when executing, and thus may be preferred for some embedded systems.
27210
27211 @opindex muninit-const-in-rodata
27212 @opindex mno-uninit-const-in-rodata
27213 @item -muninit-const-in-rodata
27214 @itemx -mno-uninit-const-in-rodata
27215 Put uninitialized @code{const} variables in the read-only data section.
27216 This option is only meaningful in conjunction with @option{-membedded-data}.
27217
27218 @opindex mcode-readable
27219 @item -mcode-readable=@var{setting}
27220 Specify whether GCC may generate code that reads from executable sections.
27221 There are three possible settings:
27222
27223 @table @gcctabopt
27224 @item -mcode-readable=yes
27225 Instructions may freely access executable sections. This is the
27226 default setting.
27227
27228 @item -mcode-readable=pcrel
27229 MIPS16 PC-relative load instructions can access executable sections,
27230 but other instructions must not do so. This option is useful on 4KSc
27231 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27232 It is also useful on processors that can be configured to have a dual
27233 instruction/data SRAM interface and that, like the M4K, automatically
27234 redirect PC-relative loads to the instruction RAM.
27235
27236 @item -mcode-readable=no
27237 Instructions must not access executable sections. This option can be
27238 useful on targets that are configured to have a dual instruction/data
27239 SRAM interface but that (unlike the M4K) do not automatically redirect
27240 PC-relative loads to the instruction RAM.
27241 @end table
27242
27243 @opindex msplit-addresses
27244 @opindex mno-split-addresses
27245 @item -msplit-addresses
27246 @itemx -mno-split-addresses
27247 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27248 relocation operators. This option has been superseded by
27249 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27250
27251 @opindex mexplicit-relocs
27252 @opindex mno-explicit-relocs
27253 @item -mexplicit-relocs
27254 @itemx -mno-explicit-relocs
27255 Use (do not use) assembler relocation operators when dealing with symbolic
27256 addresses. The alternative, selected by @option{-mno-explicit-relocs},
27257 is to use assembler macros instead.
27258
27259 @option{-mexplicit-relocs} is the default if GCC was configured
27260 to use an assembler that supports relocation operators.
27261
27262 @opindex mcheck-zero-division
27263 @opindex mno-check-zero-division
27264 @item -mcheck-zero-division
27265 @itemx -mno-check-zero-division
27266 Trap (do not trap) on integer division by zero.
27267
27268 The default is @option{-mcheck-zero-division}.
27269
27270 @opindex mdivide-traps
27271 @opindex mdivide-breaks
27272 @item -mdivide-traps
27273 @itemx -mdivide-breaks
27274 MIPS systems check for division by zero by generating either a
27275 conditional trap or a break instruction. Using traps results in
27276 smaller code, but is only supported on MIPS II and later. Also, some
27277 versions of the Linux kernel have a bug that prevents trap from
27278 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
27279 allow conditional traps on architectures that support them and
27280 @option{-mdivide-breaks} to force the use of breaks.
27281
27282 The default is usually @option{-mdivide-traps}, but this can be
27283 overridden at configure time using @option{--with-divide=breaks}.
27284 Divide-by-zero checks can be completely disabled using
27285 @option{-mno-check-zero-division}.
27286
27287 @opindex mload-store-pairs
27288 @opindex mno-load-store-pairs
27289 @item -mload-store-pairs
27290 @itemx -mno-load-store-pairs
27291 Enable (disable) an optimization that pairs consecutive load or store
27292 instructions to enable load/store bonding. This option is enabled by
27293 default but only takes effect when the selected architecture is known
27294 to support bonding.
27295
27296 @opindex munaligned-access
27297 @opindex mno-unaligned-access
27298 @item -munaligned-access
27299 @itemx -mno-unaligned-access
27300 Enable (disable) direct unaligned access for MIPS Release 6.
27301 MIPSr6 requires load/store unaligned-access support,
27302 by hardware or trap&emulate.
27303 So @option{-mno-unaligned-access} may be needed by kernel.
27304
27305 @opindex mmemcpy
27306 @opindex mno-memcpy
27307 @item -mmemcpy
27308 @itemx -mno-memcpy
27309 Force (do not force) the use of @code{memcpy} for non-trivial block
27310 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
27311 most constant-sized copies.
27312
27313 @opindex mlong-calls
27314 @opindex mno-long-calls
27315 @item -mlong-calls
27316 @itemx -mno-long-calls
27317 Disable (do not disable) use of the @code{jal} instruction. Calling
27318 functions using @code{jal} is more efficient but requires the caller
27319 and callee to be in the same 256 megabyte segment.
27320
27321 This option has no effect on abicalls code. The default is
27322 @option{-mno-long-calls}.
27323
27324 @opindex mmad
27325 @opindex mno-mad
27326 @item -mmad
27327 @itemx -mno-mad
27328 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27329 instructions, as provided by the R4650 ISA@.
27330
27331 @opindex mimadd
27332 @opindex mno-imadd
27333 @item -mimadd
27334 @itemx -mno-imadd
27335 Enable (disable) use of the @code{madd} and @code{msub} integer
27336 instructions. The default is @option{-mimadd} on architectures
27337 that support @code{madd} and @code{msub} except for the 74k
27338 architecture where it was found to generate slower code.
27339
27340 @opindex mfused-madd
27341 @opindex mno-fused-madd
27342 @item -mfused-madd
27343 @itemx -mno-fused-madd
27344 Enable (disable) use of the floating-point multiply-accumulate
27345 instructions, when they are available. The default is
27346 @option{-mfused-madd}.
27347
27348 On the R8000 CPU when multiply-accumulate instructions are used,
27349 the intermediate product is calculated to infinite precision
27350 and is not subject to the FCSR Flush to Zero bit. This may be
27351 undesirable in some circumstances. On other processors the result
27352 is numerically identical to the equivalent computation using
27353 separate multiply, add, subtract and negate instructions.
27354
27355 @opindex nocpp
27356 @item -nocpp
27357 Tell the MIPS assembler to not run its preprocessor over user
27358 assembler files (with a @samp{.s} suffix) when assembling them.
27359
27360 @opindex mfix-24k
27361 @opindex mno-fix-24k
27362 @item -mfix-24k
27363 @itemx -mno-fix-24k
27364 Work around the 24K E48 (lost data on stores during refill) errata.
27365 The workarounds are implemented by the assembler rather than by GCC@.
27366
27367 @opindex mfix-r4000
27368 @opindex mno-fix-r4000
27369 @item -mfix-r4000
27370 @itemx -mno-fix-r4000
27371 Work around certain R4000 CPU errata:
27372 @itemize @minus
27373 @item
27374 A double-word or a variable shift may give an incorrect result if executed
27375 immediately after starting an integer division.
27376 @item
27377 A double-word or a variable shift may give an incorrect result if executed
27378 while an integer multiplication is in progress.
27379 @item
27380 An integer division may give an incorrect result if started in a delay slot
27381 of a taken branch or a jump.
27382 @end itemize
27383
27384 @opindex mfix-r4400
27385 @opindex mno-fix-r4400
27386 @item -mfix-r4400
27387 @itemx -mno-fix-r4400
27388 Work around certain R4400 CPU errata:
27389 @itemize @minus
27390 @item
27391 A double-word or a variable shift may give an incorrect result if executed
27392 immediately after starting an integer division.
27393 @end itemize
27394
27395 @opindex mfix-r10000
27396 @opindex mno-fix-r10000
27397 @item -mfix-r10000
27398 @itemx -mno-fix-r10000
27399 Work around certain R10000 errata:
27400 @itemize @minus
27401 @item
27402 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27403 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
27404 @end itemize
27405
27406 This option can only be used if the target architecture supports
27407 branch-likely instructions. @option{-mfix-r10000} is the default when
27408 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27409 otherwise.
27410
27411 @opindex mfix-r5900
27412 @item -mfix-r5900
27413 @itemx -mno-fix-r5900
27414 Do not attempt to schedule the preceding instruction into the delay slot
27415 of a branch instruction placed at the end of a short loop of six
27416 instructions or fewer and always schedule a @code{nop} instruction there
27417 instead. The short loop bug under certain conditions causes loops to
27418 execute only once or twice, due to a hardware bug in the R5900 chip. The
27419 workaround is implemented by the assembler rather than by GCC@.
27420
27421 @opindex mfix-rm7000
27422 @item -mfix-rm7000
27423 @itemx -mno-fix-rm7000
27424 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
27425 workarounds are implemented by the assembler rather than by GCC@.
27426
27427 @opindex mfix-vr4120
27428 @item -mfix-vr4120
27429 @itemx -mno-fix-vr4120
27430 Work around certain VR4120 errata:
27431 @itemize @minus
27432 @item
27433 @code{dmultu} does not always produce the correct result.
27434 @item
27435 @code{div} and @code{ddiv} do not always produce the correct result if one
27436 of the operands is negative.
27437 @end itemize
27438 The workarounds for the division errata rely on special functions in
27439 @file{libgcc.a}. At present, these functions are only provided by
27440 the @code{mips64vr*-elf} configurations.
27441
27442 Other VR4120 errata require a NOP to be inserted between certain pairs of
27443 instructions. These errata are handled by the assembler, not by GCC itself.
27444
27445 @opindex mfix-vr4130
27446 @item -mfix-vr4130
27447 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
27448 workarounds are implemented by the assembler rather than by GCC,
27449 although GCC avoids using @code{mflo} and @code{mfhi} if the
27450 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27451 instructions are available instead.
27452
27453 @opindex mfix-sb1
27454 @item -mfix-sb1
27455 @itemx -mno-fix-sb1
27456 Work around certain SB-1 CPU core errata.
27457 (This flag currently works around the SB-1 revision 2
27458 ``F1'' and ``F2'' floating-point errata.)
27459
27460 @opindex mr10k-cache-barrier
27461 @item -mr10k-cache-barrier=@var{setting}
27462 Specify whether GCC should insert cache barriers to avoid the
27463 side effects of speculation on R10K processors.
27464
27465 In common with many processors, the R10K tries to predict the outcome
27466 of a conditional branch and speculatively executes instructions from
27467 the ``taken'' branch. It later aborts these instructions if the
27468 predicted outcome is wrong. However, on the R10K, even aborted
27469 instructions can have side effects.
27470
27471 This problem only affects kernel stores and, depending on the system,
27472 kernel loads. As an example, a speculatively-executed store may load
27473 the target memory into cache and mark the cache line as dirty, even if
27474 the store itself is later aborted. If a DMA operation writes to the
27475 same area of memory before the ``dirty'' line is flushed, the cached
27476 data overwrites the DMA-ed data. See the R10K processor manual
27477 for a full description, including other potential problems.
27478
27479 One workaround is to insert cache barrier instructions before every memory
27480 access that might be speculatively executed and that might have side
27481 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
27482 controls GCC's implementation of this workaround. It assumes that
27483 aborted accesses to any byte in the following regions does not have
27484 side effects:
27485
27486 @enumerate
27487 @item
27488 the memory occupied by the current function's stack frame;
27489
27490 @item
27491 the memory occupied by an incoming stack argument;
27492
27493 @item
27494 the memory occupied by an object with a link-time-constant address.
27495 @end enumerate
27496
27497 It is the kernel's responsibility to ensure that speculative
27498 accesses to these regions are indeed safe.
27499
27500 If the input program contains a function declaration such as:
27501
27502 @smallexample
27503 void foo (void);
27504 @end smallexample
27505
27506 then the implementation of @code{foo} must allow @code{j foo} and
27507 @code{jal foo} to be executed speculatively. GCC honors this
27508 restriction for functions it compiles itself. It expects non-GCC
27509 functions (such as hand-written assembly code) to do the same.
27510
27511 The option has three forms:
27512
27513 @table @gcctabopt
27514 @item -mr10k-cache-barrier=load-store
27515 Insert a cache barrier before a load or store that might be
27516 speculatively executed and that might have side effects even
27517 if aborted.
27518
27519 @item -mr10k-cache-barrier=store
27520 Insert a cache barrier before a store that might be speculatively
27521 executed and that might have side effects even if aborted.
27522
27523 @item -mr10k-cache-barrier=none
27524 Disable the insertion of cache barriers. This is the default setting.
27525 @end table
27526
27527 @opindex mflush-func
27528 @item -mflush-func=@var{func}
27529 @itemx -mno-flush-func
27530 Specifies the function to call to flush the I and D caches, or to not
27531 call any such function. If called, the function must take the same
27532 arguments as the common @code{_flush_func}, that is, the address of the
27533 memory range for which the cache is being flushed, the size of the
27534 memory range, and the number 3 (to flush both caches). The default
27535 depends on the target GCC was configured for, but commonly is either
27536 @code{_flush_func} or @code{__cpu_flush}.
27537
27538 @opindex mbranch-cost
27539 @item mbranch-cost=@var{num}
27540 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27541 This cost is only a heuristic and is not guaranteed to produce
27542 consistent results across releases. A zero cost redundantly selects
27543 the default, which is based on the @option{-mtune} setting.
27544
27545 @opindex mbranch-likely
27546 @opindex mno-branch-likely
27547 @item -mbranch-likely
27548 @itemx -mno-branch-likely
27549 Enable or disable use of Branch Likely instructions, regardless of the
27550 default for the selected architecture. By default, Branch Likely
27551 instructions may be generated if they are supported by the selected
27552 architecture. An exception is for the MIPS32 and MIPS64 architectures
27553 and processors that implement those architectures; for those, Branch
27554 Likely instructions are not be generated by default because the MIPS32
27555 and MIPS64 architectures specifically deprecate their use.
27556
27557 @opindex mcompact-branches=never
27558 @opindex mcompact-branches=optimal
27559 @opindex mcompact-branches=always
27560 @item -mcompact-branches=never
27561 @itemx -mcompact-branches=optimal
27562 @itemx -mcompact-branches=always
27563 These options control which form of branches will be generated. The
27564 default is @option{-mcompact-branches=optimal}.
27565
27566 The @option{-mcompact-branches=never} option ensures that compact branch
27567 instructions will never be generated.
27568
27569 The @option{-mcompact-branches=always} option ensures that a compact
27570 branch instruction will be generated if available for MIPS Release 6 onwards.
27571 If a compact branch instruction is not available (or pre-R6),
27572 a delay slot form of the branch will be used instead.
27573
27574 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27575 The behaviour for MIPS16/microMIPS may change in future,
27576 since they do have some compact branch instructions.
27577
27578 The @option{-mcompact-branches=optimal} option will cause a delay slot
27579 branch to be used if one is available in the current ISA and the delay
27580 slot is successfully filled. If the delay slot is not filled, a compact
27581 branch will be chosen if one is available.
27582
27583 @opindex mfp-exceptions
27584 @item -mfp-exceptions
27585 @itemx -mno-fp-exceptions
27586 Specifies whether FP exceptions are enabled. This affects how
27587 FP instructions are scheduled for some processors.
27588 The default is that FP exceptions are
27589 enabled.
27590
27591 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27592 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
27593 FP pipe.
27594
27595 @opindex mvr4130-align
27596 @item -mvr4130-align
27597 @itemx -mno-vr4130-align
27598 The VR4130 pipeline is two-way superscalar, but can only issue two
27599 instructions together if the first one is 8-byte aligned. When this
27600 option is enabled, GCC aligns pairs of instructions that it
27601 thinks should execute in parallel.
27602
27603 This option only has an effect when optimizing for the VR4130.
27604 It normally makes code faster, but at the expense of making it bigger.
27605 It is enabled by default at optimization level @option{-O3}.
27606
27607 @opindex msynci
27608 @item -msynci
27609 @itemx -mno-synci
27610 Enable (disable) generation of @code{synci} instructions on
27611 architectures that support it. The @code{synci} instructions (if
27612 enabled) are generated when @code{__builtin___clear_cache} is
27613 compiled.
27614
27615 This option defaults to @option{-mno-synci}, but the default can be
27616 overridden by configuring GCC with @option{--with-synci}.
27617
27618 When compiling code for single processor systems, it is generally safe
27619 to use @code{synci}. However, on many multi-core (SMP) systems, it
27620 does not invalidate the instruction caches on all cores and may lead
27621 to undefined behavior.
27622
27623 @opindex mrelax-pic-calls
27624 @item -mrelax-pic-calls
27625 @itemx -mno-relax-pic-calls
27626 Try to turn PIC calls that are normally dispatched via register
27627 @code{$25} into direct calls. This is only possible if the linker can
27628 resolve the destination at link time and if the destination is within
27629 range for a direct call.
27630
27631 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27632 an assembler and a linker that support the @code{.reloc} assembly
27633 directive and @option{-mexplicit-relocs} is in effect. With
27634 @option{-mno-explicit-relocs}, this optimization can be performed by the
27635 assembler and the linker alone without help from the compiler.
27636
27637 @opindex mmcount-ra-address
27638 @opindex mno-mcount-ra-address
27639 @item -mmcount-ra-address
27640 @itemx -mno-mcount-ra-address
27641 Emit (do not emit) code that allows @code{_mcount} to modify the
27642 calling function's return address. When enabled, this option extends
27643 the usual @code{_mcount} interface with a new @var{ra-address}
27644 parameter, which has type @code{intptr_t *} and is passed in register
27645 @code{$12}. @code{_mcount} can then modify the return address by
27646 doing both of the following:
27647 @itemize
27648 @item
27649 Returning the new address in register @code{$31}.
27650 @item
27651 Storing the new address in @code{*@var{ra-address}},
27652 if @var{ra-address} is nonnull.
27653 @end itemize
27654
27655 The default is @option{-mno-mcount-ra-address}.
27656
27657 @opindex mframe-header-opt
27658 @item -mframe-header-opt
27659 @itemx -mno-frame-header-opt
27660 Enable (disable) frame header optimization in the o32 ABI. When using the
27661 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
27662 function to write out register arguments. When enabled, this optimization
27663 will suppress the allocation of the frame header if it can be determined that
27664 it is unused.
27665
27666 This optimization is off by default at all optimization levels.
27667
27668 @opindex mlxc1-sxc1
27669 @item -mlxc1-sxc1
27670 @itemx -mno-lxc1-sxc1
27671 When applicable, enable (disable) the generation of @code{lwxc1},
27672 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
27673
27674 @opindex mmadd4
27675 @item -mmadd4
27676 @itemx -mno-madd4
27677 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
27678 @code{madd.d} and related instructions. Enabled by default.
27679
27680 @end table
27681
27682 @node MMIX Options
27683 @subsection MMIX Options
27684 @cindex MMIX Options
27685
27686 These options are defined for the MMIX:
27687
27688 @table @gcctabopt
27689 @opindex mlibfuncs
27690 @opindex mno-libfuncs
27691 @item -mlibfuncs
27692 @itemx -mno-libfuncs
27693 Specify that intrinsic library functions are being compiled, passing all
27694 values in registers, no matter the size.
27695
27696 @opindex mepsilon
27697 @opindex mno-epsilon
27698 @item -mepsilon
27699 @itemx -mno-epsilon
27700 Generate floating-point comparison instructions that compare with respect
27701 to the @code{rE} epsilon register.
27702
27703 @opindex mabi=mmixware
27704 @opindex mabi=gnu
27705 @item -mabi=mmixware
27706 @itemx -mabi=gnu
27707 Generate code that passes function parameters and return values that (in
27708 the called function) are seen as registers @code{$0} and up, as opposed to
27709 the GNU ABI which uses global registers @code{$231} and up.
27710
27711 @opindex mzero-extend
27712 @opindex mno-zero-extend
27713 @item -mzero-extend
27714 @itemx -mno-zero-extend
27715 When reading data from memory in sizes shorter than 64 bits, use (do not
27716 use) zero-extending load instructions by default, rather than
27717 sign-extending ones.
27718
27719 @opindex mknuthdiv
27720 @opindex mno-knuthdiv
27721 @item -mknuthdiv
27722 @itemx -mno-knuthdiv
27723 Make the result of a division yielding a remainder have the same sign as
27724 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
27725 remainder follows the sign of the dividend. Both methods are
27726 arithmetically valid, the latter being almost exclusively used.
27727
27728 @opindex mtoplevel-symbols
27729 @opindex mno-toplevel-symbols
27730 @item -mtoplevel-symbols
27731 @itemx -mno-toplevel-symbols
27732 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
27733 code can be used with the @code{PREFIX} assembly directive.
27734
27735 @opindex melf
27736 @item -melf
27737 Generate an executable in the ELF format, rather than the default
27738 @samp{mmo} format used by the @command{mmix} simulator.
27739
27740 @opindex mbranch-predict
27741 @opindex mno-branch-predict
27742 @item -mbranch-predict
27743 @itemx -mno-branch-predict
27744 Use (do not use) the probable-branch instructions, when static branch
27745 prediction indicates a probable branch.
27746
27747 @opindex mbase-addresses
27748 @opindex mno-base-addresses
27749 @item -mbase-addresses
27750 @itemx -mno-base-addresses
27751 Generate (do not generate) code that uses @emph{base addresses}. Using a
27752 base address automatically generates a request (handled by the assembler
27753 and the linker) for a constant to be set up in a global register. The
27754 register is used for one or more base address requests within the range 0
27755 to 255 from the value held in the register. The generally leads to short
27756 and fast code, but the number of different data items that can be
27757 addressed is limited. This means that a program that uses lots of static
27758 data may require @option{-mno-base-addresses}.
27759
27760 @opindex msingle-exit
27761 @opindex mno-single-exit
27762 @item -msingle-exit
27763 @itemx -mno-single-exit
27764 Force (do not force) generated code to have a single exit point in each
27765 function.
27766 @end table
27767
27768 @node MN10300 Options
27769 @subsection MN10300 Options
27770 @cindex MN10300 options
27771
27772 These @option{-m} options are defined for Matsushita MN10300 architectures:
27773
27774 @table @gcctabopt
27775 @opindex mmult-bug
27776 @item -mmult-bug
27777 Generate code to avoid bugs in the multiply instructions for the MN10300
27778 processors. This is the default.
27779
27780 @opindex mno-mult-bug
27781 @item -mno-mult-bug
27782 Do not generate code to avoid bugs in the multiply instructions for the
27783 MN10300 processors.
27784
27785 @opindex mam33
27786 @item -mam33
27787 Generate code using features specific to the AM33 processor.
27788
27789 @opindex mno-am33
27790 @item -mno-am33
27791 Do not generate code using features specific to the AM33 processor. This
27792 is the default.
27793
27794 @opindex mam33-2
27795 @item -mam33-2
27796 Generate code using features specific to the AM33/2.0 processor.
27797
27798 @opindex mam34
27799 @item -mam34
27800 Generate code using features specific to the AM34 processor.
27801
27802 @opindex mtune
27803 @item -mtune=@var{cpu-type}
27804 Use the timing characteristics of the indicated CPU type when
27805 scheduling instructions. This does not change the targeted processor
27806 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
27807 @samp{am33-2} or @samp{am34}.
27808
27809 @opindex mreturn-pointer-on-d0
27810 @item -mreturn-pointer-on-d0
27811 When generating a function that returns a pointer, return the pointer
27812 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
27813 only in @code{a0}, and attempts to call such functions without a prototype
27814 result in errors. Note that this option is on by default; use
27815 @option{-mno-return-pointer-on-d0} to disable it.
27816
27817 @opindex mno-crt0
27818 @item -mno-crt0
27819 Do not link in the C run-time initialization object file.
27820
27821 @opindex mrelax
27822 @item -mrelax
27823 Indicate to the linker that it should perform a relaxation optimization pass
27824 to shorten branches, calls and absolute memory addresses. This option only
27825 has an effect when used on the command line for the final link step.
27826
27827 This option makes symbolic debugging impossible.
27828
27829 @opindex mliw
27830 @item -mliw
27831 Allow the compiler to generate @emph{Long Instruction Word}
27832 instructions if the target is the @samp{AM33} or later. This is the
27833 default. This option defines the preprocessor macro @code{__LIW__}.
27834
27835 @opindex mno-liw
27836 @item -mno-liw
27837 Do not allow the compiler to generate @emph{Long Instruction Word}
27838 instructions. This option defines the preprocessor macro
27839 @code{__NO_LIW__}.
27840
27841 @opindex msetlb
27842 @item -msetlb
27843 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
27844 instructions if the target is the @samp{AM33} or later. This is the
27845 default. This option defines the preprocessor macro @code{__SETLB__}.
27846
27847 @opindex mno-setlb
27848 @item -mno-setlb
27849 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
27850 instructions. This option defines the preprocessor macro
27851 @code{__NO_SETLB__}.
27852
27853 @end table
27854
27855 @node Moxie Options
27856 @subsection Moxie Options
27857 @cindex Moxie Options
27858
27859 @table @gcctabopt
27860
27861 @opindex meb
27862 @item -meb
27863 Generate big-endian code. This is the default for @samp{moxie-*-*}
27864 configurations.
27865
27866 @opindex mel
27867 @item -mel
27868 Generate little-endian code.
27869
27870 @opindex mmul.x
27871 @item -mmul.x
27872 Generate mul.x and umul.x instructions. This is the default for
27873 @samp{moxiebox-*-*} configurations.
27874
27875 @opindex mno-crt0
27876 @item -mno-crt0
27877 Do not link in the C run-time initialization object file.
27878
27879 @end table
27880
27881 @node MSP430 Options
27882 @subsection MSP430 Options
27883 @cindex MSP430 Options
27884
27885 These options are defined for the MSP430:
27886
27887 @table @gcctabopt
27888
27889 @opindex masm-hex
27890 @item -masm-hex
27891 Force assembly output to always use hex constants. Normally such
27892 constants are signed decimals, but this option is available for
27893 testsuite and/or aesthetic purposes.
27894
27895 @opindex mmcu=
27896 @item -mmcu=
27897 Select the MCU to target. This is used to create a C preprocessor
27898 symbol based upon the MCU name, converted to upper case and pre- and
27899 post-fixed with @samp{__}. This in turn is used by the
27900 @file{msp430.h} header file to select an MCU-specific supplementary
27901 header file.
27902
27903 The option also sets the ISA to use. If the MCU name is one that is
27904 known to only support the 430 ISA then that is selected, otherwise the
27905 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
27906 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
27907 name selects the 430X ISA.
27908
27909 In addition an MCU-specific linker script is added to the linker
27910 command line. The script's name is the name of the MCU with
27911 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
27912 command line defines the C preprocessor symbol @code{__XXX__} and
27913 cause the linker to search for a script called @file{xxx.ld}.
27914
27915 The ISA and hardware multiply supported for the different MCUs is hard-coded
27916 into GCC. However, an external @samp{devices.csv} file can be used to
27917 extend device support beyond those that have been hard-coded.
27918
27919 GCC searches for the @samp{devices.csv} file using the following methods in the
27920 given precedence order, where the first method takes precendence over the
27921 second which takes precedence over the third.
27922
27923 @table @asis
27924 @item Include path specified with @code{-I} and @code{-L}
27925 @samp{devices.csv} will be searched for in each of the directories specified by
27926 include paths and linker library search paths.
27927 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
27928 Define the value of the global environment variable
27929 @samp{MSP430_GCC_INCLUDE_DIR}
27930 to the full path to the directory containing devices.csv, and GCC will search
27931 this directory for devices.csv. If devices.csv is found, this directory will
27932 also be registered as an include path, and linker library path. Header files
27933 and linker scripts in this directory can therefore be used without manually
27934 specifying @code{-I} and @code{-L} on the command line.
27935 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
27936 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
27937 toolchain root directory. This directory does not exist in a default
27938 installation, but if the user has created it and copied @samp{devices.csv}
27939 there, then the MCU data will be read. As above, this directory will
27940 also be registered as an include path, and linker library path.
27941
27942 @end table
27943 If none of the above search methods find @samp{devices.csv}, then the
27944 hard-coded MCU data is used.
27945
27946
27947 @opindex mwarn-mcu
27948 @opindex mno-warn-mcu
27949 @item -mwarn-mcu
27950 @itemx -mno-warn-mcu
27951 This option enables or disables warnings about conflicts between the
27952 MCU name specified by the @option{-mmcu} option and the ISA set by the
27953 @option{-mcpu} option and/or the hardware multiply support set by the
27954 @option{-mhwmult} option. It also toggles warnings about unrecognized
27955 MCU names. This option is on by default.
27956
27957 @opindex mcpu=
27958 @item -mcpu=
27959 Specifies the ISA to use. Accepted values are @samp{msp430},
27960 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
27961 @option{-mmcu=} option should be used to select the ISA.
27962
27963 @opindex msim
27964 @item -msim
27965 Link to the simulator runtime libraries and linker script. Overrides
27966 any scripts that would be selected by the @option{-mmcu=} option.
27967
27968 @opindex mlarge
27969 @item -mlarge
27970 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
27971
27972 @opindex msmall
27973 @item -msmall
27974 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
27975
27976 @opindex mrelax
27977 @item -mrelax
27978 This option is passed to the assembler and linker, and allows the
27979 linker to perform certain optimizations that cannot be done until
27980 the final link.
27981
27982 @opindex mhwmult=
27983 @item mhwmult=
27984 Describes the type of hardware multiply supported by the target.
27985 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
27986 for the original 16-bit-only multiply supported by early MCUs.
27987 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
27988 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
27989 A value of @samp{auto} can also be given. This tells GCC to deduce
27990 the hardware multiply support based upon the MCU name provided by the
27991 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
27992 the MCU name is not recognized then no hardware multiply support is
27993 assumed. @code{auto} is the default setting.
27994
27995 Hardware multiplies are normally performed by calling a library
27996 routine. This saves space in the generated code. When compiling at
27997 @option{-O3} or higher however the hardware multiplier is invoked
27998 inline. This makes for bigger, but faster code.
27999
28000 The hardware multiply routines disable interrupts whilst running and
28001 restore the previous interrupt state when they finish. This makes
28002 them safe to use inside interrupt handlers as well as in normal code.
28003
28004 @opindex minrt
28005 @item -minrt
28006 Enable the use of a minimum runtime environment - no static
28007 initializers or constructors. This is intended for memory-constrained
28008 devices. The compiler includes special symbols in some objects
28009 that tell the linker and runtime which code fragments are required.
28010
28011 @opindex mtiny-printf
28012 @item -mtiny-printf
28013 Enable reduced code size @code{printf} and @code{puts} library functions.
28014 The @samp{tiny} implementations of these functions are not reentrant, so
28015 must be used with caution in multi-threaded applications.
28016
28017 Support for streams has been removed and the string to be printed will
28018 always be sent to stdout via the @code{write} syscall. The string is not
28019 buffered before it is sent to write.
28020
28021 This option requires Newlib Nano IO, so GCC must be configured with
28022 @samp{--enable-newlib-nano-formatted-io}.
28023
28024 @opindex mmax-inline-shift=
28025 @item -mmax-inline-shift=
28026 This option takes an integer between 0 and 64 inclusive, and sets
28027 the maximum number of inline shift instructions which should be emitted to
28028 perform a shift operation by a constant amount. When this value needs to be
28029 exceeded, an mspabi helper function is used instead. The default value is 4.
28030
28031 This only affects cases where a shift by multiple positions cannot be
28032 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
28033
28034 Shifts of a 32-bit value are at least twice as costly, so the value passed for
28035 this option is divided by 2 and the resulting value used instead.
28036
28037 @opindex mcode-region
28038 @opindex mdata-region
28039 @item -mcode-region=
28040 @itemx -mdata-region=
28041 These options tell the compiler where to place functions and data that
28042 do not have one of the @code{lower}, @code{upper}, @code{either} or
28043 @code{section} attributes. Possible values are @code{lower},
28044 @code{upper}, @code{either} or @code{any}. The first three behave
28045 like the corresponding attribute. The fourth possible value -
28046 @code{any} - is the default. It leaves placement entirely up to the
28047 linker script and how it assigns the standard sections
28048 (@code{.text}, @code{.data}, etc) to the memory regions.
28049
28050 @opindex msilicon-errata
28051 @item -msilicon-errata=
28052 This option passes on a request to assembler to enable the fixes for
28053 the named silicon errata.
28054
28055 @opindex msilicon-errata-warn
28056 @item -msilicon-errata-warn=
28057 This option passes on a request to the assembler to enable warning
28058 messages when a silicon errata might need to be applied.
28059
28060 @opindex mwarn-devices-csv
28061 @opindex mno-warn-devices-csv
28062 @item -mwarn-devices-csv
28063 @itemx -mno-warn-devices-csv
28064 Warn if @samp{devices.csv} is not found or there are problem parsing it
28065 (default: on).
28066
28067 @end table
28068
28069 @node NDS32 Options
28070 @subsection NDS32 Options
28071 @cindex NDS32 Options
28072
28073 These options are defined for NDS32 implementations:
28074
28075 @table @gcctabopt
28076
28077 @opindex mbig-endian
28078 @item -mbig-endian
28079 Generate code in big-endian mode.
28080
28081 @opindex mlittle-endian
28082 @item -mlittle-endian
28083 Generate code in little-endian mode.
28084
28085 @opindex mreduced-regs
28086 @item -mreduced-regs
28087 Use reduced-set registers for register allocation.
28088
28089 @opindex mfull-regs
28090 @item -mfull-regs
28091 Use full-set registers for register allocation.
28092
28093 @opindex mcmov
28094 @item -mcmov
28095 Generate conditional move instructions.
28096
28097 @opindex mno-cmov
28098 @item -mno-cmov
28099 Do not generate conditional move instructions.
28100
28101 @opindex mext-perf
28102 @item -mext-perf
28103 Generate performance extension instructions.
28104
28105 @opindex mno-ext-perf
28106 @item -mno-ext-perf
28107 Do not generate performance extension instructions.
28108
28109 @opindex mext-perf2
28110 @item -mext-perf2
28111 Generate performance extension 2 instructions.
28112
28113 @opindex mno-ext-perf2
28114 @item -mno-ext-perf2
28115 Do not generate performance extension 2 instructions.
28116
28117 @opindex mext-string
28118 @item -mext-string
28119 Generate string extension instructions.
28120
28121 @opindex mno-ext-string
28122 @item -mno-ext-string
28123 Do not generate string extension instructions.
28124
28125 @opindex mv3push
28126 @item -mv3push
28127 Generate v3 push25/pop25 instructions.
28128
28129 @opindex mno-v3push
28130 @item -mno-v3push
28131 Do not generate v3 push25/pop25 instructions.
28132
28133 @opindex m16-bit
28134 @item -m16-bit
28135 Generate 16-bit instructions.
28136
28137 @opindex mno-16-bit
28138 @item -mno-16-bit
28139 Do not generate 16-bit instructions.
28140
28141 @opindex misr-vector-size
28142 @item -misr-vector-size=@var{num}
28143 Specify the size of each interrupt vector, which must be 4 or 16.
28144
28145 @opindex mcache-block-size
28146 @item -mcache-block-size=@var{num}
28147 Specify the size of each cache block,
28148 which must be a power of 2 between 4 and 512.
28149
28150 @opindex march
28151 @item -march=@var{arch}
28152 Specify the name of the target architecture.
28153
28154 @opindex mcmodel
28155 @item -mcmodel=@var{code-model}
28156 Set the code model to one of
28157 @table @asis
28158 @item @samp{small}
28159 All the data and read-only data segments must be within 512KB addressing space.
28160 The text segment must be within 16MB addressing space.
28161 @item @samp{medium}
28162 The data segment must be within 512KB while the read-only data segment can be
28163 within 4GB addressing space. The text segment should be still within 16MB
28164 addressing space.
28165 @item @samp{large}
28166 All the text and data segments can be within 4GB addressing space.
28167 @end table
28168
28169 @opindex mctor-dtor
28170 @item -mctor-dtor
28171 Enable constructor/destructor feature.
28172
28173 @opindex mrelax
28174 @item -mrelax
28175 Guide linker to relax instructions.
28176
28177 @end table
28178
28179 @node Nios II Options
28180 @subsection Nios II Options
28181 @cindex Nios II options
28182 @cindex Altera Nios II options
28183
28184 These are the options defined for the Altera Nios II processor.
28185
28186 @table @gcctabopt
28187
28188 @opindex G
28189 @cindex smaller data references
28190 @item -G @var{num}
28191 Put global and static objects less than or equal to @var{num} bytes
28192 into the small data or BSS sections instead of the normal data or BSS
28193 sections. The default value of @var{num} is 8.
28194
28195 @opindex mgpopt
28196 @opindex mno-gpopt
28197 @item -mgpopt=@var{option}
28198 @itemx -mgpopt
28199 @itemx -mno-gpopt
28200 Generate (do not generate) GP-relative accesses. The following
28201 @var{option} names are recognized:
28202
28203 @table @samp
28204
28205 @item none
28206 Do not generate GP-relative accesses.
28207
28208 @item local
28209 Generate GP-relative accesses for small data objects that are not
28210 external, weak, or uninitialized common symbols.
28211 Also use GP-relative addressing for objects that
28212 have been explicitly placed in a small data section via a @code{section}
28213 attribute.
28214
28215 @item global
28216 As for @samp{local}, but also generate GP-relative accesses for
28217 small data objects that are external, weak, or common. If you use this option,
28218 you must ensure that all parts of your program (including libraries) are
28219 compiled with the same @option{-G} setting.
28220
28221 @item data
28222 Generate GP-relative accesses for all data objects in the program. If you
28223 use this option, the entire data and BSS segments
28224 of your program must fit in 64K of memory and you must use an appropriate
28225 linker script to allocate them within the addressable range of the
28226 global pointer.
28227
28228 @item all
28229 Generate GP-relative addresses for function pointers as well as data
28230 pointers. If you use this option, the entire text, data, and BSS segments
28231 of your program must fit in 64K of memory and you must use an appropriate
28232 linker script to allocate them within the addressable range of the
28233 global pointer.
28234
28235 @end table
28236
28237 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28238 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28239
28240 The default is @option{-mgpopt} except when @option{-fpic} or
28241 @option{-fPIC} is specified to generate position-independent code.
28242 Note that the Nios II ABI does not permit GP-relative accesses from
28243 shared libraries.
28244
28245 You may need to specify @option{-mno-gpopt} explicitly when building
28246 programs that include large amounts of small data, including large
28247 GOT data sections. In this case, the 16-bit offset for GP-relative
28248 addressing may not be large enough to allow access to the entire
28249 small data section.
28250
28251 @opindex mgprel-sec
28252 @item -mgprel-sec=@var{regexp}
28253 This option specifies additional section names that can be accessed via
28254 GP-relative addressing. It is most useful in conjunction with
28255 @code{section} attributes on variable declarations
28256 (@pxref{Common Variable Attributes}) and a custom linker script.
28257 The @var{regexp} is a POSIX Extended Regular Expression.
28258
28259 This option does not affect the behavior of the @option{-G} option, and
28260 the specified sections are in addition to the standard @code{.sdata}
28261 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28262
28263 @opindex mr0rel-sec
28264 @item -mr0rel-sec=@var{regexp}
28265 This option specifies names of sections that can be accessed via a
28266 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
28267 of the 32-bit address space. It is most useful in conjunction with
28268 @code{section} attributes on variable declarations
28269 (@pxref{Common Variable Attributes}) and a custom linker script.
28270 The @var{regexp} is a POSIX Extended Regular Expression.
28271
28272 In contrast to the use of GP-relative addressing for small data,
28273 zero-based addressing is never generated by default and there are no
28274 conventional section names used in standard linker scripts for sections
28275 in the low or high areas of memory.
28276
28277 @opindex mel
28278 @opindex meb
28279 @item -mel
28280 @itemx -meb
28281 Generate little-endian (default) or big-endian (experimental) code,
28282 respectively.
28283
28284 @opindex march
28285 @item -march=@var{arch}
28286 This specifies the name of the target Nios II architecture. GCC uses this
28287 name to determine what kind of instructions it can emit when generating
28288 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
28289
28290 The preprocessor macro @code{__nios2_arch__} is available to programs,
28291 with value 1 or 2, indicating the targeted ISA level.
28292
28293 @opindex mno-bypass-cache
28294 @opindex mbypass-cache
28295 @item -mbypass-cache
28296 @itemx -mno-bypass-cache
28297 Force all load and store instructions to always bypass cache by
28298 using I/O variants of the instructions. The default is not to
28299 bypass the cache.
28300
28301 @opindex mcache-volatile
28302 @opindex mno-cache-volatile
28303 @item -mno-cache-volatile
28304 @itemx -mcache-volatile
28305 Volatile memory access bypass the cache using the I/O variants of
28306 the load and store instructions. The default is not to bypass the cache.
28307
28308 @opindex mno-fast-sw-div
28309 @opindex mfast-sw-div
28310 @item -mno-fast-sw-div
28311 @itemx -mfast-sw-div
28312 Do not use table-based fast divide for small numbers. The default
28313 is to use the fast divide at @option{-O3} and above.
28314
28315 @opindex mno-hw-mul
28316 @opindex mhw-mul
28317 @opindex mno-hw-mulx
28318 @opindex mhw-mulx
28319 @opindex mno-hw-div
28320 @opindex mhw-div
28321 @item -mno-hw-mul
28322 @itemx -mhw-mul
28323 @itemx -mno-hw-mulx
28324 @itemx -mhw-mulx
28325 @itemx -mno-hw-div
28326 @itemx -mhw-div
28327 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
28328 instructions by the compiler. The default is to emit @code{mul}
28329 and not emit @code{div} and @code{mulx}.
28330
28331 @item -mbmx
28332 @itemx -mno-bmx
28333 @itemx -mcdx
28334 @itemx -mno-cdx
28335 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28336 CDX (code density) instructions. Enabling these instructions also
28337 requires @option{-march=r2}. Since these instructions are optional
28338 extensions to the R2 architecture, the default is not to emit them.
28339
28340 @opindex mcustom-@var{insn}
28341 @opindex mno-custom-@var{insn}
28342 @item -mcustom-@var{insn}=@var{N}
28343 @itemx -mno-custom-@var{insn}
28344 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28345 custom instruction with encoding @var{N} when generating code that uses
28346 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
28347 instruction 253 for single-precision floating-point add operations instead
28348 of the default behavior of using a library call.
28349
28350 The following values of @var{insn} are supported. Except as otherwise
28351 noted, floating-point operations are expected to be implemented with
28352 normal IEEE 754 semantics and correspond directly to the C operators or the
28353 equivalent GCC built-in functions (@pxref{Other Builtins}).
28354
28355 Single-precision floating point:
28356 @table @asis
28357
28358 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28359 Binary arithmetic operations.
28360
28361 @item @samp{fnegs}
28362 Unary negation.
28363
28364 @item @samp{fabss}
28365 Unary absolute value.
28366
28367 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28368 Comparison operations.
28369
28370 @item @samp{fmins}, @samp{fmaxs}
28371 Floating-point minimum and maximum. These instructions are only
28372 generated if @option{-ffinite-math-only} is specified.
28373
28374 @item @samp{fsqrts}
28375 Unary square root operation.
28376
28377 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28378 Floating-point trigonometric and exponential functions. These instructions
28379 are only generated if @option{-funsafe-math-optimizations} is also specified.
28380
28381 @end table
28382
28383 Double-precision floating point:
28384 @table @asis
28385
28386 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28387 Binary arithmetic operations.
28388
28389 @item @samp{fnegd}
28390 Unary negation.
28391
28392 @item @samp{fabsd}
28393 Unary absolute value.
28394
28395 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28396 Comparison operations.
28397
28398 @item @samp{fmind}, @samp{fmaxd}
28399 Double-precision minimum and maximum. These instructions are only
28400 generated if @option{-ffinite-math-only} is specified.
28401
28402 @item @samp{fsqrtd}
28403 Unary square root operation.
28404
28405 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28406 Double-precision trigonometric and exponential functions. These instructions
28407 are only generated if @option{-funsafe-math-optimizations} is also specified.
28408
28409 @end table
28410
28411 Conversions:
28412 @table @asis
28413 @item @samp{fextsd}
28414 Conversion from single precision to double precision.
28415
28416 @item @samp{ftruncds}
28417 Conversion from double precision to single precision.
28418
28419 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28420 Conversion from floating point to signed or unsigned integer types, with
28421 truncation towards zero.
28422
28423 @item @samp{round}
28424 Conversion from single-precision floating point to signed integer,
28425 rounding to the nearest integer and ties away from zero.
28426 This corresponds to the @code{__builtin_lroundf} function when
28427 @option{-fno-math-errno} is used.
28428
28429 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28430 Conversion from signed or unsigned integer types to floating-point types.
28431
28432 @end table
28433
28434 In addition, all of the following transfer instructions for internal
28435 registers X and Y must be provided to use any of the double-precision
28436 floating-point instructions. Custom instructions taking two
28437 double-precision source operands expect the first operand in the
28438 64-bit register X. The other operand (or only operand of a unary
28439 operation) is given to the custom arithmetic instruction with the
28440 least significant half in source register @var{src1} and the most
28441 significant half in @var{src2}. A custom instruction that returns a
28442 double-precision result returns the most significant 32 bits in the
28443 destination register and the other half in 32-bit register Y.
28444 GCC automatically generates the necessary code sequences to write
28445 register X and/or read register Y when double-precision floating-point
28446 instructions are used.
28447
28448 @table @asis
28449
28450 @item @samp{fwrx}
28451 Write @var{src1} into the least significant half of X and @var{src2} into
28452 the most significant half of X.
28453
28454 @item @samp{fwry}
28455 Write @var{src1} into Y.
28456
28457 @item @samp{frdxhi}, @samp{frdxlo}
28458 Read the most or least (respectively) significant half of X and store it in
28459 @var{dest}.
28460
28461 @item @samp{frdy}
28462 Read the value of Y and store it into @var{dest}.
28463 @end table
28464
28465 Note that you can gain more local control over generation of Nios II custom
28466 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28467 and @code{target("no-custom-@var{insn}")} function attributes
28468 (@pxref{Function Attributes})
28469 or pragmas (@pxref{Function Specific Option Pragmas}).
28470
28471 @opindex mcustom-fpu-cfg
28472 @item -mcustom-fpu-cfg=@var{name}
28473
28474 This option enables a predefined, named set of custom instruction encodings
28475 (see @option{-mcustom-@var{insn}} above).
28476 Currently, the following sets are defined:
28477
28478 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28479 @gccoptlist{-mcustom-fmuls=252
28480 -mcustom-fadds=253
28481 -mcustom-fsubs=254
28482 -fsingle-precision-constant}
28483
28484 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28485 @gccoptlist{-mcustom-fmuls=252
28486 -mcustom-fadds=253
28487 -mcustom-fsubs=254
28488 -mcustom-fdivs=255
28489 -fsingle-precision-constant}
28490
28491 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28492 @gccoptlist{-mcustom-floatus=243
28493 -mcustom-fixsi=244
28494 -mcustom-floatis=245
28495 -mcustom-fcmpgts=246
28496 -mcustom-fcmples=249
28497 -mcustom-fcmpeqs=250
28498 -mcustom-fcmpnes=251
28499 -mcustom-fmuls=252
28500 -mcustom-fadds=253
28501 -mcustom-fsubs=254
28502 -mcustom-fdivs=255
28503 -fsingle-precision-constant}
28504
28505 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28506 @gccoptlist{-mcustom-fabss=224
28507 -mcustom-fnegs=225
28508 -mcustom-fcmpnes=226
28509 -mcustom-fcmpeqs=227
28510 -mcustom-fcmpges=228
28511 -mcustom-fcmpgts=229
28512 -mcustom-fcmples=230
28513 -mcustom-fcmplts=231
28514 -mcustom-fmaxs=232
28515 -mcustom-fmins=233
28516 -mcustom-round=248
28517 -mcustom-fixsi=249
28518 -mcustom-floatis=250
28519 -mcustom-fsqrts=251
28520 -mcustom-fmuls=252
28521 -mcustom-fadds=253
28522 -mcustom-fsubs=254
28523 -mcustom-fdivs=255}
28524
28525 Custom instruction assignments given by individual
28526 @option{-mcustom-@var{insn}=} options override those given by
28527 @option{-mcustom-fpu-cfg=}, regardless of the
28528 order of the options on the command line.
28529
28530 Note that you can gain more local control over selection of a FPU
28531 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28532 function attribute (@pxref{Function Attributes})
28533 or pragma (@pxref{Function Specific Option Pragmas}).
28534
28535 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28536 Hardware 2 Component}. Please note that the custom instructions enabled by
28537 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28538 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
28539 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28540 specified. In contrast to the other configurations,
28541 @option{-fsingle-precision-constant} is not set.
28542
28543 @end table
28544
28545 These additional @samp{-m} options are available for the Altera Nios II
28546 ELF (bare-metal) target:
28547
28548 @table @gcctabopt
28549
28550 @opindex mhal
28551 @item -mhal
28552 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
28553 startup and termination code, and is typically used in conjunction with
28554 @option{-msys-crt0=} to specify the location of the alternate startup code
28555 provided by the HAL BSP.
28556
28557 @opindex msmallc
28558 @item -msmallc
28559 Link with a limited version of the C library, @option{-lsmallc}, rather than
28560 Newlib.
28561
28562 @opindex msys-crt0
28563 @item -msys-crt0=@var{startfile}
28564 @var{startfile} is the file name of the startfile (crt0) to use
28565 when linking. This option is only useful in conjunction with @option{-mhal}.
28566
28567 @opindex msys-lib
28568 @item -msys-lib=@var{systemlib}
28569 @var{systemlib} is the library name of the library that provides
28570 low-level system calls required by the C library,
28571 e.g.@: @code{read} and @code{write}.
28572 This option is typically used to link with a library provided by a HAL BSP.
28573
28574 @end table
28575
28576 @node Nvidia PTX Options
28577 @subsection Nvidia PTX Options
28578 @cindex Nvidia PTX options
28579 @cindex nvptx options
28580
28581 These options are defined for Nvidia PTX:
28582
28583 @table @gcctabopt
28584
28585 @opindex m64
28586 @item -m64
28587 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
28588 supported.
28589
28590 @opindex march
28591 @item -march=@var{architecture-string}
28592 Generate code for the specified PTX ISA target architecture
28593 (e.g.@: @samp{sm_35}). Valid architecture strings are @samp{sm_30},
28594 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28595 @samp{sm_80}.
28596 The default depends on how the compiler has been configured, see
28597 @option{--with-arch}.
28598
28599 This option sets the value of the preprocessor macro
28600 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28601 @samp{350}.
28602
28603 @opindex misa
28604 @item -misa=@var{architecture-string}
28605 Alias of @option{-march=}.
28606
28607 @opindex march
28608 @item -march-map=@var{architecture-string}
28609 Select the closest available @option{-march=} value that is not more
28610 capable. For instance, for @option{-march-map=sm_50} select
28611 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28612 @option{-march=sm_53}.
28613
28614 @opindex mptx
28615 @item -mptx=@var{version-string}
28616 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28617 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28618 @samp{7.0}. The default PTX ISA version is 6.0, unless a higher
28619 version is required for specified PTX ISA target architecture via
28620 option @option{-march=}.
28621
28622 This option sets the values of the preprocessor macros
28623 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28624 for instance, for @samp{3.1} the macros have the values @samp{3} and
28625 @samp{1}, respectively.
28626
28627 @opindex mmainkernel
28628 @item -mmainkernel
28629 Link in code for a __main kernel. This is for stand-alone instead of
28630 offloading execution.
28631
28632 @opindex moptimize
28633 @item -moptimize
28634 Apply partitioned execution optimizations. This is the default when any
28635 level of optimization is selected.
28636
28637 @opindex msoft-stack
28638 @item -msoft-stack
28639 Generate code that does not use @code{.local} memory
28640 directly for stack storage. Instead, a per-warp stack pointer is
28641 maintained explicitly. This enables variable-length stack allocation (with
28642 variable-length arrays or @code{alloca}), and when global memory is used for
28643 underlying storage, makes it possible to access automatic variables from other
28644 threads, or with atomic instructions. This code generation variant is used
28645 for OpenMP offloading, but the option is exposed on its own for the purpose
28646 of testing the compiler; to generate code suitable for linking into programs
28647 using OpenMP offloading, use option @option{-mgomp}.
28648
28649 @opindex muniform-simt
28650 @item -muniform-simt
28651 Switch to code generation variant that allows to execute all threads in each
28652 warp, while maintaining memory state and side effects as if only one thread
28653 in each warp was active outside of OpenMP SIMD regions. All atomic operations
28654 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
28655 current lane index equals the master lane index), and the register being
28656 assigned is copied via a shuffle instruction from the master lane. Outside of
28657 SIMD regions lane 0 is the master; inside, each thread sees itself as the
28658 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
28659 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
28660 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
28661 with current lane index to compute the master lane index.
28662
28663 @opindex mgomp
28664 @item -mgomp
28665 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
28666 @option{-muniform-simt} options, and selects corresponding multilib variant.
28667
28668 @end table
28669
28670 @node OpenRISC Options
28671 @subsection OpenRISC Options
28672 @cindex OpenRISC Options
28673
28674 These options are defined for OpenRISC:
28675
28676 @table @gcctabopt
28677
28678 @opindex mboard
28679 @item -mboard=@var{name}
28680 Configure a board specific runtime. This will be passed to the linker for
28681 newlib board library linking. The default is @code{or1ksim}.
28682
28683 @opindex mnewlib
28684 @item -mnewlib
28685 This option is ignored; it is for compatibility purposes only. This used to
28686 select linker and preprocessor options for use with newlib.
28687
28688 @opindex msoft-div
28689 @opindex mhard-div
28690 @item -msoft-div
28691 @itemx -mhard-div
28692 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
28693 This default is hardware divide.
28694
28695 @opindex msoft-mul
28696 @opindex mhard-mul
28697 @item -msoft-mul
28698 @itemx -mhard-mul
28699 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
28700 This default is hardware multiply.
28701
28702 @opindex msoft-float
28703 @opindex mhard-float
28704 @item -msoft-float
28705 @itemx -mhard-float
28706 Select software or hardware for floating point operations.
28707 The default is software.
28708
28709 @opindex mdouble-float
28710 @item -mdouble-float
28711 When @option{-mhard-float} is selected, enables generation of double-precision
28712 floating point instructions. By default functions from @file{libgcc} are used
28713 to perform double-precision floating point operations.
28714
28715 @opindex munordered-float
28716 @item -munordered-float
28717 When @option{-mhard-float} is selected, enables generation of unordered
28718 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
28719 functions from @file{libgcc} are used to perform unordered floating point
28720 compare and set flag operations.
28721
28722 @opindex mcmov
28723 @item -mcmov
28724 Enable generation of conditional move (@code{l.cmov}) instructions. By
28725 default the equivalent will be generated using set and branch.
28726
28727 @opindex mror
28728 @item -mror
28729 Enable generation of rotate right (@code{l.ror}) instructions. By default
28730 functions from @file{libgcc} are used to perform rotate right operations.
28731
28732 @opindex mrori
28733 @item -mrori
28734 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
28735 By default functions from @file{libgcc} are used to perform rotate right with
28736 immediate operations.
28737
28738 @opindex msext
28739 @item -msext
28740 Enable generation of sign extension (@code{l.ext*}) instructions. By default
28741 memory loads are used to perform sign extension.
28742
28743 @opindex msfimm
28744 @item -msfimm
28745 Enable generation of compare and set flag with immediate (@code{l.sf*i})
28746 instructions. By default extra instructions will be generated to store the
28747 immediate to a register first.
28748
28749 @opindex mshftimm
28750 @item -mshftimm
28751 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
28752 @code{l.slli}) instructions. By default extra instructions will be generated
28753 to store the immediate to a register first.
28754
28755 @opindex mcmodel=small
28756 @item -mcmodel=small
28757 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
28758 the default model.
28759
28760 @opindex mcmodel=large
28761 @item -mcmodel=large
28762 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
28763
28764
28765 @end table
28766
28767 @node PDP-11 Options
28768 @subsection PDP-11 Options
28769 @cindex PDP-11 Options
28770
28771 These options are defined for the PDP-11:
28772
28773 @table @gcctabopt
28774 @opindex mfpu
28775 @item -mfpu
28776 Use hardware FPP floating point. This is the default. (FIS floating
28777 point on the PDP-11/40 is not supported.) Implies -m45.
28778
28779 @opindex msoft-float
28780 @item -msoft-float
28781 Do not use hardware floating point.
28782
28783 @opindex mac0
28784 @item -mac0
28785 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
28786
28787 @opindex mno-ac0
28788 @item -mno-ac0
28789 Return floating-point results in memory. This is the default.
28790
28791 @opindex m40
28792 @item -m40
28793 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
28794
28795 @opindex m45
28796 @item -m45
28797 Generate code for a PDP-11/45. This is the default.
28798
28799 @opindex m10
28800 @item -m10
28801 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
28802
28803 @opindex mint16
28804 @opindex mno-int32
28805 @item -mint16
28806 @itemx -mno-int32
28807 Use 16-bit @code{int}. This is the default.
28808
28809 @opindex mint32
28810 @opindex mno-int16
28811 @item -mint32
28812 @itemx -mno-int16
28813 Use 32-bit @code{int}.
28814
28815 @opindex msplit
28816 @item -msplit
28817 Target has split instruction and data space. Implies -m45.
28818
28819 @opindex munix-asm
28820 @item -munix-asm
28821 Use Unix assembler syntax.
28822
28823 @opindex mdec-asm
28824 @item -mdec-asm
28825 Use DEC assembler syntax.
28826
28827 @opindex mgnu-asm
28828 @item -mgnu-asm
28829 Use GNU assembler syntax. This is the default.
28830
28831 @opindex mlra
28832 @item -mlra
28833 Use the new LRA register allocator. By default, the old ``reload''
28834 allocator is used.
28835 @end table
28836
28837 @node PowerPC Options
28838 @subsection PowerPC Options
28839 @cindex PowerPC options
28840
28841 These are listed under @xref{RS/6000 and PowerPC Options}.
28842
28843 @node PRU Options
28844 @subsection PRU Options
28845 @cindex PRU Options
28846
28847 These command-line options are defined for PRU target:
28848
28849 @table @gcctabopt
28850 @opindex minrt
28851 @item -minrt
28852 Link with a minimum runtime environment, with no support for static
28853 initializers and constructors. Using this option can significantly reduce
28854 the size of the final ELF binary. Beware that the compiler could still
28855 generate code with static initializers and constructors. It is up to the
28856 programmer to ensure that the source program will not use those features.
28857
28858 @opindex mmcu
28859 @item -mmcu=@var{mcu}
28860 Specify the PRU MCU variant to use. Check Newlib for the exact list of
28861 supported MCUs.
28862
28863 @opindex mno-relax
28864 @item -mno-relax
28865 Make GCC pass the @option{--no-relax} command-line option to the linker
28866 instead of the @option{--relax} option.
28867
28868 @opindex mloop
28869 @item -mloop
28870 Allow (or do not allow) GCC to use the LOOP instruction.
28871
28872 @opindex mabi
28873 @item -mabi=@var{variant}
28874 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
28875 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
28876 more naturally with certain GCC assumptions. These are the differences:
28877
28878 @table @samp
28879 @item Function Pointer Size
28880 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
28881 supports only 32-bit data and code pointers.
28882
28883 @item Optional Return Value Pointer
28884 Function return values larger than 64 bits are passed by using a hidden
28885 pointer as the first argument of the function. TI ABI, though, mandates that
28886 the pointer can be NULL in case the caller is not using the returned value.
28887 GNU always passes and expects a valid return value pointer.
28888
28889 @end table
28890
28891 The current @option{-mabi=ti} implementation simply raises a compile error
28892 when any of the above code constructs is detected. As a consequence
28893 the standard C library cannot be built and it is omitted when linking with
28894 @option{-mabi=ti}.
28895
28896 Relaxation is a GNU feature and for safety reasons is disabled when using
28897 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
28898 instructions, so the GNU linker cannot adjust them when shortening adjacent
28899 LDI32 pseudo instructions.
28900
28901 @end table
28902
28903 @node RISC-V Options
28904 @subsection RISC-V Options
28905 @cindex RISC-V Options
28906
28907 These command-line options are defined for RISC-V targets:
28908
28909 @table @gcctabopt
28910 @opindex mbranch-cost
28911 @item -mbranch-cost=@var{n}
28912 Set the cost of branches to roughly @var{n} instructions.
28913
28914 @opindex plt
28915 @item -mplt
28916 @itemx -mno-plt
28917 When generating PIC code, do or don't allow the use of PLTs. Ignored for
28918 non-PIC. The default is @option{-mplt}.
28919
28920 @opindex mabi
28921 @item -mabi=@var{ABI-string}
28922 Specify integer and floating-point calling convention. @var{ABI-string}
28923 contains two parts: the size of integer types and the registers used for
28924 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
28925 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
28926 32-bit), and that floating-point values up to 64 bits wide are passed in F
28927 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
28928 allows the compiler to generate code that uses the F and D extensions but only
28929 allows floating-point values up to 32 bits long to be passed in registers; or
28930 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
28931 passed in registers.
28932
28933 The default for this argument is system dependent, users who want a specific
28934 calling convention should specify one explicitly. The valid calling
28935 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
28936 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
28937 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
28938 invalid because the ABI requires 64-bit values be passed in F registers, but F
28939 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
28940 only be used with the @samp{rv32e} architecture. This ABI is not well
28941 specified at present, and is subject to change.
28942
28943 @opindex mfdiv
28944 @item -mfdiv
28945 @itemx -mno-fdiv
28946 Do or don't use hardware floating-point divide and square root instructions.
28947 This requires the F or D extensions for floating-point registers. The default
28948 is to use them if the specified architecture has these instructions.
28949
28950 @opindex mdiv
28951 @item -mdiv
28952 @itemx -mno-div
28953 Do or don't use hardware instructions for integer division. This requires the
28954 M extension. The default is to use them if the specified architecture has
28955 these instructions.
28956
28957 @opindex misa-spec
28958 @item -misa-spec=@var{ISA-spec-string}
28959 Specify the version of the RISC-V Unprivileged (formerly User-Level)
28960 ISA specification to produce code conforming to. The possibilities
28961 for @var{ISA-spec-string} are:
28962 @table @code
28963 @item 2.2
28964 Produce code conforming to version 2.2.
28965 @item 20190608
28966 Produce code conforming to version 20190608.
28967 @item 20191213
28968 Produce code conforming to version 20191213.
28969 @end table
28970 The default is @option{-misa-spec=20191213} unless GCC has been configured
28971 with @option{--with-isa-spec=} specifying a different default version.
28972
28973 @opindex march
28974 @item -march=@var{ISA-string}
28975 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
28976 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
28977 @samp{rv32imaf}.
28978
28979 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
28980
28981 If both @option{-march} and @option{-mcpu=} are not specified, the default for
28982 this argument is system dependent, users who want a specific architecture
28983 extensions should specify one explicitly.
28984
28985 @opindex mcpu
28986 @item -mcpu=@var{processor-string}
28987 Use architecture of and optimize the output for the given processor, specified
28988 by particular CPU name.
28989 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
28990 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
28991 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
28992 @samp{sifive-u54}, and @samp{sifive-u74}.
28993
28994 @opindex mtune
28995 @item -mtune=@var{processor-string}
28996 Optimize the output for the given processor, specified by microarchitecture or
28997 particular CPU name. Permissible values for this option are: @samp{rocket},
28998 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
28999 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
29000
29001 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
29002 the default is @samp{rocket} if both are not specified.
29003
29004 The @samp{size} choice is not intended for use by end-users. This is used
29005 when @option{-Os} is specified. It overrides the instruction cost info
29006 provided by @option{-mtune=}, but does not override the pipeline info. This
29007 helps reduce code size while still giving good performance.
29008
29009 @opindex mpreferred-stack-boundary
29010 @item -mpreferred-stack-boundary=@var{num}
29011 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29012 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
29013 the default is 4 (16 bytes or 128-bits).
29014
29015 @strong{Warning:} If you use this switch, then you must build all modules with
29016 the same value, including any libraries. This includes the system libraries
29017 and startup modules.
29018
29019 @opindex msmall-data-limit
29020 @item -msmall-data-limit=@var{n}
29021 Put global and static data smaller than @var{n} bytes into a special section
29022 (on some targets).
29023
29024 @opindex msave-restore
29025 @item -msave-restore
29026 @itemx -mno-save-restore
29027 Do or don't use smaller but slower prologue and epilogue code that uses
29028 library function calls. The default is to use fast inline prologues and
29029 epilogues.
29030
29031 @opindex minline-atomics
29032 @item -minline-atomics
29033 @itemx -mno-inline-atomics
29034 Do or don't use smaller but slower subword atomic emulation code that uses
29035 libatomic function calls. The default is to use fast inline subword atomics
29036 that do not require libatomic.
29037
29038 @opindex mshorten-memrefs
29039 @item -mshorten-memrefs
29040 @itemx -mno-shorten-memrefs
29041 Do or do not attempt to make more use of compressed load/store instructions by
29042 replacing a load/store of 'base register + large offset' with a new load/store
29043 of 'new base + small offset'. If the new base gets stored in a compressed
29044 register, then the new load/store can be compressed. Currently targets 32-bit
29045 integer load/stores only.
29046
29047 @opindex mstrict-align
29048 @item -mstrict-align
29049 @itemx -mno-strict-align
29050 Do not or do generate unaligned memory accesses. The default is set depending
29051 on whether the processor we are optimizing for supports fast unaligned access
29052 or not.
29053
29054 @opindex mcmodel=medlow
29055 @item -mcmodel=medlow
29056 Generate code for the medium-low code model. The program and its statically
29057 defined symbols must lie within a single 2 GiB address range and must lie
29058 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
29059 statically or dynamically linked. This is the default code model.
29060
29061 @opindex mcmodel=medany
29062 @item -mcmodel=medany
29063 Generate code for the medium-any code model. The program and its statically
29064 defined symbols must be within any single 2 GiB address range. Programs can be
29065 statically or dynamically linked.
29066
29067 The code generated by the medium-any code model is position-independent, but is
29068 not guaranteed to function correctly when linked into position-independent
29069 executables or libraries.
29070
29071 @item -mexplicit-relocs
29072 @itemx -mno-exlicit-relocs
29073 Use or do not use assembler relocation operators when dealing with symbolic
29074 addresses. The alternative is to use assembler macros instead, which may
29075 limit optimization.
29076
29077 @opindex mrelax
29078 @item -mrelax
29079 @itemx -mno-relax
29080 Take advantage of linker relaxations to reduce the number of instructions
29081 required to materialize symbol addresses. The default is to take advantage of
29082 linker relaxations.
29083
29084 @opindex mriscv-attribute
29085 @item -mriscv-attribute
29086 @itemx -mno-riscv-attribute
29087 Emit (do not emit) RISC-V attribute to record extra information into ELF
29088 objects. This feature requires at least binutils 2.32.
29089
29090 @opindex mcsr-check
29091 @item -mcsr-check
29092 @itemx -mno-csr-check
29093 Enables or disables the CSR checking.
29094
29095 @opindex malign-data
29096 @item -malign-data=@var{type}
29097 Control how GCC aligns variables and constants of array, structure, or union
29098 types. Supported values for @var{type} are @samp{xlen} which uses x register
29099 width as the alignment value, and @samp{natural} which uses natural alignment.
29100 @samp{xlen} is the default.
29101
29102 @opindex mbig-endian
29103 @item -mbig-endian
29104 Generate big-endian code. This is the default when GCC is configured for a
29105 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
29106
29107 @opindex mlittle-endian
29108 @item -mlittle-endian
29109 Generate little-endian code. This is the default when GCC is configured for a
29110 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
29111 @samp{riscv32be-*-*} target.
29112
29113 @opindex mstack-protector-guard
29114 @opindex mstack-protector-guard-reg
29115 @opindex mstack-protector-guard-offset
29116 @item -mstack-protector-guard=@var{guard}
29117 @itemx -mstack-protector-guard-reg=@var{reg}
29118 @itemx -mstack-protector-guard-offset=@var{offset}
29119 Generate stack protection code using canary at @var{guard}. Supported
29120 locations are @samp{global} for a global canary or @samp{tls} for per-thread
29121 canary in the TLS block.
29122
29123 With the latter choice the options
29124 @option{-mstack-protector-guard-reg=@var{reg}} and
29125 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29126 which register to use as base register for reading the canary,
29127 and from what offset from that base register. There is no default
29128 register or offset as this is entirely for use within the Linux
29129 kernel.
29130 @end table
29131
29132 @node RL78 Options
29133 @subsection RL78 Options
29134 @cindex RL78 Options
29135
29136 @table @gcctabopt
29137
29138 @opindex msim
29139 @item -msim
29140 Links in additional target libraries to support operation within a
29141 simulator.
29142
29143 @opindex mmul
29144 @item -mmul=none
29145 @itemx -mmul=g10
29146 @itemx -mmul=g13
29147 @itemx -mmul=g14
29148 @itemx -mmul=rl78
29149 Specifies the type of hardware multiplication and division support to
29150 be used. The simplest is @code{none}, which uses software for both
29151 multiplication and division. This is the default. The @code{g13}
29152 value is for the hardware multiply/divide peripheral found on the
29153 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
29154 the multiplication and division instructions supported by the RL78/G14
29155 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
29156 the value @code{mg10} is an alias for @code{none}.
29157
29158 In addition a C preprocessor macro is defined, based upon the setting
29159 of this option. Possible values are: @code{__RL78_MUL_NONE__},
29160 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
29161
29162 @opindex mcpu
29163 @item -mcpu=g10
29164 @itemx -mcpu=g13
29165 @itemx -mcpu=g14
29166 @itemx -mcpu=rl78
29167 Specifies the RL78 core to target. The default is the G14 core, also
29168 known as an S3 core or just RL78. The G13 or S2 core does not have
29169 multiply or divide instructions, instead it uses a hardware peripheral
29170 for these operations. The G10 or S1 core does not have register
29171 banks, so it uses a different calling convention.
29172
29173 If this option is set it also selects the type of hardware multiply
29174 support to use, unless this is overridden by an explicit
29175 @option{-mmul=none} option on the command line. Thus specifying
29176 @option{-mcpu=g13} enables the use of the G13 hardware multiply
29177 peripheral and specifying @option{-mcpu=g10} disables the use of
29178 hardware multiplications altogether.
29179
29180 Note, although the RL78/G14 core is the default target, specifying
29181 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
29182 change the behavior of the toolchain since it also enables G14
29183 hardware multiply support. If these options are not specified on the
29184 command line then software multiplication routines will be used even
29185 though the code targets the RL78 core. This is for backwards
29186 compatibility with older toolchains which did not have hardware
29187 multiply and divide support.
29188
29189 In addition a C preprocessor macro is defined, based upon the setting
29190 of this option. Possible values are: @code{__RL78_G10__},
29191 @code{__RL78_G13__} or @code{__RL78_G14__}.
29192
29193 @opindex mg10
29194 @opindex mg13
29195 @opindex mg14
29196 @opindex mrl78
29197 @item -mg10
29198 @itemx -mg13
29199 @itemx -mg14
29200 @itemx -mrl78
29201 These are aliases for the corresponding @option{-mcpu=} option. They
29202 are provided for backwards compatibility.
29203
29204 @opindex mallregs
29205 @item -mallregs
29206 Allow the compiler to use all of the available registers. By default
29207 registers @code{r24..r31} are reserved for use in interrupt handlers.
29208 With this option enabled these registers can be used in ordinary
29209 functions as well.
29210
29211 @opindex m64bit-doubles
29212 @opindex m32bit-doubles
29213 @item -m64bit-doubles
29214 @itemx -m32bit-doubles
29215 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29216 or 32 bits (@option{-m32bit-doubles}) in size. The default is
29217 @option{-m32bit-doubles}.
29218
29219 @opindex msave-mduc-in-interrupts
29220 @opindex mno-save-mduc-in-interrupts
29221 @item -msave-mduc-in-interrupts
29222 @itemx -mno-save-mduc-in-interrupts
29223 Specifies that interrupt handler functions should preserve the
29224 MDUC registers. This is only necessary if normal code might use
29225 the MDUC registers, for example because it performs multiplication
29226 and division operations. The default is to ignore the MDUC registers
29227 as this makes the interrupt handlers faster. The target option -mg13
29228 needs to be passed for this to work as this feature is only available
29229 on the G13 target (S2 core). The MDUC registers will only be saved
29230 if the interrupt handler performs a multiplication or division
29231 operation or it calls another function.
29232
29233 @end table
29234
29235 @node RS/6000 and PowerPC Options
29236 @subsection IBM RS/6000 and PowerPC Options
29237 @cindex RS/6000 and PowerPC Options
29238 @cindex IBM RS/6000 and PowerPC Options
29239
29240 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29241 @table @gcctabopt
29242 @item -mpowerpc-gpopt
29243 @itemx -mno-powerpc-gpopt
29244 @itemx -mpowerpc-gfxopt
29245 @itemx -mno-powerpc-gfxopt
29246 @need 800
29247 @itemx -mpowerpc64
29248 @itemx -mno-powerpc64
29249 @itemx -mmfcrf
29250 @itemx -mno-mfcrf
29251 @itemx -mpopcntb
29252 @itemx -mno-popcntb
29253 @itemx -mpopcntd
29254 @itemx -mno-popcntd
29255 @itemx -mfprnd
29256 @itemx -mno-fprnd
29257 @need 800
29258 @opindex mpowerpc-gpopt
29259 @opindex mno-powerpc-gpopt
29260 @opindex mpowerpc-gfxopt
29261 @opindex mno-powerpc-gfxopt
29262 @opindex mpowerpc64
29263 @opindex mno-powerpc64
29264 @opindex mmfcrf
29265 @opindex mno-mfcrf
29266 @opindex mpopcntb
29267 @opindex mno-popcntb
29268 @opindex mpopcntd
29269 @opindex mno-popcntd
29270 @opindex mfprnd
29271 @opindex mno-fprnd
29272 @opindex mcmpb
29273 @opindex mno-cmpb
29274 @opindex mhard-dfp
29275 @opindex mno-hard-dfp
29276 @itemx -mcmpb
29277 @itemx -mno-cmpb
29278 @itemx -mhard-dfp
29279 @itemx -mno-hard-dfp
29280 You use these options to specify which instructions are available on the
29281 processor you are using. The default value of these options is
29282 determined when configuring GCC@. Specifying the
29283 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29284 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
29285 rather than the options listed above.
29286
29287 Specifying @option{-mpowerpc-gpopt} allows
29288 GCC to use the optional PowerPC architecture instructions in the
29289 General Purpose group, including floating-point square root. Specifying
29290 @option{-mpowerpc-gfxopt} allows GCC to
29291 use the optional PowerPC architecture instructions in the Graphics
29292 group, including floating-point select.
29293
29294 The @option{-mmfcrf} option allows GCC to generate the move from
29295 condition register field instruction implemented on the POWER4
29296 processor and other processors that support the PowerPC V2.01
29297 architecture.
29298 The @option{-mpopcntb} option allows GCC to generate the popcount and
29299 double-precision FP reciprocal estimate instruction implemented on the
29300 POWER5 processor and other processors that support the PowerPC V2.02
29301 architecture.
29302 The @option{-mpopcntd} option allows GCC to generate the popcount
29303 instruction implemented on the POWER7 processor and other processors
29304 that support the PowerPC V2.06 architecture.
29305 The @option{-mfprnd} option allows GCC to generate the FP round to
29306 integer instructions implemented on the POWER5+ processor and other
29307 processors that support the PowerPC V2.03 architecture.
29308 The @option{-mcmpb} option allows GCC to generate the compare bytes
29309 instruction implemented on the POWER6 processor and other processors
29310 that support the PowerPC V2.05 architecture.
29311 The @option{-mhard-dfp} option allows GCC to generate the decimal
29312 floating-point instructions implemented on some POWER processors.
29313
29314 The @option{-mpowerpc64} option allows GCC to generate the additional
29315 64-bit instructions that are found in the full PowerPC64 architecture
29316 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
29317 @option{-mno-powerpc64}.
29318
29319 @opindex mcpu
29320 @item -mcpu=@var{cpu_type}
29321 Set architecture type, register usage, and
29322 instruction scheduling parameters for machine type @var{cpu_type}.
29323 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29324 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29325 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29326 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29327 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29328 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29329 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29330 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29331 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29332 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29333 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29334 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29335
29336 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29337 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29338 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29339 architecture machine types, with an appropriate, generic processor
29340 model assumed for scheduling purposes.
29341
29342 Specifying @samp{native} as cpu type detects and selects the
29343 architecture option that corresponds to the host processor of the
29344 system performing the compilation.
29345 @option{-mcpu=native} has no effect if GCC does not recognize the
29346 processor.
29347
29348 The other options specify a specific processor. Code generated under
29349 those options runs best on that processor, and may not run at all on
29350 others.
29351
29352 The @option{-mcpu} options automatically enable or disable the
29353 following options:
29354
29355 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple
29356 -mpopcntb -mpopcntd -mpowerpc64
29357 -mpowerpc-gpopt -mpowerpc-gfxopt
29358 -mmulhw -mdlmzb -mmfpgpr -mvsx
29359 -mcrypto -mhtm -mpower8-fusion -mpower8-vector
29360 -mquad-memory -mquad-memory-atomic -mfloat128
29361 -mfloat128-hardware -mprefixed -mpcrel -mmma
29362 -mrop-protect}
29363
29364 The particular options set for any particular CPU varies between
29365 compiler versions, depending on what setting seems to produce optimal
29366 code for that CPU; it doesn't necessarily reflect the actual hardware's
29367 capabilities. If you wish to set an individual option to a particular
29368 value, you may specify it after the @option{-mcpu} option, like
29369 @option{-mcpu=970 -mno-altivec}.
29370
29371 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29372 not enabled or disabled by the @option{-mcpu} option at present because
29373 AIX does not have full support for these options. You may still
29374 enable or disable them individually if you're sure it'll work in your
29375 environment.
29376
29377 @opindex mtune
29378 @item -mtune=@var{cpu_type}
29379 Set the instruction scheduling parameters for machine type
29380 @var{cpu_type}, but do not set the architecture type or register usage,
29381 as @option{-mcpu=@var{cpu_type}} does. The same
29382 values for @var{cpu_type} are used for @option{-mtune} as for
29383 @option{-mcpu}. If both are specified, the code generated uses the
29384 architecture and registers set by @option{-mcpu}, but the
29385 scheduling parameters set by @option{-mtune}.
29386
29387 @opindex mcmodel=small
29388 @item -mcmodel=small
29389 Generate PowerPC64 code for the small model: The TOC is limited to
29390 64k.
29391
29392 @opindex mcmodel=medium
29393 @item -mcmodel=medium
29394 Generate PowerPC64 code for the medium model: The TOC and other static
29395 data may be up to a total of 4G in size. This is the default for 64-bit
29396 Linux.
29397
29398 @opindex mcmodel=large
29399 @item -mcmodel=large
29400 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29401 in size. Other data and code is only limited by the 64-bit address
29402 space.
29403
29404 @opindex maltivec
29405 @opindex mno-altivec
29406 @item -maltivec
29407 @itemx -mno-altivec
29408 Generate code that uses (does not use) AltiVec instructions, and also
29409 enable the use of built-in functions that allow more direct access to
29410 the AltiVec instruction set. You may also need to set
29411 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29412 enhancements.
29413
29414 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29415 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
29416 match array element order corresponding to the endianness of the
29417 target. That is, element zero identifies the leftmost element in a
29418 vector register when targeting a big-endian platform, and identifies
29419 the rightmost element in a vector register when targeting a
29420 little-endian platform.
29421
29422 @opindex mvrsave
29423 @opindex mno-vrsave
29424 @item -mvrsave
29425 @itemx -mno-vrsave
29426 Generate VRSAVE instructions when generating AltiVec code.
29427
29428 @opindex msecure-plt
29429 @item -msecure-plt
29430 Generate code that allows @command{ld} and @command{ld.so}
29431 to build executables and shared
29432 libraries with non-executable @code{.plt} and @code{.got} sections.
29433 This is a PowerPC
29434 32-bit SYSV ABI option.
29435
29436 @opindex mbss-plt
29437 @item -mbss-plt
29438 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29439 fills in, and
29440 requires @code{.plt} and @code{.got}
29441 sections that are both writable and executable.
29442 This is a PowerPC 32-bit SYSV ABI option.
29443
29444 @opindex misel
29445 @opindex mno-isel
29446 @item -misel
29447 @itemx -mno-isel
29448 This switch enables or disables the generation of ISEL instructions.
29449
29450 @opindex mvsx
29451 @opindex mno-vsx
29452 @item -mvsx
29453 @itemx -mno-vsx
29454 Generate code that uses (does not use) vector/scalar (VSX)
29455 instructions, and also enable the use of built-in functions that allow
29456 more direct access to the VSX instruction set.
29457
29458 @opindex mcrypto
29459 @opindex mno-crypto
29460 @item -mcrypto
29461 @itemx -mno-crypto
29462 Enable the use (disable) of the built-in functions that allow direct
29463 access to the cryptographic instructions that were added in version
29464 2.07 of the PowerPC ISA.
29465
29466 @opindex mhtm
29467 @opindex mno-htm
29468 @item -mhtm
29469 @itemx -mno-htm
29470 Enable (disable) the use of the built-in functions that allow direct
29471 access to the Hardware Transactional Memory (HTM) instructions that
29472 were added in version 2.07 of the PowerPC ISA.
29473
29474 @opindex mpower8-fusion
29475 @opindex mno-power8-fusion
29476 @item -mpower8-fusion
29477 @itemx -mno-power8-fusion
29478 Generate code that keeps (does not keeps) some integer operations
29479 adjacent so that the instructions can be fused together on power8 and
29480 later processors.
29481
29482 @opindex mpower8-vector
29483 @opindex mno-power8-vector
29484 @item -mpower8-vector
29485 @itemx -mno-power8-vector
29486 Generate code that uses (does not use) the vector and scalar
29487 instructions that were added in version 2.07 of the PowerPC ISA. Also
29488 enable the use of built-in functions that allow more direct access to
29489 the vector instructions.
29490
29491 @opindex mquad-memory
29492 @opindex mno-quad-memory
29493 @item -mquad-memory
29494 @itemx -mno-quad-memory
29495 Generate code that uses (does not use) the non-atomic quad word memory
29496 instructions. The @option{-mquad-memory} option requires use of
29497 64-bit mode.
29498
29499 @opindex mquad-memory-atomic
29500 @opindex mno-quad-memory-atomic
29501 @item -mquad-memory-atomic
29502 @itemx -mno-quad-memory-atomic
29503 Generate code that uses (does not use) the atomic quad word memory
29504 instructions. The @option{-mquad-memory-atomic} option requires use of
29505 64-bit mode.
29506
29507 @opindex mfloat128
29508 @opindex mno-float128
29509 @item -mfloat128
29510 @itemx -mno-float128
29511 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29512 and use either software emulation for IEEE 128-bit floating point or
29513 hardware instructions.
29514
29515 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29516 128-bit floating point support. The IEEE 128-bit floating point is only
29517 supported on Linux.
29518
29519 The default for @option{-mfloat128} is enabled on PowerPC Linux
29520 systems using the VSX instruction set, and disabled on other systems.
29521
29522 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29523 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29524 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29525 floating point instructions. Otherwise, if you do not specify to
29526 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29527 system, IEEE 128-bit floating point will be done with software
29528 emulation.
29529
29530 @opindex mfloat128-hardware
29531 @opindex mno-float128-hardware
29532 @item -mfloat128-hardware
29533 @itemx -mno-float128-hardware
29534 Enable/disable using ISA 3.0 hardware instructions to support the
29535 @var{__float128} data type.
29536
29537 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29538 Linux systems using the ISA 3.0 instruction set, and disabled on other
29539 systems.
29540
29541 @opindex m32
29542 @opindex m64
29543 @item -m32
29544 @itemx -m64
29545 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29546 targets (including GNU/Linux). The 32-bit environment sets int, long
29547 and pointer to 32 bits and generates code that runs on any PowerPC
29548 variant. The 64-bit environment sets int to 32 bits and long and
29549 pointer to 64 bits, and generates code for PowerPC64, as for
29550 @option{-mpowerpc64}.
29551
29552 @opindex mfull-toc
29553 @opindex mno-fp-in-toc
29554 @opindex mno-sum-in-toc
29555 @opindex mminimal-toc
29556 @item -mfull-toc
29557 @itemx -mno-fp-in-toc
29558 @itemx -mno-sum-in-toc
29559 @itemx -mminimal-toc
29560 Modify generation of the TOC (Table Of Contents), which is created for
29561 every executable file. The @option{-mfull-toc} option is selected by
29562 default. In that case, GCC allocates at least one TOC entry for
29563 each unique non-automatic variable reference in your program. GCC
29564 also places floating-point constants in the TOC@. However, only
29565 16,384 entries are available in the TOC@.
29566
29567 If you receive a linker error message that saying you have overflowed
29568 the available TOC space, you can reduce the amount of TOC space used
29569 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29570 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29571 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29572 generate code to calculate the sum of an address and a constant at
29573 run time instead of putting that sum into the TOC@. You may specify one
29574 or both of these options. Each causes GCC to produce very slightly
29575 slower and larger code at the expense of conserving TOC space.
29576
29577 If you still run out of space in the TOC even when you specify both of
29578 these options, specify @option{-mminimal-toc} instead. This option causes
29579 GCC to make only one TOC entry for every file. When you specify this
29580 option, GCC produces code that is slower and larger but which
29581 uses extremely little TOC space. You may wish to use this option
29582 only on files that contain less frequently-executed code.
29583
29584 @opindex maix64
29585 @opindex maix32
29586 @item -maix64
29587 @itemx -maix32
29588 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29589 @code{long} type, and the infrastructure needed to support them.
29590 Specifying @option{-maix64} implies @option{-mpowerpc64},
29591 while @option{-maix32} disables the 64-bit ABI and
29592 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
29593
29594 @opindex mxl-compat
29595 @opindex mno-xl-compat
29596 @item -mxl-compat
29597 @itemx -mno-xl-compat
29598 Produce code that conforms more closely to IBM XL compiler semantics
29599 when using AIX-compatible ABI@. Pass floating-point arguments to
29600 prototyped functions beyond the register save area (RSA) on the stack
29601 in addition to argument FPRs. Do not assume that most significant
29602 double in 128-bit long double value is properly rounded when comparing
29603 values and converting to double. Use XL symbol names for long double
29604 support routines.
29605
29606 The AIX calling convention was extended but not initially documented to
29607 handle an obscure K&R C case of calling a function that takes the
29608 address of its arguments with fewer arguments than declared. IBM XL
29609 compilers access floating-point arguments that do not fit in the
29610 RSA from the stack when a subroutine is compiled without
29611 optimization. Because always storing floating-point arguments on the
29612 stack is inefficient and rarely needed, this option is not enabled by
29613 default and only is necessary when calling subroutines compiled by IBM
29614 XL compilers without optimization.
29615
29616 @opindex mpe
29617 @item -mpe
29618 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
29619 application written to use message passing with special startup code to
29620 enable the application to run. The system must have PE installed in the
29621 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
29622 must be overridden with the @option{-specs=} option to specify the
29623 appropriate directory location. The Parallel Environment does not
29624 support threads, so the @option{-mpe} option and the @option{-pthread}
29625 option are incompatible.
29626
29627 @opindex malign-natural
29628 @opindex malign-power
29629 @item -malign-natural
29630 @itemx -malign-power
29631 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
29632 @option{-malign-natural} overrides the ABI-defined alignment of larger
29633 types, such as floating-point doubles, on their natural size-based boundary.
29634 The option @option{-malign-power} instructs GCC to follow the ABI-specified
29635 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
29636
29637 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
29638 is not supported.
29639
29640 @opindex msoft-float
29641 @opindex mhard-float
29642 @item -msoft-float
29643 @itemx -mhard-float
29644 Generate code that does not use (uses) the floating-point register set.
29645 Software floating-point emulation is provided if you use the
29646 @option{-msoft-float} option, and pass the option to GCC when linking.
29647
29648 @opindex mmultiple
29649 @opindex mno-multiple
29650 @item -mmultiple
29651 @itemx -mno-multiple
29652 Generate code that uses (does not use) the load multiple word
29653 instructions and the store multiple word instructions. These
29654 instructions are generated by default on POWER systems, and not
29655 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
29656 PowerPC systems, since those instructions do not work when the
29657 processor is in little-endian mode. The exceptions are PPC740 and
29658 PPC750 which permit these instructions in little-endian mode.
29659
29660 @opindex mupdate
29661 @opindex mno-update
29662 @item -mupdate
29663 @itemx -mno-update
29664 Generate code that uses (does not use) the load or store instructions
29665 that update the base register to the address of the calculated memory
29666 location. These instructions are generated by default. If you use
29667 @option{-mno-update}, there is a small window between the time that the
29668 stack pointer is updated and the address of the previous frame is
29669 stored, which means code that walks the stack frame across interrupts or
29670 signals may get corrupted data.
29671
29672 @opindex mavoid-indexed-addresses
29673 @opindex mno-avoid-indexed-addresses
29674 @item -mavoid-indexed-addresses
29675 @itemx -mno-avoid-indexed-addresses
29676 Generate code that tries to avoid (not avoid) the use of indexed load
29677 or store instructions. These instructions can incur a performance
29678 penalty on Power6 processors in certain situations, such as when
29679 stepping through large arrays that cross a 16M boundary. This option
29680 is enabled by default when targeting Power6 and disabled otherwise.
29681
29682 @opindex mfused-madd
29683 @opindex mno-fused-madd
29684 @item -mfused-madd
29685 @itemx -mno-fused-madd
29686 Generate code that uses (does not use) the floating-point multiply and
29687 accumulate instructions. These instructions are generated by default
29688 if hardware floating point is used. The machine-dependent
29689 @option{-mfused-madd} option is now mapped to the machine-independent
29690 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29691 mapped to @option{-ffp-contract=off}.
29692
29693 @opindex mmulhw
29694 @opindex mno-mulhw
29695 @item -mmulhw
29696 @itemx -mno-mulhw
29697 Generate code that uses (does not use) the half-word multiply and
29698 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
29699 These instructions are generated by default when targeting those
29700 processors.
29701
29702 @opindex mdlmzb
29703 @opindex mno-dlmzb
29704 @item -mdlmzb
29705 @itemx -mno-dlmzb
29706 Generate code that uses (does not use) the string-search @samp{dlmzb}
29707 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
29708 generated by default when targeting those processors.
29709
29710 @opindex mno-bit-align
29711 @opindex mbit-align
29712 @item -mno-bit-align
29713 @itemx -mbit-align
29714 On System V.4 and embedded PowerPC systems do not (do) force structures
29715 and unions that contain bit-fields to be aligned to the base type of the
29716 bit-field.
29717
29718 For example, by default a structure containing nothing but 8
29719 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
29720 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
29721 the structure is aligned to a 1-byte boundary and is 1 byte in
29722 size.
29723
29724 @opindex mno-strict-align
29725 @opindex mstrict-align
29726 @item -mno-strict-align
29727 @itemx -mstrict-align
29728 On System V.4 and embedded PowerPC systems do not (do) assume that
29729 unaligned memory references are handled by the system.
29730
29731 @opindex mrelocatable
29732 @opindex mno-relocatable
29733 @item -mrelocatable
29734 @itemx -mno-relocatable
29735 Generate code that allows (does not allow) a static executable to be
29736 relocated to a different address at run time. A simple embedded
29737 PowerPC system loader should relocate the entire contents of
29738 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
29739 a table of 32-bit addresses generated by this option. For this to
29740 work, all objects linked together must be compiled with
29741 @option{-mrelocatable} or @option{-mrelocatable-lib}.
29742 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
29743
29744 @opindex mrelocatable-lib
29745 @opindex mno-relocatable-lib
29746 @item -mrelocatable-lib
29747 @itemx -mno-relocatable-lib
29748 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
29749 @code{.fixup} section to allow static executables to be relocated at
29750 run time, but @option{-mrelocatable-lib} does not use the smaller stack
29751 alignment of @option{-mrelocatable}. Objects compiled with
29752 @option{-mrelocatable-lib} may be linked with objects compiled with
29753 any combination of the @option{-mrelocatable} options.
29754
29755 @opindex mno-toc
29756 @opindex mtoc
29757 @item -mno-toc
29758 @itemx -mtoc
29759 On System V.4 and embedded PowerPC systems do not (do) assume that
29760 register 2 contains a pointer to a global area pointing to the addresses
29761 used in the program.
29762
29763 @opindex mlittle
29764 @opindex mlittle-endian
29765 @item -mlittle
29766 @itemx -mlittle-endian
29767 On System V.4 and embedded PowerPC systems compile code for the
29768 processor in little-endian mode. The @option{-mlittle-endian} option is
29769 the same as @option{-mlittle}.
29770
29771 @opindex mbig
29772 @opindex mbig-endian
29773 @item -mbig
29774 @itemx -mbig-endian
29775 On System V.4 and embedded PowerPC systems compile code for the
29776 processor in big-endian mode. The @option{-mbig-endian} option is
29777 the same as @option{-mbig}.
29778
29779 @opindex mdynamic-no-pic
29780 @item -mdynamic-no-pic
29781 On Darwin and Mac OS X systems, compile code so that it is not
29782 relocatable, but that its external references are relocatable. The
29783 resulting code is suitable for applications, but not shared
29784 libraries.
29785
29786 @opindex msingle-pic-base
29787 @item -msingle-pic-base
29788 Treat the register used for PIC addressing as read-only, rather than
29789 loading it in the prologue for each function. The runtime system is
29790 responsible for initializing this register with an appropriate value
29791 before execution begins.
29792
29793 @opindex mprioritize-restricted-insns
29794 @item -mprioritize-restricted-insns=@var{priority}
29795 This option controls the priority that is assigned to
29796 dispatch-slot restricted instructions during the second scheduling
29797 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
29798 or @samp{2} to assign no, highest, or second-highest (respectively)
29799 priority to dispatch-slot restricted
29800 instructions.
29801
29802 @opindex msched-costly-dep
29803 @item -msched-costly-dep=@var{dependence_type}
29804 This option controls which dependences are considered costly
29805 by the target during instruction scheduling. The argument
29806 @var{dependence_type} takes one of the following values:
29807
29808 @table @asis
29809 @item @samp{no}
29810 No dependence is costly.
29811
29812 @item @samp{all}
29813 All dependences are costly.
29814
29815 @item @samp{true_store_to_load}
29816 A true dependence from store to load is costly.
29817
29818 @item @samp{store_to_load}
29819 Any dependence from store to load is costly.
29820
29821 @item @var{number}
29822 Any dependence for which the latency is greater than or equal to
29823 @var{number} is costly.
29824 @end table
29825
29826 @opindex minsert-sched-nops
29827 @item -minsert-sched-nops=@var{scheme}
29828 This option controls which NOP insertion scheme is used during
29829 the second scheduling pass. The argument @var{scheme} takes one of the
29830 following values:
29831
29832 @table @asis
29833 @item @samp{no}
29834 Don't insert NOPs.
29835
29836 @item @samp{pad}
29837 Pad with NOPs any dispatch group that has vacant issue slots,
29838 according to the scheduler's grouping.
29839
29840 @item @samp{regroup_exact}
29841 Insert NOPs to force costly dependent insns into
29842 separate groups. Insert exactly as many NOPs as needed to force an insn
29843 to a new group, according to the estimated processor grouping.
29844
29845 @item @var{number}
29846 Insert NOPs to force costly dependent insns into
29847 separate groups. Insert @var{number} NOPs to force an insn to a new group.
29848 @end table
29849
29850 @opindex mcall-sysv
29851 @item -mcall-sysv
29852 On System V.4 and embedded PowerPC systems compile code using calling
29853 conventions that adhere to the March 1995 draft of the System V
29854 Application Binary Interface, PowerPC processor supplement. This is the
29855 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
29856
29857 @opindex mcall-sysv-eabi
29858 @opindex mcall-eabi
29859 @item -mcall-sysv-eabi
29860 @itemx -mcall-eabi
29861 Specify both @option{-mcall-sysv} and @option{-meabi} options.
29862
29863 @opindex mcall-sysv-noeabi
29864 @item -mcall-sysv-noeabi
29865 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
29866
29867 @opindex mcall-aixdesc
29868 @item -mcall-aixdesc
29869 On System V.4 and embedded PowerPC systems compile code for the AIX
29870 operating system.
29871
29872 @opindex mcall-linux
29873 @item -mcall-linux
29874 On System V.4 and embedded PowerPC systems compile code for the
29875 Linux-based GNU system.
29876
29877 @opindex mcall-freebsd
29878 @item -mcall-freebsd
29879 On System V.4 and embedded PowerPC systems compile code for the
29880 FreeBSD operating system.
29881
29882 @opindex mcall-netbsd
29883 @item -mcall-netbsd
29884 On System V.4 and embedded PowerPC systems compile code for the
29885 NetBSD operating system.
29886
29887 @opindex mcall-openbsd
29888 @item -mcall-openbsd
29889 On System V.4 and embedded PowerPC systems compile code for the
29890 OpenBSD operating system.
29891
29892 @opindex mtraceback
29893 @item -mtraceback=@var{traceback_type}
29894 Select the type of traceback table. Valid values for @var{traceback_type}
29895 are @samp{full}, @samp{part}, and @samp{no}.
29896
29897 @opindex maix-struct-return
29898 @item -maix-struct-return
29899 Return all structures in memory (as specified by the AIX ABI)@.
29900
29901 @opindex msvr4-struct-return
29902 @item -msvr4-struct-return
29903 Return structures smaller than 8 bytes in registers (as specified by the
29904 SVR4 ABI)@.
29905
29906 @opindex mabi
29907 @item -mabi=@var{abi-type}
29908 Extend the current ABI with a particular extension, or remove such extension.
29909 Valid values are: @samp{altivec}, @samp{no-altivec},
29910 @samp{ibmlongdouble}, @samp{ieeelongdouble},
29911 @samp{elfv1}, @samp{elfv2},
29912 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
29913
29914 @opindex mabi=ibmlongdouble
29915 @item -mabi=ibmlongdouble
29916 Change the current ABI to use IBM extended-precision long double.
29917 This is not likely to work if your system defaults to using IEEE
29918 extended-precision long double. If you change the long double type
29919 from IEEE extended-precision, the compiler will issue a warning unless
29920 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
29921 to be enabled.
29922
29923 @opindex mabi=ieeelongdouble
29924 @item -mabi=ieeelongdouble
29925 Change the current ABI to use IEEE extended-precision long double.
29926 This is not likely to work if your system defaults to using IBM
29927 extended-precision long double. If you change the long double type
29928 from IBM extended-precision, the compiler will issue a warning unless
29929 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
29930 to be enabled.
29931
29932 @opindex mabi=elfv1
29933 @item -mabi=elfv1
29934 Change the current ABI to use the ELFv1 ABI.
29935 This is the default ABI for big-endian PowerPC 64-bit Linux.
29936 Overriding the default ABI requires special system support and is
29937 likely to fail in spectacular ways.
29938
29939 @opindex mabi=elfv2
29940 @item -mabi=elfv2
29941 Change the current ABI to use the ELFv2 ABI.
29942 This is the default ABI for little-endian PowerPC 64-bit Linux.
29943 Overriding the default ABI requires special system support and is
29944 likely to fail in spectacular ways.
29945
29946 @opindex mgnu-attribute
29947 @opindex mno-gnu-attribute
29948 @item -mgnu-attribute
29949 @itemx -mno-gnu-attribute
29950 Emit .gnu_attribute assembly directives to set tag/value pairs in a
29951 .gnu.attributes section that specify ABI variations in function
29952 parameters or return values.
29953
29954 @opindex mprototype
29955 @opindex mno-prototype
29956 @item -mprototype
29957 @itemx -mno-prototype
29958 On System V.4 and embedded PowerPC systems assume that all calls to
29959 variable argument functions are properly prototyped. Otherwise, the
29960 compiler must insert an instruction before every non-prototyped call to
29961 set or clear bit 6 of the condition code register (@code{CR}) to
29962 indicate whether floating-point values are passed in the floating-point
29963 registers in case the function takes variable arguments. With
29964 @option{-mprototype}, only calls to prototyped variable argument functions
29965 set or clear the bit.
29966
29967 @opindex msim
29968 @item -msim
29969 On embedded PowerPC systems, assume that the startup module is called
29970 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
29971 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
29972 configurations.
29973
29974 @opindex mmvme
29975 @item -mmvme
29976 On embedded PowerPC systems, assume that the startup module is called
29977 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
29978 @file{libc.a}.
29979
29980 @opindex mads
29981 @item -mads
29982 On embedded PowerPC systems, assume that the startup module is called
29983 @file{crt0.o} and the standard C libraries are @file{libads.a} and
29984 @file{libc.a}.
29985
29986 @opindex myellowknife
29987 @item -myellowknife
29988 On embedded PowerPC systems, assume that the startup module is called
29989 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
29990 @file{libc.a}.
29991
29992 @opindex mvxworks
29993 @item -mvxworks
29994 On System V.4 and embedded PowerPC systems, specify that you are
29995 compiling for a VxWorks system.
29996
29997 @opindex memb
29998 @item -memb
29999 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
30000 header to indicate that @samp{eabi} extended relocations are used.
30001
30002 @opindex meabi
30003 @opindex mno-eabi
30004 @item -meabi
30005 @itemx -mno-eabi
30006 On System V.4 and embedded PowerPC systems do (do not) adhere to the
30007 Embedded Applications Binary Interface (EABI), which is a set of
30008 modifications to the System V.4 specifications. Selecting @option{-meabi}
30009 means that the stack is aligned to an 8-byte boundary, a function
30010 @code{__eabi} is called from @code{main} to set up the EABI
30011 environment, and the @option{-msdata} option can use both @code{r2} and
30012 @code{r13} to point to two separate small data areas. Selecting
30013 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
30014 no EABI initialization function is called from @code{main}, and the
30015 @option{-msdata} option only uses @code{r13} to point to a single
30016 small data area. The @option{-meabi} option is on by default if you
30017 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
30018
30019 @opindex msdata=eabi
30020 @item -msdata=eabi
30021 On System V.4 and embedded PowerPC systems, put small initialized
30022 @code{const} global and static data in the @code{.sdata2} section, which
30023 is pointed to by register @code{r2}. Put small initialized
30024 non-@code{const} global and static data in the @code{.sdata} section,
30025 which is pointed to by register @code{r13}. Put small uninitialized
30026 global and static data in the @code{.sbss} section, which is adjacent to
30027 the @code{.sdata} section. The @option{-msdata=eabi} option is
30028 incompatible with the @option{-mrelocatable} option. The
30029 @option{-msdata=eabi} option also sets the @option{-memb} option.
30030
30031 @opindex msdata=sysv
30032 @item -msdata=sysv
30033 On System V.4 and embedded PowerPC systems, put small global and static
30034 data in the @code{.sdata} section, which is pointed to by register
30035 @code{r13}. Put small uninitialized global and static data in the
30036 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
30037 The @option{-msdata=sysv} option is incompatible with the
30038 @option{-mrelocatable} option.
30039
30040 @opindex msdata=default
30041 @opindex msdata
30042 @item -msdata=default
30043 @itemx -msdata
30044 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
30045 compile code the same as @option{-msdata=eabi}, otherwise compile code the
30046 same as @option{-msdata=sysv}.
30047
30048 @opindex msdata=data
30049 @item -msdata=data
30050 On System V.4 and embedded PowerPC systems, put small global
30051 data in the @code{.sdata} section. Put small uninitialized global
30052 data in the @code{.sbss} section. Do not use register @code{r13}
30053 to address small data however. This is the default behavior unless
30054 other @option{-msdata} options are used.
30055
30056 @opindex msdata=none
30057 @opindex mno-sdata
30058 @item -msdata=none
30059 @itemx -mno-sdata
30060 On embedded PowerPC systems, put all initialized global and static data
30061 in the @code{.data} section, and all uninitialized data in the
30062 @code{.bss} section.
30063
30064 @opindex mreadonly-in-sdata
30065 @opindex mno-readonly-in-sdata
30066 @item -mreadonly-in-sdata
30067 Put read-only objects in the @code{.sdata} section as well. This is the
30068 default.
30069
30070 @opindex mblock-move-inline-limit
30071 @item -mblock-move-inline-limit=@var{num}
30072 Inline all block moves (such as calls to @code{memcpy} or structure
30073 copies) less than or equal to @var{num} bytes. The minimum value for
30074 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
30075 targets. The default value is target-specific.
30076
30077 @opindex mblock-compare-inline-limit
30078 @item -mblock-compare-inline-limit=@var{num}
30079 Generate non-looping inline code for all block compares (such as calls
30080 to @code{memcmp} or structure compares) less than or equal to @var{num}
30081 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
30082 block compare is disabled. The default value is target-specific.
30083
30084 @opindex mblock-compare-inline-loop-limit
30085 @item -mblock-compare-inline-loop-limit=@var{num}
30086 Generate an inline expansion using loop code for all block compares that
30087 are less than or equal to @var{num} bytes, but greater than the limit
30088 for non-loop inline block compare expansion. If the block length is not
30089 constant, at most @var{num} bytes will be compared before @code{memcmp}
30090 is called to compare the remainder of the block. The default value is
30091 target-specific.
30092
30093 @opindex mstring-compare-inline-limit
30094 @item -mstring-compare-inline-limit=@var{num}
30095 Compare at most @var{num} string bytes with inline code.
30096 If the difference or end of string is not found at the
30097 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
30098 take care of the rest of the comparison. The default is 64 bytes.
30099
30100 @opindex G
30101 @cindex smaller data references (PowerPC)
30102 @cindex .sdata/.sdata2 references (PowerPC)
30103 @item -G @var{num}
30104 On embedded PowerPC systems, put global and static items less than or
30105 equal to @var{num} bytes into the small data or BSS sections instead of
30106 the normal data or BSS section. By default, @var{num} is 8. The
30107 @option{-G @var{num}} switch is also passed to the linker.
30108 All modules should be compiled with the same @option{-G @var{num}} value.
30109
30110 @opindex mregnames
30111 @opindex mno-regnames
30112 @item -mregnames
30113 @itemx -mno-regnames
30114 On System V.4 and embedded PowerPC systems do (do not) emit register
30115 names in the assembly language output using symbolic forms.
30116
30117 @opindex mlongcall
30118 @opindex mno-longcall
30119 @item -mlongcall
30120 @itemx -mno-longcall
30121 By default assume that all calls are far away so that a longer and more
30122 expensive calling sequence is required. This is required for calls
30123 farther than 32 megabytes (33,554,432 bytes) from the current location.
30124 A short call is generated if the compiler knows
30125 the call cannot be that far away. This setting can be overridden by
30126 the @code{shortcall} function attribute, or by @code{#pragma
30127 longcall(0)}.
30128
30129 Some linkers are capable of detecting out-of-range calls and generating
30130 glue code on the fly. On these systems, long calls are unnecessary and
30131 generate slower code. As of this writing, the AIX linker can do this,
30132 as can the GNU linker for PowerPC/64. It is planned to add this feature
30133 to the GNU linker for 32-bit PowerPC systems as well.
30134
30135 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
30136 GCC can generate long calls using an inline PLT call sequence (see
30137 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
30138 ELFv1 (big-endian) do not support inline PLT calls.
30139
30140 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
30141 callee, L42}, plus a @dfn{branch island} (glue code). The two target
30142 addresses represent the callee and the branch island. The
30143 Darwin/PPC linker prefers the first address and generates a @code{bl
30144 callee} if the PPC @code{bl} instruction reaches the callee directly;
30145 otherwise, the linker generates @code{bl L42} to call the branch
30146 island. The branch island is appended to the body of the
30147 calling function; it computes the full 32-bit address of the callee
30148 and jumps to it.
30149
30150 On Mach-O (Darwin) systems, this option directs the compiler emit to
30151 the glue for every direct call, and the Darwin linker decides whether
30152 to use or discard it.
30153
30154 In the future, GCC may ignore all longcall specifications
30155 when the linker is known to generate glue.
30156
30157 @opindex mpltseq
30158 @opindex mno-pltseq
30159 @item -mpltseq
30160 @itemx -mno-pltseq
30161 Implement (do not implement) -fno-plt and long calls using an inline
30162 PLT call sequence that supports lazy linking and long calls to
30163 functions in dlopen'd shared libraries. Inline PLT calls are only
30164 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
30165 linkers, and are enabled by default if the support is detected when
30166 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
30167 configured with @option{--enable-secureplt}. @option{-mpltseq} code
30168 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
30169 linked together.
30170
30171 @opindex mtls-markers
30172 @opindex mno-tls-markers
30173 @item -mtls-markers
30174 @itemx -mno-tls-markers
30175 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
30176 specifying the function argument. The relocation allows the linker to
30177 reliably associate function call with argument setup instructions for
30178 TLS optimization, which in turn allows GCC to better schedule the
30179 sequence.
30180
30181 @opindex mrecip
30182 @item -mrecip
30183 @itemx -mno-recip
30184 This option enables use of the reciprocal estimate and
30185 reciprocal square root estimate instructions with additional
30186 Newton-Raphson steps to increase precision instead of doing a divide or
30187 square root and divide for floating-point arguments. You should use
30188 the @option{-ffast-math} option when using @option{-mrecip} (or at
30189 least @option{-funsafe-math-optimizations},
30190 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30191 @option{-fno-trapping-math}). Note that while the throughput of the
30192 sequence is generally higher than the throughput of the non-reciprocal
30193 instruction, the precision of the sequence can be decreased by up to 2
30194 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30195 roots.
30196
30197 @opindex mrecip=opt
30198 @item -mrecip=@var{opt}
30199 This option controls which reciprocal estimate instructions
30200 may be used. @var{opt} is a comma-separated list of options, which may
30201 be preceded by a @code{!} to invert the option:
30202
30203 @table @samp
30204
30205 @item all
30206 Enable all estimate instructions.
30207
30208 @item default
30209 Enable the default instructions, equivalent to @option{-mrecip}.
30210
30211 @item none
30212 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30213
30214 @item div
30215 Enable the reciprocal approximation instructions for both
30216 single and double precision.
30217
30218 @item divf
30219 Enable the single-precision reciprocal approximation instructions.
30220
30221 @item divd
30222 Enable the double-precision reciprocal approximation instructions.
30223
30224 @item rsqrt
30225 Enable the reciprocal square root approximation instructions for both
30226 single and double precision.
30227
30228 @item rsqrtf
30229 Enable the single-precision reciprocal square root approximation instructions.
30230
30231 @item rsqrtd
30232 Enable the double-precision reciprocal square root approximation instructions.
30233
30234 @end table
30235
30236 So, for example, @option{-mrecip=all,!rsqrtd} enables
30237 all of the reciprocal estimate instructions, except for the
30238 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30239 which handle the double-precision reciprocal square root calculations.
30240
30241 @opindex mrecip-precision
30242 @item -mrecip-precision
30243 @itemx -mno-recip-precision
30244 Assume (do not assume) that the reciprocal estimate instructions
30245 provide higher-precision estimates than is mandated by the PowerPC
30246 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30247 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30248 The double-precision square root estimate instructions are not generated by
30249 default on low-precision machines, since they do not provide an
30250 estimate that converges after three steps.
30251
30252 @opindex mveclibabi
30253 @item -mveclibabi=@var{type}
30254 Specifies the ABI type to use for vectorizing intrinsics using an
30255 external library. The only type supported at present is @samp{mass},
30256 which specifies to use IBM's Mathematical Acceleration Subsystem
30257 (MASS) libraries for vectorizing intrinsics using external libraries.
30258 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30259 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30260 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30261 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30262 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30263 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30264 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30265 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30266 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30267 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30268 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30269 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30270 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30271 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30272 for power7. Both @option{-ftree-vectorize} and
30273 @option{-funsafe-math-optimizations} must also be enabled. The MASS
30274 libraries must be specified at link time.
30275
30276 @opindex mfriz
30277 @item -mfriz
30278 @itemx -mno-friz
30279 Generate (do not generate) the @code{friz} instruction when the
30280 @option{-funsafe-math-optimizations} option is used to optimize
30281 rounding of floating-point values to 64-bit integer and back to floating
30282 point. The @code{friz} instruction does not return the same value if
30283 the floating-point number is too large to fit in an integer.
30284
30285 @opindex mpointers-to-nested-functions
30286 @item -mpointers-to-nested-functions
30287 @itemx -mno-pointers-to-nested-functions
30288 Generate (do not generate) code to load up the static chain register
30289 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30290 systems where a function pointer points to a 3-word descriptor giving
30291 the function address, TOC value to be loaded in register @code{r2}, and
30292 static chain value to be loaded in register @code{r11}. The
30293 @option{-mpointers-to-nested-functions} is on by default. You cannot
30294 call through pointers to nested functions or pointers
30295 to functions compiled in other languages that use the static chain if
30296 you use @option{-mno-pointers-to-nested-functions}.
30297
30298 @opindex msave-toc-indirect
30299 @item -msave-toc-indirect
30300 @itemx -mno-save-toc-indirect
30301 Generate (do not generate) code to save the TOC value in the reserved
30302 stack location in the function prologue if the function calls through
30303 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
30304 saved in the prologue, it is saved just before the call through the
30305 pointer. The @option{-mno-save-toc-indirect} option is the default.
30306
30307 @opindex mcompat-align-parm
30308 @item -mcompat-align-parm
30309 @itemx -mno-compat-align-parm
30310 Generate (do not generate) code to pass structure parameters with a
30311 maximum alignment of 64 bits, for compatibility with older versions
30312 of GCC.
30313
30314 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30315 structure parameter on a 128-bit boundary when that structure contained
30316 a member requiring 128-bit alignment. This is corrected in more
30317 recent versions of GCC. This option may be used to generate code
30318 that is compatible with functions compiled with older versions of
30319 GCC.
30320
30321 The @option{-mno-compat-align-parm} option is the default.
30322
30323 @opindex mstack-protector-guard
30324 @opindex mstack-protector-guard-reg
30325 @opindex mstack-protector-guard-offset
30326 @opindex mstack-protector-guard-symbol
30327 @item -mstack-protector-guard=@var{guard}
30328 @itemx -mstack-protector-guard-reg=@var{reg}
30329 @itemx -mstack-protector-guard-offset=@var{offset}
30330 @itemx -mstack-protector-guard-symbol=@var{symbol}
30331 Generate stack protection code using canary at @var{guard}. Supported
30332 locations are @samp{global} for global canary or @samp{tls} for per-thread
30333 canary in the TLS block (the default with GNU libc version 2.4 or later).
30334
30335 With the latter choice the options
30336 @option{-mstack-protector-guard-reg=@var{reg}} and
30337 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30338 which register to use as base register for reading the canary, and from what
30339 offset from that base register. The default for those is as specified in the
30340 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30341 the offset with a symbol reference to a canary in the TLS block.
30342
30343 @opindex mpcrel
30344 @opindex mno-pcrel
30345 @item -mpcrel
30346 @itemx -mno-pcrel
30347 Generate (do not generate) pc-relative addressing. The @option{-mpcrel}
30348 option requires that the medium code model (@option{-mcmodel=medium})
30349 and prefixed addressing (@option{-mprefixed}) options are enabled.
30350
30351 @opindex mprefixed
30352 @opindex mno-prefixed
30353 @item -mprefixed
30354 @itemx -mno-prefixed
30355 Generate (do not generate) addressing modes using prefixed load and
30356 store instructions. The @option{-mprefixed} option requires that
30357 the option @option{-mcpu=power10} (or later) is enabled.
30358
30359 @opindex mmma
30360 @opindex mno-mma
30361 @item -mmma
30362 @itemx -mno-mma
30363 Generate (do not generate) the MMA instructions. The @option{-mma}
30364 option requires that the option @option{-mcpu=power10} (or later)
30365 is enabled.
30366
30367 @opindex mrop-protect
30368 @opindex mno-rop-protect
30369 @item -mrop-protect
30370 @itemx -mno-rop-protect
30371 Generate (do not generate) ROP protection instructions when the target
30372 processor supports them. Currently this option disables the shrink-wrap
30373 optimization (@option{-fshrink-wrap}).
30374
30375 @opindex mprivileged
30376 @opindex mno-privileged
30377 @item -mprivileged
30378 @itemx -mno-privileged
30379 Generate (do not generate) code that will run in privileged state.
30380
30381 @opindex block-ops-unaligned-vsx
30382 @opindex no-block-ops-unaligned-vsx
30383 @item -mblock-ops-unaligned-vsx
30384 @itemx -mno-block-ops-unaligned-vsx
30385 Generate (do not generate) unaligned vsx loads and stores for
30386 inline expansion of @code{memcpy} and @code{memmove}.
30387
30388 @item --param rs6000-vect-unroll-limit=
30389 The vectorizer will check with target information to determine whether it
30390 would be beneficial to unroll the main vectorized loop and by how much. This
30391 parameter sets the upper bound of how much the vectorizer will unroll the main
30392 loop. The default value is four.
30393
30394 @end table
30395
30396 @node RX Options
30397 @subsection RX Options
30398 @cindex RX Options
30399
30400 These command-line options are defined for RX targets:
30401
30402 @table @gcctabopt
30403 @opindex m64bit-doubles
30404 @opindex m32bit-doubles
30405 @item -m64bit-doubles
30406 @itemx -m32bit-doubles
30407 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30408 or 32 bits (@option{-m32bit-doubles}) in size. The default is
30409 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
30410 works on 32-bit values, which is why the default is
30411 @option{-m32bit-doubles}.
30412
30413 @opindex fpu
30414 @opindex nofpu
30415 @item -fpu
30416 @itemx -nofpu
30417 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30418 floating-point hardware. The default is enabled for the RX600
30419 series and disabled for the RX200 series.
30420
30421 Floating-point instructions are only generated for 32-bit floating-point
30422 values, however, so the FPU hardware is not used for doubles if the
30423 @option{-m64bit-doubles} option is used.
30424
30425 @emph{Note} If the @option{-fpu} option is enabled then
30426 @option{-funsafe-math-optimizations} is also enabled automatically.
30427 This is because the RX FPU instructions are themselves unsafe.
30428
30429 @opindex mcpu
30430 @item -mcpu=@var{name}
30431 Selects the type of RX CPU to be targeted. Currently three types are
30432 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30433 the specific @samp{RX610} CPU. The default is @samp{RX600}.
30434
30435 The only difference between @samp{RX600} and @samp{RX610} is that the
30436 @samp{RX610} does not support the @code{MVTIPL} instruction.
30437
30438 The @samp{RX200} series does not have a hardware floating-point unit
30439 and so @option{-nofpu} is enabled by default when this type is
30440 selected.
30441
30442 @opindex mbig-endian-data
30443 @opindex mlittle-endian-data
30444 @item -mbig-endian-data
30445 @itemx -mlittle-endian-data
30446 Store data (but not code) in the big-endian format. The default is
30447 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30448 format.
30449
30450 @opindex msmall-data-limit
30451 @item -msmall-data-limit=@var{N}
30452 Specifies the maximum size in bytes of global and static variables
30453 which can be placed into the small data area. Using the small data
30454 area can lead to smaller and faster code, but the size of area is
30455 limited and it is up to the programmer to ensure that the area does
30456 not overflow. Also when the small data area is used one of the RX's
30457 registers (usually @code{r13}) is reserved for use pointing to this
30458 area, so it is no longer available for use by the compiler. This
30459 could result in slower and/or larger code if variables are pushed onto
30460 the stack instead of being held in this register.
30461
30462 Note, common variables (variables that have not been initialized) and
30463 constants are not placed into the small data area as they are assigned
30464 to other sections in the output executable.
30465
30466 The default value is zero, which disables this feature. Note, this
30467 feature is not enabled by default with higher optimization levels
30468 (@option{-O2} etc) because of the potentially detrimental effects of
30469 reserving a register. It is up to the programmer to experiment and
30470 discover whether this feature is of benefit to their program. See the
30471 description of the @option{-mpid} option for a description of how the
30472 actual register to hold the small data area pointer is chosen.
30473
30474 @opindex msim
30475 @opindex mno-sim
30476 @item -msim
30477 @itemx -mno-sim
30478 Use the simulator runtime. The default is to use the libgloss
30479 board-specific runtime.
30480
30481 @opindex mas100-syntax
30482 @opindex mno-as100-syntax
30483 @item -mas100-syntax
30484 @itemx -mno-as100-syntax
30485 When generating assembler output use a syntax that is compatible with
30486 Renesas's AS100 assembler. This syntax can also be handled by the GAS
30487 assembler, but it has some restrictions so it is not generated by default.
30488
30489 @opindex mmax-constant-size
30490 @item -mmax-constant-size=@var{N}
30491 Specifies the maximum size, in bytes, of a constant that can be used as
30492 an operand in a RX instruction. Although the RX instruction set does
30493 allow constants of up to 4 bytes in length to be used in instructions,
30494 a longer value equates to a longer instruction. Thus in some
30495 circumstances it can be beneficial to restrict the size of constants
30496 that are used in instructions. Constants that are too big are instead
30497 placed into a constant pool and referenced via register indirection.
30498
30499 The value @var{N} can be between 0 and 4. A value of 0 (the default)
30500 or 4 means that constants of any size are allowed.
30501
30502 @opindex mrelax
30503 @item -mrelax
30504 Enable linker relaxation. Linker relaxation is a process whereby the
30505 linker attempts to reduce the size of a program by finding shorter
30506 versions of various instructions. Disabled by default.
30507
30508 @opindex mint-register
30509 @item -mint-register=@var{N}
30510 Specify the number of registers to reserve for fast interrupt handler
30511 functions. The value @var{N} can be between 0 and 4. A value of 1
30512 means that register @code{r13} is reserved for the exclusive use
30513 of fast interrupt handlers. A value of 2 reserves @code{r13} and
30514 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
30515 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30516 A value of 0, the default, does not reserve any registers.
30517
30518 @opindex msave-acc-in-interrupts
30519 @item -msave-acc-in-interrupts
30520 Specifies that interrupt handler functions should preserve the
30521 accumulator register. This is only necessary if normal code might use
30522 the accumulator register, for example because it performs 64-bit
30523 multiplications. The default is to ignore the accumulator as this
30524 makes the interrupt handlers faster.
30525
30526 @opindex mpid
30527 @opindex mno-pid
30528 @item -mpid
30529 @itemx -mno-pid
30530 Enables the generation of position independent data. When enabled any
30531 access to constant data is done via an offset from a base address
30532 held in a register. This allows the location of constant data to be
30533 determined at run time without requiring the executable to be
30534 relocated, which is a benefit to embedded applications with tight
30535 memory constraints. Data that can be modified is not affected by this
30536 option.
30537
30538 Note, using this feature reserves a register, usually @code{r13}, for
30539 the constant data base address. This can result in slower and/or
30540 larger code, especially in complicated functions.
30541
30542 The actual register chosen to hold the constant data base address
30543 depends upon whether the @option{-msmall-data-limit} and/or the
30544 @option{-mint-register} command-line options are enabled. Starting
30545 with register @code{r13} and proceeding downwards, registers are
30546 allocated first to satisfy the requirements of @option{-mint-register},
30547 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
30548 is possible for the small data area register to be @code{r8} if both
30549 @option{-mint-register=4} and @option{-mpid} are specified on the
30550 command line.
30551
30552 By default this feature is not enabled. The default can be restored
30553 via the @option{-mno-pid} command-line option.
30554
30555 @opindex mno-warn-multiple-fast-interrupts
30556 @opindex mwarn-multiple-fast-interrupts
30557 @item -mno-warn-multiple-fast-interrupts
30558 @itemx -mwarn-multiple-fast-interrupts
30559 Prevents GCC from issuing a warning message if it finds more than one
30560 fast interrupt handler when it is compiling a file. The default is to
30561 issue a warning for each extra fast interrupt handler found, as the RX
30562 only supports one such interrupt.
30563
30564 @opindex mallow-string-insns
30565 @opindex mno-allow-string-insns
30566 @item -mallow-string-insns
30567 @itemx -mno-allow-string-insns
30568 Enables or disables the use of the string manipulation instructions
30569 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30570 @code{SWHILE} and also the @code{RMPA} instruction. These
30571 instructions may prefetch data, which is not safe to do if accessing
30572 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
30573 for more information).
30574
30575 The default is to allow these instructions, but it is not possible for
30576 GCC to reliably detect all circumstances where a string instruction
30577 might be used to access an I/O register, so their use cannot be
30578 disabled automatically. Instead it is reliant upon the programmer to
30579 use the @option{-mno-allow-string-insns} option if their program
30580 accesses I/O space.
30581
30582 When the instructions are enabled GCC defines the C preprocessor
30583 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30584 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30585
30586 @opindex mjsr
30587 @opindex mno-jsr
30588 @item -mjsr
30589 @itemx -mno-jsr
30590 Use only (or not only) @code{JSR} instructions to access functions.
30591 This option can be used when code size exceeds the range of @code{BSR}
30592 instructions. Note that @option{-mno-jsr} does not mean to not use
30593 @code{JSR} but instead means that any type of branch may be used.
30594 @end table
30595
30596 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30597 has special significance to the RX port when used with the
30598 @code{interrupt} function attribute. This attribute indicates a
30599 function intended to process fast interrupts. GCC ensures
30600 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30601 and/or @code{r13} and only provided that the normal use of the
30602 corresponding registers have been restricted via the
30603 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30604 options.
30605
30606 @node S/390 and zSeries Options
30607 @subsection S/390 and zSeries Options
30608 @cindex S/390 and zSeries Options
30609
30610 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30611
30612 @table @gcctabopt
30613 @opindex mhard-float
30614 @opindex msoft-float
30615 @item -mhard-float
30616 @itemx -msoft-float
30617 Use (do not use) the hardware floating-point instructions and registers
30618 for floating-point operations. When @option{-msoft-float} is specified,
30619 functions in @file{libgcc.a} are used to perform floating-point
30620 operations. When @option{-mhard-float} is specified, the compiler
30621 generates IEEE floating-point instructions. This is the default.
30622
30623 @opindex mhard-dfp
30624 @opindex mno-hard-dfp
30625 @item -mhard-dfp
30626 @itemx -mno-hard-dfp
30627 Use (do not use) the hardware decimal-floating-point instructions for
30628 decimal-floating-point operations. When @option{-mno-hard-dfp} is
30629 specified, functions in @file{libgcc.a} are used to perform
30630 decimal-floating-point operations. When @option{-mhard-dfp} is
30631 specified, the compiler generates decimal-floating-point hardware
30632 instructions. This is the default for @option{-march=z9-ec} or higher.
30633
30634 @opindex mlong-double-64
30635 @opindex mlong-double-128
30636 @item -mlong-double-64
30637 @itemx -mlong-double-128
30638 These switches control the size of @code{long double} type. A size
30639 of 64 bits makes the @code{long double} type equivalent to the @code{double}
30640 type. This is the default.
30641
30642 @opindex mbackchain
30643 @opindex mno-backchain
30644 @item -mbackchain
30645 @itemx -mno-backchain
30646 Store (do not store) the address of the caller's frame as backchain pointer
30647 into the callee's stack frame.
30648 A backchain may be needed to allow debugging using tools that do not understand
30649 DWARF call frame information.
30650 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
30651 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
30652 the backchain is placed into the topmost word of the 96/160 byte register
30653 save area.
30654
30655 In general, code compiled with @option{-mbackchain} is call-compatible with
30656 code compiled with @option{-mno-backchain}; however, use of the backchain
30657 for debugging purposes usually requires that the whole binary is built with
30658 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
30659 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
30660 to build a linux kernel use @option{-msoft-float}.
30661
30662 The default is to not maintain the backchain.
30663
30664 @opindex mpacked-stack
30665 @opindex mno-packed-stack
30666 @item -mpacked-stack
30667 @itemx -mno-packed-stack
30668 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
30669 specified, the compiler uses the all fields of the 96/160 byte register save
30670 area only for their default purpose; unused fields still take up stack space.
30671 When @option{-mpacked-stack} is specified, register save slots are densely
30672 packed at the top of the register save area; unused space is reused for other
30673 purposes, allowing for more efficient use of the available stack space.
30674 However, when @option{-mbackchain} is also in effect, the topmost word of
30675 the save area is always used to store the backchain, and the return address
30676 register is always saved two words below the backchain.
30677
30678 As long as the stack frame backchain is not used, code generated with
30679 @option{-mpacked-stack} is call-compatible with code generated with
30680 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
30681 S/390 or zSeries generated code that uses the stack frame backchain at run
30682 time, not just for debugging purposes. Such code is not call-compatible
30683 with code compiled with @option{-mpacked-stack}. Also, note that the
30684 combination of @option{-mbackchain},
30685 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
30686 to build a linux kernel use @option{-msoft-float}.
30687
30688 The default is to not use the packed stack layout.
30689
30690 @opindex msmall-exec
30691 @opindex mno-small-exec
30692 @item -msmall-exec
30693 @itemx -mno-small-exec
30694 Generate (or do not generate) code using the @code{bras} instruction
30695 to do subroutine calls.
30696 This only works reliably if the total executable size does not
30697 exceed 64k. The default is to use the @code{basr} instruction instead,
30698 which does not have this limitation.
30699
30700 @opindex m64
30701 @opindex m31
30702 @item -m64
30703 @itemx -m31
30704 When @option{-m31} is specified, generate code compliant to the
30705 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
30706 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
30707 particular to generate 64-bit instructions. For the @samp{s390}
30708 targets, the default is @option{-m31}, while the @samp{s390x}
30709 targets default to @option{-m64}.
30710
30711 @opindex mzarch
30712 @opindex mesa
30713 @item -mzarch
30714 @itemx -mesa
30715 When @option{-mzarch} is specified, generate code using the
30716 instructions available on z/Architecture.
30717 When @option{-mesa} is specified, generate code using the
30718 instructions available on ESA/390. Note that @option{-mesa} is
30719 not possible with @option{-m64}.
30720 When generating code compliant to the GNU/Linux for S/390 ABI,
30721 the default is @option{-mesa}. When generating code compliant
30722 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
30723
30724 @opindex mhtm
30725 @opindex mno-htm
30726 @item -mhtm
30727 @itemx -mno-htm
30728 The @option{-mhtm} option enables a set of builtins making use of
30729 instructions available with the transactional execution facility
30730 introduced with the IBM zEnterprise EC12 machine generation
30731 @ref{S/390 System z Built-in Functions}.
30732 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
30733
30734 @opindex mvx
30735 @opindex mno-vx
30736 @item -mvx
30737 @itemx -mno-vx
30738 When @option{-mvx} is specified, generate code using the instructions
30739 available with the vector extension facility introduced with the IBM
30740 z13 machine generation.
30741 This option changes the ABI for some vector type values with regard to
30742 alignment and calling conventions. In case vector type values are
30743 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
30744 command will be added to mark the resulting binary with the ABI used.
30745 @option{-mvx} is enabled by default when using @option{-march=z13}.
30746
30747 @opindex mzvector
30748 @opindex mno-zvector
30749 @item -mzvector
30750 @itemx -mno-zvector
30751 The @option{-mzvector} option enables vector language extensions and
30752 builtins using instructions available with the vector extension
30753 facility introduced with the IBM z13 machine generation.
30754 This option adds support for @samp{vector} to be used as a keyword to
30755 define vector type variables and arguments. @samp{vector} is only
30756 available when GNU extensions are enabled. It will not be expanded
30757 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
30758 In addition to the GCC low-level builtins @option{-mzvector} enables
30759 a set of builtins added for compatibility with AltiVec-style
30760 implementations like Power and Cell. In order to make use of these
30761 builtins the header file @file{vecintrin.h} needs to be included.
30762 @option{-mzvector} is disabled by default.
30763
30764 @opindex mmvcle
30765 @opindex mno-mvcle
30766 @item -mmvcle
30767 @itemx -mno-mvcle
30768 Generate (or do not generate) code using the @code{mvcle} instruction
30769 to perform block moves. When @option{-mno-mvcle} is specified,
30770 use a @code{mvc} loop instead. This is the default unless optimizing for
30771 size.
30772
30773 @opindex mdebug
30774 @opindex mno-debug
30775 @item -mdebug
30776 @itemx -mno-debug
30777 Print (or do not print) additional debug information when compiling.
30778 The default is to not print debug information.
30779
30780 @opindex march
30781 @item -march=@var{cpu-type}
30782 Generate code that runs on @var{cpu-type}, which is the name of a
30783 system representing a certain processor type. Possible values for
30784 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
30785 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
30786 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
30787 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
30788 @samp{z16}/@samp{arch14}, and @samp{native}.
30789
30790 The default is @option{-march=z900}.
30791
30792 Specifying @samp{native} as cpu type can be used to select the best
30793 architecture option for the host processor.
30794 @option{-march=native} has no effect if GCC does not recognize the
30795 processor.
30796
30797 @opindex mtune
30798 @item -mtune=@var{cpu-type}
30799 Tune to @var{cpu-type} everything applicable about the generated code,
30800 except for the ABI and the set of available instructions.
30801 The list of @var{cpu-type} values is the same as for @option{-march}.
30802 The default is the value used for @option{-march}.
30803
30804 @opindex mtpf-trace
30805 @opindex mno-tpf-trace
30806 @item -mtpf-trace
30807 @itemx -mno-tpf-trace
30808 Generate code that adds (does not add) in TPF OS specific branches to trace
30809 routines in the operating system. This option is off by default, even
30810 when compiling for the TPF OS@.
30811
30812 @opindex mtpf-trace-skip
30813 @opindex mno-tpf-trace-skip
30814 @item -mtpf-trace-skip
30815 @itemx -mno-tpf-trace-skip
30816 Generate code that changes (does not change) the default branch
30817 targets enabled by @option{-mtpf-trace} to point to specialized trace
30818 routines providing the ability of selectively skipping function trace
30819 entries for the TPF OS. This option is off by default, even when
30820 compiling for the TPF OS and specifying @option{-mtpf-trace}.
30821
30822 @opindex mfused-madd
30823 @opindex mno-fused-madd
30824 @item -mfused-madd
30825 @itemx -mno-fused-madd
30826 Generate code that uses (does not use) the floating-point multiply and
30827 accumulate instructions. These instructions are generated by default if
30828 hardware floating point is used.
30829
30830 @opindex mwarn-framesize
30831 @item -mwarn-framesize=@var{framesize}
30832 Emit a warning if the current function exceeds the given frame size. Because
30833 this is a compile-time check it doesn't need to be a real problem when the program
30834 runs. It is intended to identify functions that most probably cause
30835 a stack overflow. It is useful to be used in an environment with limited stack
30836 size e.g.@: the linux kernel.
30837
30838 @opindex mwarn-dynamicstack
30839 @item -mwarn-dynamicstack
30840 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
30841 arrays. This is generally a bad idea with a limited stack size.
30842
30843 @opindex mstack-guard
30844 @opindex mstack-size
30845 @item -mstack-guard=@var{stack-guard}
30846 @itemx -mstack-size=@var{stack-size}
30847 If these options are provided the S/390 back end emits additional instructions in
30848 the function prologue that trigger a trap if the stack size is @var{stack-guard}
30849 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
30850 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
30851 the frame size of the compiled function is chosen.
30852 These options are intended to be used to help debugging stack overflow problems.
30853 The additionally emitted code causes only little overhead and hence can also be
30854 used in production-like systems without greater performance degradation. The given
30855 values have to be exact powers of 2 and @var{stack-size} has to be greater than
30856 @var{stack-guard} without exceeding 64k.
30857 In order to be efficient the extra code makes the assumption that the stack starts
30858 at an address aligned to the value given by @var{stack-size}.
30859 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
30860
30861 @opindex mhotpatch
30862 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
30863 If the hotpatch option is enabled, a ``hot-patching'' function
30864 prologue is generated for all functions in the compilation unit.
30865 The funtion label is prepended with the given number of two-byte
30866 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
30867 the label, 2 * @var{post-halfwords} bytes are appended, using the
30868 largest NOP like instructions the architecture allows (maximum
30869 1000000).
30870
30871 If both arguments are zero, hotpatching is disabled.
30872
30873 This option can be overridden for individual functions with the
30874 @code{hotpatch} attribute.
30875 @end table
30876
30877 @node SH Options
30878 @subsection SH Options
30879
30880 These @samp{-m} options are defined for the SH implementations:
30881
30882 @table @gcctabopt
30883 @opindex m1
30884 @item -m1
30885 Generate code for the SH1.
30886
30887 @opindex m2
30888 @item -m2
30889 Generate code for the SH2.
30890
30891 @item -m2e
30892 Generate code for the SH2e.
30893
30894 @opindex m2a-nofpu
30895 @item -m2a-nofpu
30896 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
30897 that the floating-point unit is not used.
30898
30899 @opindex m2a-single-only
30900 @item -m2a-single-only
30901 Generate code for the SH2a-FPU, in such a way that no double-precision
30902 floating-point operations are used.
30903
30904 @opindex m2a-single
30905 @item -m2a-single
30906 Generate code for the SH2a-FPU assuming the floating-point unit is in
30907 single-precision mode by default.
30908
30909 @opindex m2a
30910 @item -m2a
30911 Generate code for the SH2a-FPU assuming the floating-point unit is in
30912 double-precision mode by default.
30913
30914 @opindex m3
30915 @item -m3
30916 Generate code for the SH3.
30917
30918 @opindex m3e
30919 @item -m3e
30920 Generate code for the SH3e.
30921
30922 @opindex m4-nofpu
30923 @item -m4-nofpu
30924 Generate code for the SH4 without a floating-point unit.
30925
30926 @opindex m4-single-only
30927 @item -m4-single-only
30928 Generate code for the SH4 with a floating-point unit that only
30929 supports single-precision arithmetic.
30930
30931 @opindex m4-single
30932 @item -m4-single
30933 Generate code for the SH4 assuming the floating-point unit is in
30934 single-precision mode by default.
30935
30936 @opindex m4
30937 @item -m4
30938 Generate code for the SH4.
30939
30940 @opindex m4-100
30941 @item -m4-100
30942 Generate code for SH4-100.
30943
30944 @opindex m4-100-nofpu
30945 @item -m4-100-nofpu
30946 Generate code for SH4-100 in such a way that the
30947 floating-point unit is not used.
30948
30949 @opindex m4-100-single
30950 @item -m4-100-single
30951 Generate code for SH4-100 assuming the floating-point unit is in
30952 single-precision mode by default.
30953
30954 @opindex m4-100-single-only
30955 @item -m4-100-single-only
30956 Generate code for SH4-100 in such a way that no double-precision
30957 floating-point operations are used.
30958
30959 @opindex m4-200
30960 @item -m4-200
30961 Generate code for SH4-200.
30962
30963 @opindex m4-200-nofpu
30964 @item -m4-200-nofpu
30965 Generate code for SH4-200 without in such a way that the
30966 floating-point unit is not used.
30967
30968 @opindex m4-200-single
30969 @item -m4-200-single
30970 Generate code for SH4-200 assuming the floating-point unit is in
30971 single-precision mode by default.
30972
30973 @opindex m4-200-single-only
30974 @item -m4-200-single-only
30975 Generate code for SH4-200 in such a way that no double-precision
30976 floating-point operations are used.
30977
30978 @opindex m4-300
30979 @item -m4-300
30980 Generate code for SH4-300.
30981
30982 @opindex m4-300-nofpu
30983 @item -m4-300-nofpu
30984 Generate code for SH4-300 without in such a way that the
30985 floating-point unit is not used.
30986
30987 @opindex m4-300-single
30988 @item -m4-300-single
30989 Generate code for SH4-300 in such a way that no double-precision
30990 floating-point operations are used.
30991
30992 @opindex m4-300-single-only
30993 @item -m4-300-single-only
30994 Generate code for SH4-300 in such a way that no double-precision
30995 floating-point operations are used.
30996
30997 @opindex m4-340
30998 @item -m4-340
30999 Generate code for SH4-340 (no MMU, no FPU).
31000
31001 @opindex m4-500
31002 @item -m4-500
31003 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
31004 assembler.
31005
31006 @opindex m4a-nofpu
31007 @item -m4a-nofpu
31008 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
31009 floating-point unit is not used.
31010
31011 @opindex m4a-single-only
31012 @item -m4a-single-only
31013 Generate code for the SH4a, in such a way that no double-precision
31014 floating-point operations are used.
31015
31016 @opindex m4a-single
31017 @item -m4a-single
31018 Generate code for the SH4a assuming the floating-point unit is in
31019 single-precision mode by default.
31020
31021 @opindex m4a
31022 @item -m4a
31023 Generate code for the SH4a.
31024
31025 @opindex m4al
31026 @item -m4al
31027 Same as @option{-m4a-nofpu}, except that it implicitly passes
31028 @option{-dsp} to the assembler. GCC doesn't generate any DSP
31029 instructions at the moment.
31030
31031 @opindex mb
31032 @item -mb
31033 Compile code for the processor in big-endian mode.
31034
31035 @opindex ml
31036 @item -ml
31037 Compile code for the processor in little-endian mode.
31038
31039 @opindex mdalign
31040 @item -mdalign
31041 Align doubles at 64-bit boundaries. Note that this changes the calling
31042 conventions, and thus some functions from the standard C library do
31043 not work unless you recompile it first with @option{-mdalign}.
31044
31045 @opindex mrelax
31046 @item -mrelax
31047 Shorten some address references at link time, when possible; uses the
31048 linker option @option{-relax}.
31049
31050 @opindex mbigtable
31051 @item -mbigtable
31052 Use 32-bit offsets in @code{switch} tables. The default is to use
31053 16-bit offsets.
31054
31055 @opindex mbitops
31056 @item -mbitops
31057 Enable the use of bit manipulation instructions on SH2A.
31058
31059 @opindex mfmovd
31060 @item -mfmovd
31061 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
31062 alignment constraints.
31063
31064 @opindex mrenesas
31065 @item -mrenesas
31066 Comply with the calling conventions defined by Renesas.
31067
31068 @opindex mno-renesas
31069 @item -mno-renesas
31070 Comply with the calling conventions defined for GCC before the Renesas
31071 conventions were available. This option is the default for all
31072 targets of the SH toolchain.
31073
31074 @opindex mnomacsave
31075 @item -mnomacsave
31076 Mark the @code{MAC} register as call-clobbered, even if
31077 @option{-mrenesas} is given.
31078
31079 @opindex mieee
31080 @opindex mno-ieee
31081 @item -mieee
31082 @itemx -mno-ieee
31083 Control the IEEE compliance of floating-point comparisons, which affects the
31084 handling of cases where the result of a comparison is unordered. By default
31085 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
31086 enabled @option{-mno-ieee} is implicitly set, which results in faster
31087 floating-point greater-equal and less-equal comparisons. The implicit settings
31088 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
31089
31090 @opindex minline-ic_invalidate
31091 @item -minline-ic_invalidate
31092 Inline code to invalidate instruction cache entries after setting up
31093 nested function trampolines.
31094 This option has no effect if @option{-musermode} is in effect and the selected
31095 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
31096 instruction.
31097 If the selected code generation option does not allow the use of the @code{icbi}
31098 instruction, and @option{-musermode} is not in effect, the inlined code
31099 manipulates the instruction cache address array directly with an associative
31100 write. This not only requires privileged mode at run time, but it also
31101 fails if the cache line had been mapped via the TLB and has become unmapped.
31102
31103 @opindex misize
31104 @item -misize
31105 Dump instruction size and location in the assembly code.
31106
31107 @opindex mpadstruct
31108 @item -mpadstruct
31109 This option is deprecated. It pads structures to multiple of 4 bytes,
31110 which is incompatible with the SH ABI@.
31111
31112 @opindex matomic-model=@var{model}
31113 @item -matomic-model=@var{model}
31114 Sets the model of atomic operations and additional parameters as a comma
31115 separated list. For details on the atomic built-in functions see
31116 @ref{__atomic Builtins}. The following models and parameters are supported:
31117
31118 @table @samp
31119
31120 @item none
31121 Disable compiler generated atomic sequences and emit library calls for atomic
31122 operations. This is the default if the target is not @code{sh*-*-linux*}.
31123
31124 @item soft-gusa
31125 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
31126 built-in functions. The generated atomic sequences require additional support
31127 from the interrupt/exception handling code of the system and are only suitable
31128 for SH3* and SH4* single-core systems. This option is enabled by default when
31129 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
31130 this option also partially utilizes the hardware atomic instructions
31131 @code{movli.l} and @code{movco.l} to create more efficient code, unless
31132 @samp{strict} is specified.
31133
31134 @item soft-tcb
31135 Generate software atomic sequences that use a variable in the thread control
31136 block. This is a variation of the gUSA sequences which can also be used on
31137 SH1* and SH2* targets. The generated atomic sequences require additional
31138 support from the interrupt/exception handling code of the system and are only
31139 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
31140 parameter has to be specified as well.
31141
31142 @item soft-imask
31143 Generate software atomic sequences that temporarily disable interrupts by
31144 setting @code{SR.IMASK = 1111}. This model works only when the program runs
31145 in privileged mode and is only suitable for single-core systems. Additional
31146 support from the interrupt/exception handling code of the system is not
31147 required. This model is enabled by default when the target is
31148 @code{sh*-*-linux*} and SH1* or SH2*.
31149
31150 @item hard-llcs
31151 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
31152 instructions only. This is only available on SH4A and is suitable for
31153 multi-core systems. Since the hardware instructions support only 32 bit atomic
31154 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
31155 Code compiled with this option is also compatible with other software
31156 atomic model interrupt/exception handling systems if executed on an SH4A
31157 system. Additional support from the interrupt/exception handling code of the
31158 system is not required for this model.
31159
31160 @item gbr-offset=
31161 This parameter specifies the offset in bytes of the variable in the thread
31162 control block structure that should be used by the generated atomic sequences
31163 when the @samp{soft-tcb} model has been selected. For other models this
31164 parameter is ignored. The specified value must be an integer multiple of four
31165 and in the range 0-1020.
31166
31167 @item strict
31168 This parameter prevents mixed usage of multiple atomic models, even if they
31169 are compatible, and makes the compiler generate atomic sequences of the
31170 specified model only.
31171
31172 @end table
31173
31174 @opindex mtas
31175 @item -mtas
31176 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
31177 Notice that depending on the particular hardware and software configuration
31178 this can degrade overall performance due to the operand cache line flushes
31179 that are implied by the @code{tas.b} instruction. On multi-core SH4A
31180 processors the @code{tas.b} instruction must be used with caution since it
31181 can result in data corruption for certain cache configurations.
31182
31183 @opindex mprefergot
31184 @item -mprefergot
31185 When generating position-independent code, emit function calls using
31186 the Global Offset Table instead of the Procedure Linkage Table.
31187
31188 @opindex musermode
31189 @opindex mno-usermode
31190 @item -musermode
31191 @itemx -mno-usermode
31192 Don't allow (allow) the compiler generating privileged mode code. Specifying
31193 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31194 inlined code would not work in user mode. @option{-musermode} is the default
31195 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
31196 @option{-musermode} has no effect, since there is no user mode.
31197
31198 @opindex multcost=@var{number}
31199 @item -multcost=@var{number}
31200 Set the cost to assume for a multiply insn.
31201
31202 @opindex mdiv=@var{strategy}
31203 @item -mdiv=@var{strategy}
31204 Set the division strategy to be used for integer division operations.
31205 @var{strategy} can be one of:
31206
31207 @table @samp
31208
31209 @item call-div1
31210 Calls a library function that uses the single-step division instruction
31211 @code{div1} to perform the operation. Division by zero calculates an
31212 unspecified result and does not trap. This is the default except for SH4,
31213 SH2A and SHcompact.
31214
31215 @item call-fp
31216 Calls a library function that performs the operation in double precision
31217 floating point. Division by zero causes a floating-point exception. This is
31218 the default for SHcompact with FPU. Specifying this for targets that do not
31219 have a double precision FPU defaults to @code{call-div1}.
31220
31221 @item call-table
31222 Calls a library function that uses a lookup table for small divisors and
31223 the @code{div1} instruction with case distinction for larger divisors. Division
31224 by zero calculates an unspecified result and does not trap. This is the default
31225 for SH4. Specifying this for targets that do not have dynamic shift
31226 instructions defaults to @code{call-div1}.
31227
31228 @end table
31229
31230 When a division strategy has not been specified the default strategy is
31231 selected based on the current target. For SH2A the default strategy is to
31232 use the @code{divs} and @code{divu} instructions instead of library function
31233 calls.
31234
31235 @opindex maccumulate-outgoing-args
31236 @item -maccumulate-outgoing-args
31237 Reserve space once for outgoing arguments in the function prologue rather
31238 than around each call. Generally beneficial for performance and size. Also
31239 needed for unwinding to avoid changing the stack frame around conditional code.
31240
31241 @opindex mdivsi3_libfunc=@var{name}
31242 @item -mdivsi3_libfunc=@var{name}
31243 Set the name of the library function used for 32-bit signed division to
31244 @var{name}.
31245 This only affects the name used in the @samp{call} division strategies, and
31246 the compiler still expects the same sets of input/output/clobbered registers as
31247 if this option were not present.
31248
31249 @opindex mfixed-range
31250 @item -mfixed-range=@var{register-range}
31251 Generate code treating the given register range as fixed registers.
31252 A fixed register is one that the register allocator cannot use. This is
31253 useful when compiling kernel code. A register range is specified as
31254 two registers separated by a dash. Multiple register ranges can be
31255 specified separated by a comma.
31256
31257 @opindex mbranch-cost=@var{num}
31258 @item -mbranch-cost=@var{num}
31259 Assume @var{num} to be the cost for a branch instruction. Higher numbers
31260 make the compiler try to generate more branch-free code if possible.
31261 If not specified the value is selected depending on the processor type that
31262 is being compiled for.
31263
31264 @opindex mzdcbranch
31265 @opindex mno-zdcbranch
31266 @item -mzdcbranch
31267 @itemx -mno-zdcbranch
31268 Assume (do not assume) that zero displacement conditional branch instructions
31269 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
31270 compiler prefers zero displacement branch code sequences. This is
31271 enabled by default when generating code for SH4 and SH4A. It can be explicitly
31272 disabled by specifying @option{-mno-zdcbranch}.
31273
31274 @opindex mcbranch-force-delay-slot
31275 @item -mcbranch-force-delay-slot
31276 Force the usage of delay slots for conditional branches, which stuffs the delay
31277 slot with a @code{nop} if a suitable instruction cannot be found. By default
31278 this option is disabled. It can be enabled to work around hardware bugs as
31279 found in the original SH7055.
31280
31281 @opindex mfused-madd
31282 @opindex mno-fused-madd
31283 @item -mfused-madd
31284 @itemx -mno-fused-madd
31285 Generate code that uses (does not use) the floating-point multiply and
31286 accumulate instructions. These instructions are generated by default
31287 if hardware floating point is used. The machine-dependent
31288 @option{-mfused-madd} option is now mapped to the machine-independent
31289 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31290 mapped to @option{-ffp-contract=off}.
31291
31292 @opindex mfsca
31293 @opindex mno-fsca
31294 @item -mfsca
31295 @itemx -mno-fsca
31296 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31297 and cosine approximations. The option @option{-mfsca} must be used in
31298 combination with @option{-funsafe-math-optimizations}. It is enabled by default
31299 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
31300 approximations even if @option{-funsafe-math-optimizations} is in effect.
31301
31302 @opindex mfsrra
31303 @opindex mno-fsrra
31304 @item -mfsrra
31305 @itemx -mno-fsrra
31306 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31307 reciprocal square root approximations. The option @option{-mfsrra} must be used
31308 in combination with @option{-funsafe-math-optimizations} and
31309 @option{-ffinite-math-only}. It is enabled by default when generating code for
31310 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
31311 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31312 in effect.
31313
31314 @opindex mpretend-cmove
31315 @item -mpretend-cmove
31316 Prefer zero-displacement conditional branches for conditional move instruction
31317 patterns. This can result in faster code on the SH4 processor.
31318
31319 @opindex fdpic
31320 @item -mfdpic
31321 Generate code using the FDPIC ABI.
31322
31323 @end table
31324
31325 @node Solaris 2 Options
31326 @subsection Solaris 2 Options
31327 @cindex Solaris 2 options
31328
31329 These @samp{-m} options are supported on Solaris 2:
31330
31331 @table @gcctabopt
31332 @opindex mclear-hwcap
31333 @item -mclear-hwcap
31334 @option{-mclear-hwcap} tells the compiler to remove the hardware
31335 capabilities generated by the Solaris assembler. This is only necessary
31336 when object files use ISA extensions not supported by the current
31337 machine, but check at runtime whether or not to use them.
31338
31339 @opindex mimpure-text
31340 @item -mimpure-text
31341 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31342 the compiler to not pass @option{-z text} to the linker when linking a
31343 shared object. Using this option, you can link position-dependent
31344 code into a shared object.
31345
31346 @option{-mimpure-text} suppresses the ``relocations remain against
31347 allocatable but non-writable sections'' linker error message.
31348 However, the necessary relocations trigger copy-on-write, and the
31349 shared object is not actually shared across processes. Instead of
31350 using @option{-mimpure-text}, you should compile all source code with
31351 @option{-fpic} or @option{-fPIC}.
31352
31353 @end table
31354
31355 These switches are supported in addition to the above on Solaris 2:
31356
31357 @table @gcctabopt
31358 @opindex pthreads
31359 @item -pthreads
31360 This is a synonym for @option{-pthread}.
31361 @end table
31362
31363 @node SPARC Options
31364 @subsection SPARC Options
31365 @cindex SPARC options
31366
31367 These @samp{-m} options are supported on the SPARC:
31368
31369 @table @gcctabopt
31370 @opindex mno-app-regs
31371 @opindex mapp-regs
31372 @item -mno-app-regs
31373 @itemx -mapp-regs
31374 Specify @option{-mapp-regs} to generate output using the global registers
31375 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
31376 global register 1, each global register 2 through 4 is then treated as an
31377 allocable register that is clobbered by function calls. This is the default.
31378
31379 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31380 specify @option{-mno-app-regs}. You should compile libraries and system
31381 software with this option.
31382
31383 @opindex mflat
31384 @opindex mno-flat
31385 @item -mflat
31386 @itemx -mno-flat
31387 With @option{-mflat}, the compiler does not generate save/restore instructions
31388 and uses a ``flat'' or single register window model. This model is compatible
31389 with the regular register window model. The local registers and the input
31390 registers (0--5) are still treated as ``call-saved'' registers and are
31391 saved on the stack as needed.
31392
31393 With @option{-mno-flat} (the default), the compiler generates save/restore
31394 instructions (except for leaf functions). This is the normal operating mode.
31395
31396 @opindex mfpu
31397 @opindex mhard-float
31398 @item -mfpu
31399 @itemx -mhard-float
31400 Generate output containing floating-point instructions. This is the
31401 default.
31402
31403 @opindex mno-fpu
31404 @opindex msoft-float
31405 @item -mno-fpu
31406 @itemx -msoft-float
31407 Generate output containing library calls for floating point.
31408 @strong{Warning:} the requisite libraries are not available for all SPARC
31409 targets. Normally the facilities of the machine's usual C compiler are
31410 used, but this cannot be done directly in cross-compilation. You must make
31411 your own arrangements to provide suitable library functions for
31412 cross-compilation. The embedded targets @samp{sparc-*-aout} and
31413 @samp{sparclite-*-*} do provide software floating-point support.
31414
31415 @option{-msoft-float} changes the calling convention in the output file;
31416 therefore, it is only useful if you compile @emph{all} of a program with
31417 this option. In particular, you need to compile @file{libgcc.a}, the
31418 library that comes with GCC, with @option{-msoft-float} in order for
31419 this to work.
31420
31421 @opindex mhard-quad-float
31422 @item -mhard-quad-float
31423 Generate output containing quad-word (long double) floating-point
31424 instructions.
31425
31426 @opindex msoft-quad-float
31427 @item -msoft-quad-float
31428 Generate output containing library calls for quad-word (long double)
31429 floating-point instructions. The functions called are those specified
31430 in the SPARC ABI@. This is the default.
31431
31432 As of this writing, there are no SPARC implementations that have hardware
31433 support for the quad-word floating-point instructions. They all invoke
31434 a trap handler for one of these instructions, and then the trap handler
31435 emulates the effect of the instruction. Because of the trap handler overhead,
31436 this is much slower than calling the ABI library routines. Thus the
31437 @option{-msoft-quad-float} option is the default.
31438
31439 @opindex mno-unaligned-doubles
31440 @opindex munaligned-doubles
31441 @item -mno-unaligned-doubles
31442 @itemx -munaligned-doubles
31443 Assume that doubles have 8-byte alignment. This is the default.
31444
31445 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31446 alignment only if they are contained in another type, or if they have an
31447 absolute address. Otherwise, it assumes they have 4-byte alignment.
31448 Specifying this option avoids some rare compatibility problems with code
31449 generated by other compilers. It is not the default because it results
31450 in a performance loss, especially for floating-point code.
31451
31452 @opindex muser-mode
31453 @opindex mno-user-mode
31454 @item -muser-mode
31455 @itemx -mno-user-mode
31456 Do not generate code that can only run in supervisor mode. This is relevant
31457 only for the @code{casa} instruction emitted for the LEON3 processor. This
31458 is the default.
31459
31460 @opindex mfaster-structs
31461 @opindex mno-faster-structs
31462 @item -mfaster-structs
31463 @itemx -mno-faster-structs
31464 With @option{-mfaster-structs}, the compiler assumes that structures
31465 should have 8-byte alignment. This enables the use of pairs of
31466 @code{ldd} and @code{std} instructions for copies in structure
31467 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31468 However, the use of this changed alignment directly violates the SPARC
31469 ABI@. Thus, it's intended only for use on targets where the developer
31470 acknowledges that their resulting code is not directly in line with
31471 the rules of the ABI@.
31472
31473 @opindex mstd-struct-return
31474 @opindex mno-std-struct-return
31475 @item -mstd-struct-return
31476 @itemx -mno-std-struct-return
31477 With @option{-mstd-struct-return}, the compiler generates checking code
31478 in functions returning structures or unions to detect size mismatches
31479 between the two sides of function calls, as per the 32-bit ABI@.
31480
31481 The default is @option{-mno-std-struct-return}. This option has no effect
31482 in 64-bit mode.
31483
31484 @opindex mlra
31485 @opindex mno-lra
31486 @item -mlra
31487 @itemx -mno-lra
31488 Enable Local Register Allocation. This is the default for SPARC since GCC 7
31489 so @option{-mno-lra} needs to be passed to get old Reload.
31490
31491 @opindex mcpu
31492 @item -mcpu=@var{cpu_type}
31493 Set the instruction set, register set, and instruction scheduling parameters
31494 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
31495 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31496 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31497 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31498 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31499 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31500 @samp{m8}.
31501
31502 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31503 which selects the best architecture option for the host processor.
31504 @option{-mcpu=native} has no effect if GCC does not recognize
31505 the processor.
31506
31507 Default instruction scheduling parameters are used for values that select
31508 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
31509 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31510
31511 Here is a list of each supported architecture and their supported
31512 implementations.
31513
31514 @table @asis
31515 @item v7
31516 cypress, leon3v7
31517
31518 @item v8
31519 supersparc, hypersparc, leon, leon3, leon5
31520
31521 @item sparclite
31522 f930, f934, sparclite86x
31523
31524 @item sparclet
31525 tsc701
31526
31527 @item v9
31528 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31529 niagara7, m8
31530 @end table
31531
31532 By default (unless configured otherwise), GCC generates code for the V7
31533 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
31534 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31535 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
31536 SPARCStation 1, 2, IPX etc.
31537
31538 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31539 architecture. The only difference from V7 code is that the compiler emits
31540 the integer multiply and integer divide instructions which exist in SPARC-V8
31541 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
31542 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31543 2000 series.
31544
31545 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31546 the SPARC architecture. This adds the integer multiply, integer divide step
31547 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31548 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31549 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
31550 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31551 MB86934 chip, which is the more recent SPARClite with FPU@.
31552
31553 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31554 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
31555 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31556 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
31557 optimizes it for the TEMIC SPARClet chip.
31558
31559 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31560 architecture. This adds 64-bit integer and floating-point move instructions,
31561 3 additional floating-point condition code registers and conditional move
31562 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
31563 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
31564 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31565 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
31566 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31567 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
31568 additionally optimizes it for Sun UltraSPARC T2 chips. With
31569 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31570 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
31571 additionally optimizes it for Sun UltraSPARC T4 chips. With
31572 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31573 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
31574 additionally optimizes it for Oracle M8 chips.
31575
31576 @opindex mtune
31577 @item -mtune=@var{cpu_type}
31578 Set the instruction scheduling parameters for machine type
31579 @var{cpu_type}, but do not set the instruction set or register set that the
31580 option @option{-mcpu=@var{cpu_type}} does.
31581
31582 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31583 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31584 that select a particular CPU implementation. Those are
31585 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31586 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31587 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31588 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31589 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
31590 and GNU/Linux toolchains, @samp{native} can also be used.
31591
31592 @opindex mv8plus
31593 @opindex mno-v8plus
31594 @item -mv8plus
31595 @itemx -mno-v8plus
31596 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
31597 difference from the V8 ABI is that the global and out registers are
31598 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
31599 mode for all SPARC-V9 processors.
31600
31601 @opindex mvis
31602 @opindex mno-vis
31603 @item -mvis
31604 @itemx -mno-vis
31605 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31606 Visual Instruction Set extensions. The default is @option{-mno-vis}.
31607
31608 @opindex mvis2
31609 @opindex mno-vis2
31610 @item -mvis2
31611 @itemx -mno-vis2
31612 With @option{-mvis2}, GCC generates code that takes advantage of
31613 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
31614 default is @option{-mvis2} when targeting a cpu that supports such
31615 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
31616 also sets @option{-mvis}.
31617
31618 @opindex mvis3
31619 @opindex mno-vis3
31620 @item -mvis3
31621 @itemx -mno-vis3
31622 With @option{-mvis3}, GCC generates code that takes advantage of
31623 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
31624 default is @option{-mvis3} when targeting a cpu that supports such
31625 instructions, such as niagara-3 and later. Setting @option{-mvis3}
31626 also sets @option{-mvis2} and @option{-mvis}.
31627
31628 @opindex mvis4
31629 @opindex mno-vis4
31630 @item -mvis4
31631 @itemx -mno-vis4
31632 With @option{-mvis4}, GCC generates code that takes advantage of
31633 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
31634 default is @option{-mvis4} when targeting a cpu that supports such
31635 instructions, such as niagara-7 and later. Setting @option{-mvis4}
31636 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
31637
31638 @opindex mvis4b
31639 @opindex mno-vis4b
31640 @item -mvis4b
31641 @itemx -mno-vis4b
31642 With @option{-mvis4b}, GCC generates code that takes advantage of
31643 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
31644 the additional VIS instructions introduced in the Oracle SPARC
31645 Architecture 2017. The default is @option{-mvis4b} when targeting a
31646 cpu that supports such instructions, such as m8 and later. Setting
31647 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
31648 @option{-mvis2} and @option{-mvis}.
31649
31650 @opindex mcbcond
31651 @opindex mno-cbcond
31652 @item -mcbcond
31653 @itemx -mno-cbcond
31654 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
31655 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
31656 when targeting a CPU that supports such instructions, such as Niagara-4 and
31657 later.
31658
31659 @opindex mfmaf
31660 @opindex mno-fmaf
31661 @item -mfmaf
31662 @itemx -mno-fmaf
31663 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
31664 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
31665 when targeting a CPU that supports such instructions, such as Niagara-3 and
31666 later.
31667
31668 @opindex mfsmuld
31669 @opindex mno-fsmuld
31670 @item -mfsmuld
31671 @itemx -mno-fsmuld
31672 With @option{-mfsmuld}, GCC generates code that takes advantage of the
31673 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
31674 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
31675 or V9 with FPU except @option{-mcpu=leon}.
31676
31677 @opindex mpopc
31678 @opindex mno-popc
31679 @item -mpopc
31680 @itemx -mno-popc
31681 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
31682 Population Count instruction. The default is @option{-mpopc}
31683 when targeting a CPU that supports such an instruction, such as Niagara-2 and
31684 later.
31685
31686 @opindex msubxc
31687 @opindex mno-subxc
31688 @item -msubxc
31689 @itemx -mno-subxc
31690 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
31691 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
31692 when targeting a CPU that supports such an instruction, such as Niagara-7 and
31693 later.
31694
31695 @opindex mfix-at697f
31696 @item -mfix-at697f
31697 Enable the documented workaround for the single erratum of the Atmel AT697F
31698 processor (which corresponds to erratum #13 of the AT697E processor).
31699
31700 @opindex mfix-ut699
31701 @item -mfix-ut699
31702 Enable the documented workarounds for the floating-point errata and the data
31703 cache nullify errata of the UT699 processor.
31704
31705 @opindex mfix-ut700
31706 @item -mfix-ut700
31707 Enable the documented workaround for the back-to-back store errata of
31708 the UT699E/UT700 processor.
31709
31710 @opindex mfix-gr712rc
31711 @item -mfix-gr712rc
31712 Enable the documented workaround for the back-to-back store errata of
31713 the GR712RC processor.
31714 @end table
31715
31716 These @samp{-m} options are supported in addition to the above
31717 on SPARC-V9 processors in 64-bit environments:
31718
31719 @table @gcctabopt
31720 @opindex m32
31721 @opindex m64
31722 @item -m32
31723 @itemx -m64
31724 Generate code for a 32-bit or 64-bit environment.
31725 The 32-bit environment sets int, long and pointer to 32 bits.
31726 The 64-bit environment sets int to 32 bits and long and pointer
31727 to 64 bits.
31728
31729 @opindex mcmodel
31730 @item -mcmodel=@var{which}
31731 Set the code model to one of
31732
31733 @table @samp
31734 @item medlow
31735 The Medium/Low code model: 64-bit addresses, programs
31736 must be linked in the low 32 bits of memory. Programs can be statically
31737 or dynamically linked.
31738
31739 @item medmid
31740 The Medium/Middle code model: 64-bit addresses, programs
31741 must be linked in the low 44 bits of memory, the text and data segments must
31742 be less than 2GB in size and the data segment must be located within 2GB of
31743 the text segment.
31744
31745 @item medany
31746 The Medium/Anywhere code model: 64-bit addresses, programs
31747 may be linked anywhere in memory, the text and data segments must be less
31748 than 2GB in size and the data segment must be located within 2GB of the
31749 text segment.
31750
31751 @item embmedany
31752 The Medium/Anywhere code model for embedded systems:
31753 64-bit addresses, the text and data segments must be less than 2GB in
31754 size, both starting anywhere in memory (determined at link time). The
31755 global register %g4 points to the base of the data segment. Programs
31756 are statically linked and PIC is not supported.
31757 @end table
31758
31759 @opindex mmemory-model
31760 @item -mmemory-model=@var{mem-model}
31761 Set the memory model in force on the processor to one of
31762
31763 @table @samp
31764 @item default
31765 The default memory model for the processor and operating system.
31766
31767 @item rmo
31768 Relaxed Memory Order
31769
31770 @item pso
31771 Partial Store Order
31772
31773 @item tso
31774 Total Store Order
31775
31776 @item sc
31777 Sequential Consistency
31778 @end table
31779
31780 These memory models are formally defined in Appendix D of the SPARC-V9
31781 architecture manual, as set in the processor's @code{PSTATE.MM} field.
31782
31783 @opindex mstack-bias
31784 @opindex mno-stack-bias
31785 @item -mstack-bias
31786 @itemx -mno-stack-bias
31787 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
31788 frame pointer if present, are offset by @minus{}2047 which must be added back
31789 when making stack frame references. This is the default in 64-bit mode.
31790 Otherwise, assume no such offset is present.
31791 @end table
31792
31793 @node System V Options
31794 @subsection Options for System V
31795
31796 These additional options are available on System V Release 4 for
31797 compatibility with other compilers on those systems:
31798
31799 @table @gcctabopt
31800 @opindex G
31801 @item -G
31802 Create a shared object.
31803 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
31804
31805 @opindex Qy
31806 @item -Qy
31807 Identify the versions of each tool used by the compiler, in a
31808 @code{.ident} assembler directive in the output.
31809
31810 @opindex Qn
31811 @item -Qn
31812 Refrain from adding @code{.ident} directives to the output file (this is
31813 the default).
31814
31815 @opindex YP
31816 @item -YP,@var{dirs}
31817 Search the directories @var{dirs}, and no others, for libraries
31818 specified with @option{-l}.
31819
31820 @opindex Ym
31821 @item -Ym,@var{dir}
31822 Look in the directory @var{dir} to find the M4 preprocessor.
31823 The assembler uses this option.
31824 @c This is supposed to go with a -Yd for predefined M4 macro files, but
31825 @c the generic assembler that comes with Solaris takes just -Ym.
31826 @end table
31827
31828 @node V850 Options
31829 @subsection V850 Options
31830 @cindex V850 Options
31831
31832 These @samp{-m} options are defined for V850 implementations:
31833
31834 @table @gcctabopt
31835 @opindex mlong-calls
31836 @opindex mno-long-calls
31837 @item -mlong-calls
31838 @itemx -mno-long-calls
31839 Treat all calls as being far away (near). If calls are assumed to be
31840 far away, the compiler always loads the function's address into a
31841 register, and calls indirect through the pointer.
31842
31843 @opindex mno-ep
31844 @opindex mep
31845 @item -mno-ep
31846 @itemx -mep
31847 Do not optimize (do optimize) basic blocks that use the same index
31848 pointer 4 or more times to copy pointer into the @code{ep} register, and
31849 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
31850 option is on by default if you optimize.
31851
31852 @opindex mno-prolog-function
31853 @opindex mprolog-function
31854 @item -mno-prolog-function
31855 @itemx -mprolog-function
31856 Do not use (do use) external functions to save and restore registers
31857 at the prologue and epilogue of a function. The external functions
31858 are slower, but use less code space if more than one function saves
31859 the same number of registers. The @option{-mprolog-function} option
31860 is on by default if you optimize.
31861
31862 @opindex mspace
31863 @item -mspace
31864 Try to make the code as small as possible. At present, this just turns
31865 on the @option{-mep} and @option{-mprolog-function} options.
31866
31867 @opindex mtda
31868 @item -mtda=@var{n}
31869 Put static or global variables whose size is @var{n} bytes or less into
31870 the tiny data area that register @code{ep} points to. The tiny data
31871 area can hold up to 256 bytes in total (128 bytes for byte references).
31872
31873 @opindex msda
31874 @item -msda=@var{n}
31875 Put static or global variables whose size is @var{n} bytes or less into
31876 the small data area that register @code{gp} points to. The small data
31877 area can hold up to 64 kilobytes.
31878
31879 @opindex mzda
31880 @item -mzda=@var{n}
31881 Put static or global variables whose size is @var{n} bytes or less into
31882 the first 32 kilobytes of memory.
31883
31884 @opindex mv850
31885 @item -mv850
31886 Specify that the target processor is the V850.
31887
31888 @opindex mv850e3v5
31889 @item -mv850e3v5
31890 Specify that the target processor is the V850E3V5. The preprocessor
31891 constant @code{__v850e3v5__} is defined if this option is used.
31892
31893 @opindex mv850e2v4
31894 @item -mv850e2v4
31895 Specify that the target processor is the V850E3V5. This is an alias for
31896 the @option{-mv850e3v5} option.
31897
31898 @opindex mv850e2v3
31899 @item -mv850e2v3
31900 Specify that the target processor is the V850E2V3. The preprocessor
31901 constant @code{__v850e2v3__} is defined if this option is used.
31902
31903 @opindex mv850e2
31904 @item -mv850e2
31905 Specify that the target processor is the V850E2. The preprocessor
31906 constant @code{__v850e2__} is defined if this option is used.
31907
31908 @opindex mv850e1
31909 @item -mv850e1
31910 Specify that the target processor is the V850E1. The preprocessor
31911 constants @code{__v850e1__} and @code{__v850e__} are defined if
31912 this option is used.
31913
31914 @opindex mv850es
31915 @item -mv850es
31916 Specify that the target processor is the V850ES. This is an alias for
31917 the @option{-mv850e1} option.
31918
31919 @opindex mv850e
31920 @item -mv850e
31921 Specify that the target processor is the V850E@. The preprocessor
31922 constant @code{__v850e__} is defined if this option is used.
31923
31924 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
31925 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
31926 are defined then a default target processor is chosen and the
31927 relevant @samp{__v850*__} preprocessor constant is defined.
31928
31929 The preprocessor constants @code{__v850} and @code{__v851__} are always
31930 defined, regardless of which processor variant is the target.
31931
31932 @opindex mdisable-callt
31933 @opindex mno-disable-callt
31934 @item -mdisable-callt
31935 @itemx -mno-disable-callt
31936 This option suppresses generation of the @code{CALLT} instruction for the
31937 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
31938 architecture.
31939
31940 This option is enabled by default when the RH850 ABI is
31941 in use (see @option{-mrh850-abi}), and disabled by default when the
31942 GCC ABI is in use. If @code{CALLT} instructions are being generated
31943 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
31944
31945 @opindex mrelax
31946 @opindex mno-relax
31947 @item -mrelax
31948 @itemx -mno-relax
31949 Pass on (or do not pass on) the @option{-mrelax} command-line option
31950 to the assembler.
31951
31952 @opindex mlong-jumps
31953 @opindex mno-long-jumps
31954 @item -mlong-jumps
31955 @itemx -mno-long-jumps
31956 Disable (or re-enable) the generation of PC-relative jump instructions.
31957
31958 @opindex msoft-float
31959 @opindex mhard-float
31960 @item -msoft-float
31961 @itemx -mhard-float
31962 Disable (or re-enable) the generation of hardware floating point
31963 instructions. This option is only significant when the target
31964 architecture is @samp{V850E2V3} or higher. If hardware floating point
31965 instructions are being generated then the C preprocessor symbol
31966 @code{__FPU_OK__} is defined, otherwise the symbol
31967 @code{__NO_FPU__} is defined.
31968
31969 @opindex mloop
31970 @item -mloop
31971 Enables the use of the e3v5 LOOP instruction. The use of this
31972 instruction is not enabled by default when the e3v5 architecture is
31973 selected because its use is still experimental.
31974
31975 @opindex mrh850-abi
31976 @opindex mghs
31977 @item -mrh850-abi
31978 @itemx -mghs
31979 Enables support for the RH850 version of the V850 ABI. This is the
31980 default. With this version of the ABI the following rules apply:
31981
31982 @itemize
31983 @item
31984 Integer sized structures and unions are returned via a memory pointer
31985 rather than a register.
31986
31987 @item
31988 Large structures and unions (more than 8 bytes in size) are passed by
31989 value.
31990
31991 @item
31992 Functions are aligned to 16-bit boundaries.
31993
31994 @item
31995 The @option{-m8byte-align} command-line option is supported.
31996
31997 @item
31998 The @option{-mdisable-callt} command-line option is enabled by
31999 default. The @option{-mno-disable-callt} command-line option is not
32000 supported.
32001 @end itemize
32002
32003 When this version of the ABI is enabled the C preprocessor symbol
32004 @code{__V850_RH850_ABI__} is defined.
32005
32006 @opindex mgcc-abi
32007 @item -mgcc-abi
32008 Enables support for the old GCC version of the V850 ABI. With this
32009 version of the ABI the following rules apply:
32010
32011 @itemize
32012 @item
32013 Integer sized structures and unions are returned in register @code{r10}.
32014
32015 @item
32016 Large structures and unions (more than 8 bytes in size) are passed by
32017 reference.
32018
32019 @item
32020 Functions are aligned to 32-bit boundaries, unless optimizing for
32021 size.
32022
32023 @item
32024 The @option{-m8byte-align} command-line option is not supported.
32025
32026 @item
32027 The @option{-mdisable-callt} command-line option is supported but not
32028 enabled by default.
32029 @end itemize
32030
32031 When this version of the ABI is enabled the C preprocessor symbol
32032 @code{__V850_GCC_ABI__} is defined.
32033
32034 @opindex m8byte-align
32035 @opindex mno-8byte-align
32036 @item -m8byte-align
32037 @itemx -mno-8byte-align
32038 Enables support for @code{double} and @code{long long} types to be
32039 aligned on 8-byte boundaries. The default is to restrict the
32040 alignment of all objects to at most 4-bytes. When
32041 @option{-m8byte-align} is in effect the C preprocessor symbol
32042 @code{__V850_8BYTE_ALIGN__} is defined.
32043
32044 @opindex mbig-switch
32045 @item -mbig-switch
32046 Generate code suitable for big switch tables. Use this option only if
32047 the assembler/linker complain about out of range branches within a switch
32048 table.
32049
32050 @opindex mapp-regs
32051 @item -mapp-regs
32052 This option causes r2 and r5 to be used in the code generated by
32053 the compiler. This setting is the default.
32054
32055 @opindex mno-app-regs
32056 @item -mno-app-regs
32057 This option causes r2 and r5 to be treated as fixed registers.
32058
32059 @end table
32060
32061 @node VAX Options
32062 @subsection VAX Options
32063 @cindex VAX options
32064
32065 These @samp{-m} options are defined for the VAX:
32066
32067 @table @gcctabopt
32068 @opindex munix
32069 @item -munix
32070 Do not output certain jump instructions (@code{aobleq} and so on)
32071 that the Unix assembler for the VAX cannot handle across long
32072 ranges.
32073
32074 @opindex mgnu
32075 @item -mgnu
32076 Do output those jump instructions, on the assumption that the
32077 GNU assembler is being used.
32078
32079 @opindex mg
32080 @item -mg
32081 Output code for G-format floating-point numbers instead of D-format.
32082
32083 @opindex mlra
32084 @opindex mno-lra
32085 @item -mlra
32086 @itemx -mno-lra
32087 Enable Local Register Allocation. This is still experimental for the VAX,
32088 so by default the compiler uses standard reload.
32089 @end table
32090
32091 @node Visium Options
32092 @subsection Visium Options
32093 @cindex Visium options
32094
32095 @table @gcctabopt
32096
32097 @opindex mdebug
32098 @item -mdebug
32099 A program which performs file I/O and is destined to run on an MCM target
32100 should be linked with this option. It causes the libraries libc.a and
32101 libdebug.a to be linked. The program should be run on the target under
32102 the control of the GDB remote debugging stub.
32103
32104 @opindex msim
32105 @item -msim
32106 A program which performs file I/O and is destined to run on the simulator
32107 should be linked with option. This causes libraries libc.a and libsim.a to
32108 be linked.
32109
32110 @opindex mfpu
32111 @opindex mhard-float
32112 @item -mfpu
32113 @itemx -mhard-float
32114 Generate code containing floating-point instructions. This is the
32115 default.
32116
32117 @opindex mno-fpu
32118 @opindex msoft-float
32119 @item -mno-fpu
32120 @itemx -msoft-float
32121 Generate code containing library calls for floating-point.
32122
32123 @option{-msoft-float} changes the calling convention in the output file;
32124 therefore, it is only useful if you compile @emph{all} of a program with
32125 this option. In particular, you need to compile @file{libgcc.a}, the
32126 library that comes with GCC, with @option{-msoft-float} in order for
32127 this to work.
32128
32129 @opindex mcpu
32130 @item -mcpu=@var{cpu_type}
32131 Set the instruction set, register set, and instruction scheduling parameters
32132 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
32133 @samp{mcm}, @samp{gr5} and @samp{gr6}.
32134
32135 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
32136
32137 By default (unless configured otherwise), GCC generates code for the GR5
32138 variant of the Visium architecture.
32139
32140 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
32141 architecture. The only difference from GR5 code is that the compiler will
32142 generate block move instructions.
32143
32144 @opindex mtune
32145 @item -mtune=@var{cpu_type}
32146 Set the instruction scheduling parameters for machine type @var{cpu_type},
32147 but do not set the instruction set or register set that the option
32148 @option{-mcpu=@var{cpu_type}} would.
32149
32150 @opindex msv-mode
32151 @item -msv-mode
32152 Generate code for the supervisor mode, where there are no restrictions on
32153 the access to general registers. This is the default.
32154
32155 @opindex muser-mode
32156 @item -muser-mode
32157 Generate code for the user mode, where the access to some general registers
32158 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
32159 mode; on the GR6, only registers r29 to r31 are affected.
32160 @end table
32161
32162 @node VMS Options
32163 @subsection VMS Options
32164
32165 These @samp{-m} options are defined for the VMS implementations:
32166
32167 @table @gcctabopt
32168 @opindex mvms-return-codes
32169 @item -mvms-return-codes
32170 Return VMS condition codes from @code{main}. The default is to return POSIX-style
32171 condition (e.g.@: error) codes.
32172
32173 @opindex mdebug-main=@var{prefix}
32174 @item -mdebug-main=@var{prefix}
32175 Flag the first routine whose name starts with @var{prefix} as the main
32176 routine for the debugger.
32177
32178 @opindex mmalloc64
32179 @item -mmalloc64
32180 Default to 64-bit memory allocation routines.
32181
32182 @opindex mpointer-size=@var{size}
32183 @item -mpointer-size=@var{size}
32184 Set the default size of pointers. Possible options for @var{size} are
32185 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
32186 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
32187 The later option disables @code{pragma pointer_size}.
32188 @end table
32189
32190 @node VxWorks Options
32191 @subsection VxWorks Options
32192 @cindex VxWorks Options
32193
32194 The options in this section are defined for all VxWorks targets.
32195 Options specific to the target hardware are listed with the other
32196 options for that target.
32197
32198 @table @gcctabopt
32199 @opindex mrtp
32200 @item -mrtp
32201 GCC can generate code for both VxWorks kernels and real time processes
32202 (RTPs). This option switches from the former to the latter. It also
32203 defines the preprocessor macro @code{__RTP__}.
32204
32205 @opindex non-static
32206 @item -non-static
32207 Link an RTP executable against shared libraries rather than static
32208 libraries. The options @option{-static} and @option{-shared} can
32209 also be used for RTPs (@pxref{Link Options}); @option{-static}
32210 is the default.
32211
32212 @opindex Bstatic
32213 @opindex Bdynamic
32214 @item -Bstatic
32215 @itemx -Bdynamic
32216 These options are passed down to the linker. They are defined for
32217 compatibility with Diab.
32218
32219 @opindex Xbind-lazy
32220 @item -Xbind-lazy
32221 Enable lazy binding of function calls. This option is equivalent to
32222 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32223
32224 @opindex Xbind-now
32225 @item -Xbind-now
32226 Disable lazy binding of function calls. This option is the default and
32227 is defined for compatibility with Diab.
32228 @end table
32229
32230 @node x86 Options
32231 @subsection x86 Options
32232 @cindex x86 Options
32233
32234 These @samp{-m} options are defined for the x86 family of computers.
32235
32236 @table @gcctabopt
32237
32238 @opindex march
32239 @item -march=@var{cpu-type}
32240 Generate instructions for the machine type @var{cpu-type}. In contrast to
32241 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
32242 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32243 to generate code that may not run at all on processors other than the one
32244 indicated. Specifying @option{-march=@var{cpu-type}} implies
32245 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32246
32247 The choices for @var{cpu-type} are:
32248
32249 @table @samp
32250 @item native
32251 This selects the CPU to generate code for at compilation time by determining
32252 the processor type of the compiling machine. Using @option{-march=native}
32253 enables all instruction subsets supported by the local machine (hence
32254 the result might not run on different machines). Using @option{-mtune=native}
32255 produces code optimized for the local machine under the constraints
32256 of the selected instruction set.
32257
32258 @item x86-64
32259 A generic CPU with 64-bit extensions.
32260
32261 @item x86-64-v2
32262 @itemx x86-64-v3
32263 @itemx x86-64-v4
32264 These choices for @var{cpu-type} select the corresponding
32265 micro-architecture level from the x86-64 psABI. On ABIs other than
32266 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32267 documents for the particular micro-architecture level.
32268
32269 Since these @var{cpu-type} values do not have a corresponding
32270 @option{-mtune} setting, using @option{-march} with these values enables
32271 generic tuning. Specific tuning can be enabled using the
32272 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32273 @var{other-cpu-type} value.
32274
32275 @item i386
32276 Original Intel i386 CPU@.
32277
32278 @item i486
32279 Intel i486 CPU@. (No scheduling is implemented for this chip.)
32280
32281 @item i586
32282 @itemx pentium
32283 Intel Pentium CPU with no MMX support.
32284
32285 @item lakemont
32286 Intel Lakemont MCU, based on Intel Pentium CPU.
32287
32288 @item pentium-mmx
32289 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32290
32291 @item pentiumpro
32292 Intel Pentium Pro CPU@.
32293
32294 @item i686
32295 When used with @option{-march}, the Pentium Pro
32296 instruction set is used, so the code runs on all i686 family chips.
32297 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32298
32299 @item pentium2
32300 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32301 set support.
32302
32303 @item pentium3
32304 @itemx pentium3m
32305 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32306 instruction set support.
32307
32308 @item pentium-m
32309 Intel Pentium M; low-power version of Intel Pentium III CPU
32310 with MMX, SSE, SSE2 and FXSR instruction set support. Used by Centrino
32311 notebooks.
32312
32313 @item pentium4
32314 @itemx pentium4m
32315 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32316
32317 @item prescott
32318 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32319 instruction set support.
32320
32321 @item nocona
32322 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32323 SSE2, SSE3 and FXSR instruction set support.
32324
32325 @item core2
32326 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32327 SAHF and FXSR instruction set support.
32328
32329 @item nehalem
32330 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32331 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32332
32333 @item westmere
32334 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32335 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32336
32337 @item sandybridge
32338 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32339 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32340 support.
32341
32342 @item ivybridge
32343 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32344 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32345 and F16C instruction set support.
32346
32347 @item haswell
32348 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32349 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32350 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32351
32352 @item broadwell
32353 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32354 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32355 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32356 instruction set support.
32357
32358 @item skylake
32359 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32360 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32361 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32362 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32363
32364 @item bonnell
32365 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32366 instruction set support.
32367
32368 @item silvermont
32369 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32370 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32371 instruction set support.
32372
32373 @item goldmont
32374 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32375 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32376 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32377 set support.
32378
32379 @item goldmont-plus
32380 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32381 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32382 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32383 RDPID and SGX instruction set support.
32384
32385 @item tremont
32386 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32387 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32388 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32389 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32390 support.
32391
32392 @item sierraforest
32393 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32394 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32395 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32396 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32397 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32398 AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
32399
32400 @item grandridge
32401 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32402 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32403 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32404 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32405 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32406 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD and RAOINT instruction set
32407 support.
32408
32409 @item knl
32410 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32411 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32412 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32413 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32414
32415 @item knm
32416 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32417 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32418 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32419 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32420 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32421
32422 @item skylake-avx512
32423 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32424 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32425 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32426 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32427 AVX512DQ and AVX512CD instruction set support.
32428
32429 @item cannonlake
32430 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32431 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32432 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32433 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32434 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32435 support.
32436
32437 @item icelake-client
32438 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32439 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32440 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32441 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32442 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32443 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32444
32445 @item icelake-server
32446 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32447 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32448 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32449 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32450 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32451 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32452 instruction set support.
32453
32454 @item cascadelake
32455 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32456 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32457 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32458 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32459 AVX512CD and AVX512VNNI instruction set support.
32460
32461 @item cooperlake
32462 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32463 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32464 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32465 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32466 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32467
32468 @item tigerlake
32469 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32470 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32471 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32472 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32473 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32474 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32475 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32476
32477 @item sapphirerapids
32478 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32479 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32480 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32481 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32482 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32483 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32484 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32485 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
32486 instruction set support.
32487
32488 @item alderlake
32489 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32490 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32491 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32492 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32493 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32494 support.
32495
32496 @item rocketlake
32497 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32498 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32499 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32500 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32501 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32502 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32503
32504 @item graniterapids
32505 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32506 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32507 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32508 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32509 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32510 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32511 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
32512 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16,
32513 AVX512BF16, AMX-FP16 and PREFETCHI instruction set support.
32514
32515 @item k6
32516 AMD K6 CPU with MMX instruction set support.
32517
32518 @item k6-2
32519 @itemx k6-3
32520 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32521
32522 @item athlon
32523 @itemx athlon-tbird
32524 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32525 support.
32526
32527 @item athlon-4
32528 @itemx athlon-xp
32529 @itemx athlon-mp
32530 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32531 instruction set support.
32532
32533 @item k8
32534 @itemx opteron
32535 @itemx athlon64
32536 @itemx athlon-fx
32537 Processors based on the AMD K8 core with x86-64 instruction set support,
32538 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32539 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32540 instruction set extensions.)
32541
32542 @item k8-sse3
32543 @itemx opteron-sse3
32544 @itemx athlon64-sse3
32545 Improved versions of AMD K8 cores with SSE3 instruction set support.
32546
32547 @item amdfam10
32548 @itemx barcelona
32549 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
32550 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32551 instruction set extensions.)
32552
32553 @item bdver1
32554 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
32555 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32556 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32557
32558 @item bdver2
32559 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32560 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32561 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
32562 extensions.)
32563
32564 @item bdver3
32565 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32566 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
32567 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32568 64-bit instruction set extensions.)
32569
32570 @item bdver4
32571 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32572 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
32573 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32574 SSE4.2, ABM and 64-bit instruction set extensions.)
32575
32576 @item znver1
32577 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32578 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32579 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32580 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32581 instruction set extensions.)
32582
32583 @item znver2
32584 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32585 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32586 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32587 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32588 WBNOINVD, and 64-bit instruction set extensions.)
32589
32590 @item znver3
32591 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32592 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32593 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32594 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32595 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
32596
32597 @item znver4
32598 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32599 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32600 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32601 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32602 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
32603 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
32604 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
32605
32606 @item btver1
32607 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
32608 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
32609 instruction set extensions.)
32610
32611 @item btver2
32612 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
32613 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
32614 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
32615
32616 @item winchip-c6
32617 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
32618 set support.
32619
32620 @item winchip2
32621 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
32622 instruction set support.
32623
32624 @item c3
32625 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
32626 (No scheduling is implemented for this chip.)
32627
32628 @item c3-2
32629 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
32630 (No scheduling is implemented for this chip.)
32631
32632 @item c7
32633 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32634 (No scheduling is implemented for this chip.)
32635
32636 @item samuel-2
32637 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
32638 (No scheduling is implemented for this chip.)
32639
32640 @item nehemiah
32641 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
32642 (No scheduling is implemented for this chip.)
32643
32644 @item esther
32645 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32646 (No scheduling is implemented for this chip.)
32647
32648 @item eden-x2
32649 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
32650 (No scheduling is implemented for this chip.)
32651
32652 @item eden-x4
32653 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
32654 AVX and AVX2 instruction set support.
32655 (No scheduling is implemented for this chip.)
32656
32657 @item nano
32658 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32659 instruction set support.
32660 (No scheduling is implemented for this chip.)
32661
32662 @item nano-1000
32663 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32664 instruction set support.
32665 (No scheduling is implemented for this chip.)
32666
32667 @item nano-2000
32668 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32669 instruction set support.
32670 (No scheduling is implemented for this chip.)
32671
32672 @item nano-3000
32673 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32674 instruction set support.
32675 (No scheduling is implemented for this chip.)
32676
32677 @item nano-x2
32678 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32679 instruction set support.
32680 (No scheduling is implemented for this chip.)
32681
32682 @item nano-x4
32683 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32684 instruction set support.
32685 (No scheduling is implemented for this chip.)
32686
32687 @item lujiazui
32688 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
32689 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
32690 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
32691
32692 @item geode
32693 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
32694 @end table
32695
32696 @opindex mtune
32697 @item -mtune=@var{cpu-type}
32698 Tune to @var{cpu-type} everything applicable about the generated code, except
32699 for the ABI and the set of available instructions.
32700 While picking a specific @var{cpu-type} schedules things appropriately
32701 for that particular chip, the compiler does not generate any code that
32702 cannot run on the default machine type unless you use a
32703 @option{-march=@var{cpu-type}} option.
32704 For example, if GCC is configured for i686-pc-linux-gnu
32705 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
32706 but still runs on i686 machines.
32707
32708 The choices for @var{cpu-type} are the same as for @option{-march}.
32709 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
32710
32711 @table @samp
32712 @item generic
32713 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
32714 If you know the CPU on which your code will run, then you should use
32715 the corresponding @option{-mtune} or @option{-march} option instead of
32716 @option{-mtune=generic}. But, if you do not know exactly what CPU users
32717 of your application will have, then you should use this option.
32718
32719 As new processors are deployed in the marketplace, the behavior of this
32720 option will change. Therefore, if you upgrade to a newer version of
32721 GCC, code generation controlled by this option will change to reflect
32722 the processors
32723 that are most common at the time that version of GCC is released.
32724
32725 There is no @option{-march=generic} option because @option{-march}
32726 indicates the instruction set the compiler can use, and there is no
32727 generic instruction set applicable to all processors. In contrast,
32728 @option{-mtune} indicates the processor (or, in this case, collection of
32729 processors) for which the code is optimized.
32730
32731 @item intel
32732 Produce code optimized for the most current Intel processors, which are
32733 Haswell and Silvermont for this version of GCC. If you know the CPU
32734 on which your code will run, then you should use the corresponding
32735 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
32736 But, if you want your application performs better on both Haswell and
32737 Silvermont, then you should use this option.
32738
32739 As new Intel processors are deployed in the marketplace, the behavior of
32740 this option will change. Therefore, if you upgrade to a newer version of
32741 GCC, code generation controlled by this option will change to reflect
32742 the most current Intel processors at the time that version of GCC is
32743 released.
32744
32745 There is no @option{-march=intel} option because @option{-march} indicates
32746 the instruction set the compiler can use, and there is no common
32747 instruction set applicable to all processors. In contrast,
32748 @option{-mtune} indicates the processor (or, in this case, collection of
32749 processors) for which the code is optimized.
32750 @end table
32751
32752 @opindex mcpu
32753 @item -mcpu=@var{cpu-type}
32754 A deprecated synonym for @option{-mtune}.
32755
32756 @opindex mfpmath
32757 @item -mfpmath=@var{unit}
32758 Generate floating-point arithmetic for selected unit @var{unit}. The choices
32759 for @var{unit} are:
32760
32761 @table @samp
32762 @item 387
32763 Use the standard 387 floating-point coprocessor present on the majority of chips and
32764 emulated otherwise. Code compiled with this option runs almost everywhere.
32765 The temporary results are computed in 80-bit precision instead of the precision
32766 specified by the type, resulting in slightly different results compared to most
32767 of other chips. See @option{-ffloat-store} for more detailed description.
32768
32769 This is the default choice for non-Darwin x86-32 targets.
32770
32771 @item sse
32772 Use scalar floating-point instructions present in the SSE instruction set.
32773 This instruction set is supported by Pentium III and newer chips,
32774 and in the AMD line
32775 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
32776 instruction set supports only single-precision arithmetic, thus the double and
32777 extended-precision arithmetic are still done using 387. A later version, present
32778 only in Pentium 4 and AMD x86-64 chips, supports double-precision
32779 arithmetic too.
32780
32781 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
32782 or @option{-msse2} switches to enable SSE extensions and make this option
32783 effective. For the x86-64 compiler, these extensions are enabled by default.
32784
32785 The resulting code should be considerably faster in the majority of cases and avoid
32786 the numerical instability problems of 387 code, but may break some existing
32787 code that expects temporaries to be 80 bits.
32788
32789 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
32790 and the default choice for x86-32 targets with the SSE2 instruction set
32791 when @option{-ffast-math} is enabled.
32792
32793 @item sse,387
32794 @itemx sse+387
32795 @itemx both
32796 Attempt to utilize both instruction sets at once. This effectively doubles the
32797 amount of available registers, and on chips with separate execution units for
32798 387 and SSE the execution resources too. Use this option with care, as it is
32799 still experimental, because the GCC register allocator does not model separate
32800 functional units well, resulting in unstable performance.
32801 @end table
32802
32803 @opindex masm=@var{dialect}
32804 @item -masm=@var{dialect}
32805 Output assembly instructions using selected @var{dialect}. Also affects
32806 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
32807 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
32808 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
32809 not support @samp{intel}.
32810
32811 @opindex mieee-fp
32812 @opindex mno-ieee-fp
32813 @item -mieee-fp
32814 @itemx -mno-ieee-fp
32815 Control whether or not the compiler uses IEEE floating-point
32816 comparisons. These correctly handle the case where the result of a
32817 comparison is unordered.
32818
32819 @opindex m80387
32820 @opindex mhard-float
32821 @item -m80387
32822 @itemx -mhard-float
32823 Generate output containing 80387 instructions for floating point.
32824
32825 @opindex no-80387
32826 @opindex msoft-float
32827 @item -mno-80387
32828 @itemx -msoft-float
32829 Generate output containing library calls for floating point.
32830
32831 @strong{Warning:} the requisite libraries are not part of GCC@.
32832 Normally the facilities of the machine's usual C compiler are used, but
32833 this cannot be done directly in cross-compilation. You must make your
32834 own arrangements to provide suitable library functions for
32835 cross-compilation.
32836
32837 On machines where a function returns floating-point results in the 80387
32838 register stack, some floating-point opcodes may be emitted even if
32839 @option{-msoft-float} is used.
32840
32841 @opindex mno-fp-ret-in-387
32842 @opindex mfp-ret-in-387
32843 @item -mno-fp-ret-in-387
32844 Do not use the FPU registers for return values of functions.
32845
32846 The usual calling convention has functions return values of types
32847 @code{float} and @code{double} in an FPU register, even if there
32848 is no FPU@. The idea is that the operating system should emulate
32849 an FPU@.
32850
32851 The option @option{-mno-fp-ret-in-387} causes such values to be returned
32852 in ordinary CPU registers instead.
32853
32854 @opindex mno-fancy-math-387
32855 @opindex mfancy-math-387
32856 @item -mno-fancy-math-387
32857 Some 387 emulators do not support the @code{sin}, @code{cos} and
32858 @code{sqrt} instructions for the 387. Specify this option to avoid
32859 generating those instructions.
32860 This option is overridden when @option{-march}
32861 indicates that the target CPU always has an FPU and so the
32862 instruction does not need emulation. These
32863 instructions are not generated unless you also use the
32864 @option{-funsafe-math-optimizations} switch.
32865
32866 @opindex malign-double
32867 @opindex mno-align-double
32868 @item -malign-double
32869 @itemx -mno-align-double
32870 Control whether GCC aligns @code{double}, @code{long double}, and
32871 @code{long long} variables on a two-word boundary or a one-word
32872 boundary. Aligning @code{double} variables on a two-word boundary
32873 produces code that runs somewhat faster on a Pentium at the
32874 expense of more memory.
32875
32876 On x86-64, @option{-malign-double} is enabled by default.
32877
32878 @strong{Warning:} if you use the @option{-malign-double} switch,
32879 structures containing the above types are aligned differently than
32880 the published application binary interface specifications for the x86-32
32881 and are not binary compatible with structures in code compiled
32882 without that switch.
32883
32884 @opindex m96bit-long-double
32885 @opindex m128bit-long-double
32886 @item -m96bit-long-double
32887 @itemx -m128bit-long-double
32888 These switches control the size of @code{long double} type. The x86-32
32889 application binary interface specifies the size to be 96 bits,
32890 so @option{-m96bit-long-double} is the default in 32-bit mode.
32891
32892 Modern architectures (Pentium and newer) prefer @code{long double}
32893 to be aligned to an 8- or 16-byte boundary. In arrays or structures
32894 conforming to the ABI, this is not possible. So specifying
32895 @option{-m128bit-long-double} aligns @code{long double}
32896 to a 16-byte boundary by padding the @code{long double} with an additional
32897 32-bit zero.
32898
32899 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
32900 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
32901
32902 Notice that neither of these options enable any extra precision over the x87
32903 standard of 80 bits for a @code{long double}.
32904
32905 @strong{Warning:} if you override the default value for your target ABI, this
32906 changes the size of
32907 structures and arrays containing @code{long double} variables,
32908 as well as modifying the function calling convention for functions taking
32909 @code{long double}. Hence they are not binary-compatible
32910 with code compiled without that switch.
32911
32912 @opindex mlong-double-64
32913 @opindex mlong-double-80
32914 @opindex mlong-double-128
32915 @item -mlong-double-64
32916 @itemx -mlong-double-80
32917 @itemx -mlong-double-128
32918 These switches control the size of @code{long double} type. A size
32919 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32920 type. This is the default for 32-bit Bionic C library. A size
32921 of 128 bits makes the @code{long double} type equivalent to the
32922 @code{__float128} type. This is the default for 64-bit Bionic C library.
32923
32924 @strong{Warning:} if you override the default value for your target ABI, this
32925 changes the size of
32926 structures and arrays containing @code{long double} variables,
32927 as well as modifying the function calling convention for functions taking
32928 @code{long double}. Hence they are not binary-compatible
32929 with code compiled without that switch.
32930
32931 @opindex malign-data
32932 @item -malign-data=@var{type}
32933 Control how GCC aligns variables. Supported values for @var{type} are
32934 @samp{compat} uses increased alignment value compatible uses GCC 4.8
32935 and earlier, @samp{abi} uses alignment value as specified by the
32936 psABI, and @samp{cacheline} uses increased alignment value to match
32937 the cache line size. @samp{compat} is the default.
32938
32939 @opindex mlarge-data-threshold
32940 @item -mlarge-data-threshold=@var{threshold}
32941 When @option{-mcmodel=medium} is specified, data objects larger than
32942 @var{threshold} are placed in the large data section. This value must be the
32943 same across all objects linked into the binary, and defaults to 65535.
32944
32945 @opindex mrtd
32946 @item -mrtd
32947 Use a different function-calling convention, in which functions that
32948 take a fixed number of arguments return with the @code{ret @var{num}}
32949 instruction, which pops their arguments while returning. This saves one
32950 instruction in the caller since there is no need to pop the arguments
32951 there.
32952
32953 You can specify that an individual function is called with this calling
32954 sequence with the function attribute @code{stdcall}. You can also
32955 override the @option{-mrtd} option by using the function attribute
32956 @code{cdecl}. @xref{Function Attributes}.
32957
32958 @strong{Warning:} this calling convention is incompatible with the one
32959 normally used on Unix, so you cannot use it if you need to call
32960 libraries compiled with the Unix compiler.
32961
32962 Also, you must provide function prototypes for all functions that
32963 take variable numbers of arguments (including @code{printf});
32964 otherwise incorrect code is generated for calls to those
32965 functions.
32966
32967 In addition, seriously incorrect code results if you call a
32968 function with too many arguments. (Normally, extra arguments are
32969 harmlessly ignored.)
32970
32971 @opindex mregparm
32972 @item -mregparm=@var{num}
32973 Control how many registers are used to pass integer arguments. By
32974 default, no registers are used to pass arguments, and at most 3
32975 registers can be used. You can control this behavior for a specific
32976 function by using the function attribute @code{regparm}.
32977 @xref{Function Attributes}.
32978
32979 @strong{Warning:} if you use this switch, and
32980 @var{num} is nonzero, then you must build all modules with the same
32981 value, including any libraries. This includes the system libraries and
32982 startup modules.
32983
32984 @opindex msseregparm
32985 @item -msseregparm
32986 Use SSE register passing conventions for float and double arguments
32987 and return values. You can control this behavior for a specific
32988 function by using the function attribute @code{sseregparm}.
32989 @xref{Function Attributes}.
32990
32991 @strong{Warning:} if you use this switch then you must build all
32992 modules with the same value, including any libraries. This includes
32993 the system libraries and startup modules.
32994
32995 @opindex mvect8-ret-in-mem
32996 @item -mvect8-ret-in-mem
32997 Return 8-byte vectors in memory instead of MMX registers. This is the
32998 default on VxWorks to match the ABI of the Sun Studio compilers until
32999 version 12. @emph{Only} use this option if you need to remain
33000 compatible with existing code produced by those previous compiler
33001 versions or older versions of GCC@.
33002
33003 @opindex mpc32
33004 @opindex mpc64
33005 @opindex mpc80
33006 @item -mpc32
33007 @itemx -mpc64
33008 @itemx -mpc80
33009
33010 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
33011 is specified, the significands of results of floating-point operations are
33012 rounded to 24 bits (single precision); @option{-mpc64} rounds the
33013 significands of results of floating-point operations to 53 bits (double
33014 precision) and @option{-mpc80} rounds the significands of results of
33015 floating-point operations to 64 bits (extended double precision), which is
33016 the default. When this option is used, floating-point operations in higher
33017 precisions are not available to the programmer without setting the FPU
33018 control word explicitly.
33019
33020 Setting the rounding of floating-point operations to less than the default
33021 80 bits can speed some programs by 2% or more. Note that some mathematical
33022 libraries assume that extended-precision (80-bit) floating-point operations
33023 are enabled by default; routines in such libraries could suffer significant
33024 loss of accuracy, typically through so-called ``catastrophic cancellation'',
33025 when this option is used to set the precision to less than extended precision.
33026
33027 @opindex mdaz-ftz
33028 @item -mdaz-ftz
33029
33030 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
33031 are used to control floating-point calculations.SSE and AVX instructions
33032 including scalar and vector instructions could benefit from enabling the FTZ
33033 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
33034 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
33035 will set FTZ/DAZ flags even with @option{-shared}.
33036
33037 @opindex mstackrealign
33038 @item -mstackrealign
33039 Realign the stack at entry. On the x86, the @option{-mstackrealign}
33040 option generates an alternate prologue and epilogue that realigns the
33041 run-time stack if necessary. This supports mixing legacy codes that keep
33042 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
33043 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
33044 applicable to individual functions.
33045
33046 @opindex mpreferred-stack-boundary
33047 @item -mpreferred-stack-boundary=@var{num}
33048 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
33049 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
33050 the default is 4 (16 bytes or 128 bits).
33051
33052 @strong{Warning:} When generating code for the x86-64 architecture with
33053 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
33054 used to keep the stack boundary aligned to 8 byte boundary. Since
33055 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
33056 intended to be used in controlled environment where stack space is
33057 important limitation. This option leads to wrong code when functions
33058 compiled with 16 byte stack alignment (such as functions from a standard
33059 library) are called with misaligned stack. In this case, SSE
33060 instructions may lead to misaligned memory access traps. In addition,
33061 variable arguments are handled incorrectly for 16 byte aligned
33062 objects (including x87 long double and __int128), leading to wrong
33063 results. You must build all modules with
33064 @option{-mpreferred-stack-boundary=3}, including any libraries. This
33065 includes the system libraries and startup modules.
33066
33067 @opindex mincoming-stack-boundary
33068 @item -mincoming-stack-boundary=@var{num}
33069 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
33070 boundary. If @option{-mincoming-stack-boundary} is not specified,
33071 the one specified by @option{-mpreferred-stack-boundary} is used.
33072
33073 On Pentium and Pentium Pro, @code{double} and @code{long double} values
33074 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
33075 suffer significant run time performance penalties. On Pentium III, the
33076 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
33077 properly if it is not 16-byte aligned.
33078
33079 To ensure proper alignment of this values on the stack, the stack boundary
33080 must be as aligned as that required by any value stored on the stack.
33081 Further, every function must be generated such that it keeps the stack
33082 aligned. Thus calling a function compiled with a higher preferred
33083 stack boundary from a function compiled with a lower preferred stack
33084 boundary most likely misaligns the stack. It is recommended that
33085 libraries that use callbacks always use the default setting.
33086
33087 This extra alignment does consume extra stack space, and generally
33088 increases code size. Code that is sensitive to stack space usage, such
33089 as embedded systems and operating system kernels, may want to reduce the
33090 preferred alignment to @option{-mpreferred-stack-boundary=2}.
33091
33092 @need 200
33093 @opindex mmmx
33094 @item -mmmx
33095 @need 200
33096 @opindex msse
33097 @itemx -msse
33098 @need 200
33099 @opindex msse2
33100 @itemx -msse2
33101 @need 200
33102 @opindex msse3
33103 @itemx -msse3
33104 @need 200
33105 @opindex mssse3
33106 @itemx -mssse3
33107 @need 200
33108 @opindex msse4
33109 @itemx -msse4
33110 @need 200
33111 @opindex msse4a
33112 @itemx -msse4a
33113 @need 200
33114 @opindex msse4.1
33115 @itemx -msse4.1
33116 @need 200
33117 @opindex msse4.2
33118 @itemx -msse4.2
33119 @need 200
33120 @opindex mavx
33121 @itemx -mavx
33122 @need 200
33123 @opindex mavx2
33124 @itemx -mavx2
33125 @need 200
33126 @opindex mavx512f
33127 @itemx -mavx512f
33128 @need 200
33129 @opindex mavx512pf
33130 @itemx -mavx512pf
33131 @need 200
33132 @opindex mavx512er
33133 @itemx -mavx512er
33134 @need 200
33135 @opindex mavx512cd
33136 @itemx -mavx512cd
33137 @need 200
33138 @opindex mavx512vl
33139 @itemx -mavx512vl
33140 @need 200
33141 @opindex mavx512bw
33142 @itemx -mavx512bw
33143 @need 200
33144 @opindex mavx512dq
33145 @itemx -mavx512dq
33146 @need 200
33147 @opindex mavx512ifma
33148 @itemx -mavx512ifma
33149 @need 200
33150 @opindex mavx512vbmi
33151 @itemx -mavx512vbmi
33152 @need 200
33153 @opindex msha
33154 @itemx -msha
33155 @need 200
33156 @opindex maes
33157 @itemx -maes
33158 @need 200
33159 @opindex mpclmul
33160 @itemx -mpclmul
33161 @need 200
33162 @opindex mclflushopt
33163 @itemx -mclflushopt
33164 @need 200
33165 @opindex mclwb
33166 @itemx -mclwb
33167 @need 200
33168 @opindex mfsgsbase
33169 @itemx -mfsgsbase
33170 @need 200
33171 @opindex mptwrite
33172 @itemx -mptwrite
33173 @need 200
33174 @opindex mrdrnd
33175 @itemx -mrdrnd
33176 @need 200
33177 @opindex mf16c
33178 @itemx -mf16c
33179 @need 200
33180 @opindex mfma
33181 @itemx -mfma
33182 @need 200
33183 @opindex mpconfig
33184 @itemx -mpconfig
33185 @need 200
33186 @opindex mwbnoinvd
33187 @itemx -mwbnoinvd
33188 @need 200
33189 @opindex mfma4
33190 @itemx -mfma4
33191 @need 200
33192 @opindex mprfchw
33193 @itemx -mprfchw
33194 @need 200
33195 @opindex mrdpid
33196 @itemx -mrdpid
33197 @need 200
33198 @opindex mprefetchwt1
33199 @itemx -mprefetchwt1
33200 @need 200
33201 @opindex mrdseed
33202 @itemx -mrdseed
33203 @need 200
33204 @opindex msgx
33205 @itemx -msgx
33206 @need 200
33207 @opindex mxop
33208 @itemx -mxop
33209 @need 200
33210 @opindex mlwp
33211 @itemx -mlwp
33212 @need 200
33213 @opindex m3dnow
33214 @itemx -m3dnow
33215 @need 200
33216 @opindex m3dnowa
33217 @itemx -m3dnowa
33218 @need 200
33219 @opindex mpopcnt
33220 @itemx -mpopcnt
33221 @need 200
33222 @opindex mabm
33223 @itemx -mabm
33224 @need 200
33225 @opindex madx
33226 @itemx -madx
33227 @need 200
33228 @opindex mbmi
33229 @itemx -mbmi
33230 @need 200
33231 @opindex mbmi2
33232 @itemx -mbmi2
33233 @need 200
33234 @opindex mlzcnt
33235 @itemx -mlzcnt
33236 @need 200
33237 @opindex mfxsr
33238 @itemx -mfxsr
33239 @need 200
33240 @opindex mxsave
33241 @itemx -mxsave
33242 @need 200
33243 @opindex mxsaveopt
33244 @itemx -mxsaveopt
33245 @need 200
33246 @opindex mxsavec
33247 @itemx -mxsavec
33248 @need 200
33249 @opindex mxsaves
33250 @itemx -mxsaves
33251 @need 200
33252 @opindex mrtm
33253 @itemx -mrtm
33254 @need 200
33255 @opindex mhle
33256 @itemx -mhle
33257 @need 200
33258 @opindex mtbm
33259 @itemx -mtbm
33260 @need 200
33261 @opindex mmwaitx
33262 @itemx -mmwaitx
33263 @need 200
33264 @opindex mclzero
33265 @itemx -mclzero
33266 @need 200
33267 @opindex mpku
33268 @itemx -mpku
33269 @need 200
33270 @opindex mavx512vbmi2
33271 @itemx -mavx512vbmi2
33272 @need 200
33273 @opindex mavx512bf16
33274 @itemx -mavx512bf16
33275 @need 200
33276 @opindex mavx512fp16
33277 @itemx -mavx512fp16
33278 @need 200
33279 @opindex mgfni
33280 @itemx -mgfni
33281 @need 200
33282 @opindex mvaes
33283 @itemx -mvaes
33284 @need 200
33285 @opindex mwaitpkg
33286 @itemx -mwaitpkg
33287 @need 200
33288 @opindex mvpclmulqdq
33289 @itemx -mvpclmulqdq
33290 @need 200
33291 @opindex mavx512bitalg
33292 @itemx -mavx512bitalg
33293 @need 200
33294 @opindex mmovdiri
33295 @itemx -mmovdiri
33296 @need 200
33297 @opindex mmovdir64b
33298 @itemx -mmovdir64b
33299 @need 200
33300 @opindex menqcmd
33301 @opindex muintr
33302 @itemx -menqcmd
33303 @itemx -muintr
33304 @need 200
33305 @opindex mtsxldtrk
33306 @itemx -mtsxldtrk
33307 @need 200
33308 @opindex mavx512vpopcntdq
33309 @itemx -mavx512vpopcntdq
33310 @need 200
33311 @opindex mavx512vp2intersect
33312 @itemx -mavx512vp2intersect
33313 @need 200
33314 @opindex mavx5124fmaps
33315 @itemx -mavx5124fmaps
33316 @need 200
33317 @opindex mavx512vnni
33318 @itemx -mavx512vnni
33319 @need 200
33320 @opindex mavxvnni
33321 @itemx -mavxvnni
33322 @need 200
33323 @opindex mavx5124vnniw
33324 @itemx -mavx5124vnniw
33325 @need 200
33326 @opindex mcldemote
33327 @itemx -mcldemote
33328 @need 200
33329 @opindex mserialize
33330 @itemx -mserialize
33331 @need 200
33332 @opindex mamx-tile
33333 @itemx -mamx-tile
33334 @need 200
33335 @opindex mamx-int8
33336 @itemx -mamx-int8
33337 @need 200
33338 @opindex mamx-bf16
33339 @itemx -mamx-bf16
33340 @need 200
33341 @opindex mhreset
33342 @opindex mkl
33343 @itemx -mhreset
33344 @itemx -mkl
33345 @need 200
33346 @opindex mwidekl
33347 @itemx -mwidekl
33348 @need 200
33349 @opindex mavxifma
33350 @itemx -mavxifma
33351 @need 200
33352 @opindex mavxvnniint8
33353 @itemx -mavxvnniint8
33354 @need 200
33355 @opindex mavxneconvert
33356 @itemx -mavxneconvert
33357 @need 200
33358 @opindex mcmpccxadd
33359 @itemx -mcmpccxadd
33360 @need 200
33361 @opindex mamx-fp16
33362 @itemx -mamx-fp16
33363 @need 200
33364 @opindex mprefetchi
33365 @itemx -mprefetchi
33366 @need 200
33367 @opindex mraoint
33368 @itemx -mraoint
33369 @need 200
33370 @opindex mamx-complex
33371 @itemx -mamx-complex
33372 These switches enable the use of instructions in the MMX, SSE,
33373 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
33374 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
33375 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
33376 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
33377 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
33378 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
33379 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
33380 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
33381 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
33382 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
33383 AMX-COMPLEX or CLDEMOTE extended instruction sets. Each has a corresponding
33384 @option{-mno-} option to disable use of these instructions.
33385
33386 These extensions are also available as built-in functions: see
33387 @ref{x86 Built-in Functions}, for details of the functions enabled and
33388 disabled by these switches.
33389
33390 To generate SSE/SSE2 instructions automatically from floating-point
33391 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
33392
33393 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
33394 generates new AVX instructions or AVX equivalence for all SSEx instructions
33395 when needed.
33396
33397 These options enable GCC to use these extended instructions in
33398 generated code, even without @option{-mfpmath=sse}. Applications that
33399 perform run-time CPU detection must compile separate files for each
33400 supported architecture, using the appropriate flags. In particular,
33401 the file containing the CPU detection code should be compiled without
33402 these options.
33403
33404 @opindex mdump-tune-features
33405 @item -mdump-tune-features
33406 This option instructs GCC to dump the names of the x86 performance
33407 tuning features and default settings. The names can be used in
33408 @option{-mtune-ctrl=@var{feature-list}}.
33409
33410 @opindex mtune-ctrl=@var{feature-list}
33411 @item -mtune-ctrl=@var{feature-list}
33412 This option is used to do fine grain control of x86 code generation features.
33413 @var{feature-list} is a comma separated list of @var{feature} names. See also
33414 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33415 on if it is not preceded with @samp{^}, otherwise, it is turned off.
33416 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33417 developers. Using it may lead to code paths not covered by testing and can
33418 potentially result in compiler ICEs or runtime errors.
33419
33420 @opindex mno-default
33421 @item -mno-default
33422 This option instructs GCC to turn off all tunable features. See also
33423 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33424
33425 @opindex mcld
33426 @item -mcld
33427 This option instructs GCC to emit a @code{cld} instruction in the prologue
33428 of functions that use string instructions. String instructions depend on
33429 the DF flag to select between autoincrement or autodecrement mode. While the
33430 ABI specifies the DF flag to be cleared on function entry, some operating
33431 systems violate this specification by not clearing the DF flag in their
33432 exception dispatchers. The exception handler can be invoked with the DF flag
33433 set, which leads to wrong direction mode when string instructions are used.
33434 This option can be enabled by default on 32-bit x86 targets by configuring
33435 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
33436 instructions can be suppressed with the @option{-mno-cld} compiler option
33437 in this case.
33438
33439 @opindex mvzeroupper
33440 @item -mvzeroupper
33441 This option instructs GCC to emit a @code{vzeroupper} instruction
33442 before a transfer of control flow out of the function to minimize
33443 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33444 intrinsics.
33445
33446 @opindex mprefer-avx128
33447 @item -mprefer-avx128
33448 This option instructs GCC to use 128-bit AVX instructions instead of
33449 256-bit AVX instructions in the auto-vectorizer.
33450
33451 @opindex mprefer-vector-width
33452 @item -mprefer-vector-width=@var{opt}
33453 This option instructs GCC to use @var{opt}-bit vector width in instructions
33454 instead of default on the selected platform.
33455
33456 @opindex mmove-max
33457 @item -mmove-max=@var{bits}
33458 This option instructs GCC to set the maximum number of bits can be
33459 moved from memory to memory efficiently to @var{bits}. The valid
33460 @var{bits} are 128, 256 and 512.
33461
33462 @opindex mstore-max
33463 @item -mstore-max=@var{bits}
33464 This option instructs GCC to set the maximum number of bits can be
33465 stored to memory efficiently to @var{bits}. The valid @var{bits} are
33466 128, 256 and 512.
33467
33468 @table @samp
33469 @item none
33470 No extra limitations applied to GCC other than defined by the selected platform.
33471
33472 @item 128
33473 Prefer 128-bit vector width for instructions.
33474
33475 @item 256
33476 Prefer 256-bit vector width for instructions.
33477
33478 @item 512
33479 Prefer 512-bit vector width for instructions.
33480 @end table
33481
33482 @opindex mcx16
33483 @item -mcx16
33484 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33485 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33486 objects. This is useful for atomic updates of data structures exceeding one
33487 machine word in size. The compiler uses this instruction to implement
33488 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
33489 128-bit integers, a library call is always used.
33490
33491 @opindex msahf
33492 @item -msahf
33493 This option enables generation of @code{SAHF} instructions in 64-bit code.
33494 Early Intel Pentium 4 CPUs with Intel 64 support,
33495 prior to the introduction of Pentium 4 G1 step in December 2005,
33496 lacked the @code{LAHF} and @code{SAHF} instructions
33497 which are supported by AMD64.
33498 These are load and store instructions, respectively, for certain status flags.
33499 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33500 @code{drem}, and @code{remainder} built-in functions;
33501 see @ref{Other Builtins} for details.
33502
33503 @opindex mmovbe
33504 @item -mmovbe
33505 This option enables use of the @code{movbe} instruction to implement
33506 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33507
33508 @opindex mshstk
33509 @item -mshstk
33510 The @option{-mshstk} option enables shadow stack built-in functions
33511 from x86 Control-flow Enforcement Technology (CET).
33512
33513 @opindex mcrc32
33514 @item -mcrc32
33515 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33516 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33517 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33518
33519 @opindex mmwait
33520 @item -mmwait
33521 This option enables built-in functions @code{__builtin_ia32_monitor},
33522 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33523 @code{mwait} machine instructions.
33524
33525 @opindex mrecip
33526 @item -mrecip
33527 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33528 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33529 with an additional Newton-Raphson step
33530 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33531 (and their vectorized
33532 variants) for single-precision floating-point arguments. These instructions
33533 are generated only when @option{-funsafe-math-optimizations} is enabled
33534 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33535 Note that while the throughput of the sequence is higher than the throughput
33536 of the non-reciprocal instruction, the precision of the sequence can be
33537 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33538
33539 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33540 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33541 combination), and doesn't need @option{-mrecip}.
33542
33543 Also note that GCC emits the above sequence with additional Newton-Raphson step
33544 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33545 already with @option{-ffast-math} (or the above option combination), and
33546 doesn't need @option{-mrecip}.
33547
33548 @opindex mrecip=opt
33549 @item -mrecip=@var{opt}
33550 This option controls which reciprocal estimate instructions
33551 may be used. @var{opt} is a comma-separated list of options, which may
33552 be preceded by a @samp{!} to invert the option:
33553
33554 @table @samp
33555 @item all
33556 Enable all estimate instructions.
33557
33558 @item default
33559 Enable the default instructions, equivalent to @option{-mrecip}.
33560
33561 @item none
33562 Disable all estimate instructions, equivalent to @option{-mno-recip}.
33563
33564 @item div
33565 Enable the approximation for scalar division.
33566
33567 @item vec-div
33568 Enable the approximation for vectorized division.
33569
33570 @item sqrt
33571 Enable the approximation for scalar square root.
33572
33573 @item vec-sqrt
33574 Enable the approximation for vectorized square root.
33575 @end table
33576
33577 So, for example, @option{-mrecip=all,!sqrt} enables
33578 all of the reciprocal approximations, except for square root.
33579
33580 @opindex mveclibabi
33581 @item -mveclibabi=@var{type}
33582 Specifies the ABI type to use for vectorizing intrinsics using an
33583 external library. Supported values for @var{type} are @samp{svml}
33584 for the Intel short
33585 vector math library and @samp{acml} for the AMD math core library.
33586 To use this option, both @option{-ftree-vectorize} and
33587 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
33588 ABI-compatible library must be specified at link time.
33589
33590 GCC currently emits calls to @code{vmldExp2},
33591 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
33592 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
33593 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
33594 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
33595 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
33596 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
33597 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
33598 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
33599 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
33600 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
33601 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
33602 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
33603 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
33604 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
33605 when @option{-mveclibabi=acml} is used.
33606
33607 @opindex mabi
33608 @item -mabi=@var{name}
33609 Generate code for the specified calling convention. Permissible values
33610 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
33611 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
33612 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
33613 You can control this behavior for specific functions by
33614 using the function attributes @code{ms_abi} and @code{sysv_abi}.
33615 @xref{Function Attributes}.
33616
33617 @opindex mforce-indirect-call
33618 @item -mforce-indirect-call
33619 Force all calls to functions to be indirect. This is useful
33620 when using Intel Processor Trace where it generates more precise timing
33621 information for function calls.
33622
33623 @opindex mmanual-endbr
33624 @item -mmanual-endbr
33625 Insert ENDBR instruction at function entry only via the @code{cf_check}
33626 function attribute. This is useful when used with the option
33627 @option{-fcf-protection=branch} to control ENDBR insertion at the
33628 function entry.
33629
33630 @opindex mcet-switch
33631 @item -mcet-switch
33632 By default, CET instrumentation is turned off on switch statements that
33633 use a jump table and indirect branch track is disabled. Since jump
33634 tables are stored in read-only memory, this does not result in a direct
33635 loss of hardening. But if the jump table index is attacker-controlled,
33636 the indirect jump may not be constrained by CET. This option turns on
33637 CET instrumentation to enable indirect branch track for switch statements
33638 with jump tables which leads to the jump targets reachable via any indirect
33639 jumps.
33640
33641 @opindex mcall-ms2sysv-xlogues
33642 @opindex mno-call-ms2sysv-xlogues
33643 @item -mcall-ms2sysv-xlogues
33644 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
33645 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
33646 default, the code for saving and restoring these registers is emitted inline,
33647 resulting in fairly lengthy prologues and epilogues. Using
33648 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
33649 use stubs in the static portion of libgcc to perform these saves and restores,
33650 thus reducing function size at the cost of a few extra instructions.
33651
33652 @opindex mtls-dialect
33653 @item -mtls-dialect=@var{type}
33654 Generate code to access thread-local storage using the @samp{gnu} or
33655 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
33656 @samp{gnu2} is more efficient, but it may add compile- and run-time
33657 requirements that cannot be satisfied on all systems.
33658
33659 @opindex mpush-args
33660 @opindex mno-push-args
33661 @item -mpush-args
33662 @itemx -mno-push-args
33663 Use PUSH operations to store outgoing parameters. This method is shorter
33664 and usually equally fast as method using SUB/MOV operations and is enabled
33665 by default. In some cases disabling it may improve performance because of
33666 improved scheduling and reduced dependencies.
33667
33668 @opindex maccumulate-outgoing-args
33669 @item -maccumulate-outgoing-args
33670 If enabled, the maximum amount of space required for outgoing arguments is
33671 computed in the function prologue. This is faster on most modern CPUs
33672 because of reduced dependencies, improved scheduling and reduced stack usage
33673 when the preferred stack boundary is not equal to 2. The drawback is a notable
33674 increase in code size. This switch implies @option{-mno-push-args}.
33675
33676 @opindex mthreads
33677 @item -mthreads
33678 Support thread-safe exception handling on MinGW. Programs that rely
33679 on thread-safe exception handling must compile and link all code with the
33680 @option{-mthreads} option. When compiling, @option{-mthreads} defines
33681 @option{-D_MT}; when linking, it links in a special thread helper library
33682 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
33683
33684 @opindex mms-bitfields
33685 @opindex mno-ms-bitfields
33686 @item -mms-bitfields
33687 @itemx -mno-ms-bitfields
33688
33689 Enable/disable bit-field layout compatible with the native Microsoft
33690 Windows compiler.
33691
33692 If @code{packed} is used on a structure, or if bit-fields are used,
33693 it may be that the Microsoft ABI lays out the structure differently
33694 than the way GCC normally does. Particularly when moving packed
33695 data between functions compiled with GCC and the native Microsoft compiler
33696 (either via function call or as data in a file), it may be necessary to access
33697 either format.
33698
33699 This option is enabled by default for Microsoft Windows
33700 targets. This behavior can also be controlled locally by use of variable
33701 or type attributes. For more information, see @ref{x86 Variable Attributes}
33702 and @ref{x86 Type Attributes}.
33703
33704 The Microsoft structure layout algorithm is fairly simple with the exception
33705 of the bit-field packing.
33706 The padding and alignment of members of structures and whether a bit-field
33707 can straddle a storage-unit boundary are determine by these rules:
33708
33709 @enumerate
33710 @item Structure members are stored sequentially in the order in which they are
33711 declared: the first member has the lowest memory address and the last member
33712 the highest.
33713
33714 @item Every data object has an alignment requirement. The alignment requirement
33715 for all data except structures, unions, and arrays is either the size of the
33716 object or the current packing size (specified with either the
33717 @code{aligned} attribute or the @code{pack} pragma),
33718 whichever is less. For structures, unions, and arrays,
33719 the alignment requirement is the largest alignment requirement of its members.
33720 Every object is allocated an offset so that:
33721
33722 @smallexample
33723 offset % alignment_requirement == 0
33724 @end smallexample
33725
33726 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
33727 unit if the integral types are the same size and if the next bit-field fits
33728 into the current allocation unit without crossing the boundary imposed by the
33729 common alignment requirements of the bit-fields.
33730 @end enumerate
33731
33732 MSVC interprets zero-length bit-fields in the following ways:
33733
33734 @enumerate
33735 @item If a zero-length bit-field is inserted between two bit-fields that
33736 are normally coalesced, the bit-fields are not coalesced.
33737
33738 For example:
33739
33740 @smallexample
33741 struct
33742 @{
33743 unsigned long bf_1 : 12;
33744 unsigned long : 0;
33745 unsigned long bf_2 : 12;
33746 @} t1;
33747 @end smallexample
33748
33749 @noindent
33750 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
33751 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
33752
33753 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
33754 alignment of the zero-length bit-field is greater than the member that follows it,
33755 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
33756
33757 For example:
33758
33759 @smallexample
33760 struct
33761 @{
33762 char foo : 4;
33763 short : 0;
33764 char bar;
33765 @} t2;
33766
33767 struct
33768 @{
33769 char foo : 4;
33770 short : 0;
33771 double bar;
33772 @} t3;
33773 @end smallexample
33774
33775 @noindent
33776 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
33777 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
33778 bit-field does not affect the alignment of @code{bar} or, as a result, the size
33779 of the structure.
33780
33781 Taking this into account, it is important to note the following:
33782
33783 @enumerate
33784 @item If a zero-length bit-field follows a normal bit-field, the type of the
33785 zero-length bit-field may affect the alignment of the structure as whole. For
33786 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
33787 normal bit-field, and is of type short.
33788
33789 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
33790 still affect the alignment of the structure:
33791
33792 @smallexample
33793 struct
33794 @{
33795 char foo : 6;
33796 long : 0;
33797 @} t4;
33798 @end smallexample
33799
33800 @noindent
33801 Here, @code{t4} takes up 4 bytes.
33802 @end enumerate
33803
33804 @item Zero-length bit-fields following non-bit-field members are ignored:
33805
33806 @smallexample
33807 struct
33808 @{
33809 char foo;
33810 long : 0;
33811 char bar;
33812 @} t5;
33813 @end smallexample
33814
33815 @noindent
33816 Here, @code{t5} takes up 2 bytes.
33817 @end enumerate
33818
33819
33820 @opindex mno-align-stringops
33821 @opindex malign-stringops
33822 @item -mno-align-stringops
33823 Do not align the destination of inlined string operations. This switch reduces
33824 code size and improves performance in case the destination is already aligned,
33825 but GCC doesn't know about it.
33826
33827 @opindex minline-all-stringops
33828 @item -minline-all-stringops
33829 By default GCC inlines string operations only when the destination is
33830 known to be aligned to least a 4-byte boundary.
33831 This enables more inlining and increases code
33832 size, but may improve performance of code that depends on fast
33833 @code{memcpy} and @code{memset} for short lengths.
33834 The option enables inline expansion of @code{strlen} for all
33835 pointer alignments.
33836
33837 @opindex minline-stringops-dynamically
33838 @item -minline-stringops-dynamically
33839 For string operations of unknown size, use run-time checks with
33840 inline code for small blocks and a library call for large blocks.
33841
33842 @opindex mstringop-strategy=@var{alg}
33843 @item -mstringop-strategy=@var{alg}
33844 Override the internal decision heuristic for the particular algorithm to use
33845 for inlining string operations. The allowed values for @var{alg} are:
33846
33847 @table @samp
33848 @item rep_byte
33849 @itemx rep_4byte
33850 @itemx rep_8byte
33851 Expand using i386 @code{rep} prefix of the specified size.
33852
33853 @item byte_loop
33854 @itemx loop
33855 @itemx unrolled_loop
33856 Expand into an inline loop.
33857
33858 @item libcall
33859 Always use a library call.
33860 @end table
33861
33862 @opindex mmemcpy-strategy=@var{strategy}
33863 @item -mmemcpy-strategy=@var{strategy}
33864 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
33865 should be inlined and what inline algorithm to use when the expected size
33866 of the copy operation is known. @var{strategy}
33867 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
33868 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
33869 the max byte size with which inline algorithm @var{alg} is allowed. For the last
33870 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
33871 in the list must be specified in increasing order. The minimal byte size for
33872 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
33873 preceding range.
33874
33875 @opindex mmemset-strategy=@var{strategy}
33876 @item -mmemset-strategy=@var{strategy}
33877 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
33878 @code{__builtin_memset} expansion.
33879
33880 @opindex momit-leaf-frame-pointer
33881 @item -momit-leaf-frame-pointer
33882 Don't keep the frame pointer in a register for leaf functions. This
33883 avoids the instructions to save, set up, and restore frame pointers and
33884 makes an extra register available in leaf functions. The option
33885 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
33886 which might make debugging harder.
33887
33888 @opindex mtls-direct-seg-refs
33889 @item -mtls-direct-seg-refs
33890 @itemx -mno-tls-direct-seg-refs
33891 Controls whether TLS variables may be accessed with offsets from the
33892 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
33893 or whether the thread base pointer must be added. Whether or not this
33894 is valid depends on the operating system, and whether it maps the
33895 segment to cover the entire TLS area.
33896
33897 For systems that use the GNU C Library, the default is on.
33898
33899 @opindex msse2avx
33900 @item -msse2avx
33901 @itemx -mno-sse2avx
33902 Specify that the assembler should encode SSE instructions with VEX
33903 prefix. The option @option{-mavx} turns this on by default.
33904
33905 @opindex mfentry
33906 @item -mfentry
33907 @itemx -mno-fentry
33908 If profiling is active (@option{-pg}), put the profiling
33909 counter call before the prologue.
33910 Note: On x86 architectures the attribute @code{ms_hook_prologue}
33911 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
33912
33913 @opindex mrecord-mcount
33914 @item -mrecord-mcount
33915 @itemx -mno-record-mcount
33916 If profiling is active (@option{-pg}), generate a __mcount_loc section
33917 that contains pointers to each profiling call. This is useful for
33918 automatically patching and out calls.
33919
33920 @opindex mnop-mcount
33921 @item -mnop-mcount
33922 @itemx -mno-nop-mcount
33923 If profiling is active (@option{-pg}), generate the calls to
33924 the profiling functions as NOPs. This is useful when they
33925 should be patched in later dynamically. This is likely only
33926 useful together with @option{-mrecord-mcount}.
33927
33928 @opindex minstrument-return
33929 @item -minstrument-return=@var{type}
33930 Instrument function exit in -pg -mfentry instrumented functions with
33931 call to specified function. This only instruments true returns ending
33932 with ret, but not sibling calls ending with jump. Valid types
33933 are @var{none} to not instrument, @var{call} to generate a call to __return__,
33934 or @var{nop5} to generate a 5 byte nop.
33935
33936 @opindex mrecord-return
33937 @item -mrecord-return
33938 @itemx -mno-record-return
33939 Generate a __return_loc section pointing to all return instrumentation code.
33940
33941 @opindex mfentry-name
33942 @item -mfentry-name=@var{name}
33943 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
33944
33945 @opindex mfentry-section
33946 @item -mfentry-section=@var{name}
33947 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
33948
33949 @opindex mskip-rax-setup
33950 @item -mskip-rax-setup
33951 @itemx -mno-skip-rax-setup
33952 When generating code for the x86-64 architecture with SSE extensions
33953 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
33954 register when there are no variable arguments passed in vector registers.
33955
33956 @strong{Warning:} Since RAX register is used to avoid unnecessarily
33957 saving vector registers on stack when passing variable arguments, the
33958 impacts of this option are callees may waste some stack space,
33959 misbehave or jump to a random location. GCC 4.4 or newer don't have
33960 those issues, regardless the RAX register value.
33961
33962 @opindex m8bit-idiv
33963 @item -m8bit-idiv
33964 @itemx -mno-8bit-idiv
33965 On some processors, like Intel Atom, 8-bit unsigned integer divide is
33966 much faster than 32-bit/64-bit integer divide. This option generates a
33967 run-time check. If both dividend and divisor are within range of 0
33968 to 255, 8-bit unsigned integer divide is used instead of
33969 32-bit/64-bit integer divide.
33970
33971 @opindex mavx256-split-unaligned-load
33972 @opindex mavx256-split-unaligned-store
33973 @item -mavx256-split-unaligned-load
33974 @itemx -mavx256-split-unaligned-store
33975 Split 32-byte AVX unaligned load and store.
33976
33977 @opindex mstack-protector-guard
33978 @opindex mstack-protector-guard-reg
33979 @opindex mstack-protector-guard-offset
33980 @item -mstack-protector-guard=@var{guard}
33981 @itemx -mstack-protector-guard-reg=@var{reg}
33982 @itemx -mstack-protector-guard-offset=@var{offset}
33983 Generate stack protection code using canary at @var{guard}. Supported
33984 locations are @samp{global} for global canary or @samp{tls} for per-thread
33985 canary in the TLS block (the default). This option has effect only when
33986 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
33987
33988 With the latter choice the options
33989 @option{-mstack-protector-guard-reg=@var{reg}} and
33990 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
33991 which segment register (@code{%fs} or @code{%gs}) to use as base register
33992 for reading the canary, and from what offset from that base register.
33993 The default for those is as specified in the relevant ABI.
33994
33995 @opindex mgeneral-regs-only
33996 @item -mgeneral-regs-only
33997 Generate code that uses only the general-purpose registers. This
33998 prevents the compiler from using floating-point, vector, mask and bound
33999 registers.
34000
34001 @opindex mrelax-cmpxchg-loop
34002 @item -mrelax-cmpxchg-loop
34003 When emitting a compare-and-swap loop for @ref{__sync Builtins}
34004 and @ref{__atomic Builtins} lacking a native instruction, optimize
34005 for the highly contended case by issuing an atomic load before the
34006 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
34007 to save CPU power when restarting the loop.
34008
34009 @opindex mindirect-branch
34010 @item -mindirect-branch=@var{choice}
34011 Convert indirect call and jump with @var{choice}. The default is
34012 @samp{keep}, which keeps indirect call and jump unmodified.
34013 @samp{thunk} converts indirect call and jump to call and return thunk.
34014 @samp{thunk-inline} converts indirect call and jump to inlined call
34015 and return thunk. @samp{thunk-extern} converts indirect call and jump
34016 to external call and return thunk provided in a separate object file.
34017 You can control this behavior for a specific function by using the
34018 function attribute @code{indirect_branch}. @xref{Function Attributes}.
34019
34020 Note that @option{-mcmodel=large} is incompatible with
34021 @option{-mindirect-branch=thunk} and
34022 @option{-mindirect-branch=thunk-extern} since the thunk function may
34023 not be reachable in the large code model.
34024
34025 Note that @option{-mindirect-branch=thunk-extern} is compatible with
34026 @option{-fcf-protection=branch} since the external thunk can be made
34027 to enable control-flow check.
34028
34029 @opindex mfunction-return
34030 @item -mfunction-return=@var{choice}
34031 Convert function return with @var{choice}. The default is @samp{keep},
34032 which keeps function return unmodified. @samp{thunk} converts function
34033 return to call and return thunk. @samp{thunk-inline} converts function
34034 return to inlined call and return thunk. @samp{thunk-extern} converts
34035 function return to external call and return thunk provided in a separate
34036 object file. You can control this behavior for a specific function by
34037 using the function attribute @code{function_return}.
34038 @xref{Function Attributes}.
34039
34040 Note that @option{-mindirect-return=thunk-extern} is compatible with
34041 @option{-fcf-protection=branch} since the external thunk can be made
34042 to enable control-flow check.
34043
34044 Note that @option{-mcmodel=large} is incompatible with
34045 @option{-mfunction-return=thunk} and
34046 @option{-mfunction-return=thunk-extern} since the thunk function may
34047 not be reachable in the large code model.
34048
34049
34050 @opindex mindirect-branch-register
34051 @item -mindirect-branch-register
34052 Force indirect call and jump via register.
34053
34054 @opindex mharden-sls
34055 @item -mharden-sls=@var{choice}
34056 Generate code to mitigate against straight line speculation (SLS) with
34057 @var{choice}. The default is @samp{none} which disables all SLS
34058 hardening. @samp{return} enables SLS hardening for function returns.
34059 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
34060 @samp{all} enables all SLS hardening.
34061
34062 @opindex mindirect-branch-cs-prefix
34063 @item -mindirect-branch-cs-prefix
34064 Add CS prefix to call and jmp to indirect thunk with branch target in
34065 r8-r15 registers so that the call and jmp instruction length is 6 bytes
34066 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
34067 @samp{lfence; jmp *%r8-r15} at run-time.
34068
34069 @end table
34070
34071 These @samp{-m} switches are supported in addition to the above
34072 on x86-64 processors in 64-bit environments.
34073
34074 @table @gcctabopt
34075 @opindex m32
34076 @opindex m64
34077 @opindex mx32
34078 @opindex m16
34079 @opindex miamcu
34080 @item -m32
34081 @itemx -m64
34082 @itemx -mx32
34083 @itemx -m16
34084 @itemx -miamcu
34085 Generate code for a 16-bit, 32-bit or 64-bit environment.
34086 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
34087 to 32 bits, and
34088 generates code that runs on any i386 system.
34089
34090 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
34091 types to 64 bits, and generates code for the x86-64 architecture.
34092 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
34093 and @option{-mdynamic-no-pic} options.
34094
34095 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
34096 to 32 bits, and
34097 generates code for the x86-64 architecture.
34098
34099 The @option{-m16} option is the same as @option{-m32}, except for that
34100 it outputs the @code{.code16gcc} assembly directive at the beginning of
34101 the assembly output so that the binary can run in 16-bit mode.
34102
34103 The @option{-miamcu} option generates code which conforms to Intel MCU
34104 psABI. It requires the @option{-m32} option to be turned on.
34105
34106 @opindex mno-red-zone
34107 @opindex mred-zone
34108 @item -mno-red-zone
34109 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
34110 by the x86-64 ABI; it is a 128-byte area beyond the location of the
34111 stack pointer that is not modified by signal or interrupt handlers
34112 and therefore can be used for temporary data without adjusting the stack
34113 pointer. The flag @option{-mno-red-zone} disables this red zone.
34114
34115 @opindex mcmodel=small
34116 @item -mcmodel=small
34117 Generate code for the small code model: the program and its symbols must
34118 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
34119 Programs can be statically or dynamically linked. This is the default
34120 code model.
34121
34122 @opindex mcmodel=kernel
34123 @item -mcmodel=kernel
34124 Generate code for the kernel code model. The kernel runs in the
34125 negative 2 GB of the address space.
34126 This model has to be used for Linux kernel code.
34127
34128 @opindex mcmodel=medium
34129 @item -mcmodel=medium
34130 Generate code for the medium model: the program is linked in the lower 2
34131 GB of the address space. Small symbols are also placed there. Symbols
34132 with sizes larger than @option{-mlarge-data-threshold} are put into
34133 large data or BSS sections and can be located above 2GB. Programs can
34134 be statically or dynamically linked.
34135
34136 @opindex mcmodel=large
34137 @item -mcmodel=large
34138 Generate code for the large model. This model makes no assumptions
34139 about addresses and sizes of sections.
34140
34141 @opindex maddress-mode=long
34142 @item -maddress-mode=long
34143 Generate code for long address mode. This is only supported for 64-bit
34144 and x32 environments. It is the default address mode for 64-bit
34145 environments.
34146
34147 @opindex maddress-mode=short
34148 @item -maddress-mode=short
34149 Generate code for short address mode. This is only supported for 32-bit
34150 and x32 environments. It is the default address mode for 32-bit and
34151 x32 environments.
34152
34153 @opindex mneeded
34154 @item -mneeded
34155 @itemx -mno-needed
34156 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
34157 indicate the micro-architecture ISA level required to execute the binary.
34158
34159 @opindex mno-direct-extern-access
34160 @opindex mdirect-extern-access
34161 @item -mno-direct-extern-access
34162 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
34163 to access external symbols. With @option{-fpic} or @option{-fPIC},
34164 treat access to protected symbols as local symbols. The default is
34165 @option{-mdirect-extern-access}.
34166
34167 @strong{Warning:} shared libraries compiled with
34168 @option{-mno-direct-extern-access} and executable compiled with
34169 @option{-mdirect-extern-access} may not be binary compatible if
34170 protected symbols are used in shared libraries and executable.
34171
34172 @opindex munroll-only-small-loops
34173 @opindex mno-unroll-only-small-loops
34174 @item -munroll-only-small-loops
34175 Controls conservative small loop unrolling. It is default enabled by
34176 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
34177 -f[no-]unroll-[all-]loops would disable this flag to avoid any
34178 unintended unrolling behavior that user does not want.
34179
34180 @opindex mlam
34181 @item -mlam=@var{choice}
34182 LAM(linear-address masking) allows special bits in the pointer to be used
34183 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
34184 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
34185 positions 62:57 can be used for metadata.
34186 @end table
34187
34188 @node x86 Windows Options
34189 @subsection x86 Windows Options
34190 @cindex x86 Windows Options
34191 @cindex Windows Options for x86
34192
34193 These additional options are available for Microsoft Windows targets:
34194
34195 @table @gcctabopt
34196 @opindex mconsole
34197 @item -mconsole
34198 This option
34199 specifies that a console application is to be generated, by
34200 instructing the linker to set the PE header subsystem type
34201 required for console applications.
34202 This option is available for Cygwin and MinGW targets and is
34203 enabled by default on those targets.
34204
34205 @opindex mdll
34206 @item -mdll
34207 This option is available for Cygwin and MinGW targets. It
34208 specifies that a DLL---a dynamic link library---is to be
34209 generated, enabling the selection of the required runtime
34210 startup object and entry point.
34211
34212 @opindex mnop-fun-dllimport
34213 @item -mnop-fun-dllimport
34214 This option is available for Cygwin and MinGW targets. It
34215 specifies that the @code{dllimport} attribute should be ignored.
34216
34217 @opindex mthreads
34218 @item -mthreads
34219 This option is available for MinGW targets. It specifies
34220 that MinGW-specific thread support is to be used.
34221
34222 @opindex municode
34223 @item -municode
34224 This option is available for MinGW-w64 targets. It causes
34225 the @code{UNICODE} preprocessor macro to be predefined, and
34226 chooses Unicode-capable runtime startup code.
34227
34228 @opindex mwin32
34229 @item -mwin32
34230 This option is available for Cygwin and MinGW targets. It
34231 specifies that the typical Microsoft Windows predefined macros are to
34232 be set in the pre-processor, but does not influence the choice
34233 of runtime library/startup code.
34234
34235 @opindex mwindows
34236 @item -mwindows
34237 This option is available for Cygwin and MinGW targets. It
34238 specifies that a GUI application is to be generated by
34239 instructing the linker to set the PE header subsystem type
34240 appropriately.
34241
34242 @opindex fno-set-stack-executable
34243 @opindex fset-stack-executable
34244 @item -fno-set-stack-executable
34245 This option is available for MinGW targets. It specifies that
34246 the executable flag for the stack used by nested functions isn't
34247 set. This is necessary for binaries running in kernel mode of
34248 Microsoft Windows, as there the User32 API, which is used to set executable
34249 privileges, isn't available.
34250
34251 @opindex fno-writable-relocated-rdata
34252 @opindex fwritable-relocated-rdata
34253 @item -fwritable-relocated-rdata
34254 This option is available for MinGW and Cygwin targets. It specifies
34255 that relocated-data in read-only section is put into the @code{.data}
34256 section. This is a necessary for older runtimes not supporting
34257 modification of @code{.rdata} sections for pseudo-relocation.
34258
34259 @opindex mpe-aligned-commons
34260 @item -mpe-aligned-commons
34261 This option is available for Cygwin and MinGW targets. It
34262 specifies that the GNU extension to the PE file format that
34263 permits the correct alignment of COMMON variables should be
34264 used when generating code. It is enabled by default if
34265 GCC detects that the target assembler found during configuration
34266 supports the feature.
34267 @end table
34268
34269 See also under @ref{x86 Options} for standard options.
34270
34271 @node Xstormy16 Options
34272 @subsection Xstormy16 Options
34273 @cindex Xstormy16 Options
34274
34275 These options are defined for Xstormy16:
34276
34277 @table @gcctabopt
34278 @opindex msim
34279 @item -msim
34280 Choose startup files and linker script suitable for the simulator.
34281 @end table
34282
34283 @node Xtensa Options
34284 @subsection Xtensa Options
34285 @cindex Xtensa Options
34286
34287 These options are supported for Xtensa targets:
34288
34289 @table @gcctabopt
34290 @opindex mconst16
34291 @opindex mno-const16
34292 @item -mconst16
34293 @itemx -mno-const16
34294 Enable or disable use of @code{CONST16} instructions for loading
34295 constant values. The @code{CONST16} instruction is currently not a
34296 standard option from Tensilica. When enabled, @code{CONST16}
34297 instructions are always used in place of the standard @code{L32R}
34298 instructions. The use of @code{CONST16} is enabled by default only if
34299 the @code{L32R} instruction is not available.
34300
34301 @opindex mfused-madd
34302 @opindex mno-fused-madd
34303 @item -mfused-madd
34304 @itemx -mno-fused-madd
34305 Enable or disable use of fused multiply/add and multiply/subtract
34306 instructions in the floating-point option. This has no effect if the
34307 floating-point option is not also enabled. Disabling fused multiply/add
34308 and multiply/subtract instructions forces the compiler to use separate
34309 instructions for the multiply and add/subtract operations. This may be
34310 desirable in some cases where strict IEEE 754-compliant results are
34311 required: the fused multiply add/subtract instructions do not round the
34312 intermediate result, thereby producing results with @emph{more} bits of
34313 precision than specified by the IEEE standard. Disabling fused multiply
34314 add/subtract instructions also ensures that the program output is not
34315 sensitive to the compiler's ability to combine multiply and add/subtract
34316 operations.
34317
34318 @opindex mserialize-volatile
34319 @opindex mno-serialize-volatile
34320 @item -mserialize-volatile
34321 @itemx -mno-serialize-volatile
34322 When this option is enabled, GCC inserts @code{MEMW} instructions before
34323 @code{volatile} memory references to guarantee sequential consistency.
34324 The default is @option{-mserialize-volatile}. Use
34325 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
34326
34327 @opindex mforce-no-pic
34328 @item -mforce-no-pic
34329 For targets, like GNU/Linux, where all user-mode Xtensa code must be
34330 position-independent code (PIC), this option disables PIC for compiling
34331 kernel code.
34332
34333 @opindex mtext-section-literals
34334 @opindex mno-text-section-literals
34335 @item -mtext-section-literals
34336 @itemx -mno-text-section-literals
34337 These options control the treatment of literal pools. The default is
34338 @option{-mno-text-section-literals}, which places literals in a separate
34339 section in the output file. This allows the literal pool to be placed
34340 in a data RAM/ROM, and it also allows the linker to combine literal
34341 pools from separate object files to remove redundant literals and
34342 improve code size. With @option{-mtext-section-literals}, the literals
34343 are interspersed in the text section in order to keep them as close as
34344 possible to their references. This may be necessary for large assembly
34345 files. Literals for each function are placed right before that function.
34346
34347 @opindex mauto-litpools
34348 @opindex mno-auto-litpools
34349 @item -mauto-litpools
34350 @itemx -mno-auto-litpools
34351 These options control the treatment of literal pools. The default is
34352 @option{-mno-auto-litpools}, which places literals in a separate
34353 section in the output file unless @option{-mtext-section-literals} is
34354 used. With @option{-mauto-litpools} the literals are interspersed in
34355 the text section by the assembler. Compiler does not produce explicit
34356 @code{.literal} directives and loads literals into registers with
34357 @code{MOVI} instructions instead of @code{L32R} to let the assembler
34358 do relaxation and place literals as necessary. This option allows
34359 assembler to create several literal pools per function and assemble
34360 very big functions, which may not be possible with
34361 @option{-mtext-section-literals}.
34362
34363 @opindex mtarget-align
34364 @opindex mno-target-align
34365 @item -mtarget-align
34366 @itemx -mno-target-align
34367 When this option is enabled, GCC instructs the assembler to
34368 automatically align instructions to reduce branch penalties at the
34369 expense of some code density. The assembler attempts to widen density
34370 instructions to align branch targets and the instructions following call
34371 instructions. If there are not enough preceding safe density
34372 instructions to align a target, no widening is performed. The
34373 default is @option{-mtarget-align}. These options do not affect the
34374 treatment of auto-aligned instructions like @code{LOOP}, which the
34375 assembler always aligns, either by widening density instructions or
34376 by inserting NOP instructions.
34377
34378 @opindex mlongcalls
34379 @opindex mno-longcalls
34380 @item -mlongcalls
34381 @itemx -mno-longcalls
34382 When this option is enabled, GCC instructs the assembler to translate
34383 direct calls to indirect calls unless it can determine that the target
34384 of a direct call is in the range allowed by the call instruction. This
34385 translation typically occurs for calls to functions in other source
34386 files. Specifically, the assembler translates a direct @code{CALL}
34387 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
34388 The default is @option{-mno-longcalls}. This option should be used in
34389 programs where the call target can potentially be out of range. This
34390 option is implemented in the assembler, not the compiler, so the
34391 assembly code generated by GCC still shows direct call
34392 instructions---look at the disassembled object code to see the actual
34393 instructions. Note that the assembler uses an indirect call for
34394 every cross-file call, not just those that really are out of range.
34395
34396 @opindex mabi
34397 @item -mabi=@var{name}
34398 Generate code for the specified ABI@. Permissible values are: @samp{call0},
34399 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
34400
34401 @opindex mabi=call0
34402 @item -mabi=call0
34403 When this option is enabled function parameters are passed in registers
34404 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
34405 caller-saved, and register @code{a15} may be used as a frame pointer.
34406 When this version of the ABI is enabled the C preprocessor symbol
34407 @code{__XTENSA_CALL0_ABI__} is defined.
34408
34409 @opindex mabi=windowed
34410 @item -mabi=windowed
34411 When this option is enabled function parameters are passed in registers
34412 @code{a10} through @code{a15}, and called function rotates register window
34413 by 8 registers on entry so that its arguments are found in registers
34414 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
34415 pointer. Register window is rotated 8 registers back upon return.
34416 When this version of the ABI is enabled the C preprocessor symbol
34417 @code{__XTENSA_WINDOWED_ABI__} is defined.
34418
34419 @opindex mextra-l32r-costs
34420 @item -mextra-l32r-costs=@var{n}
34421 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34422 instructions, in clock cycles. This affects, when optimizing for speed,
34423 whether loading a constant from literal pool using @code{L32R} or
34424 synthesizing the constant from a small one with a couple of arithmetic
34425 instructions. The default value is 0.
34426
34427 @opindex mstrict-align
34428 @opindex mno-strict-align
34429 @item -mstrict-align
34430 @itemx -mno-strict-align
34431 Avoid or allow generating memory accesses that may not be aligned on a natural
34432 object boundary as described in the architecture specification.
34433 The default is @option{-mno-strict-align} for cores that support both
34434 unaligned loads and stores in hardware and @option{-mstrict-align} for all
34435 other cores.
34436
34437 @end table
34438
34439 @node zSeries Options
34440 @subsection zSeries Options
34441 @cindex zSeries options
34442
34443 These are listed under @xref{S/390 and zSeries Options}.
34444
34445
34446 @c man end
34447
34448 @node Spec Files
34449 @section Specifying Subprocesses and the Switches to Pass to Them
34450 @cindex Spec Files
34451
34452 @command{gcc} is a driver program. It performs its job by invoking a
34453 sequence of other programs to do the work of compiling, assembling and
34454 linking. GCC interprets its command-line parameters and uses these to
34455 deduce which programs it should invoke, and which command-line options
34456 it ought to place on their command lines. This behavior is controlled
34457 by @dfn{spec strings}. In most cases there is one spec string for each
34458 program that GCC can invoke, but a few programs have multiple spec
34459 strings to control their behavior. The spec strings built into GCC can
34460 be overridden by using the @option{-specs=} command-line switch to specify
34461 a spec file.
34462
34463 @dfn{Spec files} are plain-text files that are used to construct spec
34464 strings. They consist of a sequence of directives separated by blank
34465 lines. The type of directive is determined by the first non-whitespace
34466 character on the line, which can be one of the following:
34467
34468 @table @code
34469 @item %@var{command}
34470 Issues a @var{command} to the spec file processor. The commands that can
34471 appear here are:
34472
34473 @table @code
34474 @cindex @code{%include}
34475 @item %include <@var{file}>
34476 Search for @var{file} and insert its text at the current point in the
34477 specs file.
34478
34479 @cindex @code{%include_noerr}
34480 @item %include_noerr <@var{file}>
34481 Just like @samp{%include}, but do not generate an error message if the include
34482 file cannot be found.
34483
34484 @cindex @code{%rename}
34485 @item %rename @var{old_name} @var{new_name}
34486 Rename the spec string @var{old_name} to @var{new_name}.
34487
34488 @end table
34489
34490 @item *[@var{spec_name}]:
34491 This tells the compiler to create, override or delete the named spec
34492 string. All lines after this directive up to the next directive or
34493 blank line are considered to be the text for the spec string. If this
34494 results in an empty string then the spec is deleted. (Or, if the
34495 spec did not exist, then nothing happens.) Otherwise, if the spec
34496 does not currently exist a new spec is created. If the spec does
34497 exist then its contents are overridden by the text of this
34498 directive, unless the first character of that text is the @samp{+}
34499 character, in which case the text is appended to the spec.
34500
34501 @item [@var{suffix}]:
34502 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
34503 and up to the next directive or blank line are considered to make up the
34504 spec string for the indicated suffix. When the compiler encounters an
34505 input file with the named suffix, it processes the spec string in
34506 order to work out how to compile that file. For example:
34507
34508 @smallexample
34509 .ZZ:
34510 z-compile -input %i
34511 @end smallexample
34512
34513 This says that any input file whose name ends in @samp{.ZZ} should be
34514 passed to the program @samp{z-compile}, which should be invoked with the
34515 command-line switch @option{-input} and with the result of performing the
34516 @samp{%i} substitution. (See below.)
34517
34518 As an alternative to providing a spec string, the text following a
34519 suffix directive can be one of the following:
34520
34521 @table @code
34522 @item @@@var{language}
34523 This says that the suffix is an alias for a known @var{language}. This is
34524 similar to using the @option{-x} command-line switch to GCC to specify a
34525 language explicitly. For example:
34526
34527 @smallexample
34528 .ZZ:
34529 @@c++
34530 @end smallexample
34531
34532 Says that .ZZ files are, in fact, C++ source files.
34533
34534 @item #@var{name}
34535 This causes an error messages saying:
34536
34537 @smallexample
34538 @var{name} compiler not installed on this system.
34539 @end smallexample
34540 @end table
34541
34542 GCC already has an extensive list of suffixes built into it.
34543 This directive adds an entry to the end of the list of suffixes, but
34544 since the list is searched from the end backwards, it is effectively
34545 possible to override earlier entries using this technique.
34546
34547 @end table
34548
34549 GCC has the following spec strings built into it. Spec files can
34550 override these strings or create their own. Note that individual
34551 targets can also add their own spec strings to this list.
34552
34553 @smallexample
34554 asm Options to pass to the assembler
34555 asm_final Options to pass to the assembler post-processor
34556 cpp Options to pass to the C preprocessor
34557 cc1 Options to pass to the C compiler
34558 cc1plus Options to pass to the C++ compiler
34559 endfile Object files to include at the end of the link
34560 link Options to pass to the linker
34561 lib Libraries to include on the command line to the linker
34562 libgcc Decides which GCC support library to pass to the linker
34563 linker Sets the name of the linker
34564 predefines Defines to be passed to the C preprocessor
34565 signed_char Defines to pass to CPP to say whether @code{char} is signed
34566 by default
34567 startfile Object files to include at the start of the link
34568 @end smallexample
34569
34570 Here is a small example of a spec file:
34571
34572 @smallexample
34573 %rename lib old_lib
34574
34575 *lib:
34576 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
34577 @end smallexample
34578
34579 This example renames the spec called @samp{lib} to @samp{old_lib} and
34580 then overrides the previous definition of @samp{lib} with a new one.
34581 The new definition adds in some extra command-line options before
34582 including the text of the old definition.
34583
34584 @dfn{Spec strings} are a list of command-line options to be passed to their
34585 corresponding program. In addition, the spec strings can contain
34586 @samp{%}-prefixed sequences to substitute variable text or to
34587 conditionally insert text into the command line. Using these constructs
34588 it is possible to generate quite complex command lines.
34589
34590 Here is a table of all defined @samp{%}-sequences for spec
34591 strings. Note that spaces are not generated automatically around the
34592 results of expanding these sequences. Therefore you can concatenate them
34593 together or combine them with constant text in a single argument.
34594
34595 @table @code
34596 @item %%
34597 Substitute one @samp{%} into the program name or argument.
34598
34599 @item %"
34600 Substitute an empty argument.
34601
34602 @item %i
34603 Substitute the name of the input file being processed.
34604
34605 @item %b
34606 Substitute the basename for outputs related with the input file being
34607 processed. This is often the substring up to (and not including) the
34608 last period and not including the directory but, unless %w is active, it
34609 expands to the basename for auxiliary outputs, which may be influenced
34610 by an explicit output name, and by various other options that control
34611 how auxiliary outputs are named.
34612
34613 @item %B
34614 This is the same as @samp{%b}, but include the file suffix (text after
34615 the last period). Without %w, it expands to the basename for dump
34616 outputs.
34617
34618 @item %d
34619 Marks the argument containing or following the @samp{%d} as a
34620 temporary file name, so that that file is deleted if GCC exits
34621 successfully. Unlike @samp{%g}, this contributes no text to the
34622 argument.
34623
34624 @item %g@var{suffix}
34625 Substitute a file name that has suffix @var{suffix} and is chosen
34626 once per compilation, and mark the argument in the same way as
34627 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
34628 name is now chosen in a way that is hard to predict even when previously
34629 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
34630 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
34631 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
34632 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
34633 was simply substituted with a file name chosen once per compilation,
34634 without regard to any appended suffix (which was therefore treated
34635 just like ordinary text), making such attacks more likely to succeed.
34636
34637 @item %u@var{suffix}
34638 Like @samp{%g}, but generates a new temporary file name
34639 each time it appears instead of once per compilation.
34640
34641 @item %U@var{suffix}
34642 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
34643 new one if there is no such last file name. In the absence of any
34644 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
34645 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
34646 involves the generation of two distinct file names, one
34647 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
34648 simply substituted with a file name chosen for the previous @samp{%u},
34649 without regard to any appended suffix.
34650
34651 @item %j@var{suffix}
34652 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
34653 writable, and if @option{-save-temps} is not used;
34654 otherwise, substitute the name
34655 of a temporary file, just like @samp{%u}. This temporary file is not
34656 meant for communication between processes, but rather as a junk
34657 disposal mechanism.
34658
34659 @item %|@var{suffix}
34660 @itemx %m@var{suffix}
34661 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
34662 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
34663 all. These are the two most common ways to instruct a program that it
34664 should read from standard input or write to standard output. If you
34665 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
34666 construct: see for example @file{gcc/fortran/lang-specs.h}.
34667
34668 @item %.@var{SUFFIX}
34669 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
34670 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
34671 terminated by the next space or %.
34672
34673 @item %w
34674 Marks the argument containing or following the @samp{%w} as the
34675 designated output file of this compilation. This puts the argument
34676 into the sequence of arguments that @samp{%o} substitutes.
34677
34678 @item %V
34679 Indicates that this compilation produces no output file.
34680
34681 @item %o
34682 Substitutes the names of all the output files, with spaces
34683 automatically placed around them. You should write spaces
34684 around the @samp{%o} as well or the results are undefined.
34685 @samp{%o} is for use in the specs for running the linker.
34686 Input files whose names have no recognized suffix are not compiled
34687 at all, but they are included among the output files, so they are
34688 linked.
34689
34690 @item %O
34691 Substitutes the suffix for object files. Note that this is
34692 handled specially when it immediately follows @samp{%g, %u, or %U},
34693 because of the need for those to form complete file names. The
34694 handling is such that @samp{%O} is treated exactly as if it had already
34695 been substituted, except that @samp{%g, %u, and %U} do not currently
34696 support additional @var{suffix} characters following @samp{%O} as they do
34697 following, for example, @samp{.o}.
34698
34699 @item %I
34700 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
34701 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
34702 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
34703 and @option{-imultilib} as necessary.
34704
34705 @item %s
34706 Current argument is the name of a library or startup file of some sort.
34707 Search for that file in a standard list of directories and substitute
34708 the full name found. The current working directory is included in the
34709 list of directories scanned.
34710
34711 @item %T
34712 Current argument is the name of a linker script. Search for that file
34713 in the current list of directories to scan for libraries. If the file
34714 is located insert a @option{--script} option into the command line
34715 followed by the full path name found. If the file is not found then
34716 generate an error message. Note: the current working directory is not
34717 searched.
34718
34719 @item %e@var{str}
34720 Print @var{str} as an error message. @var{str} is terminated by a newline.
34721 Use this when inconsistent options are detected.
34722
34723 @item %n@var{str}
34724 Print @var{str} as a notice. @var{str} is terminated by a newline.
34725
34726 @item %(@var{name})
34727 Substitute the contents of spec string @var{name} at this point.
34728
34729 @item %x@{@var{option}@}
34730 Accumulate an option for @samp{%X}.
34731
34732 @item %X
34733 Output the accumulated linker options specified by a @samp{%x} spec string.
34734
34735 @item %Y
34736 Output the accumulated assembler options specified by @option{-Wa}.
34737
34738 @item %Z
34739 Output the accumulated preprocessor options specified by @option{-Wp}.
34740
34741 @item %M
34742 Output @code{multilib_os_dir}.
34743
34744 @item %R
34745 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
34746
34747 @item %a
34748 Process the @code{asm} spec. This is used to compute the
34749 switches to be passed to the assembler.
34750
34751 @item %A
34752 Process the @code{asm_final} spec. This is a spec string for
34753 passing switches to an assembler post-processor, if such a program is
34754 needed.
34755
34756 @item %l
34757 Process the @code{link} spec. This is the spec for computing the
34758 command line passed to the linker. Typically it makes use of the
34759 @samp{%L %G %S %D and %E} sequences.
34760
34761 @item %D
34762 Dump out a @option{-L} option for each directory that GCC believes might
34763 contain startup files. If the target supports multilibs then the
34764 current multilib directory is prepended to each of these paths.
34765
34766 @item %L
34767 Process the @code{lib} spec. This is a spec string for deciding which
34768 libraries are included on the command line to the linker.
34769
34770 @item %G
34771 Process the @code{libgcc} spec. This is a spec string for deciding
34772 which GCC support library is included on the command line to the linker.
34773
34774 @item %S
34775 Process the @code{startfile} spec. This is a spec for deciding which
34776 object files are the first ones passed to the linker. Typically
34777 this might be a file named @file{crt0.o}.
34778
34779 @item %E
34780 Process the @code{endfile} spec. This is a spec string that specifies
34781 the last object files that are passed to the linker.
34782
34783 @item %C
34784 Process the @code{cpp} spec. This is used to construct the arguments
34785 to be passed to the C preprocessor.
34786
34787 @item %1
34788 Process the @code{cc1} spec. This is used to construct the options to be
34789 passed to the actual C compiler (@command{cc1}).
34790
34791 @item %2
34792 Process the @code{cc1plus} spec. This is used to construct the options to be
34793 passed to the actual C++ compiler (@command{cc1plus}).
34794
34795 @item %*
34796 Substitute the variable part of a matched option. See below.
34797 Note that each comma in the substituted string is replaced by
34798 a single space.
34799
34800 @item %<S
34801 Remove all occurrences of @code{-S} from the command line. Note---this
34802 command is position dependent. @samp{%} commands in the spec string
34803 before this one see @code{-S}, @samp{%} commands in the spec string
34804 after this one do not.
34805
34806 @item %<S*
34807 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
34808
34809 @item %>S
34810 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
34811
34812 @item %:@var{function}(@var{args})
34813 Call the named function @var{function}, passing it @var{args}.
34814 @var{args} is first processed as a nested spec string, then split
34815 into an argument vector in the usual fashion. The function returns
34816 a string which is processed as if it had appeared literally as part
34817 of the current spec.
34818
34819 The following built-in spec functions are provided:
34820
34821 @table @code
34822 @item @code{getenv}
34823 The @code{getenv} spec function takes two arguments: an environment
34824 variable name and a string. If the environment variable is not
34825 defined, a fatal error is issued. Otherwise, the return value is the
34826 value of the environment variable concatenated with the string. For
34827 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
34828
34829 @smallexample
34830 %:getenv(TOPDIR /include)
34831 @end smallexample
34832
34833 expands to @file{/path/to/top/include}.
34834
34835 @item @code{if-exists}
34836 The @code{if-exists} spec function takes one argument, an absolute
34837 pathname to a file. If the file exists, @code{if-exists} returns the
34838 pathname. Here is a small example of its usage:
34839
34840 @smallexample
34841 *startfile:
34842 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
34843 @end smallexample
34844
34845 @item @code{if-exists-else}
34846 The @code{if-exists-else} spec function is similar to the @code{if-exists}
34847 spec function, except that it takes two arguments. The first argument is
34848 an absolute pathname to a file. If the file exists, @code{if-exists-else}
34849 returns the pathname. If it does not exist, it returns the second argument.
34850 This way, @code{if-exists-else} can be used to select one file or another,
34851 based on the existence of the first. Here is a small example of its usage:
34852
34853 @smallexample
34854 *startfile:
34855 crt0%O%s %:if-exists(crti%O%s) \
34856 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
34857 @end smallexample
34858
34859 @item @code{if-exists-then-else}
34860 The @code{if-exists-then-else} spec function takes at least two arguments
34861 and an optional third one. The first argument is an absolute pathname to a
34862 file. If the file exists, the function returns the second argument.
34863 If the file does not exist, the function returns the third argument if there
34864 is one, or NULL otherwise. This can be used to expand one text, or optionally
34865 another, based on the existence of a file. Here is a small example of its
34866 usage:
34867
34868 @smallexample
34869 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
34870 @end smallexample
34871
34872 @item @code{sanitize}
34873 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
34874 any address, thread or undefined behavior sanitizers are active.
34875
34876 @smallexample
34877 %@{%:sanitize(address):-funwind-tables@}
34878 @end smallexample
34879
34880 @item @code{replace-outfile}
34881 The @code{replace-outfile} spec function takes two arguments. It looks for the
34882 first argument in the outfiles array and replaces it with the second argument. Here
34883 is a small example of its usage:
34884
34885 @smallexample
34886 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
34887 @end smallexample
34888
34889 @item @code{remove-outfile}
34890 The @code{remove-outfile} spec function takes one argument. It looks for the
34891 first argument in the outfiles array and removes it. Here is a small example
34892 its usage:
34893
34894 @smallexample
34895 %:remove-outfile(-lm)
34896 @end smallexample
34897
34898 @item @code{version-compare}
34899 The @code{version-compare} spec function takes four or five arguments of the following
34900 form:
34901
34902 @smallexample
34903 <comparison-op> <arg1> [<arg2>] <switch> <result>
34904 @end smallexample
34905
34906 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
34907 The supported @code{comparison-op} values are:
34908
34909 @table @code
34910 @item >=
34911 True if @code{switch} is a later (or same) version than @code{arg1}
34912
34913 @item !>
34914 Opposite of @code{>=}
34915
34916 @item <
34917 True if @code{switch} is an earlier version than @code{arg1}
34918
34919 @item !<
34920 Opposite of @code{<}
34921
34922 @item ><
34923 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
34924
34925 @item <>
34926 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
34927 @end table
34928
34929 If the @code{switch} is not present at all, the condition is false unless the first character
34930 of the @code{comparison-op} is @code{!}.
34931
34932 @smallexample
34933 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
34934 @end smallexample
34935
34936 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
34937 passed.
34938
34939 @item @code{include}
34940 The @code{include} spec function behaves much like @code{%include}, with the advantage
34941 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
34942 the filename, and looks for it in the startfile path. It always returns NULL.
34943
34944 @smallexample
34945 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
34946 @end smallexample
34947
34948 @item @code{pass-through-libs}
34949 The @code{pass-through-libs} spec function takes any number of arguments. It
34950 finds any @option{-l} options and any non-options ending in @file{.a} (which it
34951 assumes are the names of linker input library archive files) and returns a
34952 result containing all the found arguments each prepended by
34953 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
34954 intended to be passed to the LTO linker plugin.
34955
34956 @smallexample
34957 %:pass-through-libs(%G %L %G)
34958 @end smallexample
34959
34960 @item @code{print-asm-header}
34961 The @code{print-asm-header} function takes no arguments and simply
34962 prints a banner like:
34963
34964 @smallexample
34965 Assembler options
34966 =================
34967
34968 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
34969 @end smallexample
34970
34971 It is used to separate compiler options from assembler options
34972 in the @option{--target-help} output.
34973
34974 @item @code{gt}
34975 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
34976 empty string) if the second-to-last argument is greater than the last argument, and NULL
34977 otherwise. The following example inserts the @code{link_gomp} spec if the last
34978 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
34979
34980 @smallexample
34981 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
34982 @end smallexample
34983
34984 @item @code{debug-level-gt}
34985 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
34986 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
34987 otherwise.
34988
34989 @smallexample
34990 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
34991 @end smallexample
34992 @end table
34993
34994 @item %@{S@}
34995 Substitutes the @code{-S} switch, if that switch is given to GCC@.
34996 If that switch is not specified, this substitutes nothing. Note that
34997 the leading dash is omitted when specifying this option, and it is
34998 automatically inserted if the substitution is performed. Thus the spec
34999 string @samp{%@{foo@}} matches the command-line option @option{-foo}
35000 and outputs the command-line option @option{-foo}.
35001
35002 @item %W@{S@}
35003 Like %@{@code{S}@} but mark last argument supplied within as a file to be
35004 deleted on failure.
35005
35006 @item %@@@{S@}
35007 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
35008 @code{@@FILE} if an @code{@@file} argument has been supplied.
35009
35010 @item %@{S*@}
35011 Substitutes all the switches specified to GCC whose names start
35012 with @code{-S}, but which also take an argument. This is used for
35013 switches like @option{-o}, @option{-D}, @option{-I}, etc.
35014 GCC considers @option{-o foo} as being
35015 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
35016 text, including the space. Thus two arguments are generated.
35017
35018 @item %@{S*&T*@}
35019 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
35020 (the order of @code{S} and @code{T} in the spec is not significant).
35021 There can be any number of ampersand-separated variables; for each the
35022 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
35023
35024 @item %@{S:X@}
35025 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
35026
35027 @item %@{!S:X@}
35028 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
35029
35030 @item %@{S*:X@}
35031 Substitutes @code{X} if one or more switches whose names start with
35032 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
35033 once, no matter how many such switches appeared. However, if @code{%*}
35034 appears somewhere in @code{X}, then @code{X} is substituted once
35035 for each matching switch, with the @code{%*} replaced by the part of
35036 that switch matching the @code{*}.
35037
35038 If @code{%*} appears as the last part of a spec sequence then a space
35039 is added after the end of the last substitution. If there is more
35040 text in the sequence, however, then a space is not generated. This
35041 allows the @code{%*} substitution to be used as part of a larger
35042 string. For example, a spec string like this:
35043
35044 @smallexample
35045 %@{mcu=*:--script=%*/memory.ld@}
35046 @end smallexample
35047
35048 @noindent
35049 when matching an option like @option{-mcu=newchip} produces:
35050
35051 @smallexample
35052 --script=newchip/memory.ld
35053 @end smallexample
35054
35055 @item %@{.S:X@}
35056 Substitutes @code{X}, if processing a file with suffix @code{S}.
35057
35058 @item %@{!.S:X@}
35059 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
35060
35061 @item %@{,S:X@}
35062 Substitutes @code{X}, if processing a file for language @code{S}.
35063
35064 @item %@{!,S:X@}
35065 Substitutes @code{X}, if not processing a file for language @code{S}.
35066
35067 @item %@{S|P:X@}
35068 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
35069 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
35070 @code{*} sequences as well, although they have a stronger binding than
35071 the @samp{|}. If @code{%*} appears in @code{X}, all of the
35072 alternatives must be starred, and only the first matching alternative
35073 is substituted.
35074
35075 For example, a spec string like this:
35076
35077 @smallexample
35078 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
35079 @end smallexample
35080
35081 @noindent
35082 outputs the following command-line options from the following input
35083 command-line options:
35084
35085 @smallexample
35086 fred.c -foo -baz
35087 jim.d -bar -boggle
35088 -d fred.c -foo -baz -boggle
35089 -d jim.d -bar -baz -boggle
35090 @end smallexample
35091
35092 @item %@{%:@var{function}(@var{args}):X@}
35093
35094 Call function named @var{function} with args @var{args}. If the
35095 function returns non-NULL, then @code{X} is substituted, if it returns
35096 NULL, it isn't substituted.
35097
35098 @item %@{S:X; T:Y; :D@}
35099
35100 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
35101 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
35102 be as many clauses as you need. This may be combined with @code{.},
35103 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
35104
35105
35106 @end table
35107
35108 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
35109 or similar construct can use a backslash to ignore the special meaning
35110 of the character following it, thus allowing literal matching of a
35111 character that is otherwise specially treated. For example,
35112 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
35113 @option{-std=iso9899:1999} option is given.
35114
35115 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
35116 construct may contain other nested @samp{%} constructs or spaces, or
35117 even newlines. They are processed as usual, as described above.
35118 Trailing white space in @code{X} is ignored. White space may also
35119 appear anywhere on the left side of the colon in these constructs,
35120 except between @code{.} or @code{*} and the corresponding word.
35121
35122 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
35123 handled specifically in these constructs. If another value of
35124 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
35125 @option{-W} switch is found later in the command line, the earlier
35126 switch value is ignored, except with @{@code{S}*@} where @code{S} is
35127 just one letter, which passes all matching options.
35128
35129 The character @samp{|} at the beginning of the predicate text is used to
35130 indicate that a command should be piped to the following command, but
35131 only if @option{-pipe} is specified.
35132
35133 It is built into GCC which switches take arguments and which do not.
35134 (You might think it would be useful to generalize this to allow each
35135 compiler's spec to say which switches take arguments. But this cannot
35136 be done in a consistent fashion. GCC cannot even decide which input
35137 files have been specified without knowing which switches take arguments,
35138 and it must know which input files to compile in order to tell which
35139 compilers to run).
35140
35141 GCC also knows implicitly that arguments starting in @option{-l} are to be
35142 treated as compiler output files, and passed to the linker in their
35143 proper position among the other output files.
35144
35145 @node Environment Variables
35146 @section Environment Variables Affecting GCC
35147 @cindex environment variables
35148
35149 @c man begin ENVIRONMENT
35150 This section describes several environment variables that affect how GCC
35151 operates. Some of them work by specifying directories or prefixes to use
35152 when searching for various kinds of files. Some are used to specify other
35153 aspects of the compilation environment.
35154
35155 Note that you can also specify places to search using options such as
35156 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
35157 take precedence over places specified using environment variables, which
35158 in turn take precedence over those specified by the configuration of GCC@.
35159 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
35160 GNU Compiler Collection (GCC) Internals}.
35161
35162 @table @env
35163 @vindex LANG
35164 @vindex LC_CTYPE
35165 @c @vindex LC_COLLATE
35166 @vindex LC_MESSAGES
35167 @c @vindex LC_MONETARY
35168 @c @vindex LC_NUMERIC
35169 @c @vindex LC_TIME
35170 @vindex LC_ALL
35171 @cindex locale
35172 @item LANG
35173 @itemx LC_CTYPE
35174 @c @itemx LC_COLLATE
35175 @itemx LC_MESSAGES
35176 @c @itemx LC_MONETARY
35177 @c @itemx LC_NUMERIC
35178 @c @itemx LC_TIME
35179 @itemx LC_ALL
35180 These environment variables control the way that GCC uses
35181 localization information which allows GCC to work with different
35182 national conventions. GCC inspects the locale categories
35183 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
35184 so. These locale categories can be set to any value supported by your
35185 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
35186 Kingdom encoded in UTF-8.
35187
35188 The @env{LC_CTYPE} environment variable specifies character
35189 classification. GCC uses it to determine the character boundaries in
35190 a string; this is needed for some multibyte encodings that contain quote
35191 and escape characters that are otherwise interpreted as a string
35192 end or escape.
35193
35194 The @env{LC_MESSAGES} environment variable specifies the language to
35195 use in diagnostic messages.
35196
35197 If the @env{LC_ALL} environment variable is set, it overrides the value
35198 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
35199 and @env{LC_MESSAGES} default to the value of the @env{LANG}
35200 environment variable. If none of these variables are set, GCC
35201 defaults to traditional C English behavior.
35202
35203 @vindex TMPDIR
35204 @item TMPDIR
35205 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35206 files. GCC uses temporary files to hold the output of one stage of
35207 compilation which is to be used as input to the next stage: for example,
35208 the output of the preprocessor, which is the input to the compiler
35209 proper.
35210
35211 @vindex GCC_COMPARE_DEBUG
35212 @item GCC_COMPARE_DEBUG
35213 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35214 @option{-fcompare-debug} to the compiler driver. See the documentation
35215 of this option for more details.
35216
35217 @vindex GCC_EXEC_PREFIX
35218 @item GCC_EXEC_PREFIX
35219 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35220 names of the subprograms executed by the compiler. No slash is added
35221 when this prefix is combined with the name of a subprogram, but you can
35222 specify a prefix that ends with a slash if you wish.
35223
35224 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
35225 an appropriate prefix to use based on the pathname it is invoked with.
35226
35227 If GCC cannot find the subprogram using the specified prefix, it
35228 tries looking in the usual places for the subprogram.
35229
35230 The default value of @env{GCC_EXEC_PREFIX} is
35231 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
35232 the installed compiler. In many cases @var{prefix} is the value
35233 of @code{prefix} when you ran the @file{configure} script.
35234
35235 Other prefixes specified with @option{-B} take precedence over this prefix.
35236
35237 This prefix is also used for finding files such as @file{crt0.o} that are
35238 used for linking.
35239
35240 In addition, the prefix is used in an unusual way in finding the
35241 directories to search for header files. For each of the standard
35242 directories whose name normally begins with @samp{/usr/local/lib/gcc}
35243 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
35244 replacing that beginning with the specified prefix to produce an
35245 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
35246 @file{foo/bar} just before it searches the standard directory
35247 @file{/usr/local/lib/bar}.
35248 If a standard directory begins with the configured
35249 @var{prefix} then the value of @var{prefix} is replaced by
35250 @env{GCC_EXEC_PREFIX} when looking for header files.
35251
35252 @vindex COMPILER_PATH
35253 @item COMPILER_PATH
35254 The value of @env{COMPILER_PATH} is a colon-separated list of
35255 directories, much like @env{PATH}. GCC tries the directories thus
35256 specified when searching for subprograms, if it cannot find the
35257 subprograms using @env{GCC_EXEC_PREFIX}.
35258
35259 @vindex LIBRARY_PATH
35260 @item LIBRARY_PATH
35261 The value of @env{LIBRARY_PATH} is a colon-separated list of
35262 directories, much like @env{PATH}. When configured as a native compiler,
35263 GCC tries the directories thus specified when searching for special
35264 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
35265 using GCC also uses these directories when searching for ordinary
35266 libraries for the @option{-l} option (but directories specified with
35267 @option{-L} come first).
35268
35269 @vindex LANG
35270 @cindex locale definition
35271 @item LANG
35272 This variable is used to pass locale information to the compiler. One way in
35273 which this information is used is to determine the character set to be used
35274 when character literals, string literals and comments are parsed in C and C++.
35275 When the compiler is configured to allow multibyte characters,
35276 the following values for @env{LANG} are recognized:
35277
35278 @table @samp
35279 @item C-JIS
35280 Recognize JIS characters.
35281 @item C-SJIS
35282 Recognize SJIS characters.
35283 @item C-EUCJP
35284 Recognize EUCJP characters.
35285 @end table
35286
35287 If @env{LANG} is not defined, or if it has some other value, then the
35288 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
35289 recognize and translate multibyte characters.
35290
35291 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
35292 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
35293 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
35294 then additional text will be emitted to stderr when fix-it hints are
35295 emitted. @option{-fdiagnostics-parseable-fixits} and
35296 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35297 environment variable.
35298
35299 @table @samp
35300 @item fixits-v1
35301 Emit parseable fix-it hints, equivalent to
35302 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
35303 expressed as a count of bytes, starting at byte 1 for the initial column.
35304
35305 @item fixits-v2
35306 As @code{fixits-v1}, but columns are expressed as display columns,
35307 as per @option{-fdiagnostics-column-unit=display}.
35308 @end table
35309
35310 @end table
35311
35312 @noindent
35313 Some additional environment variables affect the behavior of the
35314 preprocessor.
35315
35316 @include cppenv.texi
35317
35318 @c man end
35319
35320 @node Precompiled Headers
35321 @section Using Precompiled Headers
35322 @cindex precompiled headers
35323 @cindex speed of compilation
35324
35325 Often large projects have many header files that are included in every
35326 source file. The time the compiler takes to process these header files
35327 over and over again can account for nearly all of the time required to
35328 build the project. To make builds faster, GCC allows you to
35329 @dfn{precompile} a header file.
35330
35331 To create a precompiled header file, simply compile it as you would any
35332 other file, if necessary using the @option{-x} option to make the driver
35333 treat it as a C or C++ header file. You may want to use a
35334 tool like @command{make} to keep the precompiled header up-to-date when
35335 the headers it contains change.
35336
35337 A precompiled header file is searched for when @code{#include} is
35338 seen in the compilation. As it searches for the included file
35339 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
35340 compiler looks for a precompiled header in each directory just before it
35341 looks for the include file in that directory. The name searched for is
35342 the name specified in the @code{#include} with @samp{.gch} appended. If
35343 the precompiled header file cannot be used, it is ignored.
35344
35345 For instance, if you have @code{#include "all.h"}, and you have
35346 @file{all.h.gch} in the same directory as @file{all.h}, then the
35347 precompiled header file is used if possible, and the original
35348 header is used otherwise.
35349
35350 Alternatively, you might decide to put the precompiled header file in a
35351 directory and use @option{-I} to ensure that directory is searched
35352 before (or instead of) the directory containing the original header.
35353 Then, if you want to check that the precompiled header file is always
35354 used, you can put a file of the same name as the original header in this
35355 directory containing an @code{#error} command.
35356
35357 This also works with @option{-include}. So yet another way to use
35358 precompiled headers, good for projects not designed with precompiled
35359 header files in mind, is to simply take most of the header files used by
35360 a project, include them from another header file, precompile that header
35361 file, and @option{-include} the precompiled header. If the header files
35362 have guards against multiple inclusion, they are skipped because
35363 they've already been included (in the precompiled header).
35364
35365 If you need to precompile the same header file for different
35366 languages, targets, or compiler options, you can instead make a
35367 @emph{directory} named like @file{all.h.gch}, and put each precompiled
35368 header in the directory, perhaps using @option{-o}. It doesn't matter
35369 what you call the files in the directory; every precompiled header in
35370 the directory is considered. The first precompiled header
35371 encountered in the directory that is valid for this compilation is
35372 used; they're searched in no particular order.
35373
35374 There are many other possibilities, limited only by your imagination,
35375 good sense, and the constraints of your build system.
35376
35377 A precompiled header file can be used only when these conditions apply:
35378
35379 @itemize
35380 @item
35381 Only one precompiled header can be used in a particular compilation.
35382
35383 @item
35384 A precompiled header cannot be used once the first C token is seen. You
35385 can have preprocessor directives before a precompiled header; you cannot
35386 include a precompiled header from inside another header.
35387
35388 @item
35389 The precompiled header file must be produced for the same language as
35390 the current compilation. You cannot use a C precompiled header for a C++
35391 compilation.
35392
35393 @item
35394 The precompiled header file must have been produced by the same compiler
35395 binary as the current compilation is using.
35396
35397 @item
35398 Any macros defined before the precompiled header is included must
35399 either be defined in the same way as when the precompiled header was
35400 generated, or must not affect the precompiled header, which usually
35401 means that they don't appear in the precompiled header at all.
35402
35403 The @option{-D} option is one way to define a macro before a
35404 precompiled header is included; using a @code{#define} can also do it.
35405 There are also some options that define macros implicitly, like
35406 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
35407 defined this way.
35408
35409 @item If debugging information is output when using the precompiled
35410 header, using @option{-g} or similar, the same kind of debugging information
35411 must have been output when building the precompiled header. However,
35412 a precompiled header built using @option{-g} can be used in a compilation
35413 when no debugging information is being output.
35414
35415 @item The same @option{-m} options must generally be used when building
35416 and using the precompiled header. @xref{Submodel Options},
35417 for any cases where this rule is relaxed.
35418
35419 @item Each of the following options must be the same when building and using
35420 the precompiled header:
35421
35422 @gccoptlist{-fexceptions}
35423
35424 @item
35425 Some other command-line options starting with @option{-f},
35426 @option{-p}, or @option{-O} must be defined in the same way as when
35427 the precompiled header was generated. At present, it's not clear
35428 which options are safe to change and which are not; the safest choice
35429 is to use exactly the same options when generating and using the
35430 precompiled header. The following are known to be safe:
35431
35432 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock
35433 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
35434 -fsched-verbose=@var{number} -fschedule-insns -fvisibility=
35435 -pedantic-errors}
35436
35437 @item Address space layout randomization (ASLR) can lead to not binary identical
35438 PCH files. If you rely on stable PCH file contents disable ASLR when generating
35439 PCH files.
35440
35441 @end itemize
35442
35443 For all of these except the last, the compiler automatically
35444 ignores the precompiled header if the conditions aren't met. If you
35445 find an option combination that doesn't work and doesn't cause the
35446 precompiled header to be ignored, please consider filing a bug report,
35447 see @ref{Bugs}.
35448
35449 If you do use differing options when generating and using the
35450 precompiled header, the actual behavior is a mixture of the
35451 behavior for the options. For instance, if you use @option{-g} to
35452 generate the precompiled header but not when using it, you may or may
35453 not get debugging information for routines in the precompiled header.
35454
35455 @node C++ Modules
35456 @section C++ Modules
35457 @cindex speed of compilation
35458
35459 Modules are a C++20 language feature. As the name suggests, they
35460 provides a modular compilation system, intending to provide both
35461 faster builds and better library isolation. The ``Merging Modules''
35462 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35463 of changes to the standard, although it does not capture later
35464 changes.
35465
35466 @emph{G++'s modules support is not complete.} Other than bugs, the
35467 known missing pieces are:
35468
35469 @table @emph
35470
35471 @item Private Module Fragment
35472 The Private Module Fragment is recognized, but an error is emitted.
35473
35474 @item Partition definition visibility rules
35475 Entities may be defined in implementation partitions, and those
35476 definitions are not available outside of the module. This is not
35477 implemented, and the definitions are available to extra-module use.
35478
35479 @item Textual merging of reachable GM entities
35480 Entities may be multiply defined across different header-units.
35481 These must be de-duplicated, and this is implemented across imports,
35482 or when an import redefines a textually-defined entity. However the
35483 reverse is not implemented---textually redefining an entity that has
35484 been defined in an imported header-unit. A redefinition error is
35485 emitted.
35486
35487 @item Translation-Unit local referencing rules
35488 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35489 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35490 exported region may reference (for instance, the entities an exported
35491 template definition may reference). These are not fully implemented.
35492
35493 @item Standard Library Header Units
35494 The Standard Library is not provided as importable header units. If
35495 you want to import such units, you must explicitly build them first.
35496 If you do not do this with care, you may have multiple declarations,
35497 which the module machinery must merge---compiler resource usage can be
35498 affected by how you partition header files into header units.
35499
35500 @end table
35501
35502 Modular compilation is @emph{not} enabled with just the
35503 @option{-std=c++20} option. You must explicitly enable it with the
35504 @option{-fmodules-ts} option. It is independent of the language
35505 version selected, although in pre-C++20 versions, it is of course an
35506 extension.
35507
35508 No new source file suffixes are required or supported. If you wish to
35509 use a non-standard suffix (@pxref{Overall Options}), you also need
35510 to provide a @option{-x c++} option too.@footnote{Some users like to
35511 distinguish module interface files with a new suffix, such as naming
35512 the source @code{module.cppm}, which involves
35513 teaching all tools about the new suffix. A different scheme, such as
35514 naming @code{module-m.cpp} would be less invasive.}
35515
35516 Compiling a module interface unit produces an additional output (to
35517 the assembly or object file), called a Compiled Module Interface
35518 (CMI). This encodes the exported declarations of the module.
35519 Importing a module reads in the CMI. The import graph is a Directed
35520 Acyclic Graph (DAG). You must build imports before the importer.
35521
35522 Header files may themselves be compiled to header units, which are a
35523 transitional ability aiming at faster compilation. The
35524 @option{-fmodule-header} option is used to enable this, and implies
35525 the @option{-fmodules-ts} option. These CMIs are named by the fully
35526 resolved underlying header file, and thus may be a complete pathname
35527 containing subdirectories. If the header file is found at an absolute
35528 pathname, the CMI location is still relative to a CMI root directory.
35529
35530 As header files often have no suffix, you commonly have to specify a
35531 @option{-x} option to tell the compiler the source is a header file.
35532 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35533 @option{-x c++-system-header}. When used in conjunction with
35534 @option{-fmodules-ts}, these all imply an appropriate
35535 @option{-fmodule-header} option. The latter two variants use the
35536 user or system include path to search for the file specified. This
35537 allows you to, for instance, compile standard library header files as
35538 header units, without needing to know exactly where they are
35539 installed. Specifying the language as one of these variants also
35540 inhibits output of the object file, as header files have no associated
35541 object file.
35542
35543 The @option{-fmodule-only} option disables generation of the
35544 associated object file for compiling a module interface. Only the CMI
35545 is generated. This option is implied when using the
35546 @option{-fmodule-header} option.
35547
35548 The @option{-flang-info-include-translate} and
35549 @option{-flang-info-include-translate-not} options notes whether
35550 include translation occurs or not. With no argument, the first will
35551 note all include translation. The second will note all
35552 non-translations of include files not known to intentionally be
35553 textual. With an argument, queries about include translation of a
35554 header files with that particular trailing pathname are noted. You
35555 may repeat this form to cover several different header files. This
35556 option may be helpful in determining whether include translation is
35557 happening---if it is working correctly, it behaves as if it isn't
35558 there at all.
35559
35560 The @option{-flang-info-module-cmi} option can be used to determine
35561 where the compiler is reading a CMI from. Without the option, the
35562 compiler is silent when such a read is successful. This option has an
35563 optional argument, which will restrict the notification to just the
35564 set of named modules or header units specified.
35565
35566 The @option{-Winvalid-imported-macros} option causes all imported macros
35567 to be resolved at the end of compilation. Without this, imported
35568 macros are only resolved when expanded or (re)defined. This option
35569 detects conflicting import definitions for all macros.
35570
35571 For details of the @option{-fmodule-mapper} family of options,
35572 @pxref{C++ Module Mapper}.
35573
35574 @menu
35575 * C++ Module Mapper:: Module Mapper
35576 * C++ Module Preprocessing:: Module Preprocessing
35577 * C++ Compiled Module Interface:: Compiled Module Interface
35578 @end menu
35579
35580 @node C++ Module Mapper
35581 @subsection Module Mapper
35582 @cindex C++ Module Mapper
35583
35584 A module mapper provides a server or file that the compiler queries to
35585 determine the mapping between module names and CMI files. It is also
35586 used to build CMIs on demand. @emph{Mapper functionality is in its
35587 infancy and is intended for experimentation with build system
35588 interactions.}
35589
35590 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
35591 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
35592 have one of the following forms:
35593
35594 @table @gcctabopt
35595
35596 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
35597 An optional hostname and a numeric port number to connect to. If the
35598 hostname is omitted, the loopback address is used. If the hostname
35599 corresponds to multiple IPV6 addresses, these are tried in turn, until
35600 one is successful. If your host lacks IPv6, this form is
35601 non-functional. If you must use IPv4 use
35602 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
35603
35604 @item =@var{socket}@r{[}?@var{ident}@r{]}
35605 A local domain socket. If your host lacks local domain sockets, this
35606 form is non-functional.
35607
35608 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
35609 A program to spawn, and communicate with on its stdin/stdout streams.
35610 Your @var{PATH} environment variable is searched for the program.
35611 Arguments are separated by space characters, (it is not possible for
35612 one of the arguments delivered to the program to contain a space). An
35613 exception is if @var{program} begins with @@. In that case
35614 @var{program} (sans @@) is looked for in the compiler's internal
35615 binary directory. Thus the sample mapper-server can be specified
35616 with @code{@@g++-mapper-server}.
35617
35618 @item <>@r{[}?@var{ident}@r{]}
35619 @item <>@var{inout}@r{[}?@var{ident}@r{]}
35620 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
35621 Named pipes or file descriptors to communicate over. The first form,
35622 @option{<>}, communicates over stdin and stdout. The other forms
35623 allow you to specify a file descriptor or name a pipe. A numeric value
35624 is interpreted as a file descriptor, otherwise named pipe is opened.
35625 The second form specifies a bidirectional pipe and the last form
35626 allows specifying two independent pipes. Using file descriptors
35627 directly in this manner is fragile in general, as it can require the
35628 cooperation of intermediate processes. In particular using stdin &
35629 stdout is fraught with danger as other compiler options might also
35630 cause the compiler to read stdin or write stdout, and it can have
35631 unfortunate interactions with signal delivery from the terminal.
35632
35633 @item @var{file}@r{[}?@var{ident}@r{]}
35634 A mapping file consisting of space-separated module-name, filename
35635 pairs, one per line. Only the mappings for the direct imports and any
35636 module export name need be provided. If other mappings are provided,
35637 they override those stored in any imported CMI files. A repository
35638 root may be specified in the mapping file by using @samp{$root} as the
35639 module name in the first active line. Use of this option will disable
35640 any default module->CMI name mapping.
35641
35642 @end table
35643
35644 As shown, an optional @var{ident} may suffix the first word of the
35645 option, indicated by a @samp{?} prefix. The value is used in the
35646 initial handshake with the module server, or to specify a prefix on
35647 mapping file lines. In the server case, the main source file name is
35648 used if no @var{ident} is specified. In the file case, all non-blank
35649 lines are significant, unless a value is specified, in which case only
35650 lines beginning with @var{ident} are significant. The @var{ident}
35651 must be separated by whitespace from the module name. Be aware that
35652 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
35653 significant to the shell, and therefore may need quoting.
35654
35655 The mapper is connected to or loaded lazily, when the first module
35656 mapping is required. The networking protocols are only supported on
35657 hosts that provide networking. If no mapper is specified a default is
35658 provided.
35659
35660 A project-specific mapper is expected to be provided by the build
35661 system that invokes the compiler. It is not expected that a
35662 general-purpose server is provided for all compilations. As such, the
35663 server will know the build configuration, the compiler it invoked, and
35664 the environment (such as working directory) in which that is
35665 operating. As it may parallelize builds, several compilations may
35666 connect to the same socket.
35667
35668 The default mapper generates CMI files in a @samp{gcm.cache}
35669 directory. CMI files have a @samp{.gcm} suffix. The module unit name
35670 is used directly to provide the basename. Header units construct a
35671 relative path using the underlying header file name. If the path is
35672 already relative, a @samp{,} directory is prepended. Internal
35673 @samp{..} components are translated to @samp{,,}. No attempt is made
35674 to canonicalize these filenames beyond that done by the preprocessor's
35675 include search algorithm, as in general it is ambiguous when symbolic
35676 links are present.
35677
35678 The mapper protocol was published as ``A Module Mapper''
35679 @uref{https://wg21.link/p1184}. The implementation is provided by
35680 @command{libcody}, @uref{https://github.com/urnathan/libcody},
35681 which specifies the canonical protocol definition. A proof of concept
35682 server implementation embedded in @command{make} was described in
35683 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
35684
35685 @node C++ Module Preprocessing
35686 @subsection Module Preprocessing
35687 @cindex C++ Module Preprocessing
35688
35689 Modules affect preprocessing because of header units and include
35690 translation. Some uses of the preprocessor as a separate step either
35691 do not produce a correct output, or require CMIs to be available.
35692
35693 Header units import macros. These macros can affect later conditional
35694 inclusion, which therefore can cascade to differing import sets. When
35695 preprocessing, it is necessary to load the CMI. If a header unit is
35696 unavailable, the preprocessor issues a warning and continue (when
35697 not just preprocessing, an error is emitted). Detecting such imports
35698 requires preprocessor tokenization of the input stream to phase 4
35699 (macro expansion).
35700
35701 Include translation converts @code{#include}, @code{#include_next} and
35702 @code{#import} directives to internal @code{import} declarations.
35703 Whether a particular directive is translated is controlled by the
35704 module mapper. Header unit names are canonicalized during
35705 preprocessing.
35706
35707 Dependency information can be emitted for macro import, extending the
35708 functionality of @option{-MD} and @option{-MMD} options. Detection of
35709 import declarations also requires phase 4 preprocessing, and thus
35710 requires full preprocessing (or compilation).
35711
35712 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
35713 preprocessing before phase 4.
35714
35715 The @option{-save-temps} option uses @option{-fdirectives-only} for
35716 preprocessing, and preserve the macro definitions in the preprocessed
35717 output. Usually you also want to use this option when explicitly
35718 preprocessing a header-unit, or consuming such preprocessed output:
35719
35720 @smallexample
35721 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
35722 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
35723 @end smallexample
35724
35725 @node C++ Compiled Module Interface
35726 @subsection Compiled Module Interface
35727 @cindex C++ Compiled Module Interface
35728
35729 CMIs are an additional artifact when compiling named module
35730 interfaces, partitions or header units. These are read when
35731 importing. CMI contents are implementation-specific, and in GCC's
35732 case tied to the compiler version. Consider them a rebuildable cache
35733 artifact, not a distributable object.
35734
35735 When creating an output CMI, any missing directory components are
35736 created in a manner that is safe for concurrent builds creating
35737 multiple, different, CMIs within a common subdirectory tree.
35738
35739 CMI contents are written to a temporary file, which is then atomically
35740 renamed. Observers either see old contents (if there is an
35741 existing file), or complete new contents. They do not observe the
35742 CMI during its creation. This is unlike object file writing, which
35743 may be observed by an external process.
35744
35745 CMIs are read in lazily, if the host OS provides @code{mmap}
35746 functionality. Generally blocks are read when name lookup or template
35747 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
35748 option may be used.
35749
35750 The @option{--param lazy-modules=@var{n}} parameter controls the limit
35751 on the number of concurrently open module files during lazy loading.
35752 Should more modules be imported, an LRU algorithm is used to determine
35753 which files to close---until that file is needed again. This limit
35754 may be exceeded with deep module dependency hierarchies. With large
35755 code bases there may be more imports than the process limit of file
35756 descriptors. By default, the limit is a few less than the per-process
35757 file descriptor hard limit, if that is determinable.@footnote{Where
35758 applicable the soft limit is incremented as needed towards the hard limit.}
35759
35760 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
35761 You may use @command{readelf} to inspect them, although section
35762 contents are largely undecipherable. There is a section named
35763 @code{.gnu.c++.README}, which contains human-readable text. Other
35764 than the first line, each line consists of @code{@var{tag}: @code{value}}
35765 tuples.
35766
35767 @smallexample
35768 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
35769
35770 String dump of section '.gnu.c++.README':
35771 [ 0] GNU C++ primary module interface
35772 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
35773 [ 6f] version: 2020/11/16-04:54
35774 [ 89] module: foo
35775 [ 95] source: c_b.ii
35776 [ a4] dialect: C++20/coroutines
35777 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
35778 [ ee] repository: gcm.cache
35779 [ 104] buildtime: 2020/11/16 15:03:21 UTC
35780 [ 127] localtime: 2020/11/16 07:03:21 PST
35781 [ 14a] export: foo:part1 foo-part1.gcm
35782 @end smallexample
35783
35784 Amongst other things, this lists the source that was built, C++
35785 dialect used and imports of the module.@footnote{The precise contents
35786 of this output may change.} The timestamp is the same value as that
35787 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
35788 explicitly specified with the environment variable
35789 @code{SOURCE_DATE_EPOCH}. For further details
35790 @pxref{Environment Variables}.
35791
35792 A set of related CMIs may be copied, provided the relative pathnames
35793 are preserved.
35794
35795 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
35796 it may be removed or altered. The section numbering of the sections
35797 whose names do not begin with @code{.gnu.c++.}, or are not the string
35798 section is significant and must not be altered.
This page took 1.796303 seconds and 5 git commands to generate.