-b <machine> and
-V <version> have been removed because
they were unreliable. Instead, users should directly run
<machine>-gcc when cross-compiling, or
<machine>-gcc-<version>
to run a different version of gcc. gcc was called to link object
files rather than compile source code, it would previously accept
and ignore all options starting with --, including
linker options such as --as-needed
and --export-dynamic, although such options would
result in errors if any source code was compiled. Such options,
if unknown to the compiler, are now rejected in all cases; if the
intent was to pass them to the linker, options such
as -Wl,--as-needed should be used.cproj function. GCC
optimizes its builtin cproj according to the behavior
specified and allowed by the ISO C99 standard. If you want to
avoid discrepancies between the C library and GCC's builtin
transformations when using cproj in your code, use
GLIBC 2.12 or later. If you are using an older GLIBC and actually
rely on the incorrect behavior of cproj, then you can disable
GCC's transformations using -fno-builtin-cproj. -combine) has been removed in favor of the new
generic link-time optimization framework (LTO) introduced
in GCC 4.5.0.libquadmath library, which provides quad-precision
mathematical functions for targets with a __float128
datatype. __float128 is available for targets on
32-bit x86, x86-64 and Itanium architectures. The
libquadmath library is automatically built on
such targets when building the Fortran compiler.-Wunused-but-set-variable and
-Wunused-but-set-parameter warnings were added
for C, C++, Objective-C and Objective-C++.
These warnings diagnose variables respective parameters which
are only set in the code and never otherwise used.
Usually such variables are useless and often even the value
assigned to them is computed needlessly, sometimes expensively.
The -Wunused-but-set-variable warning is enabled by
default by -Wall flag and -Wunused-but-set-parameter
by -Wall -Wextra flags.Support for a number of older systems and recently unmaintained or untested target ports of GCC has been declared obsolete in GCC 4.6. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
All GCC ports for the following processor architectures have been declared obsolete:
arc-*)crx-*)m68hc11-*-*, m6811-*-*,
m68hc12-*-*, m6812-*-*)score-*)The following ports for individual systems on particular architectures have been obsoleted:
i[34567]86-*-interix3*)arm-*-pe* other
than arm*-wince-pe*)mcore-*-pe*)sh*-*-symbianelf*)alpha*-*-gnu*, powerpc*-*-gnu*)m68k-*-uclinuxoldabi*)arm*-*-netbsd*, i[34567]86-*-netbsd*,
vax-*-netbsd*, but
not *-*-netbsdelf*)The i[34567]86-*-pe alias for Cygwin targets has
also been obsoleted; users should configure
for i[34567]86-*-cygwin* instead.
Certain configure options to control the set of libraries built
with GCC on some targets have been obsoleted. On ARM targets, the
options --disable-fpu, --disable-26bit,
--disable-underscore, --disable-interwork,
--disable-biendian and --disable-nofmult
have been obsoleted. On MIPS targets, the options
--disable-single-float, --disable-biendian
and --disable-softfloat have been obsoleted.
-Ofast, has been
introduced. It combines the existing optimization level -O3
with options that can affect standards compliance but result in
better optimized code. For example, -Ofast enables
-ffast-math.-flto=n (where
n specifies the number of compilations to execute in
parallel). GCC can also cooperate with a GNU make job server
by specifying the -flto=jobserver option and
adding + to the beginning of the
Makefile rule executing the linker.-flto-partition=none. This may result in small code
quality improvements.-fuse-linker-plugin command line option.hidden visibility
attribute. Consequently the use
of -fwhole-program is not neccesary in addition to
LTO.externally_visible when
the linker plugin is not used.iostream header.const and pure
functions. Newly, noreturn functions are auto-detected.
The -Wsuggest-attribute=[const|pure|noreturn]
flag is available that informs users when adding
attributes to headers might improve code generation.
-O2 and greater. The feature can be
controlled via -fpartial-inlining.
Partial inlining splits functions with short hot path to return. This allows more aggressive inlining of the hot path leading to better performance and often to code size reductions (because cold parts of functions are not duplicated).
-Os) was improved to better handle C++
programs with larger abstraction penalty, leading
to smaller and faster code.main), functions
used only at exit and functions detected to be cold are placed into
separate text segment subsections.
This extends the -freorder-functions feature and is
controlled by the same switch. The goal is to improve the startup
time of large C++ programs.
Proper function placement requires linker support. GNU ld 2.21.51 on ELF targets was updated to place those functions together within the text section leading to better code locality and faster startup times of large C++ programs. The feature is also supported in the Apple linker. Support in the gold linker is planned.
-fstack-usage has been added. It makes
the compiler output stack usage information for the program, on a
per-function basis, in an auxiliary file.-fcombine-stack-adjustments has been added.
It can be used to enable or disable the compiler's stack-slot combining
pass which before was enabled automatically at -O1 and above,
but could not be controlled on its own.-fstrict-volatile-bitfields has been
added. Using it indicates that accesses to volatile bitfields
should use a single access of the width of the field's type.
This option can be useful for precisely defining and accessing
memory-mapped peripheral registers from C or C++.-Wdouble-promotion,
has been added that warns about cases where a value of type
float is implicitly promoted to double.
This is especially helpful for CPUs that handle the former in
hardware, but emulate the latter in software.leaf was introduced.
This attribute allows better inter-procedural optimization across
calls to functions that return to the current unit only via returning
or exception handling. This is the case for most library functions
that have no callbacks.__int128 for targets having
wide enough machine-mode support.callee_pop_aggregate allows
to specify if the caller or callee is responsible for popping the
aggregate return pointer value from the stack.#pragma GCC diagnostic has been added. For instance:
#pragma GCC diagnostic error "-Wuninitialized" foo(a); /* error is given for this one */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" foo(b); /* no diagnostic for this one */ #pragma GCC diagnostic pop foo(c); /* error is given for this one */ #pragma GCC diagnostic pop foo(d); /* depends on command line options */
-fmax-errors=N option is now supported. Using
this option causes the compiler to exit after N errors
have been issued.-std=c1x, or -std=gnu1x
for C1X with GNU extensions. Note that this support is
experimental and may change incompatibly in future releases for
consistency with changes to the C1X standard draft. The following
features are newly supported as described in the N1539 draft of
C1X (with changes agreed at the March 2011 WG14 meeting); some
other features were already supported with no compiler
changes being needed, or have some support but not in full accord
with N1539 (as amended).
_Static_assert keyword)<float.h>-fplan9-extensions option directs the
compiler to support some extensions for anonymous struct fields
which are implemented by the Plan 9 compiler. A pointer to a
struct may be automatically converted to a pointer to an
anonymous field when calling a function, in order to make the
types match. An anonymous struct field whose type is a typedef
name may be referred to using the typedef name.constexpr (thanks to Gabriel Dos Reis and Jason Merrill),
nullptr (thanks to Magnus Fromreide), noexcept,
unrestricted unions, range-based for loops (thanks to Rodrigo Rivas Costa),
opaque enum declarations (thanks also to Rodrigo), implicitly deleted
functions and implicit move constructors.-Wno-int-to-pointer-cast, which is now also available
in C++.-fstrict-enums.-fnothrow-opt flag changes the semantics of
a throw() exception specification to match the proposed
semantics of the noexcept specification: just call
terminate if an exception tries to propagate out of a
function with such an exception specification. This dramatically
reduces or eliminates the code size overhead from adding the exception
specification.-Wnoexcept flag will suggest adding
a noexcept qualifier to a function that the compiler can
tell doesn't throw if it would change the value of
a noexcept expression.-Wshadow option now warns if a local variable or
type declaration shadows another type in C++. Note that the compiler will
not warn if a local variable shadows a struct/class/enum, but will warn
if it shadows an explicit typedef. class, struct,
and union definitions.mutable on reference members
(c++/33558).
Use -fpermissive to allow the old, non-conforming behaviour.
-fabi-version=5 or -fabi-version=0.
-Wabi will now warn about code that uses the old
mangling.
struct A { A(); };
struct B : A { };
const B b = B();
Use -fpermissive to allow the old, non-conforming behaviour.
constexpr and
nullptr. cstddef header as an implementation detail. Code that
relied on that header being included as side-effect of including other
standard headers will need to include cstddef explicitly.libquadmath library, GNU Fortran
now also supports a quad-precision, kind=16 floating-point
data type (REAL(16), COMPLEX(16)). As the data
type is not fully supported in hardware, calculations might be one to
two orders of magnitude slower than with the 4, 8 or 10 bytes
floating-point data types. This change does not affect systems which
support REAL(16) in hardware nor those which do not support
libquadmath.-fwhole-file.-fwhole-file flag is now enabled by default. This
improves code generation and diagnostics. It can be
disabled using the deprecated -fno-whole-file flag.-M... flags of GCC; you may need to specify the
-cpp option in addition. The dependencies take
modules, Fortran's include, and CPP's #include
into account. Note: Using -M for the module path is no
longer supported, use -J instead.-Wconversion has been modified to only issue
warnings where a conversion leads to information loss. This drastically
reduces the number of warnings; -Wconversion is thus now
enabled with -Wall. The flag -Wconversion-extra
has been added and also warns about other conversions;
-Wconversion-extra typically issues a huge number of
warnings, most of which can be ignored.-Wunused-dummy-argument warns
about unused dummy arguments and is included in -Wall.
Before, -Wunused-variable also warned about unused dummy
arguments.ASSOCIATE construct.a(:) = ... instead of a = ...
for arrays and character strings – or disable the feature using
-std=f95 or -fno-realloc-lhs.num_images() ==
1); use the
-fcoarray=single flag to enable it.STOP and the new ERROR STOP
statements now support all constant expressions.CONTIGUOUS attribute.ALLOCATE with MOLD.STORAGE_SIZE intrinsic inquiry
function.NORM2 and PARITY
intrinsic functions.POPCNT
and POPPAR for counting the number of 1 bits and
returning the parity; BGE, BGT,
BLE, and BLT for bitwise comparisons;
DSHIFTL and DSHIFTR for combined left
and right shifts, MASKL and MASKR for
simple left and right justified masks, MERGE_BITS
for a bitwise merge using a mask, SHIFTA,
SHIFTL and SHIFTR for shift operations,
and the transformational bit intrinsics IALL,
IANY and IPARITY.EXECUTE_COMMAND_LINE intrinsic
subroutine.IMPURE attribute for procedures,
which allows for ELEMENTAL procedures without the
restrictions of PURE.NULL()) and not
allocated variables can be used as actual argument to optional
non-pointer, non-allocatable dummy arguments, denoting an absent
argument.TARGET attribute can
be used as actual argument to POINTER dummies with
INTENT(IN)NULL.EXIT statement (with construct-name) can
now be used to leave not only the DO but also the
ASSOCIATE, BLOCK, IF,
SELECT CASE and SELECT TYPE constructs.INTEGER_KINDS,
LOGICAL_KINDS, REAL_KINDS and
CHARACTER_KINDS of the intrinsic module
ISO_FORTRAN_ENV have been added; these arrays contain
the supported kind values for the respective types.C_SIZEOF of the intrinsic
module ISO_C_BINDINGS and COMPILER_VERSION
and COMPILER_OPTIONS of ISO_FORTRAN_ENV
have been implemented.ENTRY
was added for -std=f2008;
a line may start with a semicolon;
for internal and module procedures END can be used
instead of END SUBROUTINE and END
FUNCTION; SELECTED_REAL_KIND now also takes a
RADIX argument; intrinsic types are supported for
TYPE(intrinsic-type-spec); multiple type-bound
procedures can be declared in a single PROCEDURE
statement; implied-shape arrays are supported for named constants
(PARAMETER). The transformational, three argument
versions of BESSEL_JN and BESSEL_YN
were added – the elemental, two-argument version had been
added in GCC 4.4; note that the transformational functions use
a recurrence algorithm.Support for the Go programming
language has been added to GCC. It is not enabled by default
when you build GCC; use the --enable-languages
configure option to build it. The driver program for compiling Go
code is gccgo.
Go is currently known to work on GNU/Linux and RTEMS. Solaris support is in progress. It may or may not work on other platforms.
-fobjc-exceptions flag is now required to
enable Objective-C exception and synchronization syntax
(introduced by the keywords @try,
@catch, @finally and
@synchronized).-fobjc-std=objc1
command-line option.object.count is automatically converted into
[object count] or [object setCount: ...]
depending on context; for example if (object.count >
0) is automatically compiled into the equivalent of
if ([object count] > 0) while object.count =
0; is automatically compiled into the equivalent ot
[object setCount: 0];. The dot-syntax can be used
with instance and class objects and with any setters or getters,
no matter if they are part of a declared property or not.@property keyword, and are
most commonly used in conjunction with the new Objective-C 2.0
dot-syntax. The nonatomic, readonly,
readwrite, assign, retain,
copy, setter and getter
attributes are all supported. Marking declared properties with
__attribute__ ((deprecated)) is supported too.@synthesize and
@dynamic keywords are supported.
@synthesize causes the compiler to automatically
synthesize a declared property, while @dynamic is
used to disable all warnings for a declared property for which no
implementation is provided at compile time. Synthesizing declared
properties requires runtime support in most useful cases; to be
able to use it with the GNU runtime, appropriate helper functions
have been added to the GNU Objective-C runtime ABI, and are
implemented by the GNU Objective-C runtime library shipped with
GCC.@optional keyword is
supported. It allows you to mark methods or properties in a
protocol as optional as opposed to required.@package keyword is
supported. It has currently the same effect as the
@public keyword.deprecated,
sentinel, noreturn and
format.unused, to mark an
argument as unused in the implementation.deprecated.__GNU_LIBOBJC__ (with a value that is increased at
every release where there is any change to the API) in
objc/objc.h, making it easy to determine if the GNU
Objective-C runtime library is being used, and if so, which
version. Previous versions of the GNU Objective-C runtime library
(and other Objective-C runtime libraries such as the Apple one) do
not define this macro.objc/objc-api.h header file automatically selects the
old API, while including the new objc/runtime.h
header file automatically selects the new API. Support for the
old API is being phased out and upgrading the software to use the
new API is strongly recommended. To check for the availability of
the new API, the __GNU_LIBOBJC__ macro can be used as
older versions of the GNU Objective-C runtime library, which do
not support the new API, do not define such a macro.@synchronized has been added.-mcpu=cortex-m4.__sync_fetch_and_add
and friends are now inlined for supported architectures
rather than calling into a kernel helper function.-O3.-mcpu=
option.-mcpu=cortex-a15.-fstrict-volatile-bitfields by
default.-fsplit-stack option permits programs to
use a discontiguous stack. This is useful for threaded
programs, in that it is no longer necessary to specify the
maximum stack size when creating a thread. This feature is
currently only implemented for 32-bit and 64-bit x86 GNU/Linux
targets.
-mfentry.-march=core2 and -mtune=core2
options.-march=corei7 and -mtune=corei7
options.-march=corei7-avx and
-mtune=corei7-avx options.-march=btver1 and -mtune=btver1
options.-fomit-frame-pointer. The default can be reverted
to -fno-omit-frame-pointer by configuring GCC with
the --enable-frame-pointer configure option.__float128 on 32-bit and 64-bit x86 targets.--with-fpmath=avx option.-O3 when optimizing for CPUs where prefetching
is beneficial (AMD CPUs newer than K6).-mtbm.-mbmi.-march= and -mtune= name is
loongson3a.
"A" has
been renamed "c". This constraint is used to
select a floating-point register that can be used as the
destination of a multiply-accumulate instruction.
"A" and
"D" have been added. These constraint letters
resolve to all general registers when compiling for AM33, and
resolve to address registers only or data registers only when
compiling for MN10300.
MDR register is represented in the compiler.
One can access the register via the "z" constraint
in inline assembly. It can be marked as clobbered or used as
a local register variable via the "mdr" name.
The compiler uses the RETF instruction if the
function does not modify the MDR register, so it
is important that inline assembly properly annotate any usage
of the register.
-mcpu=titan.-mrecip option has been added, which indicates
whether the reciprocal and reciprocal square root instructions
should be used.-mveclibabi=mass option can be used to enable
the compiler to autovectorize mathematical functions using the
Mathematical Acceleration Subsystem library.-msingle-pic-base option has been added, which
instructs the compiler to avoid loading the PIC base register in
function prologues. The PIC base register must be initialized by
the runtime system.-mblock-move-inline-limit option has been
added, which enables the user to control the maximum size of
inlined memcpy calls and similar.-mcmodel=MODEL, controls this feature; valid values
for MODEL
are small, medium,
or large.vec_ld and vec_st
have been modified to generate the Altivec memory instructions
LVX and STVX, even if the -mvsx
option is used. In the initial GCC 4.5 release, these builtin functions
were changed to generate VSX memory reference instructions instead of
Altivec memory instructions, but there are differences between the two
instructions. If the VSX instruction set is available, you can now use
the new builtin functions vec_vsx_ld and vec_vsx_st
which always generates the VSX memory instructions.-march=z196 option, the compiler
will generate code making use of the following instruction
facilities:
-mtune=z196 option avoids the compare and
branch instructions as well as the load address instruction
with an index register as much as possible and performs
instruction scheduling appropriate for the new out-of-order
pipeline architecture.-m31 -mzarch options the generated
code still conforms to the 32-bit ABI but uses the general
purpose registers as 64-bit registers internally. This
requires a Linux kernel saving the whole 64-bit registers when
doing a context switch. Kernels providing that feature
indicate that by the 'highgprs' string
in /proc/cpuinfo.-O3.--with-tune=leon configure option and
-mtune=leon compilation option, or the compiler can
be built for the sparc-leon-{elf,linux} and
sparc-leon3-{elf,linux} targets directly.-mandroid and
-mbionic options for details on building native code.
At the moment, Android support is enabled only for ARM.CFString types has been
added.CFString "toll-free bridged" as per the Mac
OS X system tools. CFString is also recognized in the
context of format attributes and arguments (see the
documentation for format attributes for limitations).
At present, 8-bit character types are supported..zerofill sections. For non-debug code, this can
reduce object file size significantly.-mdynamic-no-pic option has been
enabled.-mdynamic-no-pic
optimization has been added and is applicable to -m32
builds. The compiler bootstrap uses the option where
appropriate.-mtune= has been
changed.-mtune=core2.-m64
enabled.-fsection-anchors option is now available
although, presently, not heavily tested.-march=pentium4 (Solaris
10+) resp. -march=pentiumpro (Solaris 8/9).__float128) support on
Solaris 2/x86.__m64 in MMX registers on Solaris 10+/x86 to match the
Sun Studio 12.1+ compilers. This is an incompatible change.
If you use such types, you must either recompile all your code with
the new compiler or use the new -mvect8-ret-in-mem
option to remain compatible with previous versions of GCC and
Sun Studio.__thiscall calling-convention.ms_hook_prologue attribute for x86_64 in addition to 32-bit x86.#pragma push_macro("macro-name") the
current definition of macro-name is saved and can be
restored with #pragma pop_macro("macro-name")
to its saved definition.__float128) support on
MinGW and Cygwin.install-strip make target is provided
that installs stripped executables, and may install libraries with
unneeded or debugging sections stripped.
vec_ld and vec_st builtin functions
generate Altivec memory instructions instead of VSX memory instructions,
then you should be able to build the compiler with VSX instruction
generation.
Note: these changes concern developers that develop GCC itself or software that integrates with GCC, such as plugins, and not the general GCC users.
gengtype utility, which previously was internal to
the GCC build process, has been enchanced to provide GC root
information for plugins as necessary.
ggc_alloc and
friends was replaced with a type-safe alternative.
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
These pages are maintained by the GCC team.
For questions related to the use of GCC, please consult these web pages and the GCC manuals. If that fails, the gcc-help@gcc.gnu.org mailing list might help.Copyright (C) Free Software Foundation, Inc.
Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.
| Last modified 2011-03-22 |
|