manual/ at main · Uberspace/manual · GitHub

Looking for:

User manual Candy GCC NB (English - pages) 













































     


Gcc manual



 

Assume int to be an 8-bit integer. Note that this is not really supported by avr-libc , so it should normally not be used. The default is to use bit integers. Generates code that changes the stack pointer without disabling interrupts. Normally, the state of the status register SREG is saved in a temporary register, interrupts are disabled while changing the stack pointer, and SREG is restored.

On avr2 and avr4 architectures less than 8 KB or flash memory , this is always the case. Dump the internal compilation result called "RTL" into comments in the generated assembler code. Used for debugging avr-gcc. Dump the address, size, and relative cost of each statement into comments in the generated assembler code.

Optimization level n. Increasing n is meant to optimize more, an optimization level of 0 means no optimization at all, which is the default if no -O option is present. The special option -Os is meant to turn on all -O2 optimizations that are not expected to increase code size. Note that at -O3 , gcc attempts to inline all "simple" functions.

For the AVR target, this will normally constitute a large pessimization due to the code increasement. The only other optimization turned on with -O3 is -frename-registers , which could rather be enabled manually instead. Note also that turning off all optimizations will prevent some warnings from being issued since the generation of those warnings depends on code analysis steps that are only performed when optimizing unreachable code, unused variables.

See also the appropriate FAQ entry for issues regarding debugging optimized code. Pass the listed options to the assembler, or linker, respectively. Assume a "freestanding" environment as per the C standard. It also makes the compiler not complain when main is declared with a void return type which makes some sense in a microcontroller environment where the application cannot meaningfully provide a return value to its environment in most cases, main won't even return anyway.

However, this also turns off all optimizations normally done by the compiler which assume that functions known by a certain name behave as described by the standard. Make any unqualfied char type an unsigned char. Without this option, they default to a signed char.

Allocate to an enum type only as many bytes as it needs for the declared range of possible values. Specifically, the enum type will be equivalent to the smallest integer type which has enough room. Do not generate tablejump instructions. By default, jump tables can be used to optimize switch statements.

When turned off, sequences of compare statements are used instead. Jump tables are usually faster to execute on average, but in particular for switch statements, where most of the jumps would go to the default label, they might waste a bit of flash memory.

Always use -fno-jump-tables switch, if compiling a bootloader for devices with more than 64 KB of code memory. By default, avr2 is assumed, but this can be altered by using the appropriate.

Early AVR devices suffered from a hardware bug where these instructions could not be properly skipped. This enables avr-gdb to trace through assembler source files.

This option must not be used when assembling sources that have been generated by the C compiler; these files already contain the appropriate line number information from the C source files.

Remember that assembler options can be passed from the C compiler frontend using -Wa see above , so in order to include the C source code into the assembler listing in file foo. In order to pass an assembler file through the C preprocessor first, and have the assembler generate line number debugging information for it, the following command can be used:.

Note that on Unix systems that have case-distinguishing file systems, specifying a file name with the suffix. S upper-case letter S will make the compiler automatically assume -x assembler-with-cpp , while using. While there are no machine-specific options for avr-ld, a number of the standard options might be of interest to AVR users.

Locate the archive library named lib name. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in '-Wall'. All of the above '-W' options combined. This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid or modify to prevent the warning , even in conjunction with macros.

The following '-W Some of them warn about constructions that users generally do not consider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary or hard to avoid in some cases, and there is no simple way to modify the code to suppress the warning. A function can return either with or without a value. Falling off the end of the function body is considered returning without a value.

For example, this function would evoke such a warning:. An expression-statement or the left-hand side of a comma expression contains no side effects. To suppress the warning, cast the unused expression to void. For example, an expression such as x[i,j] will cause a warning, but x[ void i,j] will not. Storage-class specifiers like static are not the first things in a declaration.

According to the C Standard, this usage is obsolescent. The return type of a function has a type qualifier such as const. Such a type qualifier has no effect, since the value returned by a function is not an lvalue.

But don't warn about the GNU extension of volatile void return types. That extension will be warned about if '-pedantic' is specified. A comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. But don't warn if '-Wno-sign-compare' is also specified. An aggregate has a partly bracketed initializer. For example, the following code would evoke such a warning, because braces are missing around the initializer for x.

An aggregate has an initializer which does not initialize all members. For example, the following code would cause such a warning, because x. Do not warn about compile-time integer division by zero. Floating point division by zero is not warned about, as it can be a legitimate way of obtaining infinities and NaNs.

Print warning messages for constructs found in system header files. Warnings from system headers are normally suppressed, on the assumption that they usually do not indicate real problems and would only make the compiler output harder to read. Using this command line option tells GCC to emit warnings from system headers as if they occurred in user code. However, note that using '-Wall' in conjunction with this option will not warn about unknown pragmas in system headers - for that, '-Wunknown-pragmas' must also be used.

Warn if floating point values are used in equality comparisons. The idea behind this is that sometimes it is convenient for the programmer to consider floating-point values as approximations to infinitely precise real numbers.

If you are doing this, then you need to compute by analyzing the code, or in some other way the maximum or likely maximum error that the computation introduces, and allow for it when performing comparisons and when producing output, but that's a different problem.

In particular, instead of testing for equality, you would check to see whether the two values have ranges that overlap; and this is done with the relational operators, so equality comparisons are probably mistaken.

Warn about certain constructs that behave differently in traditional and ISO C. Macro parameters that appear within string literals in the macro body. In traditional C, some preprocessor directives did not exist. Traditional preprocessors would only consider a line to be a directive if the appeared in column 1 on the line. Therefore '-Wtraditional' warns about directives that traditional C understands but would ignore because the does not appear as the first character on the line.

It also suggests you hide directives like pragma not understood by traditional C by indenting them. Some traditional implementations would not recognize elif , so it suggests avoiding it altogether. The U integer constant suffix, or the F or L floating point constant suffixes. Traditional C does support the L suffix on integer constants. Note, these suffixes appear in macros defined in limits. A switch statement has an operand of type long.

A non- static function declaration follows a static one. This construct is not accepted by some traditional C compilers. The ISO type of an integer constant has a different width or signedness from its traditional type.

This warning is only issued if the base of the constant is 10, i. Initialization of unions. If the initializer is zero, the warning is omitted. This is done under the assumption that the zero initializer in user code appears conditioned on e. The absence of these prototypes when compiling with traditional C would cause serious problems.

This is a subset of the possible conversion warnings, for the full set use '-Wconversion'. Use of ISO C style function definitions. This warning is also bypassed for nested functions because that feature is already a gcc extension and thus not relevant to traditional C compatibility. Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed.

Warn about anything that depends on the "size of" a function type or of void. Warn whenever a function call is cast to a non-matching type. Warn whenever a pointer is cast so as to remove a type qualifier from the target type. Warn whenever a pointer is cast such that the required alignment of the target is increased. These warnings will help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using const in declarations and prototypes.

Otherwise, it will just be a nuisance; this is why we did not make '-Wall' request these warnings. Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signedness of a fixed point argument except when the same as the default promotion.

Also, warn if a negative integer constant expression is implicitly converted to an unsigned type. But do not warn about explicit casts like unsigned Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. 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.

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.

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. Warn about functions which might be candidates for attribute noreturn.

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 noreturn attribute, otherwise subtle code generation bugs could be introduced. If '-Wformat' is enabled, also warn about functions which might be candidates for format attributes. GCC will guess that format attributes might be appropriate for any function that calls a function like vprintf or vscanf , but this might not always be the case, and some functions for which format attributes are appropriate may not be detected.

This option has no effect unless '-Wformat' is enabled possibly by '-Wall'. Do not warn if a multicharacter constant 'FOOF' 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. Do not warn about uses of functions, variables, and types marked as deprecated by using the deprecated attribute. 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. 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.

Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing. Warn if an extern declaration is encountered within a function. Warn if the compiler detects that code will never be executed. 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.

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.

For instance, when a function is inlined, a warning may mean that the line is unreachable in only one inlined copy of the function. This option is not made part of '-Wall' 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. 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. 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 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 '-Winline' to appear or disappear. Warn if long long type is used. This is default. To inhibit the warning messages, use '-Wno-long-long'. Flags '-Wlong-long' and '-Wno-long-long' are taken into account only when '-pedantic' flag is used. 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 GCC's optimizers were unable to handle the code effectively. Often, the problem is that your code is too big or too complex; GCC will refuse to optimize programs when the optimization itself is likely to take inordinate amounts of time. However, this manual is not meant to explain anything about the internals of GCC, so you will have to go to the official version of this page on the internet if you want to debug GCC itself.

Produce debugging information in the operating system's native format stabs is the default for the MC GDB can work with this debugging information. 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.

Nevertheless it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs.

The following options are useful when GCC is generated with the capability for more than one debugging format. Produce debugging information for use by GDB. This means to use the most expressive format available, including GDB extensions if at all possible. Request debugging information and also use level to specify how much information. The default level is 2. 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. Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when you use '-g3'. Generate extra code to write profile information suitable for the analysis program prof. You must use this option when compiling the source files you want data about, and you must also use it when linking.

Generate extra code to write profile information suitable for the analysis program gprof. Makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes.

Store the usual "temporary" intermediate files permanently; place them in the current directory and name them based on the source file.

Thus, compiling foo. This creates a preprocessed foo. These options control various sorts of optimizations. 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. Not all optimizations are controlled directly by a flag.

Only optimizations that have a flag are listed. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With '-O' , the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.

Optimize even more. GCC 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 '-O2'. As compared to '-O' , this option increases both compilation time and the performance of the generated code. It also turns on the following optimization flags: -fforce-mem -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fdelete-null-pointer-checks -fexpensive-optimizations -fregmove -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -freorder-blocks -freorder-functions -fstrict-aliasing -falign-functions -falign-jumps -falign-loops -falign-labels Please note the warning under '-fgcse' about invoking '-O2' on programs that use computed gotos.

Optimize yet more. Optimize for size. It also performs further optimizations designed to reduce code size. Options of the form '-f flag ' specify machine-independent flags.

Most flags have both positive and negative forms; the negative form of '-ffoo' would be '-fno-foo'. 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 'no-' or adding it. The following options control specific optimizations. They are either activated by '-O' options or are related to ones that are. You can use the following flags in the rare cases when "fine-tuning" of optimizations to be performed is desired.

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.

Disabled at levels '-O' , '-O2' , '-O3' , '-Os'. Force memory operands to be copied into registers before doing arithmetic on them. This produces better code by making all memory references potential common subexpressions.

When they are not common subexpressions, instruction combination should eliminate the separate register-load. Enabled at levels '-O2' , '-O3' , '-Os'. Force memory address constants to be copied into registers before doing arithmetic on them. This may produce better code just as '-fforce-mem' may. 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. This option now works with floating point arithmetic. Enabled at levels '-O' , '-O2' , '-O3' , '-Os'. Optimize sibling and tail recursive calls. Don't pay attention to the inline 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.

Integrate all simple functions into their callers. The compiler heuristically decides which functions are simple enough to be worth integrating in this way. If all calls to a given function are integrated, and the function is declared static , then the function is normally not output as assembler code in its own right. Enabled at level '-O3'.

By default, gcc limits the size of functions that can be inlined. This flag allows the control of this limit for functions that are explicitly marked as inline i. The default value of n is Increasing this value can result in more inlined code at the cost of compilation time and memory consumption. Decreasing usually makes the compilation faster and less code will be inlined which presumably means slower programs. This option is particularly useful for programs that use inlining heavily. See below for a documentation of the individual parameters controlling inlining.

Note: pseudo instruction represents, in this particular context, an abstract measurement of function's size. In no way, it represents a count of assembly instructions and as such its exact meaning might change from one release to an another. Even if all calls to a given function are integrated, and the function is declared static , nevertheless output a separate run-time callable version of the function. This switch does not affect extern inline functions.

Emit variables declared static const when optimization isn't turned on, even if the variables aren't referenced. GCC enables this option by default. If you want to force the compiler to check if the variable was referenced, regardless of whether or not optimization is turned on, use the '-fno-keep-static-consts' option.

Attempt to merge identical constants string constants and floating point constants across compilation units. This option is the default for optimized compilation if the assembler and linker support it. Use '-fno-merge-constants' to inhibit this behavior. Attempt to merge identical constants and identical variables. This option implies '-fmerge-constants'.

In addition to '-fmerge-constants' this considers e. C requires each non-automatic variable to have a distinct location, so using this option will result in non-conforming behavior. Do not use "decrement and branch" instructions on a count register, but instead generate a sequence of instructions that decrement a register, compare it against zero, then branch based upon the result.

The default is '-fbranch-count-reg' , enabled when '-fstrength-reduce' is enabled. Do not put function addresses in registers; make each instruction that calls a constant function contain the function's address explicitly. This option results in less efficient code, but some strange hacks that alter the assembler output may be confused by the optimizations performed when this option is not used. The default is '-ffunction-cse'. This can save space in the resulting code.

This option turns off this behavior because some programs explicitly rely on variables going to the data section. The default is '-fzero-initialized-in-bss'. Perform the optimizations of loop strength reduction and elimination of iteration variables. Perform optimizations where we check to see if a jump branches to a location where another comparison subsumed by the first is found. If so, the first branch is redirected to either the destination of the second branch or a point immediately following it, depending on whether the condition is known to be true or false.

In common subexpression elimination, scan through jump instructions when the target of the jump is not reached by any other path. For example, when CSE encounters an if statement with an else clause, CSE will follow the jump when the condition tested is false. This is similar to '-fcse-follow-jumps' , but causes CSE to follow jumps which conditionally skip over blocks.

When CSE encounters a simple if statement with no else clause, '-fcse-skip-blocks' causes CSE to follow the jump around the body of the if. Re-run common subexpression elimination after loop optimizations have been performed. Run the loop optimizer twice. Perform a global common subexpression elimination pass. This pass also performs global constant and copy propagation.

Note: When compiling a program using computed gotos, a GCC extension, you may get better runtime performance if you disable the global common subexpression elimination pass by adding '-fno-gcse' to the command line.

When '-fgcse-lm' is enabled, global common subexpression elimination will attempt to move loads which are only killed by stores into themselves. Enabled by default when gcse is enabled. When '-fgcse-sm' is enabled, A store motion pass is run after global common subexpression elimination. This pass will attempt to move stores out of loops. Perform loop optimizations: move constant expressions out of loops, simplify exit test conditions and optionally do strength-reduction and loop unrolling as well.

Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The resulting code may or may not perform better than without cross-jumping. Attempt to transform conditional jumps into branch-less equivalents.

This include use of conditional moves, min, max, set flags and abs instructions, and some tricks doable by standard arithmetics. The use of conditional execution on chips where it is available is controlled by if-conversion2. Use conditional execution where available to transform conditional jumps into branch-less equivalents.

Use global dataflow analysis to identify and eliminate useless checks for null pointers. The compiler assumes that dereferencing a null pointer would have halted the program. If a pointer is checked after it has already been dereferenced, it cannot be null. In some environments, this assumption is not true, and programs can safely dereference null pointers. Use '-fno-delete-null-pointer-checks' to disable this optimization for programs which depend on that behavior.

Perform a number of minor optimizations that are relatively expensive. Attempt to reassign register numbers in move instructions and as operands of other simple instructions in order to maximize the amount of register tying. This is especially helpful on machines with two-operand instructions. Note '-fregmove' and '-foptimize-register-move' are the same optimization. If supported for the target machine, attempt to reorder instructions to exploit instruction slots available after delayed branch instructions.

If supported for the target machine, attempt to reorder instructions to eliminate execution stalls due to required data being unavailable. This helps machines that have slow floating point or memory load instructions by allowing other instructions to be issued until the result of the load or floating point instruction is required.

Similar to '-fschedule-insns' , but requests an additional pass of instruction scheduling after register allocation has been done. This is especially useful on machines with a relatively small number of registers and where memory load instructions take more than one cycle. Don't schedule instructions across basic blocks. This is normally enabled by default when scheduling before register allocation, i.

Don't allow speculative motion of non-load instructions. Allow speculative motion of some load instructions. This only makes sense when scheduling before register allocation, i. Allow speculative motion of more load instructions. Enable values to be allocated in registers that will be clobbered by function calls, by emitting extra instructions to save and restore the registers around such calls.

Such allocation is done only when it seems to result in better code than would otherwise be produced. This option is always enabled by default on certain machines, usually those which have no call-preserved registers to use instead. Forces all general-induction variables in loops to be strength-reduced. These options may generate better or worse code; results are highly dependent on the structure of loops within the source code. These two options are intended to be removed someday, once they have helped determine the efficacy of various approaches to improving loop optimizations.

Disable any machine-specific peephole optimizations. The difference between '-fno-peephole' and '-fno-peephole2' is in how they are implemented in the compiler; some targets use one, some use the other, a few use both. Do not guess branch probabilities using a randomized model. This means that different runs of the compiler on the same program may produce different object code. In a hard real-time system, people don't want different runs of the compiler to produce code that has different behavior; minimizing non-determinism is of paramount importance.

This switch allows users to reduce non-determinism, possibly at the expense of inferior optimization. The default is '-fguess-branch-probability' at levels '-O' , '-O2' , '-O3' , '-Os'. Reorder basic blocks in the compiled function in order to reduce number of taken branches and improve code locality.

Enabled at levels '-O2' , '-O3'. This is implemented by using special subsections text. Reordering is done by the linker so object file format must support named sections and linker must place them in a reasonable way.

Also profile feedback must be available in to make this option effective. See '-fprofile-arcs' for details. Allows the compiler to assume the strictest aliasing rules applicable to the language being compiled. For C, this activates optimizations based on the type of expressions. In particular, an object of one type is assumed never to reside at the same address as an object of a different type, unless the types are almost the same.

A character type may alias any other type. Pay special attention to code like this:. The practice of reading from a different union member than the one most recently written to called "type-punning" is common. Even with '-fstrict-aliasing' , type-punning is allowed, provided the memory is accessed through the union type.

So, the code above will work as expected. However, this code might not:. Align the start of functions to the next power-of-two greater than n , skipping up to n bytes.

Some assemblers only support this flag when n is a power of two; in that case, it is rounded up. If n is not specified, use a machine-dependent default. Align all branch targets to a power-of-two boundary, skipping up to n bytes like '-falign-functions'.

This option can easily make code slower, because it must insert dummy operations for when the branch target is reached in the usual flow of the code. If '-falign-loops' or '-falign-jumps' are applicable and are greater than this value, then their values are used instead.

If n is not specified, use a machine-dependent default which is very likely to be 1 , meaning no alignment. Align loops to a power-of-two boundary, skipping up to n bytes like '-falign-functions'. The hope is that the loop will be executed many times, which will make up for any execution of the dummy operations.

Align branch targets to a power-of-two boundary, for branch targets where the targets can only be reached by jumping, skipping up to n bytes like '-falign-functions'. In this case, no dummy operations need be executed. Attempt to avoid false dependencies in scheduled code by making use of registers left over after register allocation. This optimization will most benefit processors with lots of registers. It can, however, make debugging impossible, since variables will no longer stay in a "home register".

Enabled at levels '-O3'. After register allocation and post-register allocation instruction splitting, we perform a copy-propagation pass to try to reduce scheduling dependencies and occasionally eliminate the copy. The following options control compiler behavior regarding floating point arithmetic. These options trade off between speed and correctness.

All must be specifically enabled. Do not store floating point variables in registers, and inhibit other options that might change whether a floating point value is taken from a register or memory. This option prevents undesirable excess precision on machines such as the where the floating registers of the keep more precision than a double is supposed to have.

Similarly for the x86 architecture. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating point.

Use '-ffloat-store' for such programs, after modifying them to store all pertinent intermediate computations into variables. This option is probably useless in TIGCC, except as a workaround for floating point arithmetic errors.

Sets '-fno-math-errno' , '-funsafe-math-optimizations' , '-fno-trapping-math' , '-ffinite-math-only' and '-fno-signaling-nans'. The default is '-fmath-errno'. When used at link-time, it may include libraries or startup files that change the default FPU control word or other similar optimizations. The default is '-fno-unsafe-math-optimizations'. The default is '-fno-finite-math-only'. Compile code assuming that floating-point operations cannot generate user-visible traps. These traps include division by zero, overflow, underflow, inexact result and invalid operation.

This option implies '-fno-signaling-nans'. Setting this option may allow faster code if one relies on "non-stop" IEEE arithmetic, for example. The default is '-ftrapping-math'. Setting this option disables optimizations that may change the number of exceptions visible with signaling NaNs. This option implies '-ftrapping-math'. The default is '-fno-signaling-nans'. This option is experimental and does not currently guarantee to disable all GCC optimizations that affect signaling NaN behavior.

Treat floating point constant as single precision constant instead of implicitly converting it to double precision constant. The following options control optimizations that may improve performance, but are not enabled by any '-O' options.

This section includes experimental options that may produce broken code. After running a program compiled with '-fprofile-arcs' see Options for Debugging Your Program or GCC , you can compile it a second time using '-fbranch-probabilities' , to improve optimizations based on the number of times each branch was taken.

When the program compiled with '-fprofile-arcs' exits, it saves arc execution counts to a file called sourcename. The information in this data file is very dependent on the structure of the generated code, so you must use the same source code and the same optimization options for both compilations.

These can be used to improve optimization. Currently, they are only used in one place: in reorg. Use a graph coloring register allocator. Currently this option is meant for testing, so we are interested to hear about miscompilations with '-fnew-ra'.

Perform tail duplication to enlarge superblock size. This transformation simplifies the control flow of the function allowing other optimizations to do better job.

Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. This option makes code larger, and may or may not make it run faster.

Unroll all loops, even if their number of iterations is uncertain when the loop is entered. This usually makes programs run more slowly. If supported by the target machine, generate instructions to prefetch memory to improve the performance of loops that access large arrays.

Disabled at level '-Os'. Place each function or data item into its own section in the output file if the target supports arbitrary sections. The name of the function or the name of the data item determines the section's name in the output file. Use these options on systems where the linker can perform optimizations to improve locality of reference in the instruction space.

AIX may have these optimizations in the future. Only use these options when there are significant benefits from doing so. When you specify these options, the assembler and linker will create larger object and executable files and will also be slower. You will not be able to use gprof on all systems if you specify this option and you may have problems with debugging if you specify both this option and '-g'. Perform optimizations in static single assignment form.

Each function's flow graph is translated into SSA form, optimizations are performed, and the flow graph is translated back from SSA form. Users should not specify this option, since it is not yet ready for production use. Requires '-fssa'. Like '-fssa' , this is an experimental feature. Perform aggressive dead-code elimination in SSA form.

In some places, GCC uses various constants to control the amount of optimization that is done. For example, GCC will not inline functions that contain more that a certain number of instructions. You can control some of these constants on the command-line using the '--param' option.

In each case, the value is an integer. The allowable choices for name are given in the following table:. The maximum number of incoming edges to consider for crossjumping.

Increasing values mean more aggressive optimization, making the compile time increase with probably small improvement in executable size. The maximum number of instructions to consider when looking for an instruction to fill a delay slot.

If more than this arbitrary number of instructions is searched, the time savings from filling the delay slot will be minimal so stop searching. Increasing values mean more aggressive optimization, making the compile time increase with probably small improvement in executable run time.

When trying to fill delay slots, the maximum number of instructions to consider when searching for a block with valid live register information. Increasing this arbitrarily chosen value means more aggressive optimization, increasing the compile time. This parameter should be removed when the delay slot code is rewritten to maintain the control-flow graph.

The approximate maximum amount of memory that will be allocated in order to perform the global common subexpression elimination optimization. If more memory than specified is required, the optimization will not be done. The maximum number of pending dependencies scheduling will allow before flushing the current state and starting over. Large functions with few branches or calls can create excessively large lists which needlessly consume memory and resources.

Several parameters control the tree inliner used in gcc. This number sets the maximum number of instructions counted in gcc's internal representation in a single function that the tree inliner will consider for inlining. This only affects functions declared inline. The default value is When you use '-finline-functions' included in '-O3' , a lot of functions that would otherwise not be considered for inlining by the compiler will be investigated.

To those functions, a different more restrictive limit compared to functions declared inline can be applied. The tree inliner does decrease the allowable size for single functions to be inlined after we already inlined the number of instructions given here by repeated inlining. This number should be a factor of two or more larger than the single function limit. Higher numbers result in better runtime performance, but incur higher compile-time resource CPU time, memory requirements and result in larger binaries.

Very high values are not advisable, as too large binaries may adversely affect runtime performance. After exceeding the maximum number of inlined instructions by repeated inlining, a linear function is used to decrease the allowable size for single functions. The slope of that function is the negative reciprocal of the number specified here. The repeated inlining is throttled more and more by the linear function after exceeding the limit.

To avoid too much throttling, a minimum for this function is specified here to allow repeated inlining for very small functions even when a lot of repeated inlining already has been done.

For languages that use the RTL inliner this happens at a later stage than tree inlining , you can set the maximum allowable size counted in RTL instructions for the RTL inliner with this parameter. The maximum number of instructions that a loop should have if that loop is unrolled, and if the loop is unrolled, it determines how many times the loop code is unrolled. Select fraction of the maximal count of repetitions of basic block in program given basic block needs to have to be considered hot.

Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot. This value is used to limit superblock formation once the given percentage of executed instructions is covered.

This limits unnecessary code size expansion. The 'tracer-dynamic-coverage-feedback' is used only when profile feedback is available.

The real profiles as opposed to statically estimated ones are much less balanced allowing the threshold to be larger value. Stop tail duplication once code growth has reached given percentage. This is rather hokey argument, as most of the duplicates will be eliminated later in cross jumping, so it may be set to much higher values than is the desired code growth.

Stop reverse growth when the reverse probability of best edge is less than this threshold in percent. Stop forward growth if the best edge do have probability lower than this threshold.

Similarly to 'tracer-dynamic-coverage' two values are present, one for compilation for profile feedback and one for compilation without. The value for compilation with profile feedback needs to be more conservative higher in order to make tracer effective. GCC uses a garbage collector to manage its own memory allocation. This parameter specifies the minimum percentage by which the garbage collector's heap should be allowed to expand between collections.

Tuning this may improve compilation speed; it has no effect on code generation. Setting this parameter and 'ggc-min-heapsize' to zero causes a full collection to occur at every opportunity. This is extremely slow, but can be useful for debugging. Minimum size of the garbage collector's heap before it begins bothering to collect garbage.

Again, tuning this may improve compilation speed, and has no effect on code generation. Setting this parameter very large effectively disables garbage collection. Setting this parameter and 'ggc-min-expand' to zero causes a full collection to occur at every opportunity. These options control the C preprocessor , which is run on each C source file before actual compilation.

If you use the '-E' option, nothing is done except preprocessing. Some of these options make sense only together with '-E' because they cause the preprocessor output to be unsuitable for actual compilation. You can use '-Wp, option ' to bypass the compiler driver and pass option directly through to the preprocessor. If option contains commas, it is split into multiple options at the commas. However, many options are modified, translated or interpreted by the compiler driver before being passed to the preprocessor, and '-Wp' forcibly bypasses this phase.

The preprocessor's direct interface is undocumented and subject to change, so whenever possible you should avoid using '-Wp' and let the driver handle the options instead. Predefine name as a macro, with definition definition. There are no restrictions on the contents of definition , but if you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax.

If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign if any. Parentheses are meaningful to most shells, so you will need to quote the option. With sh and csh , '-D' name args All '-imacros file ' and '-include file ' options are processed after all '-D' and '-U' options. Cancel any previous definition of name , either built in or provided with a '-D' option.

Add the directory dir to the list of directories to be searched for header files. Directories named by '-I' are searched before the standard system include directories.

If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated see System Headers. Write output to file. This is the same as specifying file as the second non-option argument to cpp.

Turns on all optional warnings which are desirable for normal code. At present this is '-Wcomment' and '-Wtrigraphs'. Note that many of the preprocessor's warnings are on by default and have no options to control them. Both forms have the same effect. Warn if any trigraphs are encountered. This option used to take effect only if '-trigraphs' was also specified, but now works independently. Warnings are not given for trigraphs within comments, as they do not affect the meaning of the program.

Also warn about ISO C constructs that have no traditional C equivalent, and problematic constructs which should be avoided. See Traditional Mode. Warn whenever an identifier which is not a macro is encountered in an if directive, outside of defined. Such identifiers are replaced with zero. Warn about macros defined in the main file that are unused.

A macro is used if it is expanded or tested for existence at least once. The preprocessor will also warn if the macro has not been used at the time it is redefined or undefined.

Built-in macros, macros defined on the command line, and macros defined in include files are not warned about. Note: If a macro is actually used, but only used in skipped conditional blocks, then CPP will report it as unused. To avoid the warning in such a case, you might improve the scope of the macro's definition by, for example, moving it into the first skipped block.

Alternatively, you could provide a dummy use with something like:. Warn whenever an else or an endif are followed by text. This usually happens in code of the form. The second and third FOO should be in comments, but often are not in older programs. This warning is on by default. Issue warnings for code in system headers.

These are normally unhelpful in finding bugs in your own code, therefore suppressed. If you are responsible for the system library, you may want to see them. Issue all the mandatory diagnostics listed in the C standard. Some of them are left out by default, since they trigger frequently on harmless code. Issue all the mandatory diagnostics, and make all mandatory diagnostics into errors. This includes mandatory diagnostics that GCC issues without '-pedantic' but treats as warnings.

Instead of outputting the result of preprocessing, output a rule suitable for make describing the dependencies of the main source file. The preprocessor outputs one make rule containing the object file name for that source file, a colon, and the names of all the included files, including those coming from '-include' or '-imacros' command line options. Unless specified explicitly with '-MT' or '-MQ' , the object file name consists of the basename of the source file with any suffix replaced with object file suffix.

The rule has no commands. This option does not suppress the preprocessor's debug output, such as '-dM'. Debug output will still be sent to the regular output stream as normal. Passing '-M' to the driver implies '-E' , and suppresses warnings with an implicit '-w'.

Like '-M' but do not mention header files that are found in system header directories, nor header files that are included, directly or indirectly, from such a header. This implies that the choice of angle brackets or double quotes in an include directive does not in itself determine whether that header will appear in '-MM' dependency output.

This is a slight change in semantics from GCC versions 3. When used with '-M' or '-MM' , specifies a file to write the dependencies to. If no '-MF' switch is given the preprocessor sends the rules to the same place it would have sent preprocessed output. In conjunction with an option such as '-M' requesting dependency generation, '-MG' assumes missing header files are generated files and adds them to the dependency list without raising an error.

The dependency filename is taken directly from the include directive without prepending any path. This feature is used in automatic updating of makefiles. This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing. These dummy rules work around errors make gives if you remove header files without updating the Makefile to match. This is typical output:. Change the target of the rule emitted by dependency generation.

By default CPP takes the name of the main input file, including any path, deletes any file suffix such as. The result is the target. An '-MT' option will set the target to be exactly the string you specify.

   

 

Gcc manual.GCC online documentation



   

Ask a question. What is a condenser dryer? A condenser dryer is a dryer in which condensation ends up in a reservoir. What is a drain dryer? A drain dryer is a dryer in which the warm air and condensation are drained through a hose.

Our minimum requirements are: GCC 7. This section will focus on building a GCC If your version is less than 7.

If your version is at or greater than 7. Every operating system I have come across has its own nuances of getting stuff built. Normally any issues are going to be solved by installing the necessary development libraries using your system package manager apt-get, yum, zypper, etc.

In general, it has been the goal to stick as best as possible to established standards while implementing this library. Unless otherwise noted, functions of this library are not guaranteed to be reentrant. In particular, any functions that store local state are known to be non-reentrant, as well as functions that manipulate IO registers like the EEPROM access routines.

If these functions are used within both standard and interrupt contexts undefined behaviour will result. I see! So the syntax is always man first! Thanks a lot! To view manual use this commands order: man gcc. Not the answer you're looking for? Browse other questions tagged command-line gcc manpage or ask your own question. The Overflow Blog. CEO update: Eliminating obstacles to productivity, efficiency, and learning. Announcing more ways to learn and grow your skills.



Comments