tended to use \f(CW\*(C`strcmp\*(C'\fR. This warning is enabled by \&\fB\-Wall\fR. .IP "\fB\-Wlogical\-op\fR" 4 .IX Item "-Wlogical-op" Warn about suspicious uses of logical operators in expressions. This includes using logical operators in contexts where a bit-wise operator is likely to be expected. .IP "\fB\-Waggregate\-return\fR" 4 .IX Item "-Waggregate-return" Warn if any functions that return structures or unions are defined or called. (In languages where you can return an array, this also elicits a warning.) .IP "\fB\-Wno\-attributes\fR" 4 .IX Item "-Wno-attributes" Do not warn if an unexpected \f(CW\*(C`_\|_attribute_\|_\*(C'\fR is used, such as unrecognized attributes, function attributes applied to variables, etc. This will not stop errors for incorrect use of supported attributes. .IP "\fB\-Wstrict\-prototypes\fR (C and Objective-C only)" 4 .IX Item "-Wstrict-prototypes (C and Objective-C only)" Warn if a function is declared or defined without specifying the argument types. (An old-style function definition is permitted without a warning if preceded by a declaration which specifies the argument types.) .IP "\fB\-Wold\-style\-declaration\fR (C and Objective-C only)" 4 .IX Item "-Wold-style-declaration (C and Objective-C only)" Warn for obsolescent usages, according to the C Standard, in a declaration. For example, warn if storage-class specifiers like \&\f(CW\*(C`static\*(C'\fR are not the first things in a declaration. This warning is also enabled by \fB\-Wextra\fR. .IP "\fB\-Wold\-style\-definition\fR (C and Objective-C only)" 4 .IX Item "-Wold-style-definition (C and Objective-C only)" Warn if an old-style function definition is used. A warning is given even if there is a previous prototype. .IP "\fB\-Wmissing\-parameter\-type\fR (C and Objective-C only)" 4 .IX Item "-Wmissing-parameter-type (C and Objective-C only)" A function parameter is declared without a type specifier in K&R\-style functions: .Sp .Vb 1 \& void foo(bar) { } .Ve .Sp This warning is also enabled by \fB\-Wextra\fR. .IP "\fB\-Wmissing\-prototypes\fR (C and Objective-C only)" 4 .IX Item "-Wmissing-prototypes (C and Objective-C only)" Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. The aim is to detect global functions that fail to be declared in header files. .IP "\fB\-Wmissing\-declarations\fR" 4 .IX Item "-Wmissing-declarations" Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. In \*(C+, no warnings are issued for function templates, or for inline functions, or for functions in anonymous namespaces. .IP "\fB\-Wmissing\-field\-initializers\fR" 4 .IX Item "-Wmissing-field-initializers" Warn if a structure's initializer has some fields missing. For example, the following code would cause such a warning, because \&\f(CW\*(C`x.h\*(C'\fR is implicitly zero: .Sp .Vb 2 \& struct s { int f, g, h; }; \& struct s x = { 3, 4 }; .Ve .Sp This option does not warn about designated initializers, so the following modification would not trigger a warning: .Sp .Vb 2 \& struct s { int f, g, h; }; \& struct s x = { .f = 3, .g = 4 }; .Ve .Sp This warning is included in \fB\-Wextra\fR. To get other \fB\-Wextra\fR warnings without this one, use \fB\-Wextra \-Wno\-missing\-field\-initializers\fR. .IP "\fB\-Wmissing\-noreturn\fR" 4 .IX Item "-Wmissing-noreturn" Warn about functions which might be candidates for attribute \f(CW\*(C`noreturn\*(C'\fR. Note these are only possible candidates, not absolute ones. Care should be taken to manually verify functions actually do not ever return before adding the \f(CW\*(C`noreturn\*(C'\fR attribute, otherwise subtle code generation bugs could be introduced. You will not get a warning for \f(CW\*(C`main\*(C'\fR in hosted C environments. .IP "\fB\-Wmissing\-format\-attribute\fR" 4 .IX Item "-Wmissing-format-attribute" Warn about function pointers which might be candidates for \f(CW\*(C`format\*(C'\fR attributes. Note these are only possible candidates, not absolute ones. \&\s-1GCC\s0 will guess that function pointers with \f(CW\*(C`format\*(C'\fR attributes that are used in assignment, initialization, parameter passing or return statements should have a corresponding \f(CW\*(C`format\*(C'\fR attribute in the resulting type. I.e. the left-hand side of the assignment or initialization, the type of the parameter variable, or the return type of the containing function respectively should also have a \f(CW\*(C`format\*(C'\fR attribute to avoid the warning. .Sp \&\s-1GCC\s0 will also warn about function definitions which might be candidates for \f(CW\*(C`format\*(C'\fR attributes. Again, these are only possible candidates. \s-1GCC\s0 will guess that \f(CW\*(C`format\*(C'\fR attributes might be appropriate for any function that calls a function like \&\f(CW\*(C`vprintf\*(C'\fR or \f(CW\*(C`vscanf\*(C'\fR, but this might not always be the case, and some functions for which \f(CW\*(C`format\*(C'\fR attributes are appropriate may not be detected. .IP "\fB\-Wno\-multichar\fR" 4 .IX Item "-Wno-multichar" Do not warn if a multicharacter constant (\fB'\s-1FOOF\s0'\fR) is used. Usually they indicate a typo in the user's code, as they have implementation-defined values, and should not be used in portable code. .IP "\fB\-Wnormalized=\fR" 4 .IX Item "-Wnormalized=" In \s-1ISO\s0 C and \s-1ISO\s0 \*(C+, two identifiers are different if they are different sequences of characters. However, sometimes when characters outside the basic \s-1ASCII\s0 character set are used, you can have two different character sequences that look the same. To avoid confusion, the \s-1ISO\s0 10646 standard sets out some \fInormalization rules\fR which when applied ensure that two sequences that look the same are turned into the same sequence. \s-1GCC\s0 can warn you if you are using identifiers which have not been normalized; this option controls that warning. .Sp There are four levels of warning that \s-1GCC\s0 supports. The default is \&\fB\-Wnormalized=nfc\fR, which warns about any identifier which is not in the \s-1ISO\s0 10646 \*(L"C\*(R" normalized form, \fI\s-1NFC\s0\fR. \s-1NFC\s0 is the recommended form for most uses. .Sp Unfortunately, there are some characters which \s-1ISO\s0 C and \s-1ISO\s0 \*(C+ allow in identifiers that when turned into \s-1NFC\s0 aren't allowable as identifiers. That is, there's no way to use these symbols in portable \&\s-1ISO\s0 C or \*(C+ and have all your identifiers in \s-1NFC\s0. \&\fB\-Wnormalized=id\fR suppresses the warning for these characters. It is hoped that future versions of the standards involved will correct this, which is why this option is not the default. .Sp You can switch the warning off for all characters by writing \&\fB\-Wnormalized=none\fR. You would only want to do this if you were using some other normalization scheme (like \*(L"D\*(R"), because otherwise you can easily create bugs that are literally impossible to see. .Sp Some characters in \s-1ISO\s0 10646 have distinct meanings but look identical in some fonts or display methodologies, especially once formatting has been applied. For instance \f(CW\*(C`\eu207F\*(C'\fR, \*(L"\s-1SUPERSCRIPT\s0 \s-1LATIN\s0 \s-1SMALL\s0 \&\s-1LETTER\s0 N\*(R", will display just like a regular \f(CW\*(C`n\*(C'\fR which has been placed in a superscript. \s-1ISO\s0 10646 defines the \fI\s-1NFKC\s0\fR normalization scheme to convert all these into a standard form as well, and \s-1GCC\s0 will warn if your code is not in \s-1NFKC\s0 if you use \&\fB\-Wnormalized=nfkc\fR. This warning is comparable to warning about every identifier that contains the letter O because it might be confused with the digit 0, and so is not the default, but may be useful as a local coding convention if the programming environment is unable to be fixed to display these characters distinctly. .IP "\fB\-Wno\-deprecated\-declarations\fR" 4 .IX Item "-Wno-deprecated-declarations" Do not warn about uses of functions, variables, and types marked as deprecated by using the \f(CW\*(C`deprecated\*(C'\fR attribute. .IP "\fB\-Wno\-overflow\fR" 4 .IX Item "-Wno-overflow" Do not warn about compile-time overflow in constant expressions. .IP "\fB\-Woverride\-init\fR (C and Objective-C only)" 4 .IX Item "-Woverride-init (C and Objective-C only)" Warn if an initialized field without side effects is overridden when using designated initializers. .Sp This warning is included in \fB\-Wextra\fR. To get other \&\fB\-Wextra\fR warnings without this one, use \fB\-Wextra \&\-Wno\-override\-init\fR. .IP "\fB\-Wpacked\fR" 4 .IX Item "-Wpacked" Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or size of the structure. Such structures may be mis-aligned for little benefit. For instance, in this code, the variable \f(CW\*(C`f.x\*(C'\fR in \f(CW\*(C`struct bar\*(C'\fR will be misaligned even though \f(CW\*(C`struct bar\*(C'\fR does not itself have the packed attribute: .Sp .Vb 8 \& struct foo { \& int x; \& char a, b, c, d; \& } _\|_attribute_\|_((packed)); \& struct bar { \& char z; \& struct foo f; \& }; .Ve .IP "\fB\-Wpadded\fR" 4 .IX Item "-Wpadded" Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure. Sometimes when this happens it is possible to rearrange the fields of the structure to reduce the padding and so make the structure smaller. .IP "\fB\-Wredundant\-decls\fR" 4 .IX Item "-Wredundant-decls" Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing. .IP "\fB\-Wnested\-externs\fR (C and Objective-C only)" 4 .IX Item "-Wnested-externs (C and Objective-C only)" Warn if an \f(CW\*(C`extern\*(C'\fR declaration is encountered within a function. .IP "\fB\-Wunreachable\-code\fR" 4 .IX Item "-Wunreachable-code" Warn if the compiler detects that code will never be executed. .Sp This option is intended to warn when the compiler detects that at least a whole line of source code will never be executed, because some condition is never satisfied or because it is after a procedure that never returns. .Sp It is possible for this option to produce a warning even though there are circumstances under which part of the affected line can be executed, so care should be taken when removing apparently-unreachable code. .Sp For instance, when a function is inlined, a warning may mean that the line is unreachable in only one inlined copy of the function. .Sp This option is not made part of \fB\-Wall\fR because in a debugging version of a program there is often substantial code which checks correct functioning of the program and is, hopefully, unreachable because the program does work. Another common use of unreachable code is to provide behavior which is selectable at compile-time. .IP "\fB\-Winline\fR" 4 .IX Item "-Winline" Warn if a function can not be inlined and it was declared as inline. Even with this option, the compiler will not warn about failures to inline functions declared in system headers. .Sp The compiler uses a variety of heuristics to determine whether or not to inline a function. For example, the compiler takes into account the size of the function being inlined and the amount of inlining that has already been done in the current function. Therefore, seemingly insignificant changes in the source program can cause the warnings produced by \fB\-Winline\fR to appear or disappear. .IP "\fB\-Wno\-invalid\-offsetof\fR (\*(C+ and Objective\-\*(C+ only)" 4 .IX Item "-Wno-invalid-offsetof ( and Objective- only)" Suppress warnings from applying the \fBoffsetof\fR macro to a non-POD type. According to the 1998 \s-1ISO\s0 \*(C+ standard, applying \fBoffsetof\fR to a non-POD type is undefined. In existing \*(C+ implementations, however, \fBoffsetof\fR typically gives meaningful results even when applied to certain kinds of non-POD types. (Such as a simple \&\fBstruct\fR that fails to be a \s-1POD\s0 type only by virtue of having a constructor.) This flag is for users who are aware that they are writing nonportable code and who have deliberately chosen to ignore the warning about it. .Sp The restrictions on \fBoffsetof\fR may be relaxed in a future version of the \*(C+ standard. .IP "\fB\-Wno\-int\-to\-pointer\-cast\fR (C and Objective-C only)" 4 .IX Item "-Wno-int-to-pointer-cast (C and Objective-C only)" Suppress warnings from casts to pointer type of an integer of a different size. .IP "\fB\-Wno\-pointer\-to\-int\-cast\fR (C and Objective-C only)" 4 .IX Item "-Wno-pointer-to-int-cast (C and Objective-C only)" Suppress warnings from casts from a pointer to an integer type of a different size. .IP "\fB\-Winvalid\-pch\fR" 4 .IX Item "-Winvalid-pch" Warn if a precompiled header is found in the search path but can't be used. .IP "\fB\-Wlong\-long\fR" 4 .IX Item "-Wlong-long" Warn if \fBlong long\fR type is used. This is default. To inhibit the warning messages, use \fB\-Wno\-long\-long\fR. Flags \&\fB\-Wlong\-long\fR and \fB\-Wno\-long\-long\fR are taken into account only when \fB\-pedantic\fR flag is used. .IP "\fB\-Wvariadic\-macros\fR" 4 .IX Item "-Wvariadic-macros" Warn if variadic macros are used in pedantic \s-1ISO\s0 C90 mode, or the \s-1GNU\s0 alternate syntax when in pedantic \s-1ISO\s0 C99 mode. This is default. To inhibit the warning messages, use \fB\-Wno\-variadic\-macros\fR. .IP "\fB\-Wvla\fR" 4 .IX Item "-Wvla" Warn if variable length array is used in the code. \&\fB\-Wno\-vla\fR will prevent the \fB\-pedantic\fR warning of the variable length array. .IP "\fB\-Wvolatile\-register\-var\fR" 4 .IX Item "-Wvolatile-register-var" Warn if a register variable is declared volatile. The volatile modifier does not inhibit all optimizations that may eliminate reads and/or writes to register variables. .IP "\fB\-Wdisabled\-optimization\fR" 4 .IX Item "-Wdisabled-optimization" Warn if a requested optimization pass is disabled. This warning does not generally indicate that there is anything wrong with your code; it merely indicates that \s-1GCC\s0's optimizers were unable to handle the code effectively. Often, the problem is that your code is too big or too complex; \s-1GCC\s0 will refuse to optimize programs when the optimization itself is likely to take inordinate amounts of time. .IP "\fB\-Wpointer\-sign\fR (C and Objective-C only)" 4 .IX Item "-Wpointer-sign (C and Objective-C only)" Warn for pointer argument passing or assignment with different signedness. This option is only supported for C and Objective-C. It is implied by \&\fB\-Wall\fR and by \fB\-pedantic\fR, which can be disabled with \&\fB\-Wno\-pointer\-sign\fR. .IP "\fB\-Wstack\-protector\fR" 4 .IX Item "-Wstack-protector" This option is only active when \fB\-fstack\-protector\fR is active. It warns about functions that will not be protected against stack smashing. .IP "\fB\-Woverlength\-strings\fR" 4 .IX Item "-Woverlength-strings" Warn about string constants which are longer than the \*(L"minimum maximum\*(R" length specified in the C standard. Modern compilers generally allow string constants which are much longer than the standard's minimum limit, but very portable programs should avoid using longer strings. .Sp The limit applies \fIafter\fR string constant concatenation, and does not count the trailing \s-1NUL\s0. In C89, the limit was 509 characters; in C99, it was raised to 4095. \*(C+98 does not specify a normative minimum maximum, so we do not diagnose overlength strings in \*(C+. .Sp This option is implied by \fB\-pedantic\fR, and can be disabled with \&\fB\-Wno\-overlength\-strings\fR. .Sh "Options for Debugging Your Program or \s-1GCC\s0" .IX Subsection "Options for Debugging Your Program or GCC" \&\s-1GCC\s0 has various special options that are used for debugging either your program or \s-1GCC:\s0 .IP "\fB\-g\fR" 4 .IX Item "-g" Produce debugging information in the operating system's native format (stabs, \s-1COFF\s0, \s-1XCOFF\s0, or \s-1DWARF\s0 2). \s-1GDB\s0 can work with this debugging information. .Sp On most systems that use stabs format, \fB\-g\fR enables use of extra debugging information that only \s-1GDB\s0 can use; this extra information makes debugging work better in \s-1GDB\s0 but will probably make other debuggers crash or refuse to read the program. If you want to control for certain whether to generate the extra information, use \fB\-gstabs+\fR, \fB\-gstabs\fR, \&\fB\-gxcoff+\fR, \fB\-gxcoff\fR, or \fB\-gvms\fR (see below). .Sp \&\s-1GCC\s0 allows you to use \fB\-g\fR with \&\fB\-O\fR. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops. .Sp Nevertheless it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs. .Sp The following options are useful when \s-1GCC\s0 is generated with the capability for more than one debugging format. .IP "\fB\-ggdb\fR" 4 .IX Item "-ggdb" Produce debugging information for use by \s-1GDB\s0. This means to use the most expressive format available (\s-1DWARF\s0 2, stabs, or the native format if neither of those are supported), including \s-1GDB\s0 extensions if at all possible. .IP "\fB\-gstabs\fR" 4 .IX Item "-gstabs" Produce debugging information in stabs format (if that is supported), without \s-1GDB\s0 extensions. This is the format used by \s-1DBX\s0 on most \s-1BSD\s0 systems. On \s-1MIPS\s0, Alpha and System V Release 4 systems this option produces stabs debugging output which is not understood by \s-1DBX\s0 or \s-1SDB\s0. On System V Release 4 systems this option requires the \s-1GNU\s0 assembler. .IP "\fB\-feliminate\-unused\-debug\-symbols\fR" 4 .IX Item "-feliminate-unused-debug-symbols" Produce debugging information in stabs format (if that is supported), for only symbols that are actually used. .IP "\fB\-femit\-class\-debug\-always\fR" 4 .IX Item "-femit-class-debug-always" Instead of emitting debugging information for a \*(C+ class in only one object file, emit it in all object files using the class. This option should be used only with debuggers that are unable to handle the way \s-1GCC\s0 normally emits debugging information for classes because using this option will increase the size of debugging information by as much as a factor of two. .IP "\fB\-gstabs+\fR" 4 .IX Item "-gstabs+" Produce debugging information in stabs format (if that is supported), using \s-1GNU\s0 extensions understood only by the \s-1GNU\s0 debugger (\s-1GDB\s0). The use of these extensions is likely to make other debuggers crash or refuse to read the program. .IP "\fB\-gcoff\fR" 4 .IX Item "-gcoff" Produce debugging information in \s-1COFF\s0 format (if that is supported). This is the format used by \s-1SDB\s0 on most System V systems prior to System V Release 4. .IP "\fB\-gxcoff\fR" 4 .IX Item "-gxcoff" Produce debugging information in \s-1XCOFF\s0 format (if that is supported). This is the format used by the \s-1DBX\s0 debugger on \s-1IBM\s0 \s-1RS/6000\s0 systems. .IP "\fB\-gxcoff+\fR" 4 .IX Item "-gxcoff+" Produce debugging information in \s-1XCOFF\s0 format (if that is supported), using \s-1GNU\s0 extensions understood only by the \s-1GNU\s0 debugger (\s-1GDB\s0). The use of these extensions is likely to make other debuggers crash or refuse to read the program, and may cause assemblers other than the \s-1GNU\s0 assembler (\s-1GAS\s0) to fail with an error. .IP "\fB\-gdwarf\-2\fR" 4 .IX Item "-gdwarf-2" Produce debugging information in \s-1DWARF\s0 version 2 format (if that is supported). This is the format used by \s-1DBX\s0 on \s-1IRIX\s0 6. With this option, \s-1GCC\s0 uses features of \s-1DWARF\s0 version 3 when they are useful; version 3 is upward compatible with version 2, but may still cause problems for older debuggers. .IP "\fB\-gvms\fR" 4 .IX Item "-gvms" Produce debugging information in \s-1VMS\s0 debug format (if that is supported). This is the format used by \s-1DEBUG\s0 on \s-1VMS\s0 systems. .IP "\fB\-g\fR\fIlevel\fR" 4 .IX Item "-glevel" .PD 0 .IP "\fB\-ggdb\fR\fIlevel\fR" 4 .IX Item "-ggdblevel" .IP "\fB\-gstabs\fR\fIlevel\fR" 4 .IX Item "-gstabslevel" .IP "\fB\-gcoff\fR\fIlevel\fR" 4 .IX Item "-gcofflevel" .IP "\fB\-gxcoff\fR\fIlevel\fR" 4 .IX Item "-gxcofflevel" .IP "\fB\-gvms\fR\fIlevel\fR" 4 .IX Item "-gvmslevel" .PD Request debugging information and also use \fIlevel\fR to specify how much information. The default level is 2. .Sp Level 0 produces no debug information at all. Thus, \fB\-g0\fR negates \&\fB\-g\fR. .Sp Level 1 produces minimal information, enough for making backtraces in parts of the program that you don't plan to debug. This includes descriptions of functions and external variables, but no information about local variables and no line numbers. .Sp Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when you use \fB\-g3\fR. .Sp \&\fB\-gdwarf\-2\fR does not accept a concatenated debug level, because \&\s-1GCC\s0 used to support an option \fB\-gdwarf\fR that meant to generate debug information in version 1 of the \s-1DWARF\s0 format (which is very different from version 2), and it would have been too confusing. That debug format is long obsolete, but the option cannot be changed now. Instead use an additional \fB\-g\fR\fIlevel\fR option to change the debug level for \s-1DWARF2\s0. .IP "\fB\-feliminate\-dwarf2\-dups\fR" 4 .IX Item "-feliminate-dwarf2-dups" Compress \s-1DWARF2\s0 debugging information by eliminating duplicated information about each symbol. This option only makes sense when generating \s-1DWARF2\s0 debugging information with \fB\-gdwarf\-2\fR. .IP "\fB\-femit\-struct\-debug\-baseonly\fR" 4 .IX Item "-femit-struct-debug-baseonly" Emit debug information for struct-like types only when the base name of the compilation source file matches the base name of file in which the struct was defined. .Sp This option substantially reduces the size of debugging information, but at significant potential loss in type information to the debugger. See \fB\-femit\-struct\-debug\-reduced\fR for a less aggressive option. See \fB\-femit\-struct\-debug\-detailed\fR for more detailed control. .Sp This option works only with \s-1DWARF\s0 2. .IP "\fB\-femit\-struct\-debug\-reduced\fR" 4 .IX Item "-femit-struct-debug-reduced" Emit debug information for struct-like types only when the base name of the compilation source file matches the base name of file in which the type was defined, unless the struct is a template or defined in a system header. .Sp This option significantly reduces the size of debugging information, with some potential loss in type information to the debugger. See \fB\-femit\-struct\-debug\-baseonly\fR for a more aggressive option. See \fB\-femit\-struct\-debug\-detailed\fR for more detailed control. .Sp This option works only with \s-1DWARF\s0 2. .IP "\fB\-femit\-struct\-debug\-detailed\fR[\fB=\fR\fIspec-list\fR]" 4 .IX Item "-femit-struct-debug-detailed[=spec-list]" Specify the struct-like types for which the compiler will generate debug information. The intent is to reduce duplicate struct debug information between different object files within the same program. .Sp This option is a detailed version of \&\fB\-femit\-struct\-debug\-reduced\fR and \fB\-femit\-struct\-debug\-baseonly\fR, which will serve for most needs. .Sp A specification has the syntax [\fBdir:\fR|\fBind:\fR][\fBord:\fR|\fBgen:\fR](\fBany\fR|\fBsys\fR|\fBbase\fR|\fBnone\fR) .Sp The optional first word limits the specification to structs that are used directly (\fBdir:\fR) or used indirectly (\fBind:\fR). A struct type is used directly when it is the type of a variable, member. Indirect uses arise through pointers to structs. That is, when use of an incomplete struct would be legal, the use is indirect. An example is \&\fBstruct one direct; struct two * indirect;\fR. .Sp The optional second word limits the specification to ordinary structs (\fBord:\fR) or generic structs (\fBgen:\fR). Generic structs are a bit complicated to explain. For \*(C+, these are non-explicit specializations of template classes, or non-template classes within the above. Other programming languages have generics, but \fB\-femit\-struct\-debug\-detailed\fR does not yet implement them. .Sp The third word specifies the source files for those structs for which the compiler will emit debug information. The values \fBnone\fR and \fBany\fR have the normal meaning. The value \fBbase\fR means that the base of name of the file in which the type declaration appears must match the base of the name of the main compilation file. In practice, this means that types declared in \fIfoo.c\fR and \fIfoo.h\fR will have debug information, but types declared in other header will not. The value \fBsys\fR means those types satisfying \fBbase\fR or declared in system or compiler headers. .Sp You may need to experiment to determine the best settings for your application. .Sp The default is \fB\-femit\-struct\-debug\-detailed=all\fR. .Sp This option works only with \s-1DWARF\s0 2. .IP "\fB\-fno\-merge\-debug\-strings\fR" 4 .IX Item "-fno-merge-debug-strings" Direct the linker to merge together strings which are identical in different object files. This is not supported by all assemblers or linker. This decreases the size of the debug information in the output file at the cost of increasing link processing time. This is on by default. .IP "\fB\-fdebug\-prefix\-map=\fR\fIold\fR\fB=\fR\fInew\fR" 4 .IX Item "-fdebug-prefix-map=old=new" When compiling files in directory \fI\fIold\fI\fR, record debugging information describing them as in \fI\fInew\fI\fR instead. .IP "\fB\-p\fR" 4 .IX Item "-p" Generate extra code to write profile information suitable for the analysis program \fBprof\fR. You must use this option when compiling the source files you want data about, and you must also use it when linking. .IP "\fB\-pg\fR" 4 .IX Item "-pg" Generate extra code to write profile information suitable for the analysis program \fBgprof\fR. You must use this option when compiling the source files you want data about, and you must also use it when linking. .IP "\fB\-Q\fR" 4 .IX Item "-Q" Makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes. .IP "\fB\-ftime\-report\fR" 4 .IX Item "-ftime-report" Makes the compiler print some statistics about the time consumed by each pass when it finishes. .IP "\fB\-fmem\-report\fR" 4 .IX Item "-fmem-report" Makes the compiler print some statistics about permanent memory allocation when it finishes. .IP "\fB\-fpre\-ipa\-mem\-report\fR" 4 .IX Item "-fpre-ipa-mem-report" .PD 0 .IP "\fB\-fpost\-ipa\-mem\-report\fR" 4 .IX Item "-fpost-ipa-mem-report" .PD Makes the compiler print some statistics about permanent memory allocation before or after interprocedural optimization. .IP "\fB\-fprofile\-arcs\fR" 4 .IX Item "-fprofile-arcs" Add code so that program flow \fIarcs\fR are instrumented. During execution the program records how many times each branch and call is executed and how many times it is taken or returns. When the compiled program exits it saves this data to a file called \&\fI\fIauxname\fI.gcda\fR for each source file. The data may be used for profile-directed optimizations (\fB\-fbranch\-probabilities\fR), or for test coverage analysis (\fB\-ftest\-coverage\fR). Each object file's \&\fIauxname\fR is generated from the name of the output file, if explicitly specified and it is not the final executable, otherwise it is the basename of the source file. In both cases any suffix is removed (e.g. \fIfoo.gcda\fR for input file \fIdir/foo.c\fR, or \&\fIdir/foo.gcda\fR for output file specified as \fB\-o dir/foo.o\fR). .IP "\fB\-\-coverage\fR" 4 .IX Item "--coverage" This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for \fB\-fprofile\-arcs\fR \&\fB\-ftest\-coverage\fR (when compiling) and \fB\-lgcov\fR (when linking). See the documentation for those options for more details. .RS 4 .IP "\(bu" 4 Compile the source files with \fB\-fprofile\-arcs\fR plus optimization and code generation options. For test coverage analysis, use the additional \fB\-ftest\-coverage\fR option. You do not need to profile every source file in a program. .IP "\(bu" 4 Link your object files with \fB\-lgcov\fR or \fB\-fprofile\-arcs\fR (the latter implies the former). .IP "\(bu" 4 Run the program on a representative workload to generate the arc profile information. This may be repeated any number of times. You can run concurrent instances of your program, and provided that the file system supports locking, the data files will be correctly updated. Also \&\f(CW\*(C`fork\*(C'\fR calls are detected and correctly handled (double counting will not happen). .IP "\(bu" 4 For profile-directed optimizations, compile the source files again with the same optimization and code generation options plus \&\fB\-fbranch\-probabilities\fR. .IP "\(bu" 4 For test coverage analysis, use \fBgcov\fR to produce human readable information from the \fI.gcno\fR and \fI.gcda\fR files. Refer to the \&\fBgcov\fR documentation for further information. .RE .RS 4 .Sp With \fB\-fprofile\-arcs\fR, for each function of your program \s-1GCC\s0 creates a program flow graph, then finds a spanning tree for the graph. Only arcs that are not on the spanning tree have to be instrumented: the compiler adds code to count the number of times that these arcs are executed. When an arc is the only exit or only entrance to a block, the instrumentation code can be added to the block; otherwise, a new basic block must be created to hold the instrumentation code. .RE .IP "\fB\-ftest\-coverage\fR" 4 .IX Item "-ftest-coverage" Produce a notes file that the \fBgcov\fR code-coverage utility can use to show program coverage. Each source file's note file is called \&\fI\fIauxname\fI.gcno\fR. Refer to the \fB\-fprofile\-arcs\fR option above for a description of \fIauxname\fR and instructions on how to generate test coverage data. Coverage data will match the source files more closely, if you do not optimize. .IP "\fB\-fdbg\-cnt\-list\fR" 4 .IX Item "-fdbg-cnt-list" Print the name and the counter upperbound for all debug counters. .IP "\fB\-fdbg\-cnt=\fR\fIcounter-value-list\fR" 4 .IX Item "-fdbg-cnt=counter-value-list" Set the internal debug counter upperbound. \fIcounter-value-list\fR is a comma-separated list of \fIname\fR:\fIvalue\fR pairs which sets the upperbound of each debug counter \fIname\fR to \fIvalue\fR. All debug counters have the initial upperbound of \fI\s-1UINT_MAX\s0\fR, thus \fIdbg_cnt()\fR returns true always unless the upperbound is set by this option. e.g. With \-fdbg\-cnt=dce:10,tail_call:0 dbg_cnt(dce) will return true only for first 10 invocations and dbg_cnt(tail_call) will return false always. .IP "\fB\-d\fR\fIletters\fR" 4 .IX Item "-dletters" .PD 0 .IP "\fB\-fdump\-rtl\-\fR\fIpass\fR" 4 .IX Item "-fdump-rtl-pass" .PD Says to make debugging dumps during compilation at times specified by \&\fIletters\fR. This is used for debugging the RTL-based passes of the compiler. The file names for most of the dumps are made by appending a pass number and a word to the \fIdumpname\fR. \fIdumpname\fR is generated from the name of the output file, if explicitly specified and it is not an executable, otherwise it is the basename of the source file. These switches may have different effects when \fB\-E\fR is used for preprocessing. .Sp Most debug dumps can be enabled either passing a letter to the \fB\-d\fR option, or with a long \fB\-fdump\-rtl\fR switch; here are the possible letters for use in \fIletters\fR and \fIpass\fR, and their meanings: .RS 4 .IP "\fB\-dA\fR" 4 .IX Item "-dA" Annotate the assembler output with miscellaneous debugging information. .IP "\fB\-dB\fR" 4 .IX Item "-dB" .PD 0 .IP "\fB\-fdump\-rtl\-bbro\fR" 4 .IX Item "-fdump-rtl-bbro" .PD Dump after block reordering, to \fI\fIfile\fI.148r.bbro\fR. .IP "\fB\-dc\fR" 4 .IX Item "-dc" .PD 0 .IP "\fB\-fdump\-rtl\-combine\fR" 4 .IX Item "-fdump-rtl-combine" .PD Dump after the \s-1RTL\s0 instruction combination pass, to the file \&\fI\fIfile\fI.129r.combine\fR. .IP "\fB\-dC\fR" 4 .IX Item "-dC" .PD 0 .IP "\fB\-fdump\-rtl\-ce1\fR" 4 .IX Item "-fdump-rtl-ce1" .IP "\fB\-fdump\-rtl\-ce2\fR" 4 .IX Item "-fdump-rtl-ce2" .PD \&\fB\-dC\fR and \fB\-fdump\-rtl\-ce1\fR enable dumping after the first if conversion, to the file \fI\fIfile\fI.117r.ce1\fR. \fB\-dC\fR and \fB\-fdump\-rtl\-ce2\fR enable dumping after the second if conversion, to the file \fI\fIfile\fI.130r.ce2\fR. .IP "\fB\-dd\fR" 4 .IX Item "-dd" .PD 0 .IP "\fB\-fdump\-rtl\-btl\fR" 4 .IX Item "-fdump-rtl-btl" .IP "\fB\-fdump\-rtl\-dbr\fR" 4 .IX Item "-fdump-rtl-dbr" .PD \&\fB\-dd\fR and \fB\-fdump\-rtl\-btl\fR enable dumping after branch target load optimization, to \fI\fIfile\fI.31.btl\fR. \fB\-dd\fR and \fB\-fdump\-rtl\-dbr\fR enable dumping after delayed branch scheduling, to \fI\fIfile\fI.36.dbr\fR. .IP "\fB\-dD\fR" 4 .IX Item "-dD" Dump all macro definitions, at the end of preprocessing, in addition to normal output. .IP "\fB\-dE\fR" 4 .IX Item "-dE" .PD 0 .IP "\fB\-fdump\-rtl\-ce3\fR" 4 .IX Item "-fdump-rtl-ce3" .PD Dump after the third if conversion, to \fI\fIfile\fI.146r.ce3\fR. .IP "\fB\-df\fR" 4 .IX Item "-df" .PD 0 .IP "\fB\-fdump\-rtl\-cfg\fR" 4 .IX Item "-fdump-rtl-cfg" .IP "\fB\-fdump\-rtl\-life\fR" 4 .IX Item "-fdump-rtl-life" .PD \&\fB\-df\fR and \fB\-fdump\-rtl\-cfg\fR enable dumping after control and data flow analysis, to \fI\fIfile\fI.116r.cfg\fR. \fB\-df\fR and \fB\-fdump\-rtl\-cfg\fR enable dumping dump after life analysis, to \fI\fIfile\fI.128r.life1\fR and \fI\fIfile\fI.135r.life2\fR. .IP "\fB\-dg\fR" 4 .IX Item "-dg" .PD 0 .IP "\fB\-fdump\-rtl\-greg\fR" 4 .IX Item "-fdump-rtl-greg" .PD Dump after global register allocation, to \fI\fIfile\fI.139r.greg\fR. .IP "\fB\-dG\fR" 4 .IX Item "-dG" .PD 0 .IP "\fB\-fdump\-rtl\-gcse\fR" 4 .IX Item "-fdump-rtl-gcse" .IP "\fB\-fdump\-rtl\-bypass\fR" 4 .IX Item "-fdump-rtl-bypass" .PD \&\fB\-dG\fR and \fB\-fdump\-rtl\-gcse\fR enable dumping after \s-1GCSE\s0, to \&\fI\fIfile\fI.114r.gcse\fR. \fB\-dG\fR and \fB\-fdump\-rtl\-bypass\fR enable dumping after jump bypassing and control flow optimizations, to \&\fI\fIfile\fI.115r.bypass\fR. .IP "\fB\-dh\fR" 4 .IX Item "-dh" .PD 0 .IP "\fB\-fdump\-rtl\-eh\fR" 4 .IX Item "-fdump-rtl-eh" .PD Dump after finalization of \s-1EH\s0 handling code, to \fI\fIfile\fI.02.eh\fR. .IP "\fB\-di\fR" 4 .IX Item "-di" .PD 0 .IP "\fB\-fdump\-rtl\-sibling\fR" 4 .IX Item "-fdump-rtl-sibling" .PD Dump after sibling call optimizations, to \fI\fIfile\fI.106r.sibling\fR. .IP "\fB\-dj\fR" 4 .IX Item "-dj" .PD 0 .IP "\fB\-fdump\-rtl\-jump\fR" 4 .IX Item "-fdump-rtl-jump" .PD Dump after the first jump optimization, to \fI\fIfile\fI.112r.jump\fR. .IP "\fB\-dk\fR" 4 .IX Item "-dk" .PD 0 .IP "\fB\-fdump\-rtl\-stack\fR" 4 .IX Item "-fdump-rtl-stack" .PD Dump after conversion from \s-1GCC\s0's \*(L"flat register file\*(R" registers to the x87's stack-like registers, to \fI\fIfile\fI.152r.stack\fR. .IP "\fB\-dl\fR" 4 .IX Item "-dl" .PD 0 .IP "\fB\-fdump\-rtl\-lreg\fR" 4 .IX Item "-fdump-rtl-lreg" .PD Dump after local register allocation, to \fI\fIfile\fI.138r.lreg\fR. .IP "\fB\-dL\fR" 4 .IX Item "-dL" .PD 0 .IP "\fB\-fdump\-rtl\-loop2\fR" 4 .IX Item "-fdump-rtl-loop2" .PD \&\fB\-dL\fR and \fB\-fdump\-rtl\-loop2\fR enable dumping after the loop optimization pass, to \fI\fIfile\fI.119r.loop2\fR, \&\fI\fIfile\fI.120r.loop2_init\fR, \&\fI\fIfile\fI.121r.loop2_invariant\fR, and \&\fI\fIfile\fI.125r.loop2_done\fR. .IP "\fB\-dm\fR" 4 .IX Item "-dm" .PD 0 .IP "\fB\-fdump\-rtl\-sms\fR" 4 .IX Item "-fdump-rtl-sms" .PD Dump after modulo scheduling, to \fI\fIfile\fI.136r.sms\fR. .IP "\fB\-dM\fR" 4 .IX Item "-dM" .PD 0 .IP "\fB\-fdump\-rtl\-mach\fR" 4 .IX Item "-fdump-rtl-mach" .PD Dump after performing the machine dependent reorganization pass, to \&\fI\fIfile\fI.155r.mach\fR if that pass exists. .IP "\fB\-dn\fR" 4 .IX Item "-dn" .PD 0 .IP "\fB\-fdump\-rtl\-rnreg\fR" 4 .IX Item "-fdump-rtl-rnreg" .PD Dump after register renumbering, to \fI\fIfile\fI.147r.rnreg\fR. .IP "\fB\-dN\fR" 4 .IX Item "-dN" .PD 0 .IP "\fB\-fdump\-rtl\-regmove\fR" 4 .IX Item "-fdump-rtl-regmove" .PD Dump after the register move pass, to \fI\fIfile\fI.132r.regmove\fR. .IP "\fB\-do\fR" 4 .IX Item "-do" .PD 0 .IP "\fB\-fdump\-rtl\-postreload\fR" 4 .IX Item "-fdump-rtl-postreload" .PD Dump after post-reload optimizations, to \fI\fIfile\fI.24.postreload\fR. .IP "\fB\-dr\fR" 4 .IX Item "-dr" .PD 0 .IP "\fB\-fdump\-rtl\-expand\fR" 4 .IX Item "-fdump-rtl-expand" .PD Dump after \s-1RTL\s0 generation, to \fI\fIfile\fI.104r.expand\fR. .IP "\fB\-dR\fR" 4 .IX Item "-dR" .PD 0 .IP "\fB\-fdump\-rtl\-sched2\fR" 4 .IX Item "-fdump-rtl-sched2" .PD Dump after the second scheduling pass, to \fI\fIfile\fI.149r.sched2\fR. .IP "\fB\-ds\fR" 4 .IX Item "-ds" .PD 0 .IP "\fB\-fdump\-rtl\-cse\fR" 4 .IX Item "-fdump-rtl-cse" .PD Dump after \s-1CSE\s0 (including the jump optimization that sometimes follows \&\s-1CSE\s0), to \fI\fIfile\fI.113r.cse\fR. .IP "\fB\-dS\fR" 4 .IX Item "-dS" .PD 0 .IP "\fB\-fdump\-rtl\-sched1\fR" 4 .IX Item "-fdump-rtl-sched1" .PD Dump after the first scheduling pass, to \fI\fIfile\fI.136r.sched1\fR. .IP "\fB\-dt\fR" 4 .IX Item "-dt" .PD 0 .IP "\fB\-fdump\-rtl\-cse2\fR" 4 .IX Item "-fdump-rtl-cse2" .PD Dump after the second \s-1CSE\s0 pass (including the jump optimization that sometimes follows \s-1CSE\s0), to \fI\fIfile\fI.127r.cse2\fR. .IP "\fB\-dT\fR" 4 .IX Item "-dT" .PD 0 .IP "\fB\-fdump\-rtl\-tracer\fR" 4 .IX Item "-fdump-rtl-tracer" .PD Dump after running tracer, to \fI\fIfile\fI.118r.tracer\fR. .IP "\fB\-dV\fR" 4 .IX Item "-dV" .PD 0 .IP "\fB\-fdump\-rtl\-vpt\fR" 4 .IX Item "-fdump-rtl-vpt" .IP "\fB\-fdump\-rtl\-vartrack\fR" 4 .IX Item "-fdump-rtl-vartrack" .PD \&\fB\-dV\fR and \fB\-fdump\-rtl\-vpt\fR enable dumping after the value profile transformations, to \fI\fIfile\fI.10.vpt\fR. \fB\-dV\fR and \fB\-fdump\-rtl\-vartrack\fR enable dumping after variable tracking, to \fI\fIfile\fI.154r.vartrack\fR. .IP "\fB\-dw\fR" 4 .IX Item "-dw" .PD 0 .IP "\fB\-fdump\-rtl\-flow2\fR" 4 .IX Item "-fdump-rtl-flow2" .PD Dump after the second flow pass, to \fI\fIfile\fI.142r.flow2\fR. .IP "\fB\-dz\fR" 4 .IX Item "-dz" .PD 0 .IP "\fB\-fdump\-rtl\-peephole2\fR" 4 .IX Item "-fdump-rtl-peephole2" .PD Dump after the peephole pass, to \fI\fIfile\fI.145r.peephole2\fR. .IP "\fB\-dZ\fR" 4 .IX Item "-dZ" .PD 0 .IP "\fB\-fdump\-rtl\-web\fR" 4 .IX Item "-fdump-rtl-web" .PD Dump after live range splitting, to \fI\fIfile\fI.126r.web\fR. .IP "\fB\-da\fR" 4 .IX Item "-da" .PD 0 .IP "\fB\-fdump\-rtl\-all\fR" 4 .IX Item "-fdump-rtl-all" .PD Produce all the dumps listed above. .IP "\fB\-dH\fR" 4 .IX Item "-dH" Produce a core dump whenever an error occurs. .IP "\fB\-dm\fR" 4 .IX Item "-dm" Print statistics on memory usage, at the end of the run, to standard error. .IP "\fB\-dp\fR" 4 .IX Item "-dp" Annotate the assembler output with a comment indicating which pattern and alternative was used. The length of each instruction is also printed. .IP "\fB\-dP\fR" 4 .IX Item "-dP" Dump the \s-1RTL\s0 in the assembler output as a comment before each instruction. Also turns on \fB\-dp\fR annotation. .IP "\fB\-dv\fR" 4 .IX Item "-dv" For each of the other indicated dump files (either with \fB\-d\fR or \&\fB\-fdump\-rtl\-\fR\fIpass\fR), dump a representation of the control flow graph suitable for viewing with \s-1VCG\s0 to \fI\fIfile\fI.\fIpass\fI.vcg\fR. .IP "\fB\-dx\fR" 4 .IX Item "-dx" Just generate \s-1RTL\s0 for a function instead of compiling it. Usually used with \fBr\fR (\fB\-fdump\-rtl\-expand\fR). .IP "\fB\-dy\fR" 4 .IX Item "-dy" Dump debugging information during parsing, to standard error. .RE .RS 4 .RE .IP "\fB\-fdump\-noaddr\fR" 4 .IX Item "-fdump-noaddr" When doing debugging dumps (see \fB\-d\fR option above), suppress address output. This makes it more feasible to use diff on debugging dumps for compiler invocations with different compiler binaries and/or different text / bss / data / heap / stack / dso start locations. .IP "\fB\-fdump\-unnumbered\fR" 4 .IX Item "-fdump-unnumbered" When doing debugging dumps (see \fB\-d\fR option above), suppress instruction numbers and address output. This makes it more feasible to use diff on debugging dumps for compiler invocations with different options, in particular with and without \fB\-g\fR. .IP "\fB\-fdump\-translation\-unit\fR (\*(C+ only)" 4 .IX Item "-fdump-translation-unit ( only)" .PD 0 .IP "\fB\-fdump\-translation\-unit\-\fR\fIoptions\fR\fB \fR(\*(C+ only)" 4 .IX Item "-fdump-translation-unit-options ( only)" .PD Dump a representation of the tree structure for the entire translation unit to a file. The file name is made by appending \fI.tu\fR to the source file name. If the \fB\-\fR\fIoptions\fR form is used, \fIoptions\fR controls the details of the dump as described for the \&\fB\-fdump\-tree\fR options. .IP "\fB\-fdump\-class\-hierarchy\fR (\*(C+ only)" 4 .IX Item "-fdump-class-hierarchy ( only)" .PD 0 .IP "\fB\-fdump\-class\-hierarchy\-\fR\fIoptions\fR\fB \fR(\*(C+ only)" 4 .IX Item "-fdump-class-hierarchy-options ( only)" .PD Dump a representation of each class's hierarchy and virtual function table layout to a file. The file name is made by appending \fI.class\fR to the source file name. If the \fB\-\fR\fIoptions\fR form is used, \&\fIoptions\fR controls the details of the dump as described for the \&\fB\-fdump\-tree\fR options. .IP "\fB\-fdump\-ipa\-\fR\fIswitch\fR" 4 .IX Item "-fdump-ipa-switch" Control the dumping at various stages of inter-procedural analysis language tree to a file. The file name is generated by appending a switch specific suffix to the source file name. The following dumps are possible: .RS 4 .IP "\fBall\fR" 4 .IX Item "all" Enables all inter-procedural analysis dumps. .IP "\fBcgraph\fR" 4 .IX Item "cgraph" Dumps information about call-graph optimization, unused function removal, and inlining decisions. .IP "\fBinline\fR" 4 .IX Item "inline" Dump after function inlining. .RE .RS 4 .RE .IP "\fB\-fdump\-tree\-\fR\fIswitch\fR" 4 .IX Item "-fdump-tree-switch" .PD 0 .IP "\fB\-fdump\-tree\-\fR\fIswitch\fR\fB\-\fR\fIoptions\fR" 4 .IX Item "-fdump-tree-switch-options" .PD Control the dumping at various stages of processing the intermediate language tree to a file. The file name is generated by appending a switch specific suffix to the source file name. If the \fB\-\fR\fIoptions\fR form is used, \fIoptions\fR is a list of \fB\-\fR separated options that control the details of the dump. Not all options are applicable to all dumps, those which are not meaningful will be ignored. The following options are available .RS 4 .IP "\fBaddress\fR" 4 .IX Item "address" Print the address of each node. Usually this is not meaningful as it changes according to the environment and source file. Its primary use is for tying up a dump file with a debug environment. .IP "\fBslim\fR" 4 .IX Item "slim" Inhibit dumping of members of a scope or body of a function merely because that scope has been reached. Only dump such items when they are directly reachable by some other path. When dumping pretty-printed trees, this option inhibits dumping the bodies of control structures. .IP "\fBraw\fR" 4 .IX Item "raw" Print a raw representation of the tree. By default, trees are pretty-printed into a C\-like representation. .IP "\fBdetails\fR" 4 .IX Item "details" Enable more detailed dumps (not honored by every dump option). .IP "\fBstats\fR" 4 .IX Item "stats" Enable dumping various statistics about the pass (not honored by every dump option). .IP "\fBblocks\fR" 4 .IX Item "blocks" Enable showing basic block boundaries (disabled in raw dumps). .IP "\fBvops\fR" 4 .IX Item "vops" Enable showing virtual operands for every statement. .IP "\fBlineno\fR" 4 .IX Item "lineno" Enable showing line numbers for statements. .IP "\fBuid\fR" 4 .IX Item "uid" Enable showing the unique \s-1ID\s0 (\f(CW\*(C`DECL_UID\*(C'\fR) for each variable. .IP "\fBall\fR" 4 .IX Item "all" Turn on all options, except \fBraw\fR, \fBslim\fR and \fBlineno\fR. .RE .RS 4 .Sp The following tree dumps are possible: .IP "\fBoriginal\fR" 4 .IX Item "original" Dump before any tree based optimization, to \fI\fIfile\fI.original\fR. .IP "\fBoptimized\fR" 4 .IX Item "optimized" Dump after all tree based optimization, to \fI\fIfile\fI.optimized\fR. .IP "\fBgimple\fR" 4 .IX Item "gimple" Dump each function before and after the gimplification pass to a file. The file name is made by appending \fI.gimple\fR to the source file name. .IP "\fBcfg\fR" 4 .IX Item "cfg" Dump the control flow graph of each function to a file. The file name is made by appending \fI.cfg\fR to the source file name. .IP "\fBvcg\fR" 4 .IX Item "vcg" Dump the control flow graph of each function to a file in \s-1VCG\s0 format. The file name is made by appending \fI.vcg\fR to the source file name. Note that if the file contains more than one function, the generated file cannot be used directly by \s-1VCG\s0. You will need to cut and paste each function's graph into its own separate file first. .IP "\fBch\fR" 4 .IX Item "ch" Dump each function after copying loop headers. The file name is made by appending \fI.ch\fR to the source file name. .IP "\fBssa\fR" 4 .IX Item "ssa" Dump \s-1SSA\s0 related information to a file. The file name is made by appending \&\fI.ssa\fR to the source file name. .IP "\fBsalias\fR" 4 .IX Item "salias" Dump structure aliasing variable information to a file. This file name is made by appending \fI.salias\fR to the source file name. .IP "\fBalias\fR" 4 .IX Item "alias" Dump aliasing information for each function. The file name is made by appending \fI.alias\fR to the source file name. .IP "\fBccp\fR" 4 .IX Item "ccp" Dump each function after \s-1CCP\s0. The file name is made by appending \&\fI.ccp\fR to the source file name. .IP "\fBstoreccp\fR" 4 .IX Item "storeccp" Dump each function after STORE-CCP. The file name is made by appending \&\fI.storeccp\fR to the source file name. .IP "\fBpre\fR" 4 .IX Item "pre" Dump trees after partial redundancy elimination. The file name is made by appending \fI.pre\fR to the source file name. .IP "\fBfre\fR" 4 .IX Item "fre" Dump trees after full redundancy elimination. The file name is made by appending \fI.fre\fR to the source file name. .IP "\fBcopyprop\fR" 4 .IX Item "copyprop" Dump trees after copy propagation. The file name is made by appending \fI.copyprop\fR to the source file name. .IP "\fBstore_copyprop\fR" 4 .IX Item "store_copyprop" Dump trees after store copy-propagation. The file name is made by appending \fI.store_copyprop\fR to the source file name. .IP "\fBdce\fR" 4 .IX Item "dce" Dump each function after dead code elimination. The file name is made by appending \fI.dce\fR to the source file name. .IP "\fBmudflap\fR" 4 .IX Item "mudflap" Dump each function after adding mudflap instrumentation. The file name is made by appending \fI.mudflap\fR to the source file name. .IP "\fBsra\fR" 4 .IX Item "sra" Dump each function after performing scalar replacement of aggregates. The file name is made by appending \fI.sra\fR to the source file name. .IP "\fBsink\fR" 4 .IX Item "sink" Dump each function after performing code sinking. The file name is made by appending \fI.sink\fR to the source file name. .IP "\fBdom\fR" 4 .IX Item "dom" Dump each function after applying dominator tree optimizations. The file name is made by appending \fI.dom\fR to the source file name. .IP "\fBdse\fR" 4 .IX Item "dse" Dump each function after applying dead store elimination. The file name is made by appending \fI.dse\fR to the source file name. .IP "\fBphiopt\fR" 4 .IX Item "phiopt" Dump each function after optimizing \s-1PHI\s0 nodes into straightline code. The file name is made by appending \fI.phiopt\fR to the source file name. .IP "\fBforwprop\fR" 4 .IX Item "forwprop" Dump each function after forward propagating single use variables. The file name is made by appending \fI.forwprop\fR to the source file name. .IP "\fBcopyrename\fR" 4 .IX Item "copyrename" Dump each function after applying the copy rename optimization. The file name is made by appending \fI.copyrename\fR to the source file name. .IP "\fBnrv\fR" 4 .IX Item "nrv" Dump each function after applying the named return value optimization on generic trees. The file name is made by appending \fI.nrv\fR to the source file name. .IP "\fBvect\fR" 4 .IX Item "vect" Dump each function after applying vectorization of loops. The file name is made by appending \fI.vect\fR to the source file name. .IP "\fBvrp\fR" 4 .IX Item "vrp" Dump each function after Value Range Propagation (\s-1VRP\s0). The file name is made by appending \fI.vrp\fR to the source file name. .IP "\fBall\fR" 4 .IX Item "all" Enable all the available tree dumps with the flags provided in this option. .RE .RS 4 .RE .IP "\fB\-ftree\-vectorizer\-verbose=\fR\fIn\fR" 4 .IX Item "-ftree-vectorizer-verbose=n" This option controls the amount of debugging output the vectorizer prints. This information is written to standard error, unless \&\fB\-fdump\-tree\-all\fR or \fB\-fdump\-tree\-vect\fR is specified, in which case it is output to the usual dump listing file, \fI.vect\fR. For \fIn\fR=0 no diagnostic information is reported. If \fIn\fR=1 the vectorizer reports each loop that got vectorized, and the total number of loops that got vectorized. If \fIn\fR=2 the vectorizer also reports non-vectorized loops that passed the first analysis phase (vect_analyze_loop_form) \- i.e. countable, inner-most, single-bb, single\-entry/exit loops. This is the same verbosity level that \fB\-fdump\-tree\-vect\-stats\fR uses. Higher verbosity levels mean either more information dumped for each reported loop, or same amount of information reported for more loops: If \fIn\fR=3, alignment related information is added to the reports. If \fIn\fR=4, data-references related information (e.g. memory dependences, memory access-patterns) is added to the reports. If \fIn\fR=5, the vectorizer reports also non-vectorized inner-most loops that did not pass the first analysis phase (i.e., may not be countable, or may have complicated control-flow). If \fIn\fR=6, the vectorizer reports also non-vectorized nested loops. For \fIn\fR=7, all the information the vectorizer generates during its analysis and transformation is reported. This is the same verbosity level that \fB\-fdump\-tree\-vect\-details\fR uses. .IP "\fB\-frandom\-seed=\fR\fIstring\fR" 4 .IX Item "-frandom-seed=string" This option provides a seed that \s-1GCC\s0 uses when it would otherwise use random numbers. It is used to generate certain symbol names that have to be different in every compiled file. It is also used to place unique stamps in coverage data files and the object files that produce them. You can use the \fB\-frandom\-seed\fR option to produce reproducibly identical object files. .Sp The \fIstring\fR should be different for every file you compile. .IP "\fB\-fsched\-verbose=\fR\fIn\fR" 4 .IX Item "-fsched-verbose=n" On targets that use instruction scheduling, this option controls the amount of debugging output the scheduler prints. This information is written to standard error, unless \fB\-dS\fR or \fB\-dR\fR is specified, in which case it is output to the usual dump listing file, \fI.sched\fR or \fI.sched2\fR respectively. However for \fIn\fR greater than nine, the output is always printed to standard error. .Sp For \fIn\fR greater than zero, \fB\-fsched\-verbose\fR outputs the same information as \fB\-dRS\fR. For \fIn\fR greater than one, it also output basic block probabilities, detailed ready list information and unit/insn info. For \fIn\fR greater than two, it includes \s-1RTL\s0 at abort point, control-flow and regions info. And for \fIn\fR over four, \fB\-fsched\-verbose\fR also includes dependence info. .IP "\fB\-save\-temps\fR" 4 .IX Item "-save-temps" Store the usual \*(L"temporary\*(R" intermediate files permanently; place them in the current directory and name them based on the source file. Thus, compiling \fIfoo.c\fR with \fB\-c \-save\-temps\fR would produce files \&\fIfoo.i\fR and \fIfoo.s\fR, as well as \fIfoo.o\fR. This creates a preprocessed \fIfoo.i\fR output file even though the compiler now normally uses an integrated preprocessor. .Sp When used in combination with the \fB\-x\fR command line option, \&\fB\-save\-temps\fR is sensible enough to avoid over writing an input source file with the same extension as an intermediate file. The corresponding intermediate file may be obtained by renaming the source file before using \fB\-save\-temps\fR. .IP "\fB\-time\fR" 4 .IX Item "-time" Report the \s-1CPU\s0 time taken by each subprocess in the compilation sequence. For C source files, this is the compiler proper and assembler (plus the linker if linking is done). The output looks like this: .Sp .Vb 2 \& # cc1 0.12 0.01 \& # as 0.00 0.01 .Ve .Sp The first number on each line is the \*(L"user time\*(R", that is time spent executing the program itself. The second number is \*(L"system time\*(R", time spent executing operating system routines on behalf of the program. Both numbers are in seconds. .IP "\fB\-fvar\-tracking\fR" 4 .IX Item "-fvar-tracking" Run variable tracking pass. It computes where variables are stored at each position in code. Better debugging information is then generated (if the debugging information format supports this information). .Sp It is enabled by default when compiling with optimization (\fB\-Os\fR, \&\fB\-O\fR, \fB\-O2\fR, ...), debugging information (\fB\-g\fR) and the debug info format supports it. .IP "\fB\-print\-file\-name=\fR\fIlibrary\fR" 4 .IX Item "-print-file-name=library" Print the full absolute name of the library file \fIlibrary\fR that would be used when linking\-\-\-and don't do anything else. With this option, \s-1GCC\s0 does not compile or link anything; it just prints the file name. .IP "\fB\-print\-multi\-directory\fR" 4 .IX Item "-print-multi-directory" Print the directory name corresponding to the multilib selected by any other switches present in the command line. This directory is supposed to exist in \fB\s-1GCC_EXEC_PREFIX\s0\fR. .IP "\fB\-print\-multi\-lib\fR" 4 .IX Item "-print-multi-lib" Print the mapping from multilib directory names to compiler switches that enable them. The directory name is separated from the switches by \&\fB;\fR, and each switch starts with an \fB@} instead of the \&\f(CB@samp\fB{\-\fR, without spaces between multiple switches. This is supposed to ease shell-processing. .IP "\fB\-print\-prog\-name=\fR\fIprogram\fR" 4 .IX Item "-print-prog-name=program" Like \fB\-print\-file\-name\fR, but searches for a program such as \fBcpp\fR. .IP "\fB\-print\-libgcc\-file\-name\fR" 4 .IX Item "-print-libgcc-file-name" Same as \fB\-print\-file\-name=libgcc.a\fR. .Sp This is useful when you use \fB\-nostdlib\fR or \fB\-nodefaultlibs\fR but you do want to link with \fIlibgcc.a\fR. You can do .Sp .Vb 1 \& gcc \-nostdlib ... \`gcc \-print\-libgcc\-file\-name\` .Ve .IP "\fB\-print\-search\-dirs\fR" 4 .IX Item "-print-search-dirs" Print the name of the configured installation directory and a list of program and library directories \fBgcc\fR will search\-\-\-and don't do anything else. .Sp This is useful when \fBgcc\fR prints the error message \&\fBinstallation problem, cannot exec cpp0: No such file or directory\fR. To resolve this you either need to put \fIcpp0\fR and the other compiler components where \fBgcc\fR expects to find them, or you can set the environment variable \fB\s-1GCC_EXEC_PREFIX\s0\fR to the directory where you installed them. Don't forget the trailing \fB/\fR. .IP "\fB\-print\-sysroot\-headers\-suffix\fR" 4 .IX Item "-print-sysroot-headers-suffix" Print the suffix added to the target sysroot when searching for headers, or give an error if the compiler is not configured with such a suffix\-\-\-and don't do anything else. .IP "\fB\-dumpmachine\fR" 4 .IX Item "-dumpmachine" Print the compiler's target machine (for example, \&\fBi686\-pc\-linux\-gnu\fR)\-\-\-and don't do anything else. .IP "\fB\-dumpversion\fR" 4 .IX Item "-dumpversion" Print the compiler version (for example, \fB3.0\fR)\-\-\-and don't do anything else. .IP "\fB\-dumpspecs\fR" 4 .IX Item "-dumpspecs" Print the compiler's built-in specs\-\-\-and don't do anything else. (This is used when \s-1GCC\s0 itself is being built.) .IP "\fB\-feliminate\-unused\-debug\-types\fR" 4 .IX Item "-feliminate-unused-debug-types" Normally, when producing \s-1DWARF2\s0 output, \s-1GCC\s0 will emit debugging information for all types declared in a compilation unit, regardless of whether or not they are actually used in that compilation unit. Sometimes this is useful, such as if, in the debugger, you want to cast a value to a type that is not actually used in your program (but is declared). More often, however, this results in a significant amount of wasted space. With this option, \s-1GCC\s0 will avoid producing debug symbol output for types that are nowhere used in the source file being compiled. .Sh "Options That Control Optimization" .IX Subsection "Options That Control Optimization" These options control various sorts of optimizations. .PP Without any optimization option, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code. .PP Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. .PP The compiler performs optimization based on the knowledge it has of the program. Optimization levels \fB\-O\fR and above, in particular, enable \fIunit-at-a-time\fR mode, which allows the compiler to consider information gained from later functions in the file when compiling a function. Compiling multiple files at once to a single output file in \fIunit-at-a-time\fR mode allows the compiler to use information gained from all of the files when compiling each of them. .PP Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed. .IP "\fB\-O\fR" 4 .IX Item "-O" .PD 0 .IP "\fB\-O1\fR" 4 .IX Item "-O1" .PD Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. .Sp With \fB\-O\fR, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time. .Sp \&\fB\-O\fR turns on the following optimization flags: .Sp \&\fB\-fauto\-inc\-dec \&\-fcprop\-registers \&\-fdce \&\-fdefer\-pop \&\-fdelayed\-branch \&\-fdse \&\-fguess\-branch\-probability \&\-fif\-conversion2 \&\-fif\-conversion \&\-finline\-small\-functions \&\-fipa\-pure\-const \&\-fipa\-reference \&\-fmerge\-constants \&\-fsplit\-wide\-types \&\-ftree\-ccp \&\-ftree\-ch \&\-ftree\-copyrename \&\-ftree\-dce \&\-ftree\-dominator\-opts \&\-ftree\-dse \&\-ftree\-fre \&\-ftree\-sra \&\-ftree\-ter \&\-funit\-at\-a\-time\fR .Sp \&\fB\-O\fR also turns on \fB\-fomit\-frame\-pointer\fR on machines where doing so does not interfere with debugging. .IP "\fB\-O2\fR" 4 .IX Item "-O2" Optimize even more. \s-1GCC\s0 performs nearly all supported optimizations that do not involve a space-speed tradeoff. The compiler does not perform loop unrolling or function inlining when you specify \fB\-O2\fR. As compared to \fB\-O\fR, this option increases both compilation time and the performance of the generated code. .Sp \&\fB\-O2\fR turns on all optimization flags specified by \fB\-O\fR. It also turns on the following optimization flags: \&\fB\-fthread\-jumps \&\-falign\-functions \-falign\-jumps \&\-falign\-loops \-falign\-labels \&\-fcaller\-saves \&\-fcrossjumping \&\-fcse\-follow\-jumps \-fcse\-skip\-blocks \&\-fdelete\-null\-pointer\-checks \&\-fexpensive\-optimizations \&\-fgcse \-fgcse\-lm \&\-foptimize\-sibling\-calls \&\-fpeephole2 \&\-fregmove \&\-freorder\-blocks \-freorder\-functions \&\-frerun\-cse\-after\-loop \&\-fsched\-interblock \-fsched\-spec \&\-fschedule\-insns \-fschedule\-insns2 \&\-fstrict\-aliasing \-fstrict\-overflow \&\-ftree\-pre \&\-ftree\-vrp\fR .Sp Please note the warning under \fB\-fgcse\fR about invoking \fB\-O2\fR on programs that use computed gotos. .IP "\fB\-O3\fR" 4 .IX Item "-O3" Optimize yet more. \fB\-O3\fR turns on all optimizations specified by \&\fB\-O2\fR and also turns on the \fB\-finline\-functions\fR, \&\fB\-funswitch\-loops\fR, \fB\-fpredictive\-commoning\fR, \&\fB\-fgcse\-after\-reload\fR and \fB\-ftree\-vectorize\fR options. .IP "\fB\-O0\fR" 4 .IX Item "-O0" Reduce compilation time and make debugging produce the expected results. This is the default. .IP "\fB\-Os\fR" 4 .IX Item "-Os" Optimize for size. \fB\-Os\fR enables all \fB\-O2\fR optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size. .Sp \&\fB\-Os\fR disables the following optimization flags: \&\fB\-falign\-functions \-falign\-jumps \-falign\-loops \&\-falign\-labels \-freorder\-blocks \-freorder\-blocks\-and\-partition \&\-fprefetch\-loop\-arrays \-ftree\-vect\-loop\-version\fR .Sp If you use multiple \fB\-O\fR options, with or without level numbers, the last such option is the one that is effective. .PP Options of the form \fB\-f\fR\fIflag\fR specify machine-independent flags. Most flags have both positive and negative forms; the negative form of \fB\-ffoo\fR would be \fB\-fno\-foo\fR. In the table below, only one of the forms is listed\-\-\-the one you typically will use. You can figure out the other form by either removing \fBno\-\fR or adding it. .PP The following options control specific optimizations. They are either activated by \fB\-O\fR options or are related to ones that are. You can use the following flags in the rare cases when \*(L"fine-tuning\*(R" of optimizations to be performed is desired. .IP "\fB\-fno\-default\-inline\fR" 4 .IX Item "-fno-default-inline" Do not make member functions inline by default merely because they are defined inside the class scope (\*(C+ only). Otherwise, when you specify \&\fB\-O\fR, member functions defined inside class scope are compiled inline by default; i.e., you don't need to add \fBinline\fR in front of the member function name. .IP "\fB\-fno\-defer\-pop\fR" 4 .IX Item "-fno-defer-pop" Always pop the arguments to each function call as soon as that function returns. For machines which must pop arguments after a function call, the compiler normally lets arguments accumulate on the stack for several function calls and pops them all at once. .Sp Disabled at levels \fB\-O\fR, \fB\-O2\fR, \fB\-O3\fR, \fB\-Os\fR. .IP "\fB\-fforward\-propagate\fR" 4 .IX Item "-fforward-propagate" Perform a forward propagation pass on \s-1RTL\s0. The pass tries to combine two instructions and checks if the result can be simplified. If loop unrolling is active, two passes are performed and the second is scheduled after loop unrolling. .Sp This option is enabled by default at optimization levels \fB\-O2\fR, \&\fB\-O3\fR, \fB\-Os\fR. .IP "\fB\-fomit\-frame\-pointer\fR" 4 .IX Item "-fomit-frame-pointer" Don't keep the frame pointer in a register for functions that don't need one. This avoids the instructions to save, set up and restore frame pointers; it also makes an extra register available in many functions. \fBIt also makes debugging impossible on some machines.\fR .Sp On some machines, such as the \s-1VAX\s0, this flag has no effect, because the standard calling sequence automatically handles the frame pointer and nothing is saved by pretending it doesn't exist. The machine-description macro \f(CW\*(C`FRAME_POINTER_REQUIRED\*(C'\fR controls whether a target machine supports this flag. .Sp Enabled at levels \fB\-O\fR, \fB\-O2\fR, \fB\-O3\fR, \fB\-Os\fR. .IP "\fB\-foptimize\-sibling\-calls\fR" 4 .IX Item "-foptimize-sibling-calls" Optimize sibling and tail recursive calls. .Sp Enabled at levels \fB\-O2\fR, \fB\-O3\fR, \fB\-Os\fR. .IP "\fB\-fno\-inline\fR" 4 .IX Item "-fno-inline" Don't pay attention to the \f(CW\*(C`inline\*(C'\fR keyword. Normally this option is used to keep the compiler from expanding any functions inline. Note that if you are not optimizing, no functions can be expanded inline. .IP "\fB\-fin