Using the GNU Compiler Collection (GCC)
This file documents the use of the GNU compilers.
Copyright © 1988-2021 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
lto-dump
—Tool for dumping LTO object files. - 14 Known Causes of Trouble with GCC
- 15 Reporting Bugs
- 16 How To Get Help with GCC
- 17 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 That Control Static Analysis
- 3.10 Options for Debugging Your Program
- 3.11 Options That Control Optimization
- 3.12 Program Instrumentation Options
- 3.13 Options Controlling the Preprocessor
- 3.14 Passing Options to the Assembler
- 3.15 Options for Linking
- 3.16 Options for Directory Search
- 3.17 Options for Code Generation Conventions
- 3.18 GCC Developer Options
-
3.19 Machine-Dependent Options
- 3.19.1 AArch64 Options
- 3.19.2 Adapteva Epiphany Options
- 3.19.3 AMD GCN Options
- 3.19.4 ARC Options
- 3.19.5 ARM Options
- 3.19.6 AVR Options
- 3.19.7 Blackfin Options
- 3.19.8 C6X Options
- 3.19.9 CRIS Options
- 3.19.10 CR16 Options
- 3.19.11 C-SKY Options
- 3.19.12 Darwin Options
- 3.19.13 DEC Alpha Options
- 3.19.14 eBPF Options
- 3.19.15 FR30 Options
- 3.19.16 FT32 Options
- 3.19.17 FRV Options
- 3.19.18 GNU/Linux Options
- 3.19.19 H8/300 Options
- 3.19.20 HPPA Options
- 3.19.21 IA-64 Options
- 3.19.22 LM32 Options
- 3.19.23 M32C Options
- 3.19.24 M32R/D Options
- 3.19.25 M680x0 Options
- 3.19.26 MCore Options
- 3.19.27 MeP Options
- 3.19.28 MicroBlaze Options
- 3.19.29 MIPS Options
- 3.19.30 MMIX Options
- 3.19.31 MN10300 Options
- 3.19.32 Moxie Options
- 3.19.33 MSP430 Options
- 3.19.34 NDS32 Options
- 3.19.35 Nios II Options
- 3.19.36 Nvidia PTX Options
- 3.19.37 OpenRISC Options
- 3.19.38 PDP-11 Options
- 3.19.39 picoChip Options
- 3.19.40 PowerPC Options
- 3.19.41 PRU Options
- 3.19.42 RISC-V Options
- 3.19.43 RL78 Options
- 3.19.44 IBM RS/6000 and PowerPC Options
- 3.19.45 RX Options
- 3.19.46 S/390 and zSeries Options
- 3.19.47 Score Options
- 3.19.48 SH Options
- 3.19.49 Solaris 2 Options
- 3.19.50 SPARC Options
- 3.19.51 Options for System V
- 3.19.52 TILE-Gx Options
- 3.19.53 TILEPro Options
- 3.19.54 V850 Options
- 3.19.55 VAX Options
- 3.19.56 Visium Options
- 3.19.57 VMS Options
- 3.19.58 VxWorks Options
- 3.19.59 x86 Options
- 3.19.60 x86 Windows Options
- 3.19.61 Xstormy16 Options
- 3.19.62 Xtensa Options
- 3.19.63 zSeries Options
- 3.20 Specifying Subprocesses and the Switches to Pass to Them
- 3.21 Environment Variables Affecting GCC
- 3.22 Using Precompiled Headers
- 3.23 C++ Modules
-
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, Labels 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 BPF Function Attributes
- 6.33.9 CR16 Function Attributes
- 6.33.10 C-SKY Function Attributes
- 6.33.11 Epiphany Function Attributes
- 6.33.12 H8/300 Function Attributes
- 6.33.13 IA-64 Function Attributes
- 6.33.14 M32C Function Attributes
- 6.33.15 M32R/D Function Attributes
- 6.33.16 m68k Function Attributes
- 6.33.17 MCORE Function Attributes
- 6.33.18 MeP Function Attributes
- 6.33.19 MicroBlaze Function Attributes
- 6.33.20 Microsoft Windows Function Attributes
- 6.33.21 MIPS Function Attributes
- 6.33.22 MSP430 Function Attributes
- 6.33.23 NDS32 Function Attributes
- 6.33.24 Nios II Function Attributes
- 6.33.25 Nvidia PTX Function Attributes
- 6.33.26 PowerPC Function Attributes
- 6.33.27 RISC-V Function Attributes
- 6.33.28 RL78 Function Attributes
- 6.33.29 RX Function Attributes
- 6.33.30 S/390 Function Attributes
- 6.33.31 SH 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 V850 Variable Attributes
- 6.34.15 x86 Variable Attributes
- 6.34.16 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 BPF Built-in Functions
- 6.60.13 FR-V Built-in Functions
- 6.60.14 MIPS DSP Built-in Functions
- 6.60.15 MIPS Paired-Single Support
- 6.60.16 MIPS Loongson Built-in Functions
- 6.60.17 MIPS SIMD Architecture (MSA) Support
- 6.60.18 Other MIPS Built-in Functions
- 6.60.19 MSP430 Built-in Functions
- 6.60.20 NDS32 Built-in Functions
- 6.60.21 picoChip Built-in Functions
-
6.60.22 Basic PowerPC Built-in Functions
- 6.60.22.1 Basic PowerPC Built-in Functions Available on all Configurations
- 6.60.22.2 Basic PowerPC Built-in Functions Available on ISA 2.05
- 6.60.22.3 Basic PowerPC Built-in Functions Available on ISA 2.06
- 6.60.22.4 Basic PowerPC Built-in Functions Available on ISA 2.07
- 6.60.22.5 Basic PowerPC Built-in Functions Available on ISA 3.0
- 6.60.22.6 Basic PowerPC Built-in Functions Available on ISA 3.1
-
6.60.23 PowerPC AltiVec/VSX Built-in Functions
- 6.60.23.1 PowerPC AltiVec Built-in Functions on ISA 2.05
- 6.60.23.2 PowerPC AltiVec Built-in Functions Available on ISA 2.06
- 6.60.23.3 PowerPC AltiVec Built-in Functions Available on ISA 2.07
- 6.60.23.4 PowerPC AltiVec Built-in Functions Available on ISA 3.0
- 6.60.23.5 PowerPC AltiVec Built-in Functions Available on ISA 3.1
- 6.60.24 PowerPC Hardware Transactional Memory Built-in Functions
- 6.60.25 PowerPC Atomic Memory Operation Functions
- 6.60.26 PowerPC Matrix-Multiply Assist Built-in Functions
- 6.60.27 PRU Built-in Functions
- 6.60.28 RISC-V Built-in Functions
- 6.60.29 RX Built-in Functions
- 6.60.30 S/390 System z Built-in Functions
- 6.60.31 SH Built-in Functions
- 6.60.32 SPARC VIS Built-in Functions
- 6.60.33 TI C6X Built-in Functions
- 6.60.34 TILE-Gx Built-in Functions
- 6.60.35 TILEPro Built-in Functions
- 6.60.36 x86 Built-in Functions
- 6.60.37 x86 Transactional Memory Intrinsics
- 6.60.38 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 PRU Pragmas
- 6.62.6 RS/6000 and PowerPC Pragmas
- 6.62.7 S/390 Pragmas
- 6.62.8 Darwin Pragmas
- 6.62.9 Solaris Pragmas
- 6.62.10 Symbol-Renaming Pragmas
- 6.62.11 Structure-Layout Pragmas
- 6.62.12 Weak Pragmas
- 6.62.13 Diagnostic Pragmas
- 6.62.14 Visibility Pragmas
- 6.62.15 Push/Pop Macro Pragmas
- 6.62.16 Function Specific Option Pragmas
- 6.62.17 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
lto-dump
—Tool for dumping LTO object files. -
14 Known Causes of Trouble with GCC
- 14.1 Actual Bugs We Haven’t Fixed Yet
- 14.2 Interoperation
- 14.3 Incompatibilities of GCC
- 14.4 Fixed Header Files
- 14.5 Standard Libraries
- 14.6 Disappointments and Misunderstandings
- 14.7 Common Misunderstandings with GNU C++
- 14.8 Certain Changes We Don’t Want to Make
- 14.9 Warning Messages and Error Messages
- 15 Reporting Bugs
- 16 How To Get Help with GCC
- 17 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 11.1.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. |
|
• lto-dump: |
lto-dump —Tool for dumping LTO object files. |
|
• 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-11.1.0/gcc/index.html