Using the GNU Compiler Collection (GCC)
This file documents the use of the GNU compilers.
Copyright © 1988-2019 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 Table of Contents
- 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
gcov-tool
—an Offline Gcda Profile Processing Tool - 12
gcov-dump
—an Offline Gcda and Gcno Profile Dump Tool - 13 Known Causes of Trouble with GCC
- 14 Reporting Bugs
- 15 How To Get Help with GCC
- 16 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
- 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
- 3.10 Options That Control Optimization
- 3.11 Program Instrumentation Options
- 3.12 Options Controlling the Preprocessor
- 3.13 Passing Options to the Assembler
- 3.14 Options for Linking
- 3.15 Options for Directory Search
- 3.16 Options for Code Generation Conventions
- 3.17 GCC Developer Options
-
3.18 Machine-Dependent Options
- 3.18.1 AArch64 Options
- 3.18.2 Adapteva Epiphany Options
- 3.18.3 AMD GCN Options
- 3.18.4 ARC Options
- 3.18.5 ARM Options
- 3.18.6 AVR Options
- 3.18.7 Blackfin Options
- 3.18.8 C6X Options
- 3.18.9 CRIS Options
- 3.18.10 CR16 Options
- 3.18.11 C-SKY Options
- 3.18.12 Darwin Options
- 3.18.13 DEC Alpha Options
- 3.18.14 FR30 Options
- 3.18.15 FT32 Options
- 3.18.16 FRV Options
- 3.18.17 GNU/Linux Options
- 3.18.18 H8/300 Options
- 3.18.19 HPPA Options
- 3.18.20 IA-64 Options
- 3.18.21 LM32 Options
- 3.18.22 M32C Options
- 3.18.23 M32R/D Options
- 3.18.24 M680x0 Options
- 3.18.25 MCore Options
- 3.18.26 MeP Options
- 3.18.27 MicroBlaze Options
- 3.18.28 MIPS Options
- 3.18.29 MMIX Options
- 3.18.30 MN10300 Options
- 3.18.31 Moxie Options
- 3.18.32 MSP430 Options
- 3.18.33 NDS32 Options
- 3.18.34 Nios II Options
- 3.18.35 Nvidia PTX Options
- 3.18.36 OpenRISC Options
- 3.18.37 PDP-11 Options
- 3.18.38 picoChip Options
- 3.18.39 PowerPC Options
- 3.18.40 RISC-V Options
- 3.18.41 RL78 Options
- 3.18.42 IBM RS/6000 and PowerPC Options
- 3.18.43 RX Options
- 3.18.44 S/390 and zSeries Options
- 3.18.45 Score Options
- 3.18.46 SH Options
- 3.18.47 Solaris 2 Options
- 3.18.48 SPARC Options
- 3.18.49 SPU Options
- 3.18.50 Options for System V
- 3.18.51 TILE-Gx Options
- 3.18.52 TILEPro Options
- 3.18.53 V850 Options
- 3.18.54 VAX Options
- 3.18.55 Visium Options
- 3.18.56 VMS Options
- 3.18.57 VxWorks Options
- 3.18.58 x86 Options
- 3.18.59 x86 Windows Options
- 3.18.60 Xstormy16 Options
- 3.18.61 Xtensa Options
- 3.18.62 zSeries Options
- 3.19 Specifying Subprocesses and the Switches to Pass to Them
- 3.20 Environment Variables Affecting GCC
- 3.21 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 Nonlocal Gotos
- 6.6 Constructing Function Calls
- 6.7 Referring to a Type with
typeof
- 6.8 Conditionals with Omitted Operands
- 6.9 128-bit Integers
- 6.10 Double-Word Integers
- 6.11 Complex Numbers
- 6.12 Additional Floating Types
- 6.13 Half-Precision Floating Point
- 6.14 Decimal Floating Types
- 6.15 Hex Floats
- 6.16 Fixed-Point Types
- 6.17 Named Address Spaces
- 6.18 Arrays of Length Zero
- 6.19 Structures with No Members
- 6.20 Arrays of Variable Length
- 6.21 Macros with a Variable Number of Arguments.
- 6.22 Slightly Looser Rules for Escaped Newlines
- 6.23 Non-Lvalue Arrays May Have Subscripts
- 6.24 Arithmetic on
void
- and Function-Pointers - 6.25 Pointer Arguments in Variadic Functions
- 6.26 Pointers to Arrays with Qualifiers Work as Expected
- 6.27 Non-Constant Initializers
- 6.28 Compound Literals
- 6.29 Designated Initializers
- 6.30 Case Ranges
- 6.31 Cast to a Union Type
- 6.32 Mixed Declarations and Code
-
6.33 Declaring Attributes of Functions
- 6.33.1 Common Function Attributes
- 6.33.2 AArch64 Function Attributes
- 6.33.3 AMD GCN Function Attributes
- 6.33.4 ARC Function Attributes
- 6.33.5 ARM Function Attributes
- 6.33.6 AVR Function Attributes
- 6.33.7 Blackfin Function Attributes
- 6.33.8 CR16 Function Attributes
- 6.33.9 C-SKY Function Attributes
- 6.33.10 Epiphany Function Attributes
- 6.33.11 H8/300 Function Attributes
- 6.33.12 IA-64 Function Attributes
- 6.33.13 M32C Function Attributes
- 6.33.14 M32R/D Function Attributes
- 6.33.15 m68k Function Attributes
- 6.33.16 MCORE Function Attributes
- 6.33.17 MeP Function Attributes
- 6.33.18 MicroBlaze Function Attributes
- 6.33.19 Microsoft Windows Function Attributes
- 6.33.20 MIPS Function Attributes
- 6.33.21 MSP430 Function Attributes
- 6.33.22 NDS32 Function Attributes
- 6.33.23 Nios II Function Attributes
- 6.33.24 Nvidia PTX Function Attributes
- 6.33.25 PowerPC Function Attributes
- 6.33.26 RISC-V Function Attributes
- 6.33.27 RL78 Function Attributes
- 6.33.28 RX Function Attributes
- 6.33.29 S/390 Function Attributes
- 6.33.30 SH Function Attributes
- 6.33.31 SPU Function Attributes
- 6.33.32 Symbian OS Function Attributes
- 6.33.33 V850 Function Attributes
- 6.33.34 Visium Function Attributes
- 6.33.35 x86 Function Attributes
- 6.33.36 Xstormy16 Function Attributes
-
6.34 Specifying Attributes of Variables
- 6.34.1 Common Variable Attributes
- 6.34.2 ARC Variable Attributes
- 6.34.3 AVR Variable Attributes
- 6.34.4 Blackfin Variable Attributes
- 6.34.5 H8/300 Variable Attributes
- 6.34.6 IA-64 Variable Attributes
- 6.34.7 M32R/D Variable Attributes
- 6.34.8 MeP Variable Attributes
- 6.34.9 Microsoft Windows Variable Attributes
- 6.34.10 MSP430 Variable Attributes
- 6.34.11 Nvidia PTX Variable Attributes
- 6.34.12 PowerPC Variable Attributes
- 6.34.13 RL78 Variable Attributes
- 6.34.14 SPU Variable Attributes
- 6.34.15 V850 Variable Attributes
- 6.34.16 x86 Variable Attributes
- 6.34.17 Xstormy16 Variable Attributes
- 6.35 Specifying Attributes of Types
- 6.36 Label Attributes
- 6.37 Enumerator Attributes
- 6.38 Statement Attributes
- 6.39 Attribute Syntax
- 6.40 Prototypes and Old-Style Function Definitions
- 6.41 C++ Style Comments
- 6.42 Dollar Signs in Identifier Names
- 6.43 The Character ESC in Constants
- 6.44 Determining the Alignment of Functions, Types or Variables
- 6.45 An Inline Function is As Fast As a Macro
- 6.46 When is a Volatile Object Accessed?
- 6.47 How to Use Inline Assembly Language in C Code
- 6.48 Alternate Keywords
- 6.49 Incomplete
enum
Types - 6.50 Function Names as Strings
- 6.51 Getting the Return or Frame Address of a Function
- 6.52 Using Vector Instructions through Built-in Functions
- 6.53 Support for
offsetof
- 6.54 Legacy
__sync
Built-in Functions for Atomic Memory Access - 6.55 Built-in Functions for Memory Model Aware Atomic Operations
- 6.56 Built-in Functions to Perform Arithmetic with Overflow Checking
- 6.57 x86-Specific Memory Model Extensions for Transactional Memory
- 6.58 Object Size Checking Built-in Functions
- 6.59 Other Built-in Functions Provided by GCC
-
6.60 Built-in Functions Specific to Particular Target Machines
- 6.60.1 AArch64 Built-in Functions
- 6.60.2 Alpha Built-in Functions
- 6.60.3 Altera Nios II Built-in Functions
- 6.60.4 ARC Built-in Functions
- 6.60.5 ARC SIMD Built-in Functions
- 6.60.6 ARM iWMMXt Built-in Functions
- 6.60.7 ARM C Language Extensions (ACLE)
- 6.60.8 ARM Floating Point Status and Control Intrinsics
- 6.60.9 ARM ARMv8-M Security Extensions
- 6.60.10 AVR Built-in Functions
- 6.60.11 Blackfin Built-in Functions
- 6.60.12 FR-V Built-in Functions
- 6.60.13 MIPS DSP Built-in Functions
- 6.60.14 MIPS Paired-Single Support
- 6.60.15 MIPS Loongson Built-in Functions
- 6.60.16 MIPS SIMD Architecture (MSA) Support
- 6.60.17 Other MIPS Built-in Functions
- 6.60.18 MSP430 Built-in Functions
- 6.60.19 NDS32 Built-in Functions
- 6.60.20 picoChip Built-in Functions
-
6.60.21 Basic PowerPC Built-in Functions
- 6.60.21.1 Basic PowerPC Built-in Functions Available on all Configurations
- 6.60.21.2 Basic PowerPC Built-in Functions Available on ISA 2.05
- 6.60.21.3 Basic PowerPC Built-in Functions Available on ISA 2.06
- 6.60.21.4 Basic PowerPC Built-in Functions Available on ISA 2.07
- 6.60.21.5 Basic PowerPC Built-in Functions Available on ISA 3.0
- 6.60.22 PowerPC AltiVec/VSX Built-in Functions
- 6.60.23 PowerPC Hardware Transactional Memory Built-in Functions
- 6.60.24 PowerPC Atomic Memory Operation Functions
- 6.60.25 RX Built-in Functions
- 6.60.26 S/390 System z Built-in Functions
- 6.60.27 SH Built-in Functions
- 6.60.28 SPARC VIS Built-in Functions
- 6.60.29 SPU Built-in Functions
- 6.60.30 TI C6X Built-in Functions
- 6.60.31 TILE-Gx Built-in Functions
- 6.60.32 TILEPro Built-in Functions
- 6.60.33 x86 Built-in Functions
- 6.60.34 x86 Transactional Memory Intrinsics
- 6.60.35 x86 Control-Flow Protection Intrinsics
- 6.61 Format Checks Specific to Particular Target Machines
-
6.62 Pragmas Accepted by GCC
- 6.62.1 AArch64 Pragmas
- 6.62.2 ARM Pragmas
- 6.62.3 M32C Pragmas
- 6.62.4 MeP Pragmas
- 6.62.5 RS/6000 and PowerPC Pragmas
- 6.62.6 S/390 Pragmas
- 6.62.7 Darwin Pragmas
- 6.62.8 Solaris Pragmas
- 6.62.9 Symbol-Renaming Pragmas
- 6.62.10 Structure-Layout Pragmas
- 6.62.11 Weak Pragmas
- 6.62.12 Diagnostic Pragmas
- 6.62.13 Visibility Pragmas
- 6.62.14 Push/Pop Macro Pragmas
- 6.62.15 Function Specific Option Pragmas
- 6.62.16 Loop-Specific Pragmas
- 6.63 Unnamed Structure and Union Fields
- 6.64 Thread-Local Storage
- 6.65 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 C++ Interface and Implementation Pragmas
- 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 Type Traits
- 7.10 C++ Concepts
- 7.11 Deprecated Features
- 7.12 Backwards Compatibility
- 8 GNU Objective-C Features
- 9 Binary Compatibility
-
10
gcov
—a Test Coverage Program -
11
gcov-tool
—an Offline Gcda Profile Processing Tool -
12
gcov-dump
—an Offline Gcda and Gcno Profile Dump Tool -
13 Known Causes of Trouble with GCC
- 13.1 Actual Bugs We Haven’t Fixed Yet
- 13.2 Interoperation
- 13.3 Incompatibilities of GCC
- 13.4 Fixed Header Files
- 13.5 Standard Libraries
- 13.6 Disappointments and Misunderstandings
- 13.7 Common Misunderstandings with GNU C++
- 13.8 Certain Changes We Don’t Want to Make
- 13.9 Warning Messages and Error Messages
- 14 Reporting Bugs
- 15 How To Get Help with GCC
- 16 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 9.3.0. 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 in GNU Compiler Collection (GCC) Internals.
• G++ and GCC: | You can compile C or C++ programs. | |
• Standards: | Language standards supported by GCC. | |
• Invoking GCC: | Command options supported by ‘gcc’. | |
• C Implementation: | How GCC implements the ISO C specification. | |
• C++ Implementation: | How GCC implements the ISO C++ specification. | |
• C Extensions: | GNU extensions to the C language family. | |
• C++ Extensions: | GNU extensions to the C++ language. | |
• Objective-C: | GNU Objective-C runtime features. | |
• Compatibility: | Binary Compatibility | |
• Gcov: |
gcov —a test coverage program. |
|
• Gcov-tool: |
gcov-tool —an offline gcda profile processing program. |
|
• Gcov-dump: |
gcov-dump —an offline gcda and gcno profile dump tool. |
|
• Trouble: | If you have trouble using GCC. | |
• Bugs: | How, why and where to report bugs. | |
• Service: | How To Get Help with GCC | |
• Contributing: | How to contribute to testing and developing GCC. | |
• Funding: | How to help assure funding for free software. | |
• GNU Project: | The GNU Project and GNU/Linux. | |
• Copying: | GNU General Public License says how you can copy and share GCC. | |
• GNU Free Documentation License: | How you can copy and share this manual. | |
• Contributors: | People who have contributed to GCC. | |
• Option Index: | Index to command line options. | |
• Keyword Index: | Index of concepts and symbol names. |
Next: G++ and GCC [Contents][Index]
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/index.html