Using the GNU Compiler Collection (GCC)
This file documents the use of the GNU compilers. Copyright © 1988-2015 Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being “Funding Free Software”, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.
Short Contents
- Introduction
- 1 Programming Languages Supported by GCC
- 2 Language Standards Supported by GCC
- 3 GCC Command Options
- 4 C Implementation-defined behavior
- 5 C++ Implementation-defined behavior
- 6 Extensions to the C Language Family
- 7 Extensions to the C++ Language
- 8 GNU Objective-C features
- 9 Binary Compatibility
- 10
gcov
—a Test Coverage Program - 11 Known Causes of Trouble with GCC
- 12 Reporting Bugs
- 13 How To Get Help with GCC
- 14 Contributing to GCC Development
- Funding Free Software
- The GNU Project and GNU/Linux
- GNU General Public License
- GNU Free Documentation License
- Contributors to GCC
- Option Index
- Keyword Index
Table of Contents
- Introduction
- 1 Programming Languages Supported by GCC
- 2 Language Standards Supported by GCC
-
3 GCC Command Options
- 3.1 Option Summary
- 3.2 Options Controlling the Kind of Output
- 3.3 Compiling C++ Programs
- 3.4 Options Controlling C Dialect
- 3.5 Options Controlling C++ Dialect
- 3.6 Options Controlling Objective-C and Objective-C++ Dialects
- 3.7 Options to Control Diagnostic Messages Formatting
- 3.8 Options to Request or Suppress Warnings
- 3.9 Options for Debugging Your Program or GCC
- 3.10 Options That Control Optimization
- 3.11 Options Controlling the Preprocessor
- 3.12 Passing Options to the Assembler
- 3.13 Options for Linking
- 3.14 Options for Directory Search
- 3.15 Specifying subprocesses and the switches to pass to them
- 3.16 Specifying Target Machine and Compiler Version
-
3.17 Hardware Models and Configurations
- 3.17.1 AArch64 Options
- 3.17.2 Adapteva Epiphany Options
- 3.17.3 ARC Options
- 3.17.4 ARM Options
- 3.17.5 AVR Options
- 3.17.6 Blackfin Options
- 3.17.7 C6X Options
- 3.17.8 CRIS Options
- 3.17.9 CR16 Options
- 3.17.10 Darwin Options
- 3.17.11 DEC Alpha Options
- 3.17.12 FR30 Options
- 3.17.13 FRV Options
- 3.17.14 GNU/Linux Options
- 3.17.15 H8/300 Options
- 3.17.16 HPPA Options
- 3.17.17 Intel 386 and AMD x86-64 Options
- 3.17.18 i386 and x86-64 Windows Options
- 3.17.19 IA-64 Options
- 3.17.20 LM32 Options
- 3.17.21 M32C Options
- 3.17.22 M32R/D Options
- 3.17.23 M680x0 Options
- 3.17.24 MCore Options
- 3.17.25 MeP Options
- 3.17.26 MicroBlaze Options
- 3.17.27 MIPS Options
- 3.17.28 MMIX Options
- 3.17.29 MN10300 Options
- 3.17.30 Moxie Options
- 3.17.31 MSP430 Options
- 3.17.32 NDS32 Options
- 3.17.33 Nios II Options
- 3.17.34 PDP-11 Options
- 3.17.35 picoChip Options
- 3.17.36 PowerPC Options
- 3.17.37 RL78 Options
- 3.17.38 IBM RS/6000 and PowerPC Options
- 3.17.39 RX Options
- 3.17.40 S/390 and zSeries Options
- 3.17.41 Score Options
- 3.17.42 SH Options
- 3.17.43 Solaris 2 Options
- 3.17.44 SPARC Options
- 3.17.45 SPU Options
- 3.17.46 Options for System V
- 3.17.47 TILE-Gx Options
- 3.17.48 TILEPro Options
- 3.17.49 V850 Options
- 3.17.50 VAX Options
- 3.17.51 VMS Options
- 3.17.52 VxWorks Options
- 3.17.53 x86-64 Options
- 3.17.54 Xstormy16 Options
- 3.17.55 Xtensa Options
- 3.17.56 zSeries Options
- 3.18 Options for Code Generation Conventions
- 3.19 Environment Variables Affecting GCC
- 3.20 Using Precompiled Headers
-
4 C Implementation-defined behavior
- 4.1 Translation
- 4.2 Environment
- 4.3 Identifiers
- 4.4 Characters
- 4.5 Integers
- 4.6 Floating point
- 4.7 Arrays and pointers
- 4.8 Hints
- 4.9 Structures, unions, enumerations, and bit-fields
- 4.10 Qualifiers
- 4.11 Declarators
- 4.12 Statements
- 4.13 Preprocessing directives
- 4.14 Library functions
- 4.15 Architecture
- 4.16 Locale-specific behavior
- 5 C++ Implementation-defined behavior
-
6 Extensions to the C Language Family
- 6.1 Statements and Declarations in Expressions
- 6.2 Locally Declared Labels
- 6.3 Labels as Values
- 6.4 Nested Functions
- 6.5 Constructing Function Calls
-
6.6 Referring to a Type with
typeof
- 6.7 Conditionals with Omitted Operands
- 6.8 128-bit integers
- 6.9 Double-Word Integers
- 6.10 Complex Numbers
- 6.11 Additional Floating Types
- 6.12 Half-Precision Floating Point
- 6.13 Decimal Floating Types
- 6.14 Hex Floats
- 6.15 Fixed-Point Types
- 6.16 Named Address Spaces
- 6.17 Arrays of Length Zero
- 6.18 Structures With No Members
- 6.19 Arrays of Variable Length
- 6.20 Macros with a Variable Number of Arguments.
- 6.21 Slightly Looser Rules for Escaped Newlines
- 6.22 Non-Lvalue Arrays May Have Subscripts
-
6.23 Arithmetic on
void
- and Function-Pointers - 6.24 Non-Constant Initializers
- 6.25 Compound Literals
- 6.26 Designated Initializers
- 6.27 Case Ranges
- 6.28 Cast to a Union Type
- 6.29 Mixed Declarations and Code
- 6.30 Declaring Attributes of Functions
- 6.31 Attribute Syntax
- 6.32 Prototypes and Old-Style Function Definitions
- 6.33 C++ Style Comments
- 6.34 Dollar Signs in Identifier Names
- 6.35 The Character <ESC> in Constants
- 6.36 Specifying Attributes of Variables
- 6.37 Specifying Attributes of Types
- 6.38 Inquiring on Alignment of Types or Variables
- 6.39 An Inline Function is As Fast As a Macro
- 6.40 When is a Volatile Object Accessed?
- 6.41 Assembler Instructions with C Expression Operands
-
6.42 Constraints for
asm
Operands - 6.43 Controlling Names Used in Assembler Code
- 6.44 Variables in Specified Registers
- 6.45 Alternate Keywords
-
6.46 Incomplete
enum
Types - 6.47 Function Names as Strings
- 6.48 Getting the Return or Frame Address of a Function
- 6.49 Using Vector Instructions through Built-in Functions
- 6.50 Offsetof
- 6.51 Legacy __sync Built-in Functions for Atomic Memory Access
- 6.52 Built-in functions for memory model aware atomic operations
- 6.53 x86 specific memory model extensions for transactional memory
- 6.54 Object Size Checking Built-in Functions
- 6.55 Cilk Plus C/C++ language extension Built-in Functions.
- 6.56 Other Built-in Functions Provided by GCC
-
6.57 Built-in Functions Specific to Particular Target Machines
- 6.57.1 Alpha Built-in Functions
- 6.57.2 Altera Nios II Built-in Functions
- 6.57.3 ARC Built-in Functions
- 6.57.4 ARC SIMD Built-in Functions
- 6.57.5 ARM iWMMXt Built-in Functions
-
6.57.6 ARM NEON Intrinsics
- 6.57.6.1 Addition
- 6.57.6.2 Multiplication
- 6.57.6.3 Multiply-accumulate
- 6.57.6.4 Multiply-subtract
- 6.57.6.5 Fused-multiply-accumulate
- 6.57.6.6 Fused-multiply-subtract
- 6.57.6.7 Round to integral (to nearest, ties to even)
- 6.57.6.8 Round to integral (to nearest, ties away from zero)
- 6.57.6.9 Round to integral (towards +Inf)
- 6.57.6.10 Round to integral (towards -Inf)
- 6.57.6.11 Round to integral (towards 0)
- 6.57.6.12 Subtraction
- 6.57.6.13 Comparison (equal-to)
- 6.57.6.14 Comparison (greater-than-or-equal-to)
- 6.57.6.15 Comparison (less-than-or-equal-to)
- 6.57.6.16 Comparison (greater-than)
- 6.57.6.17 Comparison (less-than)
- 6.57.6.18 Comparison (absolute greater-than-or-equal-to)
- 6.57.6.19 Comparison (absolute less-than-or-equal-to)
- 6.57.6.20 Comparison (absolute greater-than)
- 6.57.6.21 Comparison (absolute less-than)
- 6.57.6.22 Test bits
- 6.57.6.23 Absolute difference
- 6.57.6.24 Absolute difference and accumulate
- 6.57.6.25 Maximum
- 6.57.6.26 Minimum
- 6.57.6.27 Pairwise add
- 6.57.6.28 Pairwise add, single_opcode widen and accumulate
- 6.57.6.29 Folding maximum
- 6.57.6.30 Folding minimum
- 6.57.6.31 Reciprocal step
- 6.57.6.32 Vector shift left
- 6.57.6.33 Vector shift left by constant
- 6.57.6.34 Vector shift right by constant
- 6.57.6.35 Vector shift right by constant and accumulate
- 6.57.6.36 Vector shift right and insert
- 6.57.6.37 Vector shift left and insert
- 6.57.6.38 Absolute value
- 6.57.6.39 Negation
- 6.57.6.40 Bitwise not
- 6.57.6.41 Count leading sign bits
- 6.57.6.42 Count leading zeros
- 6.57.6.43 Count number of set bits
- 6.57.6.44 Reciprocal estimate
- 6.57.6.45 Reciprocal square-root estimate
- 6.57.6.46 Get lanes from a vector
- 6.57.6.47 Set lanes in a vector
- 6.57.6.48 Create vector from literal bit pattern
- 6.57.6.49 Set all lanes to the same value
- 6.57.6.50 Combining vectors
- 6.57.6.51 Splitting vectors
- 6.57.6.52 Conversions
- 6.57.6.53 Move, single_opcode narrowing
- 6.57.6.54 Move, single_opcode long
- 6.57.6.55 Table lookup
- 6.57.6.56 Extended table lookup
- 6.57.6.57 Multiply, lane
- 6.57.6.58 Long multiply, lane
- 6.57.6.59 Saturating doubling long multiply, lane
- 6.57.6.60 Saturating doubling multiply high, lane
- 6.57.6.61 Multiply-accumulate, lane
- 6.57.6.62 Multiply-subtract, lane
- 6.57.6.63 Vector multiply by scalar
- 6.57.6.64 Vector long multiply by scalar
- 6.57.6.65 Vector saturating doubling long multiply by scalar
- 6.57.6.66 Vector saturating doubling multiply high by scalar
- 6.57.6.67 Vector multiply-accumulate by scalar
- 6.57.6.68 Vector multiply-subtract by scalar
- 6.57.6.69 Vector extract
- 6.57.6.70 Reverse elements
- 6.57.6.71 Bit selection
- 6.57.6.72 Transpose elements
- 6.57.6.73 Zip elements
- 6.57.6.74 Unzip elements
- 6.57.6.75 Element/structure loads, VLD1 variants
- 6.57.6.76 Element/structure stores, VST1 variants
- 6.57.6.77 Element/structure loads, VLD2 variants
- 6.57.6.78 Element/structure stores, VST2 variants
- 6.57.6.79 Element/structure loads, VLD3 variants
- 6.57.6.80 Element/structure stores, VST3 variants
- 6.57.6.81 Element/structure loads, VLD4 variants
- 6.57.6.82 Element/structure stores, VST4 variants
- 6.57.6.83 Logical operations (AND)
- 6.57.6.84 Logical operations (OR)
- 6.57.6.85 Logical operations (exclusive OR)
- 6.57.6.86 Logical operations (AND-NOT)
- 6.57.6.87 Logical operations (OR-NOT)
- 6.57.6.88 Reinterpret casts
- 6.57.7 ARM ACLE Intrinsics
- 6.57.8 AVR Built-in Functions
- 6.57.9 Blackfin Built-in Functions
- 6.57.10 FR-V Built-in Functions
- 6.57.11 X86 Built-in Functions
- 6.57.12 X86 transaction memory intrinsics
- 6.57.13 MIPS DSP Built-in Functions
- 6.57.14 MIPS Paired-Single Support
- 6.57.15 MIPS Loongson Built-in Functions
- 6.57.16 Other MIPS Built-in Functions
- 6.57.17 MSP430 Built-in Functions
- 6.57.18 NDS32 Built-in Functions
- 6.57.19 picoChip Built-in Functions
- 6.57.20 PowerPC Built-in Functions
- 6.57.21 PowerPC AltiVec Built-in Functions
- 6.57.22 PowerPC Hardware Transactional Memory Built-in Functions
- 6.57.23 RX Built-in Functions
- 6.57.24 S/390 System z Built-in Functions
- 6.57.25 SH Built-in Functions
- 6.57.26 SPARC VIS Built-in Functions
- 6.57.27 SPU Built-in Functions
- 6.57.28 TI C6X Built-in Functions
- 6.57.29 TILE-Gx Built-in Functions
- 6.57.30 TILEPro Built-in Functions
- 6.58 Format Checks Specific to Particular Target Machines
-
6.59 Pragmas Accepted by GCC
- 6.59.1 ARM Pragmas
- 6.59.2 M32C Pragmas
- 6.59.3 MeP Pragmas
- 6.59.4 RS/6000 and PowerPC Pragmas
- 6.59.5 Darwin Pragmas
- 6.59.6 Solaris Pragmas
- 6.59.7 Symbol-Renaming Pragmas
- 6.59.8 Structure-Packing Pragmas
- 6.59.9 Weak Pragmas
- 6.59.10 Diagnostic Pragmas
- 6.59.11 Visibility Pragmas
- 6.59.12 Push/Pop Macro Pragmas
- 6.59.13 Function Specific Option Pragmas
- 6.59.14 Loop-Specific Pragmas
- 6.60 Unnamed struct/union fields within structs/unions
- 6.61 Thread-Local Storage
-
6.62 Binary constants using the ‘
0b
’ prefix
-
7 Extensions to the C++ Language
- 7.1 When is a Volatile C++ Object Accessed?
- 7.2 Restricting Pointer Aliasing
- 7.3 Vague Linkage
- 7.4 #pragma interface and implementation
- 7.5 Where's the Template?
- 7.6 Extracting the function pointer from a bound pointer to member function
- 7.7 C++-Specific Variable, Function, and Type Attributes
- 7.8 Function Multiversioning
- 7.9 Namespace Association
- 7.10 Type Traits
- 7.11 Java Exceptions
- 7.12 Deprecated Features
- 7.13 Backwards Compatibility
- 8 GNU Objective-C features
- 9 Binary Compatibility
-
10
gcov
—a Test Coverage Program -
11 Known Causes of Trouble with GCC
- 11.1 Actual Bugs We Haven't Fixed Yet
- 11.2 Interoperation
- 11.3 Incompatibilities of GCC
- 11.4 Fixed Header Files
- 11.5 Standard Libraries
- 11.6 Disappointments and Misunderstandings
- 11.7 Common Misunderstandings with GNU C++
- 11.8 Certain Changes We Don't Want to Make
- 11.9 Warning Messages and Error Messages
- 12 Reporting Bugs
- 13 How To Get Help with GCC
- 14 Contributing to GCC Development
- Funding Free Software
- The GNU Project and GNU/Linux
- GNU General Public License
- GNU Free Documentation License
- Contributors to GCC
- Option Index
- Keyword Index
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 the compilers (GCC) version 4.9.3. 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. See Introduction.
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/index.html