Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions

Using the gnu compiler collection (gcc)
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING GCC:
Table of Contents

Advertisement

Quick Links

Red Hat Enterprise Linux 3
Using the GNU Compiler
Collection (GCC)

Advertisement

Table of Contents
loading

Summary of Contents for Red Hat ENTERPRISE LINUX 3 - USING GCC

  • Page 1 Red Hat Enterprise Linux 3 Using the GNU Compiler Collection (GCC)
  • Page 2 HTML, PDF, and RPM versions of the manuals are available on the Documentation CD and online at http://www.redhat.com/docs/. The GPG fingerprint of the security@redhat.com key is: CA 20 86 86 2B D6 9D FC 65 F6 EC C4 21 91 80 CD DB 42 A6 0E...
  • Page 3: Table Of Contents

    Table of Contents 1. Introduction............................. 1 2. Compile C, C++, Objective-C, Ada, Fortran, Java, or treelang ..........3 3. Language Standards Supported by GCC ..................5 4. GCC Command Options ........................ 7 4.1. Option Summary........................ 7 4.2. Options Controlling the Kind of Output ................12 4.3.
  • Page 4 6. Extensions to the C Language Family..................121 6.1. Statements and Declarations in Expressions..............121 6.2. Locally Declared Labels ....................122 6.3. Labels as Values......................122 6.4. Nested Functions......................123 6.5. Constructing Function Calls ..................125 6.6. Referring to a Type with ..................
  • Page 5 6.47. Built-in Functions Specific to Particular Target Machines .......... 184 6.47.1. X86 Built-in Functions ................. 184 6.47.2. PowerPC AltiVec Built-in Functions ............188 6.48. Pragmas Accepted by GCC ..................205 6.48.1. RS/6000 and PowerPC Pragmas ..............205 6.48.2. Solaris Pragmas..................... 205 6.48.3.
  • Page 6 12. Reporting Bugs.......................... 253 12.1. Have You Found a Bug? ....................253 12.2. How and where to Report Bugs ................... 253 13. How To Get Help with GCC ....................255 14. Contributing to GCC Development..................257 15. Funding Free Software ......................259 16.
  • Page 7: Introduction

    Chapter 1. Introduction This manual documents how to use the GNU compilers, as well as their features and incompatibilities, and how to report bugs. It corresponds to GCC version 3.4. The internals of the GNU compilers, including how to port them to new targets and some information about how to write front ends for new languages, are documented in a separate manual.
  • Page 8 Chapter 1. Introduction...
  • Page 9: Compile C, C++, Objective-C, Ada, Fortran, Java, Or Treelang

    Chapter 2. Compile C, C++, Objective-C, Ada, Fortran, Java, or treelang Several versions of the compiler (C, C++, Objective-C, Ada, Fortran, Java and treelang) are integrated; this is why we use the name "GNU Compiler Collection". GCC can compile programs written in any of these languages.
  • Page 10 Chapter 2. Compile C, C++, Objective-C, Ada, Fortran, Java, or treelang...
  • Page 11: Language Standards Supported By Gcc

    Chapter 3. Language Standards Supported by GCC For each language compiled by GCC for which there is a standard, GCC attempts to follow one or more versions of that standard, possibly with some exceptions, and possibly with some extensions. GCC supports three versions of the C standard, although support for the most recent version is not yet complete.
  • Page 12 Chapter 3. Language Standards Supported by GCC a freestanding environment; a program using the facilities of an operating system would normally be in a hosted implementation. GCC aims towards being usable as a conforming freestanding implementation, or as the compiler for a conforming hosted implementation.
  • Page 13: Gcc Command Options

    Chapter 4. GCC Command Options When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the tion says not to run the linker. Then the output consists of object files output by the assembler. Other options are passed on to one stage of processing.
  • Page 14 Chapter 4. GCC Command Options C++ Language Options Refer to Section 4.5 Options Controlling C++ Dialect. -fabi-version= -fno-access-control -fcheck-new -fconserve-space -fno-const-strings -fno-elide-constructors -fno-enforce-eh-specs -fexternal-templates -falt-external-templates -ffor-scope -fno-for-scope -fno-gnu-keywords -fno-implicit-templates -fno-implicit-inline-templates -fno-implement-inlines -fms-extensions -fno-nonansi-builtins -fno-operator-names -fno-optional-diags -fpermissive -frepo -fno-rtti -fstats -ftemplate-depth- -fuse-cxa-atexit -fvtable-gc -fno-weak...
  • Page 15 Chapter 4. GCC Command Options -Wunused-value -Wunused-variable -Wwrite-strings C-only Warning Options -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wtraditional Debugging Options Refer to Section 4.9 Options for Debugging Your Program or GCC. -dumpspecs -dumpmachine -dumpversion letters -fdump-unnumbered -fdump-translation-unit[- -fdump-class-hierarchy[- -fdump-tree-original[- -fdump-tree-optimized[- -fdump-tree-inlined[- -feliminate-dwarf2-dups -feliminate-unused-debug-types -fmem-report -fprofile-arcs -frandom-seed=...
  • Page 16 Chapter 4. GCC Command Options Preprocessor Options Refer to Section 4.11 Options Controlling the Preprocessor. question answer question answer macro defn -idirafter -include -imacros file file -iprefix -iwithprefix file -iwithprefixbefore -isystem -nostdinc -remap -trigraphs -undef -Wp, macro option -Xpreprocessor option Assembler Option Refer to Section 4.12 Passing Options to the Assembler.
  • Page 17 Chapter 4. GCC Command Options -mpowerpc-gfxopt -mno-powerpc-gfxopt -mnew-mnemonics -mold-mnemonics -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-call -mno-xl-call -mpe -malign-power -malign-natural -msoft-float -mhard-float -mmultiple -mno-multiple -mstring -mno-string -mupdate -mno-update -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle -mlittle-endian -mbig...
  • Page 18: Options Controlling The Kind Of Output

    Chapter 4. GCC Command Options -freg-struct-return -fshared-data -fshort-enums -fshort-double -fshort-wchar -fverbose-asm -fpack-struct -fstack-check -fstack-limit-register= -fstack-limit-symbol= -fargument-alias -fargument-noalias -fargument-noalias-global -fleading-underscore -ftls-model= model -ftrapv -fwrapv -fbounds-check 4.2. Options Controlling the Kind of Output Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order.
  • Page 19 Chapter 4. GCC Command Options file .for file .FOR file Fortran source code which should not be preprocessed. file .fpp file .FPP file Fortran source code which must be preprocessed (with the traditional preprocessor). file Fortran source code which must be preprocessed with a RATFOR preprocessor (not included with GCC).
  • Page 20 Chapter 4. GCC Command Options -pass-exit-codes Normally the program will exit with the code of 1 if any phase of the compiler returns a non-success return code. If you specify , the program will instead -pass-exit-codes return with numerically highest error produced by any phase that returned an error indication. If you only want some of the stages of compilation, you can use (or filename suffixes) to tell where to start, and one of the options...
  • Page 21: Compiling C++ Programs

    Chapter 4. GCC Command Options -pipe Use pipes rather than temporary files for communication between the various stages of compila- tion. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble. -help Print (on the standard output) a description of the command line options understood by .
  • Page 22 Chapter 4. GCC Command Options The alternate keywords continue __asm__ __extension__ __inline__ __typeof__ to work despite . You would not want to use them in an ISO C program, of course, but -ansi it is useful to put them in header files that might be included in compilations done with -ansi Alternate predefined macros such as are also available, with or without...
  • Page 23 Chapter 4. GCC Command Options options specifying some version of ISO C have the same effects as , except that -std -ansi features that were not in ISO C90 but are in the specified version (for example, comments and keyword in ISO C99) are not disabled. inline Chapter 3 Language Standards Supported by GCC, for details of these standard versions.
  • Page 24 Chapter 4. GCC Command Options -ffreestanding Assert that compilation takes place in a freestanding environment. This implies -fno-builtin A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at . The most obvious example is an OS kernel. This is main equivalent to -fno-hosted...
  • Page 25: Options Controlling C++ Dialect

    Chapter 4. GCC Command Options -fsigned-bitfields -funsigned-bitfields -fno-signed-bitfields -fno-unsigned-bitfields These options control whether a bit-field is signed or unsigned, when the declaration does not use either . By default, such a bit-field is signed, because this is consistent: signed unsigned the basic integer types such as are signed types.
  • Page 26 Chapter 4. GCC Command Options This option is no longer useful on most targets, now that support has been added for putting variables into BSS without making them common. -fno-const-strings Give string constants type instead of type . By default, G++ uses type char * const char * as required by the standard.
  • Page 27 Chapter 4. GCC Command Options -fno-implicit-inline-templates Don’t emit code for implicit instantiations of inline templates, either. The default is to handle inlines differently so that compiles with and without optimization will need the same set of explicit instantiations. -fno-implement-inlines To save space, do not emit out-of-line copies of inline functions controlled by #pragma .
  • Page 28 Chapter 4. GCC Command Options -fuse-cxa-atexit Register destructors for objects with static storage duration with the function __cxa_atexit rather than the function. This option is required for fully standards-compliant handling atexit of static destructors, but will only work if your C library supports __cxa_atexit -fvtable-gc Emit special relocations for vtables and virtual function references so that the linker can iden-...
  • Page 29 Chapter 4. GCC Command Options struct C : public A, public virtual B {}; In this case, G++ will not place into the tail-padding for ; other compilers will. You can avoid this problem by explicitly padding so that its size is a multiple of its alignment (ignor- ing virtual base classes);...
  • Page 30 Chapter 4. GCC Command Options -Weffc++ (C++ only) Warn about violations of the following style guidelines from Scott Meyers’ Effective C++ book: Item 11: Define a copy constructor and an assignment operator for classes with dynamically • allocated memory. Item 12: Prefer initialization to assignment in constructors. •...
  • Page 31: Options Controlling Objective-C Dialect

    Chapter 4. GCC Command Options -Wno-pmf-conversions (C++ only) Disable the diagnostic for converting a bound pointer to member function to a plain pointer. -Wsign-promo (C++ only) Warn when overload resolution chooses a promotion from unsigned or enumeral type to a signed type over a conversion to an unsigned type of the same size.
  • Page 32: Options To Control Diagnostic Messages Formatting

    Chapter 4. GCC Command Options -Wno-protocol If a class is declared to implement a protocol, a warning is issued for every method in the protocol that is not implemented by the class. The default behavior is to issue a warning for every method not explicitly implemented in the class, even if a method implementation is inherited from the superclass.
  • Page 33: Options To Request Or Suppress Warnings

    Chapter 4. GCC Command Options 4.8. Options to Request or Suppress Warnings Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there may have been an error. You can request many specific warnings with options beginning , for example -Wimplicit request warnings on implicit declarations.
  • Page 34 Chapter 4. GCC Command Options -Wchar-subscripts Warn if an array subscript has type . This is a common cause of error, as programmers often char forget that this type is signed on some machines. -Wcomment Warn whenever a comment-start sequence appears in a comment, or whenever a Backslash-Newline appears in a...
  • Page 35 Chapter 4. GCC Command Options -Wformat-security is specified, also warn about uses of format functions that represent possible se- -Wformat curity problems. At present, this warns about calls to functions where the printf scanf format string is not a string literal and there are no format arguments, as in printf (foo);...
  • Page 36 Chapter 4. GCC Command Options In C, every branch belongs to the innermost possible statement, which in this example else . This is often not what the programmer expected, as illustrated in the above example if (b) by indentation the programmer chose. When there is the potential for this confusion, GCC will issue a warning when this flag is specified.
  • Page 37 Chapter 4. GCC Command Options -Wswitch Warn whenever a statement has an index of enumeral type and lacks a for one or switch case more of the named codes of that enumeration. (The presence of a label prevents this default warning.) labels outside the enumeration range also provoke warnings when this option is case...
  • Page 38 Chapter 4. GCC Command Options -Wuninitialized Warn if an automatic variable is used without first being initialized or if a variable may be clob- bered by a call. setjmp These warnings are possible only in optimizing compilation, because they require data flow in- formation that is computed only when optimizing.
  • Page 39 Chapter 4. GCC Command Options -Wstrict-aliasing This option is only active when is active. It warns about code which might -fstrict-aliasing break the strict aliasing rules that the compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in -Wall -Wall All of the above...
  • Page 40 Chapter 4. GCC Command Options An empty body occurs in an statement. • else A pointer is compared against integer zero with , , or • A variable might be changed by • longjmp vfork Any of several floating-point events that often indicate errors, such as overflow, underflow, •...
  • Page 41 Chapter 4. GCC Command Options A function-like macro that appears without arguments. • The unary plus operator. • integer constant suffix, or the floating point constant suffixes. (Traditional C • does support the suffix on integer constants.) Note, these suffixes appear in macros de- fined in the system headers of most modern systems, for example, the macros in _MIN...
  • Page 42 Chapter 4. GCC Command Options -Wbad-function-cast (C only) Warn whenever a function call is cast to a non-matching type. For example, warn if is cast to malloc() anything * -Wcast-qual Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a is cast to an ordinary const char *...
  • Page 43 Chapter 4. GCC Command Options -Wmissing-declarations (C only) 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.
  • Page 44: Options For Debugging Your Program Or Gcc

    Chapter 4. GCC Command Options -Wunreachable-code 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.
  • Page 45 Chapter 4. GCC Command Options Produce debugging information in the operating system’s native format (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging information. On most systems that use stabs format, enables use of extra debugging information that only GDB can use;...
  • Page 46 Chapter 4. GCC Command Options -gdwarf+ Produce debugging information in DWARF version 1 format (if that is supported), using GNU extensions understood only by the GNU debugger (GDB). The use of these extensions is likely to make other debuggers crash or refuse to read the program. This option is deprecated.
  • Page 47 Chapter 4. GCC Command Options -ftime-report Makes the compiler print some statistics about the time consumed by each pass when it finishes. -fmem-report Makes the compiler print some statistics about permanent memory allocation when it finishes. -fprofile-arcs Add code so that program flow arcs 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.
  • Page 48 Chapter 4. GCC Command Options Dump after computing branch probabilities, to .15.bp file Dump after block reordering, to .31.bbro file Dump after instruction combination, to the file .21.combine file Dump after the first if conversion, to the file .16.ce1 file Dump after delayed branch scheduling, to .36.dbr file...
  • Page 49 Chapter 4. GCC Command Options Dump after conversion from registers to stack, to .34.stack file Dump after local register allocation, to .25.lreg file Dump after loop optimization passes, to .12.loop .18.loop2 file file Dump after performing the machine dependent reorganization pass, to .35.mach file Dump after register renumbering, to...
  • Page 50 Chapter 4. GCC Command Options Produce a core dump whenever an error occurs. Print statistics on memory usage, at the end of the run, to standard error. Annotate the assembler output with a comment indicating which pattern and alternative was used.
  • Page 51 Chapter 4. GCC Command Options 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.
  • Page 52 Chapter 4. GCC Command Options # as 0.00 0.01 The first number on each line is the "user time," that is time spent executing the program itself. The second number is "system time," time spent executing operating system routines on behalf of the program.
  • Page 53: Options That Control Optimization

    Chapter 4. GCC Command Options lation 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.
  • Page 54 Chapter 4. GCC Command Options -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 about invoking on programs that use computed gotos. -fgcse Optimize yet more. turns on all optimizations specified by and also turns on the options.
  • Page 55 Chapter 4. GCC Command Options Enabled at levels -fforce-addr Force memory address constants to be copied into registers before doing arithmetic on them. This may produce better code just as may. -fforce-mem -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;...
  • Page 56 Chapter 4. GCC Command Options max-inline-insns-auto is set to min-inline-insns is set to 130 or /4, whichever is smaller. max-inline-insns-rtl is set to Using thus results in the default settings for these parameters. See below -finline-limit=600 for a documentation of the individual parameters controlling inlining. Note: pseudo instruction represents, in this particular context, an abstract measurement of func- tion’s size.
  • Page 57 Chapter 4. GCC Command Options The default is , enabled when is enabled. -fbranch-count-reg -fstrength-reduce -fno-function-cse 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.
  • Page 58 Chapter 4. GCC Command Options -fgcse Perform a global common subexpression elimination pass. This pass also performs global con- stant 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 to the command line.
  • Page 59 Chapter 4. GCC Command Options In some environments, this assumption is not true, and programs can safely dereference null pointers. Use to disable this optimization for programs -fno-delete-null-pointer-checks which depend on that behavior. Enabled at levels -fexpensive-optimizations Perform a number of minor optimizations that are relatively expensive. Enabled at levels -foptimize-register-move -fregmove...
  • Page 60 Chapter 4. GCC Command Options -fsched2-use-superblocks When schedulilng after register allocation, do use superblock scheduling algorithm. Superblock scheduling allows motion across basic block boundaries resulting on faster schedules. This option is experimental, as not all machine descriptions used by GCC model the CPU closely enough to avoid unreliable results from the algorithm.
  • Page 61 Chapter 4. GCC Command Options -fno-guess-branch-probability Do not guess branch probabilities using a randomized model. Sometimes gcc will opt to use a randomized model to guess branch probabilities, when none are available from either profiling feedback ( ) or . This -fprofile-arcs __builtin_expect means that different runs of the compiler on the same program may produce different object...
  • Page 62 Chapter 4. GCC Command Options return *ip; Every language that wishes to perform language-specific alias analysis should define a function that computes, given an node, an alias set for the node. Nodes in different alias sets are not tree allowed to alias. For an example, see the C front-end function c_get_alias_set Enabled at levels -falign-functions...
  • Page 63 Chapter 4. GCC Command Options -frename-registers 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 -fno-cprop-registers After register allocation and post-register allocation instruction splitting, we perform a copy-...
  • Page 64 Chapter 4. GCC Command Options -ffinite-math-only Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs. This option should never be turned on by any option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications.
  • Page 65 Chapter 4. GCC Command Options -ftracer Perform tail duplication to enlarge superblock size. This transformation simplifies the control flow of the function allowing other optimizations to do better job. -funit-at-a-time Parse the whole compilation unit before starting to produce code. This allows some extra opti- mizations to take place but consumes more memory.
  • Page 66 Chapter 4. GCC Command Options Disabled at level -ffunction-sections -fdata-sections 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.
  • Page 67 Chapter 4. GCC Command Options max-delay-slot-live-search 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 cho- sen 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.
  • Page 68 Chapter 4. GCC Command Options max-inline-insns-rtl 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 default value is 600. max-unrolled-insns 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.
  • Page 69 Chapter 4. GCC Command Options tracer-max-code-growth 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. tracer-min-branch-ratio Stop reverse growth when the reverse probability of best edge is less than this threshold (in percent).
  • Page 70: Options Controlling The Preprocessor

    Chapter 4. GCC Command Options 4.11. Options Controlling the Preprocessor These options control the C preprocessor, which is run on each C source file before actual compilation. If you use the option, nothing is done except preprocessing. Some of these options make sense only together with because they cause the preprocessor output to be unsuitable for actual compilation.
  • Page 71 Chapter 4. GCC Command Options file Write output to . This is the same as specifying as the second non-option argument file file has a different interpretation of a second non-option argument, so you must use to specify the output file. -Wall Turns on all optional warnings which are desirable for normal code.
  • Page 72 Chapter 4. GCC Command Options -Wendif-labels Warn whenever an or an are followed by text. This usually happens in code of #else #endif the form #if FOO #else FOO #endif FOO The second and third should be in comments, but often are not in older programs. This warning is on by default.
  • Page 73 Chapter 4. GCC Command Options file When used with , specifies a file to write the dependencies to. If no switch is given the preprocessor sends the rules to the same place it would have sent preprocessed output. When used with the driver options overrides the default dependency output -MMD file.
  • Page 74 Chapter 4. GCC Command Options -fpch-deps When using precompiled headers (refer to Section 4.20 Using Precompiled Headers), this flag will cause the dependency-output flags to also list the files from the precompiled header’s depen- dencies. If not specified only the precompiled header would be listed and not the files that were used to create it because those files are not consulted when a precompiled header is used.
  • Page 75 Chapter 4. GCC Command Options gnu++98 The same as plus GNU extensions. This is the default for C++ code. -std=c++98 Split the include path. Any directories specified with options before are searched only for headers requested with ; they are not searched for #include "...
  • Page 76 Chapter 4. GCC Command Options -isystem Search for header files, after all directories specified by but before the standard system directories. Mark it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. -fdollars-in-identifiers Accept in identifiers.
  • Page 77 Chapter 4. GCC Command Options Like except in two respects: it does not include the predefined macros, and it outputs both the directives and the result of preprocessing. Both kinds of output go to the #define standard output file. Like , but emit only the macro names, not their expansions.
  • Page 78: Passing Options To The Assembler

    Chapter 4. GCC Command Options -help -target-help Print text describing all the command line options instead of preprocessing anything. Verbose mode. Print out GNU CPP’s version number at the beginning of execution, and report the final form of the include path. Print the name of each header file used, in addition to other normal activities.
  • Page 79 Chapter 4. GCC Command Options library library Search the library named when linking. (The second alternative with the library as a library separate argument is only for POSIX compliance and is not recommended.) It makes a difference where in the command you write this option; the linker searches and pro- cesses libraries and object files in the order they are specified.
  • Page 80 Chapter 4. GCC Command Options Remove all symbol table and relocation information from the executable. -static On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect. -shared Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option.
  • Page 81: Options For Directory Search

    Chapter 4. GCC Command Options , because this passes the entire string as a single argument, which "-assert definitions" is not what the linker expects. -Wl, option Pass as an option to the linker. If contains commas, it is split into multiple option option options at the commas.
  • Page 82: Specifying Subprocesses And The Switches To Pass To Them

    Chapter 4. GCC Command Options The compiler driver program runs one or more of the subprograms . It tries as a prefix for each program it tries to run, both with and without prefix machine version (refer to Section 4.16 Specifying Target Machine and Compiler Version). For each subprogram to be run, the compiler driver first tries the prefix, if any.
  • Page 83 Chapter 4. GCC Command Options %include_noerr file Just like , but do not generate an error message if the include file cannot be found. %include %rename old_name new_name Rename the spec string old_name new_name spec_name This tells the compiler to create, override or delete the named spec string. All lines after this directive up to the next directive or blank line are considered to be the text for the spec string.
  • Page 84 Chapter 4. GCC Command Options libgcc Decides which GCC support library to pass to the linker linker Sets the name of the linker predefines Defines to be passed to the C preprocessor signed_char Defines to pass to CPP to say whether is signed char by default...
  • Page 85 Chapter 4. GCC Command Options suffix Like , but generates a new temporary file name even if was already seen. suffix suffix Substitutes the last file name generated with , generating a new one if there is no such suffix last file name.
  • Page 86 Chapter 4. GCC Command Options Substitute any of (made from (made from -iprefix GCC_EXEC_PREFIX -isysroot ), and (made from options) as TARGET_SYSTEM_ROOT -isystem COMPILER_PATH necessary. Current argument is the name of a library or startup file of some sort. Search for that file in a standard list of directories and substitute the full name found.
  • Page 87 Chapter 4. GCC Command Options Process the spec. This is a spec string for deciding which libraries should be included on the command line to the linker. Process the spec. This is a spec string for deciding which GCC support library should libgcc be included on the command line to the linker.
  • Page 88 Chapter 4. GCC Command Options crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s if-exists-else spec function is similar to the spec function, except if-exists-else if-exists that it takes two arguments. The first argument is an absolute pathname to a file. If the file exists, returns the pathname. If it does not exist, it returns the second if-exists-else argument.
  • Page 89: Specifying Target Machine And Compiler Version

    Chapter 4. GCC Command Options Substitutes if either was given to GCC. This may be combined with , and sequences as well, although they have a stronger binding than the . If appears in , all of the alternatives must be starred, and only the first matching alternative is substituted. For example, a spec string like this: %{.c:-foo} %{!.c:-bar} %{.c|d:-baz} %{!.c|d:-boggle} will output the following command-line options from the following input command-line options:...
  • Page 90: Hardware Models And Configurations

    Chapter 4. GCC Command Options 4.17. Hardware Models and Configurations Earlier we discussed the standard option which chooses among different installed compilers for completely different target machines, such as 68000 vs. 80386. In addition, each of these target machine types can have its own special options, starting with to choose among various hardware models or configurations--for example, 68010 vs 68020, float- ing coprocessor or none.
  • Page 91 Chapter 4. GCC Command Options -mno-flat -mflat With , the compiler does not generate save/restore instructions and will use a "flat" or -mflat single register window calling convention. This model uses %i7 as the frame pointer and is compatible with the normal register window model. Code from either may be intermixed. The local registers and the input registers (0-5) are still treated as "call saved"...
  • Page 92 Chapter 4. GCC Command Options sparclite hypersparc sparclite86x f930 f934 sparclet tsc701 , and ultrasparc ultrasparc3 Default instruction scheduling parameters are used for values that select an architecture and not an implementation. These are sparclite sparclet Here is a list of each supported architecture and their supported implementations. cypress supersparc, hypersparc sparclite:...
  • Page 93: Ibm Rs/6000 And Powerpc Options

    Chapter 4. GCC Command Options -mcmodel=medmid Generate code for the Medium/Middle code model: the program must be linked in the low 44 bits of the address space, the text segment must be less than 2G bytes, and data segment must be within 2G of the text segment.
  • Page 94 Chapter 4. GCC Command Options GCC to generate instructions that are present in the POWER2 architecture but not the original POWER architecture. option allows GCC to generate instructions that are found only in the 32-bit sub- -mpowerpc set of the PowerPC architecture. Specifying implies and also -mpowerpc-gpopt...
  • Page 95 Chapter 4. GCC Command Options power power2 rios1 rios2 -mpower -mno-powerpc -mno-new-mnemonics powerpc rs64a 603e 7400 7450 -mno-power -mpowerpc -mnew-mnemonics -mpower -mpowerpc -mnew-mnemonics -mno-power -mpowerpc -mnew-mnemonics -msoft-float -mtune= cpu_type Set the instruction scheduling parameters for machine type , but do not set the ar- cpu_type chitecture type, register usage, or choice of mnemonics, as would.
  • Page 96 Chapter 4. GCC Command Options -misel= yes/no -misel This switch enables or disables the generation of ISEL instructions. -mspe= yes/no -mspe This switch enables or disables the generation of SPE simd instructions. -mfloat-gprs= yes/no -mfloat-gprs This switch enables or disables the generation of floating point operations on the general purpose registers for architectures that support it.
  • Page 97 Chapter 4. GCC Command Options -mpe Support IBM RS/6000 SP Parallel Environment (PE). Link an application written to use message passing with special startup code to enable the application to run. The system must have PE installed in the standard location ( ), or the file must be overridden /usr/lpp/ppe.poe/...
  • Page 98 Chapter 4. GCC Command Options -mno-bit-align -mbit-align On embedded PowerPC systems do not (do) force structures and unions that contain bit-fields to be aligned to the base type of the bit-field. For example, by default a structure containing nothing but 8 bit-fields of length 1 unsigned would be aligned to a 4 byte boundary and have a size of 4 bytes.
  • Page 99 Chapter 4. GCC Command Options -mcall-solaris On embedded PowerPC systems compile code for the Solaris operating system. -mcall-linux On embedded PowerPC systems compile code for the Linux-based GNU system. -mcall-gnu On embedded PowerPC systems compile code for the Hurd-based GNU system. -mcall-netbsd On embedded PowerPC systems compile code for the NetBSD operating system.
  • Page 100 Chapter 4. GCC Command Options -mvxworks On embedded PowerPC systems, specify that you are compiling for a VxWorks system. -mwindiss Specify that you are compiling for the WindISS simulation environment. -memb On embedded PowerPC systems, set the bit in the ELF flags header to indicate that PPC_EMB extended relocations are used.
  • Page 101: Intel 386 And Amd X86-64 Options

    Chapter 4. GCC Command Options On embedded PowerPC systems, put global and static items less than or equal to bytes into the small data or bss sections instead of the normal data or bss section. By default, is 8. The switch is also passed to the linker.
  • Page 102 Chapter 4. GCC Command Options -m386 -m486 -mpentium -mpentiumpro These options are synonyms for , and -mtune=i386 -mtune=i486 -mtune=pentium respectively. These synonyms are deprecated. -mtune=pentiumpro -mfpmath= unit Generate floating point arithmetics for selected unit . the choices for are: unit unit Use the standard 387 floating point coprocessor present majority of chips and emulated otherwise.
  • Page 103 Chapter 4. GCC Command Options -msoft-float Generate output containing library calls for floating point. Warning: the requisite libraries are not part of GCC. Normally the facilities of the machine’s usual C compiler are used, but this can’t be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation.
  • Page 104 Chapter 4. GCC Command Options -mrtd Use a different function-calling convention, in which functions that take a fixed number of arguments return with the instruction, which pops their arguments while returning. This ret num saves one instruction in the caller since there is no need to pop the arguments there. You can specify that an individual function is called with this calling sequence with the function attribute .
  • Page 105 Chapter 4. GCC Command Options Section 6.47.1 X86 Built-in Functions, for details of the functions enabled and disabled by these switches. To have SSE/SSE2 instructions generated automatically from floating-point code, see -mfpmath=sse -mpush-args -mno-push-args Use PUSH operations to store outgoing parameters. This method is shorter and usually equally fast as method using SUB/MOV operations and is enabled by default.
  • Page 106: Options

    Chapter 4. GCC Command Options -m32 -m64 Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD’s x86-64 architecture. -mno-red-zone Do not use a so called red zone for x86-64 code.
  • Page 107 Chapter 4. GCC Command Options -mvolatile-asm-stop -mno-volatile-asm-stop Generate (or don’t) a stop bit immediately before and after volatile asm statements. -mb-step Generate code that works around Itanium B step errata. -mregister-names -mno-register-names Generate (or don’t) , and register names for the stacked registers. This may make assembler output more readable.
  • Page 108: S/390 And Zseries Options

    Chapter 4. GCC Command Options -mearly-stop-bits -mno-early-stop-bits Allow stop bits to be placed earlier than immediately preceding the instruction that triggered the stop bit. This can improve instruction scheduling, but does not always do so. 4.17.5. S/390 and zSeries Options These are the options defined for the S/390 and zSeries architecture.
  • Page 109: Options For Code Generation Conventions

    Chapter 4. GCC Command Options -march= arch Generate code that will run on , which is the name of system representing a certain proces- arch sor type. Possible values for cpu-type z900 -mtune= arch Tune to everything applicable about the generated code, except for the ABI and the cpu-type set of available instructions.
  • Page 110 Chapter 4. GCC Command Options -fasynchronous-unwind-tables Generate unwind table in dwarf2 format, if supported by target machine. The table is exact at each instruction boundary, so it can be used for stack unwinding from asynchronous events (such as debugger or garbage collector). -fpcc-struct-return Return "short"...
  • Page 111 Chapter 4. GCC Command Options -fshared-data Requests that the data and non- variables of this compilation be shared data rather than const private data. The distinction makes sense only on certain operating systems, where shared data is shared between processes running the same program, while private data exists in one copy per process.
  • Page 112 Chapter 4. GCC Command Options -fPIC If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. This option makes a difference on the SPARC. Position-independent code requires special support, and therefore works only on certain ma- chines.
  • Page 113 Chapter 4. GCC Command Options current function and its call site. (On some platforms, does not __builtin_return_address work beyond the current function, so the call site information may not be available to the profiling functions otherwise.) void __cyg_profile_func_enter (void *this_fn, void *call_site);...
  • Page 114: Environment Variables Affecting Gcc

    Chapter 4. GCC Command Options Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself. -fleading-underscore This option and its counterpart, , forcibly change the way C sym- -fno-leading-underscore bols are represented in the object file.
  • Page 115 Chapter 4. GCC Command Options GCC_EXEC_PREFIX is set, it specifies a prefix to use in the names of the subprograms executed GCC_EXEC_PREFIX by the compiler. No slash is added when this prefix is combined with the name of a subprogram, but you can specify a prefix that ends with a slash if you wish.
  • Page 116: Using Precompiled Headers

    Chapter 4. GCC Command Options CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH Each variable’s value is a list of directories separated by a special character, much like , in PATH which to look for header files. The special character, , is target-dependent and PATH_SEPARATOR determined at GCC build time.
  • Page 117: Running Protoize

    Chapter 4. GCC Command Options Alternatively, you might decide to put the precompiled header file in a directory and use to ensure that directory is searched before (or instead of) the directory containing the original header. Then, if you want to check that the precompiled header file is always used, you can put a file of the same name as the original header in this directory containing an command.
  • Page 118 Chapter 4. GCC Command Options But not all the eligible files are converted. By default, convert only protoize unprotoize source and header files in the current directory. You can specify additional directories whose files should be converted with the option. You can also specify particular files to exclude directory with the option.
  • Page 119 Chapter 4. GCC Command Options converts prototyped function definitions to old-style function definitions, where unprotoize the arguments are declared between the argument list and the initial . By default, unprotoize uses five spaces as the indentation. If you want to indent with just one space instead, use -i "...
  • Page 120 Chapter 4. GCC Command Options...
  • Page 121: C Implementation-Defined Behavior

    Chapter 5. C Implementation-defined behavior A conforming implementation of ISO C is required to document its choice of behavior in each of the areas that are designated "implementation defined." The following lists all such areas, along with the section number from the ISO/IEC 9899:1999 standard. 5.1.
  • Page 122: Integers

    Chapter 5. C Implementation-defined behavior [The value of a wide character constant containing more than one multibyte character, or containing • a multibyte character or escape sequence not represented in the extended execution character set (6.4.4.4).] [The current locale used to convert a wide character constant consisting of a single multibyte char- •...
  • Page 123: Arrays And Pointers

    Chapter 5. C Implementation-defined behavior [Whether the "inexact" floating-point exception can be raised when the rounded result actually does • equal the mathematical result in an IEC 60559 conformant implementation (F.9).] [Whether the "underflow" (and "inexact") floating-point exception can be raised when a result is •...
  • Page 124: Qualifiers

    Chapter 5. C Implementation-defined behavior [Allowable bit-field types other than , and (6.7.2.1).] • _Bool signed int unsigned int [Whether a bit-field can straddle a storage-unit boundary (6.7.2.1).] • [The order of allocation of bit-fields within a unit (6.7.2.1).] • [The alignment of non-bit-field members of structures (6.7.2.1).] •...
  • Page 125: Architecture

    Chapter 5. C Implementation-defined behavior 5.13. Architecture [The values or expressions assigned to the macros specified in the headers • float.h , and (5.2.4.2, 7.18.2, 7.18.3).] limits.h stdint.h [The number, order, and encoding of bytes in any object (when not explicitly specified in this •...
  • Page 126 Chapter 5. C Implementation-defined behavior...
  • Page 127: Extensions To The C Language Family

    Chapter 6. Extensions to the C Language Family GNU C provides several language features not found in ISO standard C. (The option -pedantic directs GCC to print a warning message if any of these features is used.) To test for the availability of these features in conditional compilation, check for a predefined macro , which is always __GNUC__...
  • Page 128: Locally Declared Labels

    Chapter 6. Extensions to the C Language Family In addition, there are semantic issues with statement-expressions in C++. If you try to use statement- expressions instead of inline functions in C++, you may be surprised at the way object destruction is handled.
  • Page 129: Labels As Values

    Chapter 6. Extensions to the C Language Family 6.3. Labels as Values You can get the address of a label defined in the current function (or a containing function) with the unary operator . The value has type . This value is a constant and can be used wherever a &&...
  • Page 130 Chapter 6. Extensions to the C Language Family return square (a) + square (b); The nested function can access all the variables of the containing function that are visible at the point of its definition. This is called lexical scoping. For example, here we show a nested function which uses an inherited variable named offset bar (int *array, int offset, int size)
  • Page 131: Constructing Function Calls

    Chapter 6. Extensions to the C Language Family /* ... */ for (i = 0; i size; i++) /* ... */ access (array, i) /* ... */ /* ... */ return 0; /* Control comes here from access if it detects an error. failure: return -1;...
  • Page 132: Referring To A Type With

    Chapter 6. Extensions to the C Language Family 6.6. Referring to a Type with typeof Another way to refer to the type of an expression is with . The syntax of using of this keyword typeof looks like , but the construct acts semantically like a type name defined with sizeof typedef There are two ways of writing the argument to...
  • Page 133: Generalized Lvalues

    Chapter 6. Extensions to the C Language Family Compatibility Note: In addition to , GCC 2 supported a more limited extension which permit- typeof ted one to write typedef expr with the effect of declaring to have the type of the expression .
  • Page 134: Conditionals With Omitted Operands

    Chapter 6. Extensions to the C Language Family This is quite different from what would do--that would convert 1 to floating point and (int)f = 1 store it. Rather than cause this inconsistency, we think it is better to prohibit use of on a cast.
  • Page 135: Hex Floats

    Chapter 6. Extensions to the C Language Family To write a constant with a complex data type, use the suffix (either one; they are equivalent). For example, has type has type . Such a constant 2.5fi _Complex float _Complex int always has a pure imaginary value, but you can form any complex value you like by adding one to a real constant.
  • Page 136: Structures With No Members

    Chapter 6. Extensions to the C Language Family Flexible array members are written as without the • contents[] Flexible array members have incomplete type, and so the operator may not be applied. As • sizeof a quirk of the original implementation of zero-length arrays, evaluates to zero.
  • Page 137: Macros With A Variable Number Of Arguments

    Chapter 6. Extensions to the C Language Family 6.14. Arrays of Variable Length Variable-length automatic arrays are allowed in ISO C99, and as an extension GCC accepts them in C89 mode and in C++. (However, GCC’s implementation of variable-length arrays does not yet conform in detail to the ISO C99 standard.) These arrays are declared like any other automatic arrays, but with a length that is not a constant expression.
  • Page 138: Slightly Looser Rules For Escaped Newlines

    Chapter 6. Extensions to the C Language Family 6.15. Macros with a Variable Number of Arguments. In the ISO C standard of 1999, a macro can be declared to accept a variable number of arguments much as a function can. The syntax for defining the macro is similar to that of a function. Here is an example: #define debug(format, ...) fprintf (stderr, format, __VA_ARGS__) Here...
  • Page 139: Non-Lvalue Arrays May Have Subscripts

    Chapter 6. Extensions to the C Language Family 6.17. String Literals with Embedded Newlines As an extension, GNU CPP permits string literals to cross multiple lines without escaping the embed- ded newlines. Each embedded newline is replaced with a single character in the resulting string literal, regardless of what form the newline took originally.
  • Page 140: Designated Initializers

    Chapter 6. Extensions to the C Language Family struct foo {int a; char b[2];} structure; Here is an example of constructing a with a compound literal: struct foo structure = ((struct foo) {x + y, ’a’, 0}); This is equivalent to writing the following: struct foo temp = {x + y, ’a’, 0};...
  • Page 141 Chapter 6. Extensions to the C Language Family An alternative syntax for this which has been obsolete since GCC 2.5 but GCC still accepts is to write before the element value, with no index To initialize a range of elements to the same value, write .
  • Page 142: Case Ranges

    Chapter 6. Extensions to the C Language Family You can also write a series of designators before an to specify a nested fieldname index subobject to initialize; the list is taken relative to the subobject corresponding to the closest surround- ing brace pair.
  • Page 143: Mixed Declarations And Code

    Chapter 6. Extensions to the C Language Family void hack (union foo); /* ... */ hack ((union foo) x); 6.25. Mixed Declarations and Code ISO C99 and ISO C++ allow declarations and code to be freely mixed within compound statements. As an extension, GCC also allows this in C89 mode.
  • Page 144 Chapter 6. Extensions to the C Language Family The attribute is not implemented in GCC versions earlier than 2.5. An alternative way noreturn to declare that a function does not return, which works in the current version and in some older versions, is as follows: typedef void voidfn ();...
  • Page 145 Chapter 6. Extensions to the C Language Family format ( archetype string-index first-to-check attribute specifies that a function takes format printf scanf strftime strfmon style arguments which should be type-checked against a format string. For example, the declara- tion: extern int my_printf (void *my_object, const char *my_format, ...) __attribute__ ((format (printf, 2, 3)));...
  • Page 146 Chapter 6. Extensions to the C Language Family whose operands are a call to one of your own function. The compiler always treats gettext , and in this manner except when strict ISO C support is requested by dgettext dcgettext or an appropriate option, or is used.
  • Page 147 Chapter 6. Extensions to the C Language Family used This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly.
  • Page 148 Chapter 6. Extensions to the C Language Family hidden Hidden visibility indicates that the symbol will not be placed into the dynamic symbol table, so no other module (executable or shared library) can reference it directly. protected Protected visibility indicates that the symbol will be placed in the dynamic symbol table, but that references within the defining module will bind to the local symbol.
  • Page 149: Attribute Syntax

    Chapter 6. Extensions to the C Language Family Section 4.17.2 IBM RS/6000 and PowerPC Options, for more information on when long calls are and are not necessary. interrupt Use this attribute on the C4x ports to indicate that the specified function is an interrupt handler. The compiler will generate function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.
  • Page 150 Chapter 6. Extensions to the C Language Family Because of infelicities in the grammar for attributes, some forms described here may not be success- fully parsed in all cases. There are some problems with the semantics of attributes in C++. For example, there are no man- glings for attributes, although they may affect code generation, so problems may arise when attributed types are used in conjunction with templates or overloading.
  • Page 151 Chapter 6. Extensions to the C Language Family may be used; for example, .) There is one necessary limitation to this syntax: the first old- section style parameter declaration in a function definition cannot begin with an attribute specifier, because such an attribute applies to the function instead by syntax described below (which, however, is not yet implemented in this case).
  • Page 152: Prototypes And Old-Style Function Definitions

    Chapter 6. Extensions to the C Language Family For example, void (__attribute__((noreturn)) ****f) (void); specifies the type "pointer to pointer to pointer to pointer to non-returning function returning ". void As another example, char *__attribute__((aligned(8))) *f; specifies the type "pointer to 8-byte-aligned pointer to ".
  • Page 153: C++ Style Comments

    Chapter 6. Extensions to the C Language Family int isroot (uid_t); isroot (uid_t x) return x == 0; GNU C++ does not support old-style function definitions, so this extension is irrelevant. 6.29. C++ Style Comments In GNU C, you may use C++ style comments, which start with and continue until the end of the line.
  • Page 154 Chapter 6. Extensions to the C Language Family 6.33. Specifying Attributes of Variables The keyword allows you to specify special attributes of variables or structure fields. __attribute__ This keyword is followed by an attribute specification inside double parentheses. Some attributes are currently defined generically for variables.
  • Page 155 Chapter 6. Extensions to the C Language Family is enabled, then will be run during the stack unwinding -fexceptions cleanup_function that happens during the processing of the exception. Note that the attribute does not cleanup allow the exception to be caught, only to perform an action. It is undefined what happens if does not return normally.
  • Page 156 Chapter 6. Extensions to the C Language Family main() /* Initialize stack pointer */ init_sp (stack + sizeof (stack)); /* Initialize initialized data */ memcpy (&init_data, &data, &edata - &data); /* Turn on the serial ports */ init_duart (&a); init_duart (&b); Use the attribute with an initialized definition of a global variable, as shown in the section...
  • Page 157: I386 Variable Attributes

    Chapter 6. Extensions to the C Language Family You can also use this attribute on a for a union data type; then it applies to all function typedef parameters with that type. unused This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable.
  • Page 158 Chapter 6. Extensions to the C Language Family You may specify the attributes either in a declaration aligned transparent_union typedef or just past the closing curly brace of a complete enum, struct or union type definition and the packed attribute only past the closing brace of a definition. You may also specify attributes between the enum, struct or union tag and the name of the type rather than after the closing brace.
  • Page 159 Chapter 6. Extensions to the C Language Family certain maximum alignment. (For some linkers, the maximum supported alignment may be very very small.) If your linker is only able to align variables up to a maximum of 8 byte alignment, then specifying in an will still only provide you with 8 byte...
  • Page 160 Chapter 6. Extensions to the C Language Family unused When attached to a type (including a or a ), this attribute means that variables union struct of that type are meant to appear possibly unused. GCC will not produce a warning for any vari- ables of that type, even if the variable appears to do nothing.
  • Page 161: Type Attributes

    Chapter 6. Extensions to the C Language Family 6.35. Type Attributes 6.35.1. i386 Type Attributes Two attributes are currently defined for i386 configurations: ms_struct gcc_struct ms_struct gcc_struct is used on a structure, or if bit-fields are used it may be that the Microsoft ABI packs packed them differently than GCC would normally pack them.
  • Page 162: Assembler Instructions With C Expression Operands

    Chapter 6. Extensions to the C Language Family When a function is both inline and , if all calls to the function are integrated into the caller, and static the function’s address is never used, then the function’s own assembler code is never referenced. In this case, GCC does not actually output assembler code for the function, unless you specify the option .
  • Page 163 Chapter 6. Extensions to the C Language Family If there are no output operands but there are input operands, you must place two consecutive colons surrounding the place where the output operands would go. As of GCC version 3.1, it is also possible to specify input and output operands using symbolic names which can be referenced within the assembler code.
  • Page 164 Chapter 6. Extensions to the C Language Family : "r" (test), "r"(new), "[result]"(old)); Some instructions clobber specific hard registers. To describe this, write a third colon after the input operands, followed by the names of the clobbered hard registers (given as strings). You may not write a clobber description in a way that overlaps with an input or output operand.
  • Page 165 Chapter 6. Extensions to the C Language Family Speaking of labels, jumps from one to another are not supported. The compiler’s optimizers do not know about these jumps, and therefore they cannot take account of them when deciding how to optimize.
  • Page 166: I386 Floating Point Asm Operands

    Chapter 6. Extensions to the C Language Family It is a natural idea to look for a way to give access to the condition code left by the assembler in- struction. However, when we attempted to implement this, we found no way to make it work reliably. The problem is that output operands might need reloading, which would result in additional following "store"...
  • Page 167: Constraints For Asm Operands

    Chapter 6. Extensions to the C Language Family asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp)); This asm takes two inputs, which are popped by the opcode, and replaces them with one fyl2xp1 output. The user must code the clobber for reg-stack.c to know that pops both inputs.
  • Page 168 Chapter 6. Extensions to the C Language Family A memory operand with autoincrement addressing (either preincrement or postincrement) is allowed. A register operand is allowed provided that it is in a general register. An immediate integer operand (one with constant value) is allowed. This includes symbolic constants whose values will be known only at assembly time.
  • Page 169: Multiple Alternative Constraints

    Chapter 6. Extensions to the C Language Family Any register, memory or immediate integer operand is allowed, except for registers that are not general registers. Any operand whatsoever is allowed. , . . . An operand that matches the specified operand number is allowed. If a digit is used together with letters within the same alternative, the digit should come last.
  • Page 170: Constraint Modifier Characters

    Chapter 6. Extensions to the C Language Family Disparage slightly the alternative that the appears in, as a choice when no alternative applies exactly. The compiler regards this alternative as one unit more costly for each that appears in Disparage severely the alternative that the appears in.
  • Page 171: Constraints For Particular Machines

    Chapter 6. Extensions to the C Language Family Says that the following character should be ignored when choosing register preferences. no effect on the meaning of the constraint as a constraint, and no effect on reloading. 6.38.4. Constraints for Particular Machines Whenever possible, you should use the general-purpose constraint letters in arguments, since they will convey meaning more readily to people reading your code.
  • Page 172 Chapter 6. Extensions to the C Language Family register register LINK register (condition register) number 0 register (condition register) stack memory for FPR-GPR transfers FPMEM Signed 16-bit constant Unsigned 16-bit constant shifted left 16 bits (use instead for constants) SImode Unsigned 16-bit constant Signed 16-bit constant shifted left 16 bits Constant larger than 31...
  • Page 173 Chapter 6. Extensions to the C Language Family Constant suitable as a 32-bit mask operand Intel 386-- i386.h , or register for the i386. For x86-64 it is equivalent to class. (for 8-bit instructions that do not use upper halves) , or register.
  • Page 174 Chapter 6. Extensions to the C Language Family register SSE register MMX register Constant in range 0 to 31 (for 32-bit shifts) Constant in range 0 to 63 (for 64-bit shifts) 0xff 0xffff 0, 1, 2, or 3 (shifts for instruction) Constant in range 0 to 255 (for instruction)
  • Page 175 Chapter 6. Extensions to the C Language Family Predicate register ( as in "conditional") Application register residing in M-unit Application register residing in I-unit Floating-point register Memory operand. Remember that allows postincrement and postdecrement which require printing with on IA-64. Use to disallow postincrement and postdecrement.
  • Page 176 Chapter 6. Extensions to the C Language Family Memory operand except postincrement and postdecrement IP2K-- ip2k.h registers (general address) register register register register register register register registers (offsettable address) Non-pointer registers (not Non-SP registers (everything except Indirect thru - Avoid this except for , since we can’t access extra bytes QImode Indirect thru...
  • Page 177 Chapter 6. Extensions to the C Language Family Integers from -255 to -1 Integers from 0 to 7--valid bit number in a register Integers from 0 to 127--valid displacement for addressing mode Integers from 1 to 127 Integer -1 Integer 1 Zero Integers from 0 to 255 SPARC--...
  • Page 178 Chapter 6. Extensions to the C Language Family Signed 13-bit constant Zero 32-bit constant with the low 12 bits clear (a constant that can be loaded with the sethi instruction) A constant in the range supported by instructions movcc A constant in the range supported by instructions movrcc Same as...
  • Page 179: Controlling Names Used In Assembler Code

    Chapter 6. Extensions to the C Language Family S/390 and zSeries-- s390.h Address register (general purpose register except r0) Data register (arbitrary general purpose register) Floating-point register Unsigned 8-bit constant (0-255) Unsigned 12-bit constant (0-4095) Signed 16-bit constant (-32768-32767) Unsigned 16-bit constant (0-65535) Memory reference without index register Symbolic constant suitable for use with the instruction...
  • Page 180: Variables In Specified Registers

    Chapter 6. Extensions to the C Language Family extern func () asm ("FUNC"); func (x, y) int x, y; /* ... */ It is up to you to make sure that the assembler names you choose do not conflict with any other assembler symbols.
  • Page 181: Specifying Registers For Local Variables

    Chapter 6. Extensions to the C Language Family It is not safe to access the global register variables from signal handlers, or from more than one thread of control, because the system library routines may temporarily use the register for other things (unless you recompile them specially for the task at hand).
  • Page 182: Alternate Keywords

    Chapter 6. Extensions to the C Language Family Defining such a register variable does not reserve the register; it remains available for other uses in places where flow control determines the variable’s value is not live. However, these registers are made unavailable for use in the reload pass;...
  • Page 183 Chapter 6. Extensions to the C Language Family These names are always the same in a C function, but in a C++ function they may be different. For example, this program: extern "C" { extern int printf (char *, ...); class a { public: void sub (int i)
  • Page 184: Getting The Return Or Frame Address Of A Function

    Chapter 6. Extensions to the C Language Family 6.44. Getting the Return or Frame Address of a Function These functions may be used to get information about the callers of a function. void * (unsigned int ) This function returns the return address __builtin_return_address level of the current function, or of one of its callers.
  • Page 185: Other Built-In Functions Provided By Gcc

    Chapter 6. Extensions to the C Language Family An integer, four times as wide as a QI mode integer, usually 32 bits. An integer, eight times as wide as a QI mode integer, usually 64 bits. A floating point value, as wide as a SI mode integer, usually 32 bits. A floating point value, as wide as a DI mode integer, usually 64 bits.
  • Page 186 Chapter 6. Extensions to the C Language Family GCC includes built-in versions of many of the functions in the standard C library. The versions pre- fixed with will always be treated as having the same meaning as the C library function __builtin_ even if you specify the option.
  • Page 187 Chapter 6. Extensions to the C Language Family else if (__builtin_types_compatible_p (typeof (x), double)) \ tmp = foo_double (tmp); else if (__builtin_types_compatible_p (typeof (x), float)) tmp = foo_float (tmp); else abort (); tmp; Note: This construct is only available for C. ) You can use the built-in function type__builtin_choose_expr const_exp...
  • Page 188 Chapter 6. Extensions to the C Language Family 6.21 Compound Literals) and will not return 1 when you pass a constant numeric value to the inline function unless you specify the option. You may also use in initializers for static data. For instance, you can write __builtin_constant_p static const int table[] = { __builtin_constant_p (EXPRESSION) ? (EXPRESSION) : -1,...
  • Page 189 Chapter 6. Extensions to the C Language Family Data prefetch does not generate faults if is invalid, but the address expression itself must be addr valid. For example, a prefetch of will not fault if is not a valid address, but p- next p- next evaluation will fault if...
  • Page 190: Built-In Functions Specific To Particular Target Machines

    Chapter 6. Extensions to the C Language Family (unsigned long) Similar to , except the argument type is __builtin_clzl __builtin_clz unsigned long (unsigned long) Similar to , except the argument type is __builtin_ctzl __builtin_ctz unsigned long (unsigned long) Similar to , except the argument __builtin_popcountl __builtin_popcount...
  • Page 191 Chapter 6. Extensions to the C Language Family v8qi __builtin_ia32_paddusb (v8qi, v8qi) v4hi __builtin_ia32_paddusw (v4hi, v4hi) v8qi __builtin_ia32_psubusb (v8qi, v8qi) v4hi __builtin_ia32_psubusw (v4hi, v4hi) v4hi __builtin_ia32_pmullw (v4hi, v4hi) v4hi __builtin_ia32_pmulhw (v4hi, v4hi) di __builtin_ia32_pand (di, di) di __builtin_ia32_pandn (di,di) di __builtin_ia32_por (di, di) di __builtin_ia32_pxor (di, di) v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi) v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi)
  • Page 192 Chapter 6. Extensions to the C Language Family v4sf __builtin_ia32_mulps (v4sf, v4sf) v4sf __builtin_ia32_divps (v4sf, v4sf) v4sf __builtin_ia32_addss (v4sf, v4sf) v4sf __builtin_ia32_subss (v4sf, v4sf) v4sf __builtin_ia32_mulss (v4sf, v4sf) v4sf __builtin_ia32_divss (v4sf, v4sf) v4si __builtin_ia32_cmpeqps (v4sf, v4sf) v4si __builtin_ia32_cmpltps (v4sf, v4sf) v4si __builtin_ia32_cmpleps (v4sf, v4sf) v4si __builtin_ia32_cmpgtps (v4sf, v4sf) v4si __builtin_ia32_cmpgeps (v4sf, v4sf)
  • Page 193 Chapter 6. Extensions to the C Language Family void __builtin_ia32_storeaps (float *, v4sf) Generates the machine instruction as a store to memory. movaps v4sf __builtin_ia32_loadups (float *) Generates the machine instruction as a load from memory. movups void __builtin_ia32_storeups (float *, v4sf) Generates the machine instruction as a store to memory.
  • Page 194: Powerpc Altivec Built-In Functions

    Chapter 6. Extensions to the C Language Family v2sf __builtin_ia32_pfnacc (v2sf, v2sf) v2sf __builtin_ia32_pfpnacc (v2sf, v2sf) v2sf __builtin_ia32_pi2fw (v2si) v2sf __builtin_ia32_pswapdsf (v2sf) v2si __builtin_ia32_pswapdsi (v2si) 6.47.2. PowerPC AltiVec Built-in Functions These built-in functions are available for the PowerPC family of computers, depending on the command-line switches used.
  • Page 195 Chapter 6. Extensions to the C Language Family vector unsigned int vec_add (vector signed int, vector unsigned int); vector unsigned int vec_add (vector unsigned int, vector signed int); vector unsigned int vec_add (vector unsigned int, vector unsigned int); vector float vec_add (vector float, vector float); vector unsigned int vec_addc (vector unsigned int, vector unsigned int);...
  • Page 196 Chapter 6. Extensions to the C Language Family vector unsigned short vec_andc (vector unsigned short, vector signed short); vector unsigned short vec_andc (vector unsigned short, vector unsigned short); vector signed char vec_andc (vector signed char, vector signed char); vector unsigned char vec_andc (vector signed char, vector unsigned char);...
  • Page 197 Chapter 6. Extensions to the C Language Family vector float vec_ctf (vector unsigned int, const char); vector float vec_ctf (vector signed int, const char); vector signed int vec_cts (vector float, const char); vector unsigned int vec_ctu (vector float, const char); void vec_dss (const char);...
  • Page 198 Chapter 6. Extensions to the C Language Family vector unsigned char vec_lvsl (int, void *, int *); vector unsigned char vec_lvsr (int, void *, int *); vector float vec_madd (vector float, vector float, vector float); vector signed short vec_madds (vector signed short, vector signed short, vector signed short);...
  • Page 199 Chapter 6. Extensions to the C Language Family vector unsigned short vec_min (vector signed short, vector unsigned short); vector unsigned short vec_min (vector unsigned short, vector signed short); vector unsigned short vec_min (vector unsigned short, vector unsigned short); vector signed short vec_min (vector signed short, vector signed short); vector unsigned int vec_min (vector signed int, vector unsigned int);...
  • Page 200 Chapter 6. Extensions to the C Language Family vector signed short vec_mulo (vector signed char, vector signed char); vector unsigned int vec_mulo (vector unsigned short, vector unsigned short); vector signed int vec_mulo (vector signed short, vector signed short); vector float vec_nmsub (vector float, vector float, vector float); vector float vec_nor (vector float, vector float);...
  • Page 201 Chapter 6. Extensions to the C Language Family vector float vec_perm (vector float, vector float, vector unsigned char); vector signed int vec_perm (vector signed int, vector signed int, vector unsigned char); vector unsigned int vec_perm (vector unsigned int, vector unsigned int, vector unsigned char);...
  • Page 202 Chapter 6. Extensions to the C Language Family vector unsigned char, vector unsigned char); vector signed char vec_sl (vector signed char, vector unsigned char); vector unsigned char vec_sl (vector unsigned char, vector unsigned char); vector signed short vec_sl (vector signed short, vector unsigned short); vector unsigned short vec_sl (vector unsigned short, vector unsigned short);...
  • Page 203 Chapter 6. Extensions to the C Language Family vector unsigned int vec_slo (vector unsigned int, vector unsigned char); vector signed short vec_slo (vector signed short, vector signed char); vector signed short vec_slo (vector signed short, vector unsigned char); vector unsigned short vec_slo (vector unsigned short, vector signed char);...
  • Page 204 Chapter 6. Extensions to the C Language Family vector unsigned int vec_srl (vector unsigned int, vector unsigned char); vector signed short vec_srl (vector signed short, vector unsigned int); vector signed short vec_srl (vector signed short, vector unsigned short); vector signed short vec_srl (vector signed short, vector unsigned char); vector unsigned short vec_srl (vector unsigned short, vector unsigned int);...
  • Page 205 Chapter 6. Extensions to the C Language Family void vec_ste (vector signed char, int, signed char *); void vec_ste (vector unsigned char, int, unsigned char *); void vec_ste (vector signed short, int, short *); void vec_ste (vector signed short, int, unsigned short *); void vec_ste (vector unsigned short, int, void *);...
  • Page 206 Chapter 6. Extensions to the C Language Family vector unsigned short); vector signed short vec_subs (vector signed short, vector signed short); vector unsigned int vec_subs (vector signed int, vector unsigned int); vector unsigned int vec_subs (vector unsigned int, vector signed int); vector unsigned int vec_subs (vector unsigned int, vector unsigned int);...
  • Page 207 Chapter 6. Extensions to the C Language Family vector signed short); vector signed int vec_all_eq (vector unsigned short, vector unsigned short); vector signed int vec_all_eq (vector signed int, vector unsigned int); vector signed int vec_all_eq (vector signed int, vector signed int); vector signed int vec_all_eq (vector unsigned int, vector signed int);...
  • Page 208 Chapter 6. Extensions to the C Language Family vector signed int vec_all_le (vector signed char, vector signed char); vector signed int vec_all_le (vector signed short, vector unsigned short); vector signed int vec_all_le (vector unsigned short, vector signed short); vector signed int vec_all_le (vector unsigned short, vector unsigned short);...
  • Page 209 Chapter 6. Extensions to the C Language Family vector signed int vec_all_nge (vector float, vector float); vector signed int vec_all_ngt (vector float, vector float); vector signed int vec_all_nle (vector float, vector float); vector signed int vec_all_nlt (vector float, vector float); vector signed int vec_all_numeric (vector float);...
  • Page 210 Chapter 6. Extensions to the C Language Family vector unsigned short); vector signed int vec_any_gt (vector unsigned short, vector signed short); vector signed int vec_any_gt (vector unsigned short, vector unsigned short); vector signed int vec_any_gt (vector signed short, vector signed short); vector signed int vec_any_gt (vector signed int, vector unsigned int);...
  • Page 211: Pragmas Accepted By Gcc

    Chapter 6. Extensions to the C Language Family vector signed int vec_any_ne (vector signed char, vector signed char); vector signed int vec_any_ne (vector unsigned char, vector signed char); vector signed int vec_any_ne (vector unsigned char, vector unsigned char); vector signed int vec_any_ne (vector signed short, vector unsigned short);...
  • Page 212: Tru64 Pragmas

    Chapter 6. Extensions to the C Language Family redefine_extname oldname newname This pragma gives the C function the assembler label . The pragma must oldname newname appear before the function declaration. This pragma is equivalent to the asm labels extension (refer to Section 6.39 Controlling Names Used in Assembler Code).
  • Page 213: Thread-Local Storage

    In C++, if an initializer is present for a thread-local variable, it must be a constant-expression as defined in 5.19.2 of the ANSI/ISO C++ standard. See http://people.redhat.com/drepper/tls.pdfELF Handling For Thread-Local Storage for a detailed explanation of the four thread-local storage addressing models, and how the run-time is expected to function.
  • Page 214: Iso/Iec 14882:1998 Edits For Thread-Local Storage

    Chapter 6. Extensions to the C Language Family to the list of storage class specifiers in paragraph 1. __thread Change paragraph 2 to With the exception of , at most one storage-class specifier may be given [. . . ]. The __thread __thread specifier may be used alone, or immediately following...
  • Page 215 Chapter 6. Extensions to the C Language Family Thread, static, and automatic storage durations are associated with objects introduced by declarations [. . . ]. to the list of specifiers in paragraph 3. __thread [basic.stc.thread] • New section before [basic.stc.static] The keyword applied to an non-local object gives the object thread storage duration.
  • Page 216 Chapter 6. Extensions to the C Language Family...
  • Page 217: Extensions To The C++ Language

    Chapter 7. Extensions to the C++ Language The GNU compiler provides these extensions to the C++ language (and you can also use most of the C language extensions in your C++ programs). If you want to write code that checks whether these features are available, you can test for the GNU compiler the same way as for C programs: check for a predefined macro .
  • Page 218: Restricting Pointer Aliasing

    Chapter 7. Extensions to the C++ Language *dst = *src; will cause a read of the volatile object pointed to by and stores the value into the volatile object pointed to by . There is no guarantee that these reads and writes are atomic, especially for objects larger than Less obvious expressions are where something which looks like an access is used in a void context.
  • Page 219: Vague Linkage

    Chapter 7. Extensions to the C++ Language /* ... */ Within the body of will have the effective definition T::fn this T *__restrict__ const this Notice that the interpretation of a member function qualifier is different to that of __restrict__ qualifier, in that it is applied to the pointer rather than the object.
  • Page 220: Declarations And Definitions In One Header

    Chapter 7. Extensions to the C++ Language When used with GNU ld version 2.8 or later on an ELF system such as Linux/GNU or Solaris 2, or on Microsoft Windows, duplicate copies of these constructs will be discarded at link time. This is known as COMDAT support.
  • Page 221: Where's The Template

    Chapter 7. Extensions to the C++ Language . Backup copies of inline member functions, debugging information, and the internal interface tables used to implement virtual functions are all generated in implementation files. If you use with no argument, it applies to an include file with #pragma implementation the same basename as your source file.
  • Page 222 Chapter 7. Extensions to the C++ Language repository. At link time, the link wrapper adds in the objects in the repository and compiles any needed instances that were not previously emitted. The advantages of this model are more optimal compilation speed and the ability to use the system linker; to implement the Borland model a compiler vendor also needs to replace the linker.
  • Page 223: Extracting The Function Pointer From A Bound Pointer To Member Function

    Chapter 7. Extensions to the C++ Language If you use one big file to do the instantiations, you may want to compile it without so you get all of the instances required by your explicit -fno-implicit-templates instantiations (but not by any other files) without having to specify them as well. g++ has extended the template instantiation syntax given in the ISO standard to allow forward declaration of explicit instantiations (with ), instantiation of the compiler support data...
  • Page 224: Java Exceptions

    Chapter 7. Extensions to the C++ Language init_priority ( priority In Standard C++, objects defined at namespace scope are guaranteed to be initialized in an order in strict accordance with that of their definitions in a given translation unit. No guarantee is made for initializations across translation units.
  • Page 225: Backwards Compatibility

    Chapter 7. Extensions to the C++ Language -fexternal-templates -falt-external-templates These are two of the many ways for g++ to implement template instantiation. Refer to Section 7.6 Where’s the Template?. The C++ standard clearly defines how template definitions have to be organized across implementation units.
  • Page 226 Chapter 7. Extensions to the C++ Language...
  • Page 227: Gnu Objective-C Runtime Features

    Chapter 8. GNU Objective-C runtime features This document is meant to describe some of the GNU Objective-C runtime features. It is not intended to teach you Objective-C, there are several resources on the Internet that present the language. Ques- tions and comments about this document to Ovidiu Predescu mailto:ovidiu@@cup.hp.com. 8.1.
  • Page 228: Type Encoding

    Chapter 8. GNU Objective-C runtime features is a method that is not overridden by categories. If a class and a category of it both imple- +load ment , both methods are invoked. This allows some additional initializations to be performed +load in a category.
  • Page 229 Chapter 8. GNU Objective-C runtime features unsigned int long unsigned long long long unsigned long long float double void Class char* unknown type bit-fields followed by the starting position of the bit-field, the type of the bit-field and the size of the bit-field (the bit-fields encoding was changed from the NeXT’s compiler encoding, see below) The encoding of bit-fields has changed to allow bit-fields to be properly handled by the runtime functions that compute sizes and alignments of types that contain bit-fields.
  • Page 230: Garbage Collection

    Chapter 8. GNU Objective-C runtime features struct { int i; {?=i[3f]b128i3b131i2c} float f[3]; int a:3; int b:2; char c; } In addition to the types the compiler also encodes the type specifiers. The table below describes the encoding of the current Objective-C type specifiers: Specifier Encoding const...
  • Page 231: Constant String Objects

    Chapter 8. GNU Objective-C runtime features - initWithPointer:(const void*)p; - (const void*)weakPointer; @end @implementation WeakPointer + (void)initialize class_ivar_set_gcinvisible (self, "weakPointer", YES); - initWithPointer:(const void*)p weakPointer = p; return self; - (const void*)weakPointer return weakPointer; @end Weak pointers are supported through a new type character specifier represented by the character.
  • Page 232: Compatibility_Alias

    Chapter 8. GNU Objective-C runtime features When the compiler creates the statically allocated constant string object, the field will c_string be filled by the compiler with the string; the field will be filled by the compiler with the length string length; the pointer will be filled with by the compiler, and it will later be fixed up NULL...
  • Page 233: Binary Compatibility

    Chapter 9. Binary Compatibility Binary compatibility encompasses several related concepts: application binary interface (ABI) The set of runtime conventions followed by all of the tools that deal with binary representations of a program, including compilers, assemblers, linkers, and language runtime support. Some ABIs are formal with a written specification, possibly designed by multiple interested parties.
  • Page 234 Chapter 9. Binary Compatibility interfaces for runtime arithmetic support • object file formats • In addition, the application binary interface implemented by a C++ compiler affects code generation and runtime support for: name mangling • exception handling • invoking constructors and destructors •...
  • Page 235 Chapter 9. Binary Compatibility and to suppress the use of GCC’s support libraries with one or more of the options -nostdlib , and -nostartfiles -nodefaultlibs...
  • Page 236 Chapter 9. Binary Compatibility...
  • Page 237: Gcov --A Test Coverage Program

    Chapter 10. --a Test Coverage Program gcov is a tool you can use in conjunction with GCC to test code coverage in your programs. gcov 10.1. Introduction to gcov is a test coverage program. Use it in concert with GCC to analyze your programs to help create gcov more efficient, faster running code and to discover untested parts of your program.
  • Page 238 gcov Chapter 10. --a Test Coverage Program -help Display help about using (on the standard output), and exit without doing any further gcov processing. -version Display the version number (on the standard output), and exit without doing any further gcov processing.
  • Page 239 gcov Chapter 10. --a Test Coverage Program directory|file -object-directory directory -object-file file Specify either the directory containing the gcov data files, or the object path name. The , and data files are searched for using this option. If a directory is specified, the data .bbg files are in that directory and named after the source file name, without its extension.
  • Page 240 gcov Chapter 10. --a Test Coverage Program int i, total; total = 0; for (i = 0; i 10; i++) total += i; if (total != 45) #####: printf ("Failure\n"); else printf ("Success\n"); return 0; 17:} When you use the option, you will get individual block counts, and the output looks like this: 0:Source:tmp.c 0:Graph:tmp.bbg...
  • Page 241 gcov Chapter 10. --a Test Coverage Program 80.00% of 5 branches taken at least once in file tmp.c 50.00% of 2 calls executed in file tmp.c Creating tmp.c.gcov. Here is a sample of a resulting file: tmp.c.gcov 0:Source:tmp.c 0:Graph:tmp.bbg 0:Data:tmp.da 0:Runs:1 0:Programs:1 1:#include...
  • Page 242: Brief Description Of

    gcov Chapter 10. --a Test Coverage Program doesn’t match the executable (differing number of basic block counts) it will ignore the contents of the file. It then adds in the new execution counts and finally writes the data to the file. 10.3.
  • Page 243: Known Causes Of Trouble With Gcc

    Chapter 11. Known Causes of Trouble with GCC This section describes known problems that affect users of GCC. Most of these are not GCC bugs per se--if they were, we would fix them. But the result for a user may be like the result of a bug. Some of these problems are due to bugs in other software, some are missing features that are too much work to add, and some are places where people’s opinions differ as to what is best.
  • Page 244 Chapter 11. Known Causes of Trouble with GCC An area where the difference is most apparent is name mangling. The use of different name man- gling is intentional, to protect you from more subtle problems. Compilers differ as to many internal details of C++ implementation, including: how class instances are laid out, how multiple inheri- tance is implemented, and how virtual function calls are handled.
  • Page 245 Chapter 11. Known Causes of Trouble with GCC The 128-bit long double format that the SPARC port supports currently works by using the archi- • tecturally defined quad-word floating point instructions. Since there is no hardware that supports these instructions they must be emulated by the operating system. Long doubles do not work in Sun OS versions 4.0.3 and earlier, because the kernel emulator uses an obsolete and incompatible format.
  • Page 246: Problems Compiling Certain Programs

    Chapter 11. Known Causes of Trouble with GCC be linked with "runtime-linking" option and the functions explicitly must be exported by the application ( -Wl,-brtl,-bE:exportfile AIX on the RS/6000 provides support (NLS) for environments outside of the United States. Compil- •...
  • Page 247 Chapter 11. Known Causes of Trouble with GCC can use the flag, which directs GCC to handle string constants the same -fwritable-strings way most C compilers do. is positive. • -2147483648 This is because 2147483648 cannot fit in the type , so (following the ISO C rules) its data type .
  • Page 248 Chapter 11. Known Causes of Trouble with GCC Traditional C allows the following erroneous pair of declarations to appear together in a given • scope: typedef int foo; typedef foo foo; GCC treats all characters of identifiers as significant. According to K&R-1 (2.2), "No more than the •...
  • Page 249: Fixed Header Files

    Chapter 11. Known Causes of Trouble with GCC token. Each such token must correspond to one token in C. Since this does not, GCC prints an error message. Although it may appear obvious that what is meant is an operator and two values, the ISO C standard specifically requires that this be treated as erroneous.
  • Page 250: Disappointments And Misunderstandings

    Chapter 11. Known Causes of Trouble with GCC some very old versions did. Version 2.2 of the GNU C library includes nearly complete C99 support. You could also ask your operating system vendor if newer libraries are available. 11.8. Disappointments and Misunderstandings These problems are perhaps regrettable, but we don’t know any practical way around them.
  • Page 251: Common Misunderstandings With Gnu C

    Chapter 11. Known Causes of Trouble with GCC You can partially avoid this problem by using the option (refer to Section 4.10 -ffloat-store Options That Control Optimization). On AIX and other platforms without weak symbol support, templates need to be instantiated ex- •...
  • Page 252: Temporaries May Vanish Before You Expect

    Chapter 11. Known Causes of Trouble with GCC void f () { foo (1); // 1 int i = N; // 2 T t; t.bar(); // 3 foo (t); // 4 static const int N; Here, the names appear in a context that does not depend on the type of .
  • Page 253: Implicit Copy-Assignment For Virtual Bases

    Chapter 11. Known Causes of Trouble with GCC requires you to call the member function. However, any class that returns a pointer to some c_str internal structure is potentially subject to this problem. For example, a program may use a function that returns objects, and another func- strfunc...
  • Page 254: Caveats Of Using

    Chapter 11. Known Causes of Trouble with GCC struct Derived:public A, public B{ Derived():Base("Derived"){} void func(Derived &d1, Derived &d2) d1 = d2; The C++ standard specifies that is only called once when constructing or Base::Base copy-constructing a Derived object. It is unspecified whether is called more than Base::operator= once when the implicit copy-assignment for Derived objects is invoked (as it is inside...
  • Page 255: Certain Changes We Don't Want To Make

    Chapter 11. Known Causes of Trouble with GCC You can generally work around this problem by using step by step, each time specifying protoize a different set of options for compilation, until all of the functions have been converted. There is no automatic way to verify that you have got them all, however.
  • Page 256 Chapter 11. Known Causes of Trouble with GCC The GNU C compiler supports both dialects; you can specify the signed dialect with and the unsigned dialect with . However, this -fsigned-bitfields -funsigned-bitfields leaves open the question of which dialect to use by default. Currently, the preferred dialect makes plain bit-fields signed, because this is simplest.
  • Page 257: Warning Messages And Error Messages

    Chapter 11. Known Causes of Trouble with GCC Undefining in C++. • __STDC__ Programs written to compile with C++-to-C translators get the value of that goes with __STDC__ the C compiler that is subsequently used. These programs must test to determine what __STDC__ kind of C preprocessor that compiler uses: whether they should concatenate tokens in the ISO C fashion or in the traditional fashion.
  • Page 258 Chapter 11. Known Causes of Trouble with GCC • Warnings report other unusual conditions in your code that may indicate a problem, although com- pilation can (and does) proceed. Warning messages also report the source file name and line number, but include the text to distinguish them from error messages.
  • Page 259: Reporting Bugs

    Chapter 12. Reporting Bugs Your bug reports play an essential role in making GCC reliable. When you encounter a problem, the first thing to do is to see if it is already known. Refer to Chapter 11 Known Causes of Trouble with GCC. If it isn’t known, then you should report the problem. 12.1.
  • Page 260 Chapter 12. Reporting Bugs...
  • Page 261: How To Get Help With Gcc

    Chapter 13. How To Get Help with GCC If you need help installing, using or changing GCC, there are two ways to find it: Send a message to a suitable network mailing list. First try mailto:gcc-help@@gcc.gnu.org (for • help installing or using GCC), and if that brings no response, try mailto:gcc@@gcc.gnu.org. For help changing GCC, ask mailto:gcc@@gcc.gnu.org.
  • Page 262 Chapter 13. How To Get Help with GCC...
  • Page 263: Contributing To Gcc Development

    Chapter 14. Contributing to GCC Development If you would like to help pretest GCC releases to assure they work well, our current development sources are available by CVS (see http://gcc.gnu.org/cvs.html). Source and binary snapshots are also available for FTP; see http://gcc.gnu.org/snapshots.html. If you would like to work on improvements to GCC, please read the advice at these URLs: http://gcc.gnu.org/contribute.html http://gcc.gnu.org/contributewhy.html...
  • Page 264 Chapter 14. Contributing to GCC Development...
  • Page 265: Funding Free Software

    Chapter 15. Funding Free Software If you want to have more free software a few years from now, it makes sense for you to help encourage people to contribute funds for its development. The most effective approach known is to encourage commercial redistributors to donate.
  • Page 266 Chapter 15. Funding Free Software...
  • Page 267: The Gnu Project And Gnu/Linux

    Chapter 16. The GNU Project and GNU/Linux The GNU Project was launched in 1984 to develop a complete Unix-like operating system which is free software: the GNU system. (GNU is a recursive acronym for "GNU’s Not Unix"; it is pro- nounced "guh-NEW".) Variants of the GNU operating system, which use the kernel Linux, are now widely used;...
  • Page 268 Chapter 16. The GNU Project and GNU/Linux...
  • Page 269: Gnu General Public License

    Chapter 17. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright © 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 17.1.
  • Page 270 Chapter 17. GNU GENERAL PUBLIC LICENSE means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or trans- lated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
  • Page 271 Chapter 17. GNU GENERAL PUBLIC LICENSE b. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange;...
  • Page 272: How To Apply These Terms To Your New Programs

    Chapter 17. GNU GENERAL PUBLIC LICENSE author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
  • Page 273 Chapter 17. GNU GENERAL PUBLIC LICENSE To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright"...
  • Page 274 Chapter 17. GNU GENERAL PUBLIC LICENSE...
  • Page 275: Gnu Free Documentation License

    Chapter 18. GNU Free Documentation License Version 1.2, November 2002 Copyright © 2000,2001,2002 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 1.
  • Page 276 Chapter 18. GNU Free Documentation License The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent"...
  • Page 277 Chapter 18. GNU Free Documentation License on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
  • Page 278 Chapter 18. GNU Free Documentation License for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K.
  • Page 279: Addendum: How To Use This License For Your Documents

    Chapter 18. GNU Free Documentation License single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
  • Page 280 Chapter 18. GNU Free Documentation License 18.1. ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) year your name...
  • Page 281: Contributors To Gcc

    Any omissions in this list are accidental. Feel free to contact mailto:law@@redhat.com or mailto:gerald@@pfeifer.com if you have been left out or some of your contributions are not listed. Please keep this list in alphabetical order.
  • Page 282 Chapter 19. Contributors to GCC Stephan Buys for contributing Doxygen notes for libstdc++. • Paolo Carlini for libstdc++ work: lots of efficiency improvements to the string class, hard detective • work on the frustrating localization issues, and keeping up with the problem reports. John Carr for his alias work, SPARC hacking, infrastructure improvements, previous contributions •...
  • Page 283 Chapter 19. Contributors to GCC Vadim Egorov for libstdc++ fixes in strings, streambufs, and iostreams. • Christian Ehrhardt for dealing with bug reports. • Ben Elliston for his work to move the Objective-C runtime into its own subdirectory and for his •...
  • Page 284 Chapter 19. Contributors to GCC Kamil Iskra for general m68k hacking. • Lee Iverson for random fixes and MIPS testing. • Andreas Jaeger for various fixes to the MIPS port • Jakub Jelinek for his SPARC work and sibling call optimizations as well as lots of bug fixes and •...
  • Page 285 Philip Martin for lots of libstdc++ string and vector iterator fixes and improvements, and string • clean up and testsuites. Mauve project http://sources.redhat.com/cgi- • bin/cvsweb.cgi/~checkout~/mauve/THANKS?rev=1.2&cvsroot=mauve&only_with_tag=HEADcontributors, for Java test code. Bryce McKinlay for numerous GCJ and libgcj fixes and improvements. •...
  • Page 286 Chapter 19. Contributors to GCC Mike Moreton for his various Java patches. • David Mosberger-Tang for various Alpha improvements. • Stephen Moshier contributed the floating point emulator that assists in cross-compilation and per- • mits support for floating point numbers wider than 64 bits and for ISO C99 support. Bill Moyer for his behind the scenes work on various issues.
  • Page 287 Chapter 19. Contributors to GCC Loren J. Rittle for improvements to libstdc++-v3 including the FreeBSD port, threading fixes, • thread-related configury changes, critical threading documentation, and solutions to really tricky I/O problems. Craig Rodrigues for processing tons of bug reports. •...
  • Page 288 Chapter 19. Contributors to GCC John Stracke for his Java HTTP protocol fixes. • Mike Stump for his Elxsi port, g++ contributions over the years and more recently his vxworks • contributions Jeff Sturm for Java porting help, bug fixes, and encouragement. •...
  • Page 289 Chapter 19. Contributors to GCC Carlo Wood for various fixes. • Tom Wood for work on the m88k port. • Masanobu Yuhara of Fujitsu Laboratories implemented the machine description for the Tron archi- • tecture (specifically, the Gmicro). Kevin Zachmann helped ported GCC to the Tahoe. •...
  • Page 290 Chapter 19. Contributors to GCC Patrik Hagglund • Phil Hargett • Amancio Hasty • Bryan W. Headley • Kate Hedstrom • Richard Henderson • Kevin B. Hendricks • Manfred Hollstein • Kamil Iskra • Joep Jansen • Christian Joensson • David Kidd •...
  • Page 291 Chapter 19. Contributors to GCC Loren J. Rittle • Torsten Rueger • Danny Sadinoff • Marc Schifer • Peter Schmid • David Schuler • Vin Shelton • Franz Sirl • Tim Souder • Mike Stump • Adam Sulmicki • George Talbot •...
  • Page 292 Chapter 19. Contributors to GCC...
  • Page 293: Option Index

    Option Index dB, see Section 4.9 Options for Debugging Your Pro- gram or GCC GCC’s command line options are indexed here dC, see Section 4.9 Options for Debugging Your Pro- without any initial . Where an option gram or GCC has both positive and negative forms (such as dc, see Section 4.9 Options for Debugging Your Pro- gram or GCC...
  • Page 294 Option Index dp, see Section 4.9 Options for Debugging Your Pro- fargument-noalias-global, see Section 4.18 Options gram or GCC for Code Generation Conventions dR, see Section 4.9 Options for Debugging Your Pro- fbounds-check, see Section 4.18 Options for Code gram or GCC Generation Conventions dr, see Section 4.9 Options for Debugging Your Pro- fbranch-probabilities, see Section 4.10 Options That...
  • Page 295 Option Index ffast-math, see Section 4.10 Options That Control Op- fmessage-length, see Section 4.7 Options to Control timization Diagnostic Messages Formatting ffinite-math-only, see Section 4.10 Options That Con- fmove-all-movables, see Section 4.10 Options That trol Optimization Control Optimization ffixed, see Section 4.18 Options for Code Generation fms-extensions, see Section 4.5 Options Controlling Conventions C++ Dialect...
  • Page 296 Option Index fno-implement-inlines, see Section 4.5 Options Con- fpcc-struct-return, see Section 4.18 Options for Code trolling C++ Dialect Generation Conventions fno-implicit-inline-templates, see Section 4.5 Options fpcc-struct-return, see Section 11.5 Incompatibilities Controlling C++ Dialect of GCC fno-implicit-templates, see Section 7.6 Where’s the fpch-deps, see Section 4.11 Options Controlling the Template? Preprocessor...
  • Page 297 Option Index fsched2-use-traces, see Section 4.10 Options That ftime-report, see Section 4.9 Options for Debugging Control Optimization Your Program or GCC fschedule-insns, see Section 4.10 Options That Con- ftracer, see Section 4.10 Options That Control Opti- trol Optimization mization fschedule-insns2, see Section 4.10 Options That Con- ftrapv, see Section 4.18 Options for Code Generation trol Optimization Conventions...
  • Page 298 Option Index ggdb, see Section 4.9 Options for Debugging Your Program or GCC M, see Section 4.11 Options Controlling the Prepro- gstabs, see Section 4.9 Options for Debugging Your cessor Program or GCC m128bit-long-double, see Section 4.17.3 Intel 386 gstabs+, see Section 4.9 Options for Debugging Your and AMD x86-64 Options Program or GCC m31, see Section 4.17.5 S/390 and zSeries Options...
  • Page 299 Option Index mbig-endian, see Section 4.17.2 IBM RS/6000 and minline-float-divide-max-throughput, see Section PowerPC Options 4.17.4 IA-64 Options mbit-align, see Section 4.17.2 IBM RS/6000 and Pow- minline-float-divide-min-latency, see Section 4.17.4 erPC Options IA-64 Options mcall-gnu, see Section 4.17.2 IBM RS/6000 and Pow- minline-int-divide-max-throughput, Section erPC Options...
  • Page 300 Option Index mno-gnu-as, see Section 4.17.4 IA-64 Options mno-volatile-asm-stop, see Section 4.17.4 IA-64 Op- tions mno-gnu-ld, see Section 4.17.4 IA-64 Options mno-xl-call, see Section 4.17.2 IBM RS/6000 and mno-ieee-fp, see Section 4.17.3 Intel 386 and AMD PowerPC Options x86-64 Options mold-mnemonics, see Section 4.17.2 IBM RS/6000 mno-longcall, see Section 4.17.2 IBM RS/6000 and and PowerPC Options...
  • Page 301 Option Index msdata=eabi, see Section 4.17.2 IBM RS/6000 and nodefaultlibs, see Section 4.13 Options for Linking PowerPC Options nostartfiles, see Section 4.13 Options for Linking msdata=none, see Section 4.17.2 IBM RS/6000 and nostdinc, see Section 4.11 Options Controlling the PowerPC Options Preprocessor msdata=sysv, see Section 4.17.2 IBM RS/6000 and nostdinc++, see Section 4.5 Options Controlling C++...
  • Page 302 Option Index pedantic-errors, see Chapter 3 Language Standards std, see Chapter 3 Language Standards Supported by Supported by GCC pedantic-errors, see Section 11.1 Actual Bugs We std, see Section 6.46 Other built-in functions provided Haven’t Fixed Yet by GCC pedantic-errors, see Section 4.11 Options Controlling std, see Section 4.4 Options Controlling C Dialect the Preprocessor std, see Section 11.11 Certain Changes We Don’t...
  • Page 303 Option Index Wextra, see Section 4.8 Options to Request or Sup- press Warnings W, see Section 4.8 Options to Request or Suppress Wfloat-equal, see Section 4.8 Options to Request or Warnings Suppress Warnings W, see Section 11.5 Incompatibilities of GCC Wformat, see Section 4.8 Options to Request or Sup- w, see Section 4.8 Options to Request or Suppress press Warnings...
  • Page 304 Option Index Wno-deprecated-declarations, see Section 4.8 Op- Wsequence-point, see Section 4.8 Options to Request tions to Request or Suppress Warnings or Suppress Warnings Wshadow, see Section 4.8 Options to Request or Sup- Wno-div-by-zero, see Section 4.8 Options to Request press Warnings or Suppress Warnings Wsign-compare, see Section 4.8 Options to Request Wno-format-extra-args, see Section 4.8 Options to...
  • Page 305 Option Index Wunused-variable, see Section 4.8 Options to Request or Suppress Warnings Wwrite-strings, see Section 4.8 Options to Request or Suppress Warnings x, see Section 4.11 Options Controlling the Prepro- cessor x, see Section 4.2 Options Controlling the Kind of Output Xassembler, see Section 4.12 Passing Options to the Assembler...
  • Page 307: Keyword Index

    Keyword Index extensions, see Section 6.8 Conditionals with Omitted Operands extensions, see Section 6.7 Generalized Lvalues ?: side effect, see Section 6.8 Conditionals with Omit- in constraint, see Section 6.38.2 Multiple Alterna- ted Operands tive Constraints in variables in macros, see Section 6.6 Referring to in constraint, see Section 6.38.3 Constraint Modifier a Type with typeof...
  • Page 308 Keyword Index __builtin_islessequal, see Section 6.46 Other built-in _Exit, see Section 6.46 Other built-in functions pro- functions provided by GCC vided by GCC __builtin_islessgreater, see Section 6.46 Other built- _exit, see Section 6.46 Other built-in functions pro- in functions provided by GCC vided by GCC __builtin_isunordered, see Section 6.46 Other built-in functions provided by GCC...
  • Page 309 Keyword Index application binary interface, see Chapter 9 Binary bug criteria, see Section 12.1 Have You Found a Bug? Compatibility bugs, see Chapter 12 Reporting Bugs ARM [Annotated C++ Reference Manual], see Sec- bugs, known, see Chapter 11 Known Causes of Trou- tion 7.11 Backwards Compatibility ble with GCC arrays of length zero, see Section 6.12 Arrays of...
  • Page 310 Keyword Index C95, see Chapter 3 Language Standards Supported by compiler version, specifying, see Section 4.16 Speci- fying Target Machine and Compiler Version COMPILER_PATH, see Section 4.19 Environment C99, see Chapter 3 Language Standards Supported by Variables Affecting GCC complex conjugation, see Section 6.10 Complex Num- C9X, see Chapter 3 Language Standards Supported bers by GCC...
  • Page 311 Keyword Index creall, see Section 6.46 Other built-in functions pro- in constraint, see Section 6.38.1 Simple Constraints vided by GCC cross compiling, see Section 4.16 Specifying Target Machine and Compiler Version earlyclobber operand, see Section 6.38.3 Constraint Modifier Characters DBX, see Section 11.3 Interoperation empty structures, see Section 6.13 Structures With No deallocating variable length arrays, see Section 6.14 Members...
  • Page 312 Keyword Index , and constant strings, see Section 11.5 Incom- fscanf patibilities of GCC fabs, see Section 6.46 Other built-in functions pro- function attributes, see Section 6.26 Declaring At- vided by GCC tributes of Functions fabsf, see Section 6.46 Other built-in functions pro- function pointers, arithmetic, see Section 6.19 Arith- vided by GCC metic on...
  • Page 313 Keyword Index GCC_EXEC_PREFIX, see Section 4.19 Environment incompatibilities of GCC, see Section 11.5 Incompat- Variables Affecting GCC ibilities of GCC , see Section 6.34 Specifying Attributes increment operators, see Section 12.1 Have You Found gcc_struct of Types a Bug? attribute, see Section 6.33 Specifying index, see Section 6.46 Other built-in functions pro- gcc_struct Attributes of Variables...
  • Page 314 Keyword Index ISO C9X, see Chapter 3 Language Standards Sup- local variables, specifying registers, see Section ported by GCC 6.40.2 Specifying Registers for Local Variables ISO support, see Section 4.4 Options Controlling C locale, see Section 4.19 Environment Variables Affect- Dialect ing GCC ISO/IEC 9899, see Chapter 3 Language Standards...
  • Page 315 Keyword Index member fns, automatically , see Section 6.36 nearbyintl, see Section 6.46 Other built-in functions inline An Inline Function is As Fast As a Macro provided by GCC memcmp, see Section 6.46 Other built-in functions nested functions, see Section 6.4 Nested Functions provided by GCC newlines (escaped), see Section 6.16 Slightly Looser memcpy, see Section 6.46 Other built-in functions...
  • Page 316 Keyword Index options, directory search, see Section 4.14 Options for pragma, reason for not using, see Section 6.26 Declar- Directory Search ing Attributes of Functions options, GCC command, see Chapter 4 GCC Com- pragma, redefine_extname, see Section 6.48.2 Solaris mand Options Pragmas options, grouping, see Chapter 4 GCC Command Op- pragmas, see Section 6.48 Pragmas Accepted by GCC...
  • Page 317 Keyword Index registers for local variables, see Section 6.40.2 Speci- variable attribute, see Section 6.33 Specify- section fying Registers for Local Variables ing Attributes of Variables registers in constraints, see Section 6.38.1 Simple setjmp, see Section 6.40.1 Defining Global Register Constraints Variables registers, global allocation, see Section 6.40 Variables...
  • Page 318 Keyword Index sscanf, see Section 6.46 Other built-in functions pro- surprises in C++, see Section 11.9 Common Misun- vided by GCC derstandings with GNU C++ , and constant strings, see Section 11.5 Incom- syntax checking, see Section 4.8 Options to Request sscanf patibilities of GCC or Suppress Warnings...
  • Page 319 Keyword Index two-stage name lookup, see Section 11.9.2 Name variable-length arrays, see Section 6.14 Arrays of lookup, templates, and accessing members of base Variable Length classes variables in specified registers, see Section 6.40 Vari- type alignment, see Section 6.32 Inquiring on Align- ables in Specified Registers ment of Types or Variables variables, local, in macros, see Section 6.6 Referring...
  • Page 320 Keyword Index attribute, see Section 6.26 Declaring Attributes weak of Functions whitespace, see Section 11.5 Incompatibilities of in constraint, see Section 6.38.1 Simple Constraints X3.159-1989, see Chapter 3 Language Standards Supported by GCC x86-64 Options, see Section 4.17.3 Intel 386 and AMD x86-64 Options zero-length arrays, see Section 6.12 Arrays of Length Zero...

This manual is also suitable for:

Enterprise linux 3

Table of Contents