Using the GNU Compiler Collection
For gcc version 4.2.3
Richard M. Stallman and the GC C Developer Community
Published by:
GNU Press Website: www.gnupress.org
a division of the General: press@gnu.org
Free Software Foundation Orders: sales@gnu.org
51 Franklin Street, Fifth Floor Tel 617-542-5942
Boston, MA 02110-1301 USA Fax 617-542-2652
Last printed October 2003 for GCC 3.3.1.
Printed copies are available for $45 each.
Copyright
c
1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005 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.2 or any later version published by the
Free Software Foundation; with the Invariant Sections being “GNU General Public License”
and “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 c opy and modify this GNU Manual, like GNU software. Copies
published by the Free Software Foundation raise funds for GNU development.
i
Short Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 Programming Languages Supported by GCC . . . . . . . . . . . . 3
2 Language Standards Supported by GCC . . . . . . . . . . . . . . . 5
3 GCC Command Options . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 C Implementation-defined behavior . . . . . . . . . . . . . . . . . 213
5 Extensions to the C Language Family . . . . . . . . . . . . . . . . 221
6 Extensions to the C++ Language . . . . . . . . . . . . . . . . . . 375
7 GNU Objective-C runtime features . . . . . . . . . . . . . . . . . . 385
8 Binary Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
9 gcov—a Test Coverage Program . . . . . . . . . . . . . . . . . . . 395
10 Known C auses of Trouble with GCC . . . . . . . . . . . . . . . . 403
11 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
12 How To Get Help with GCC . . . . . . . . . . . . . . . . . . . . . . 423
13 Contributing to GCC Development . . . . . . . . . . . . . . . . . 425
Funding Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
The GNU Project and GNU/Linux. . . . . . . . . . . . . . . . . . . . . 429
GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . . 431
GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . 437
Contributors to GCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Option I ndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Keyword Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
ii Using the GNU Compiler Collection (GCC)
iii
Table of Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 Programming Languages Supported by GCC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Language Standards Supported by GCC . . . . 5
3 GCC Command Options . . . . . . . . . . . . . . . . . . . 7
3.1 Option Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Options Controlling the Kind of Output . . . . . . . . . . . . . . . . . . . . . 18
3.3 Compiling C++ Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.4 Options Controlling C Dialect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5 Options Controlling C++ Dialect. . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.6 Options Controlling Objective-C and Objective-C++ Dialects. . 33
3.7 Options to Control Diagnostic Messages Formatting. . . . . . . . . . . 37
3.8 Options to Request or Suppress Warnings . . . . . . . . . . . . . . . . . . . . 38
3.9 Options for Debugging Your Program or GCC . . . . . . . . . . . . . . . . 56
3.10 Options That Control Optimization . . . . . . . . . . . . . . . . . . . . . . . . 68
3.11 Options Controlling the Preprocess or . . . . . . . . . . . . . . . . . . . . . . . 99
3.12 Passing Options to the Assembler . . . . . . . . . . . . . . . . . . . . . . . . . 109
3.13 Options for Linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
3.14 Options for Directory Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
3.15 Specifying subprocesses and the switches to pass to them. . . . 114
3.16 Specifying Target Machine and Compiler Version . . . . . . . . . . . 120
3.17 Hardware Models and Configurations . . . . . . . . . . . . . . . . . . . . . . 121
3.17.1 ARC Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
3.17.2 ARM Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
3.17.3 AVR Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
3.17.4 Blackfin Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
3.17.5 CRIS Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
3.17.6 CRX Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
3.17.7 Darwin Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
3.17.8 DEC Alpha Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
3.17.9 DEC Alpha/VMS Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
3.17.10 FRV Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
3.17.11 GNU/Linux Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
3.17.12 H8/300 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
3.17.13 HPPA Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
3.17.14 Intel 386 and AMD x86-64 Options . . . . . . . . . . . . . . . . . . 145
3.17.15 IA-64 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
3.17.16 M32C Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
3.17.17 M32R/D Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157