GCC 4.6 Release Series — Changes, New Features, and Fixes - GNU Project
- ️Fri Jan 31 2025
GCC 4.6 Release Series
Changes, New Features, and Fixes
Caveats
- The options
-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 ofgcc
. - GCC now has stricter checks for invalid command-line options.
In particular, when
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. - Versions of the GNU C library up to and including 2.11.1
included an incorrect
implementation of the
cproj
function. GCC optimizes its builtincproj
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 usingcproj
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
. - The C-only intermodule optimization framework (IMA, enabled by
-combine
) has been removed in favor of the new generic link-time optimization framework (LTO) introduced in GCC 4.5.0. - GCC now ships with the LGPL-licensed
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. Thelibquadmath
library is automatically built on such targets when building the Fortran compiler. - New
-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. - On ARM, a bug has been fixed in GCC's implementation of the AAPCS rules for the layout of vectors that could lead to wrong code being generated. Vectors larger than 8 bytes in size are now by default aligned to an 8-byte boundary. This is an ABI change: code that makes explicit use of vector types may be incompatible with binary objects built with older versions of GCC. Auto-vectorized code is not affected by this change. (This change affects GCC versions 4.6.4 and later, with the exception of versions 4.7.0 and 4.7.1.)
- On AVR, variables with the
progmem
attribute to locate data in flash memory must be qualified asconst
. 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:
- Argonaut ARC (
arc-*
) - National Semiconductor CRX (
crx-*
) - Motorola 68HC11 and 68HC12
(
m68hc11-*-*
,m6811-*-*
,m68hc12-*-*
,m6812-*-*
) - Sunplus S+core (
score-*
)
The following ports for individual systems on particular architectures have been obsoleted:
- Interix (
i[34567]86-*-interix3*
) - NetWare x86 (
i[3456x]86-*-netware*
) - Generic ARM PE (
arm-*-pe*
other thanarm*-wince-pe*
) - MCore PE (
mcore-*-pe*
) - SH SymbianOS (
sh*-*-symbianelf*
) - GNU Hurd on Alpha and PowerPC
(
alpha*-*-gnu*
,powerpc*-*-gnu*
) - M68K uClinux old ABI
(
m68k-*-uclinuxoldabi*
) - a.out NetBSD
(
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 fori[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.- Argonaut ARC (
- Support has been removed for all the configurations obsoleted in GCC 4.5.
- More information on porting to GCC 4.6 from previous versions of GCC can be found in the porting guide for this release.
General Optimizer Improvements
- A new general optimization level,
-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
. - Link-time optimization improvements:
- The Scalable Whole
Program Optimizer (WHOPR) project has stabilized to the
point of being usable. It has become the default mode when
using the LTO optimization model. Link time optimization can
now split itself into multiple parallel compilations. Parallelism
is controlled with
-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.
Classical LTO mode can be enforced by-flto-partition=none
. This may result in small code quality improvements. - A large number of bugs were fixed. GCC itself, Mozilla Firefox and other large applications can be built with LTO enabled.
- The linker plugin support improvements
- Linker plugin is now enabled by default when the linker is
detected to have plugin support. This is the case for GNU
ld 2.21.51 or newer (on ELF and Cygwin targets) and the Gold
linker on ELF targets. Plugin support of the Apple linker on
Darwin is not compatible with GCC.
The linker plugin can also be controlled by the
-fuse-linker-plugin
command-line option. - Resolution information from the linker plugin is used to drive
whole program assumptions. Use of the linker plugin results in
more aggressive optimization on binaries and on shared libraries
that use the
hidden
visibility attribute. Consequently the use of-fwhole-program
is not necessary in addition to LTO.
- Linker plugin is now enabled by default when the linker is
detected to have plugin support. This is the case for GNU
ld 2.21.51 or newer (on ELF and Cygwin targets) and the Gold
linker on ELF targets. Plugin support of the Apple linker on
Darwin is not compatible with GCC.
The linker plugin can also be controlled by the
- Hidden symbols used from non-LTO objects now have to be
explicitly annotated with
externally_visible
when the linker plugin is not used. - C++ inline functions and virtual tables are now privatized more aggressively, leading to better inter-procedural optimization and faster dynamic linking.
- Memory usage and intermediate language streaming performance have been improved.
- Static constructors and destructors from individual units are
inlined into a single function.
This can significantly improve startup times of large C++
applications where static constructors are very common. For
example, static constructors are used when including the
iostream
header. - Support for the Ada language has been added.
- The Scalable Whole
Program Optimizer (WHOPR) project has stabilized to the
point of being usable. It has become the default mode when
using the LTO optimization model. Link time optimization can
now split itself into multiple parallel compilations. Parallelism
is controlled with
- Interprocedural optimization improvements
- The interprocedural framework was re-tuned for link time optimization. Several scalability issues were resolved.
- Improved auto-detection of
const
andpure
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. - A number of inlining heuristic improvements. In particular:
- Partial inlining is now supported and enabled by default
at
-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).
- Scalability for large compilation units was improved significantly.
- Inlining of callbacks is now more aggressive.
- Virtual methods are considered for inlining when the caller is inlined and devirtualization is then possible.
- Inlining when optimizing for size (either in cold
regions of a program or when compiling with
-Os
) was improved to better handle C++ programs with larger abstraction penalty, leading to smaller and faster code.
- Partial inlining is now supported and enabled by default
at
- The IPA reference optimization pass detecting global variables used or modified by functions was strengthened and sped up.
- Functions whose address was taken are now optimized out when all references to them are dead.
- A new inter-procedural static profile estimation pass detects functions that are executed once or unlikely to be executed. Unlikely executed functions are optimized for size. Functions executed once are optimized for size except for the inner loops.
- On most targets with named section support, functions used only
at startup (static constructors and
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.
- A new switch
-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. - A new switch
-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. - A new switch
-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++.
Compile time and memory usage improvements
- Datastructures used by the dataflow framework in GCC were reorganized for better memory usage and more cache locality. Compile time is improved especially on units with large functions (possibly resulting from a lot of inlining) not fitting into the processor cache. The compile time of the GCC C compiler binary with link-time optimization went down by over 10% (benchmarked on x86-64 target).
New Languages and Language specific improvements
Ada
- Stack checking has been improved on selected architectures (Alpha, IA-32/x86-64, RS/6000 and SPARC): it now will detect stack overflows in all cases on these architectures.
- Initial support for Ada 2012 has been added.
C family
- A new warning, enabled by
-Wdouble-promotion
, has been added that warns about cases where a value of typefloat
is implicitly promoted todouble
. This is especially helpful for CPUs that handle the former in hardware, but emulate the latter in software. - A new function attribute
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. - Support for a new data type
__int128
for targets having wide enough machine-mode support. - The new function attribute
callee_pop_aggregate
allows to specify if the caller or callee is responsible for popping the aggregate return pointer value from the stack. - Support for selectively enabling and disabling warnings
via
#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 */
- The
-fmax-errors=N
option is now supported. Using this option causes the compiler to exit afterN
errors have been issued.
C
- There is now experimental support for some features from the
upcoming C1X revision of the ISO C standard. This support may be
selected with
-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 assertions (
_Static_assert
keyword) - Typedef redefinition
- New macros in
<float.h>
- Anonymous structures and unions
- Static assertions (
- The new
-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.
C++
- Improved experimental support for the
upcoming C++0x ISO C++ standard, including support for
constexpr
(thanks to Gabriel Dos Reis and Jason Merrill),nullptr
(thanks to Magnus Fromreide),noexcept
, unrestricted unions, range-basedfor
loops (thanks to Rodrigo Rivas Costa), opaque enum declarations (thanks also to Rodrigo), implicitly deleted functions and implicit move constructors. - When an extern declaration within a function does not match a declaration in the enclosing context, G++ now properly declares the name within the namespace of the function rather than the namespace which was open just before the function definition (c++/43145).
- GCC now warns by default when casting integers to larger
pointer types. These warnings can be disabled with the option
-Wno-int-to-pointer-cast
, which is now also available in C++. - G++ no longer optimizes using the assumption that a value of
enumeration type will fall within the range specified by the standard,
since that assumption is easily violated with a conversion from integer
type (c++/43680).
The old behavior can be restored with
-fstrict-enums
. - The new
-fnothrow-opt
flag changes the semantics of athrow()
exception specification to match the proposed semantics of thenoexcept
specification: just callterminate
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. - The new
-Wnoexcept
flag will suggest adding anoexcept
qualifier to a function that the compiler can tell doesn't throw if it would change the value of anoexcept
expression. - The
-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. - When an identifier is not found in the current scope, G++ now offers suggestions about which identifier might have been intended.
- G++ now issues clearer diagnostics for missing semicolons
after
class
,struct
, andunion
definitions. - G++ now issues clearer diagnostics for missing semicolons after class member declarations.
- G++ now issues clearer diagnostics when a colon is used in a place where a double-colon was intended.
- G++ no longer accepts
mutable
on reference members (c++/33558). Use-fpermissive
to allow the old, non-conforming behaviour. - A few mangling fixes have been made, to attribute const/volatile on
function pointer types, decltype of a plain decl, and use of a
function parameter in the declaration of another parameter. By
default the compiler still uses the old mangling, but emits aliases
with the new mangling on targets that support strong aliases. Users
can switch over entirely to the new mangling
with
-fabi-version=5
or-fabi-version=0
.-Wabi
will now warn about code that uses the old mangling. - In 4.6.0 and 4.6.1 G++ no longer allows objects of const-qualified
type to be default initialized unless the type has a user-declared
default constructor. In 4.6.2 G++ implements the proposed resolution
of DR
253, so default initialization is allowed if it initializes all
subobjects. Code that fails to compile can be fixed by providing an
initializer e.g.
struct A { A(); }; struct B : A { int i; }; const B b = B();
Use-fpermissive
to allow the old, non-conforming behaviour.
Runtime Library (libstdc++)
-
Improved experimental support for the upcoming ISO C++ standard,
C++0x, including using
constexpr
andnullptr
. - Performance improvements to the Debug Mode, thanks to François Dumont.
- Atomic operations used for reference-counting are annotated so that they can be understood by race detectors such as Helgrind, see Data Race Hunting.
- Most libstdc++ standard headers have been changed to no longer include
the
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 includecstddef
explicitly.
Fortran
- On systems supporting the
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 supportREAL(16)
in hardware nor those which do not supportlibquadmath
. - Much improved compile time for large array constructors.
- In order to reduce execution time and memory consumption, use of temporary arrays in assignment expressions is avoided for many cases. The compiler now reverses loops in order to avoid generating a temporary array where possible.
- Improved diagnostics, especially with
-fwhole-file
. - The
-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. - Support the generation of Makefile dependencies via the
-M
... flags of GCC; you may need to specify the-cpp
option in addition. The dependencies take modules, Fortran'sinclude
, and CPP's#include
into account. Note: Using-M
for the module path is no longer supported, use-J
instead. - The flag
-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. - A new command-line option
-Wunused-dummy-argument
warns about unused dummy arguments and is included in-Wall
. Before,-Wunused-variable
also warned about unused dummy arguments. - Fortran 2003 support has been extended:
- Improved support for polymorphism between libraries and programs and for complicated inheritance patterns (cf. object-oriented programming).
- Experimental support of the
ASSOCIATE
construct. - In pointer assignments it is now possible to specify the lower bounds of the pointer and, for a rank-1 or a simply contiguous data-target, to remap the bounds.
- Automatic (re)allocation: In intrinsic assignments to
allocatable variables the left-hand side will be automatically
allocated (if unallocated) or reallocated (if the shape or type
parameter is different). To avoid the small performance penalty,
you can use
a(:) = ...
instead ofa = ...
for arrays and character strings – or disable the feature using-std=f95
or-fno-realloc-lhs
. - Deferred type parameter: For scalar allocatable and pointer variables the character length can be deferred.
- Namelist variables with allocatable and pointer attribute and nonconstant length type parameter are supported.
- Fortran 2008 support has been extended:
- Experimental
coarray support (for one image only, i.e.
num_images() == 1
); use the-fcoarray=single
flag to enable it. - The
STOP
and the newERROR STOP
statements now support all constant expressions. - Support for the
CONTIGUOUS
attribute. - Support for
ALLOCATE
withMOLD
. - Support for the
STORAGE_SIZE
intrinsic inquiry function. - Support of the
NORM2
andPARITY
intrinsic functions. - The following bit intrinsics were added:
POPCNT
andPOPPAR
for counting the number of 1 bits and returning the parity;BGE
,BGT
,BLE
, andBLT
for bitwise comparisons;DSHIFTL
andDSHIFTR
for combined left and right shifts,MASKL
andMASKR
for simple left and right justified masks,MERGE_BITS
for a bitwise merge using a mask,SHIFTA
,SHIFTL
andSHIFTR
for shift operations, and the transformational bit intrinsicsIALL
,IANY
andIPARITY
. - Support of the
EXECUTE_COMMAND_LINE
intrinsic subroutine. - Support for the
IMPURE
attribute for procedures, which allows forELEMENTAL
procedures without the restrictions ofPURE
. - Null pointers (including
NULL()
) and not allocated variables can be used as actual argument to optional non-pointer, non-allocatable dummy arguments, denoting an absent argument. - Non-pointer variables with
TARGET
attribute can be used as actual argument toPOINTER
dummies withINTENT(IN)
- Pointers including procedure pointers and those in a derived
type (pointer components) can now be initialized by a target
instead of only by
NULL
. - The
EXIT
statement (with construct-name) can now be used to leave not only theDO
but also theASSOCIATE
,BLOCK
,IF
,SELECT CASE
andSELECT TYPE
constructs. - Internal procedures can now be used as actual argument.
- The named constants
INTEGER_KINDS
,LOGICAL_KINDS
,REAL_KINDS
andCHARACTER_KINDS
of the intrinsic moduleISO_FORTRAN_ENV
have been added; these arrays contain the supported kind values for the respective types. - The module procedures
C_SIZEOF
of the intrinsic moduleISO_C_BINDINGS
andCOMPILER_VERSION
andCOMPILER_OPTIONS
ofISO_FORTRAN_ENV
have been implemented. - Minor changes: obsolescence diagnostics for
ENTRY
was added for-std=f2008
; a line may start with a semicolon; for internal and module proceduresEND
can be used instead ofEND SUBROUTINE
andEND FUNCTION
;SELECTED_REAL_KIND
now also takes aRADIX
argument; intrinsic types are supported forTYPE(intrinsic-type-spec)
; multiple type-bound procedures can be declared in a singlePROCEDURE
statement; implied-shape arrays are supported for named constants (PARAMETER
). The transformational, three argument versions ofBESSEL_JN
andBESSEL_YN
were added – the elemental, two-argument version had been added in GCC 4.4; note that the transformational functions use a recurrence algorithm.
- Experimental
coarray support (for one image only, i.e.
Go
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.
Objective-C and Objective-C++
- The
-fobjc-exceptions
flag is now required to enable Objective-C exception and synchronization syntax (introduced by the keywords@try
,@catch
,@finally
and@synchronized
). - A number of Objective-C 2.0 features and extensions are now
supported by GCC. These features are enabled by default; you can
disable them by using the new
-fobjc-std=objc1
command-line option. - The Objective-C 2.0 dot-syntax is now supported. It is an
alternative syntax for using getters and setters;
object.count
is automatically converted into[object count]
or[object setCount: ...]
depending on context; for exampleif (object.count > 0)
is automatically compiled into the equivalent ofif ([object count] > 0)
whileobject.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. - Objective-C 2.0 declared properties are now supported. They
are declared using the new
@property
keyword, and are most commonly used in conjunction with the new Objective-C 2.0 dot-syntax. Thenonatomic
,readonly
,readwrite
,assign
,retain
,copy
,setter
andgetter
attributes are all supported. Marking declared properties with__attribute__ ((deprecated))
is supported too. - The Objective-C 2.0
@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. - The Objective-C 2.0 fast enumeration syntax is supported in Objective-C. This is currently not yet available in Objective-C++. Fast enumeration requires support in the runtime, and such support has been added to the GNU Objective-C runtime library (shipped with GCC).
- The Objective-C 2.0
@optional
keyword is supported. It allows you to mark methods or properties in a protocol as optional as opposed to required. - The Objective-C 2.0
@package
keyword is supported. It has currently the same effect as the@public
keyword. - Objective-C 2.0 method attributes are supported. Currently
the supported attributes are
deprecated
,sentinel
,noreturn
andformat
. - Objective-C 2.0 method argument attributes are supported. The
most widely used attribute is
unused
, to mark an argument as unused in the implementation. - Objective-C 2.0 class and protocol attributes are supported.
Currently the only supported attribute is
deprecated
. - Objective-C 2.0 class extensions are supported. A class extension has the same syntax as a category declaration with no category name, and the methods and properties declared in it are added directly to the main class. It is mostly used as an alternative to a category to add methods to a class without advertising them in the public headers, with the advantage that for class extensions the compiler checks that all the privately declared methods are actually implemented.
- As a result of these enhancements, GCC can now be used to build Objective-C and Objective-C++ software that uses Foundation and other important system frameworks with the NeXT runtime on Darwin 9 and Darwin 10 (OSX 10.5 and 10.6).
- Many bugs in the compiler have been fixed in this release; in particular, LTO can now be used when compiling Objective-C and Objective-C++ and the parser is much more robust in dealing with invalid code.
Runtime Library (libobjc)
- The GNU Objective-C runtime library now defines the macro
__GNU_LIBOBJC__
(with a value that is increased at every release where there is any change to the API) inobjc/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. - A new Objective-C 2.0 API, almost identical to the one
implemented by the Apple Objective-C runtime, has been implemented
in the GNU Objective-C runtime library. The new API hides the
internals of most runtime structures but provides a more extensive
set of functions to operate on them. It is much easier, for
example, to create or modify classes at runtime. The new API also
makes it easier to port software from Apple to GNU as almost no
changes should be required. The old API is still supported for
backwards compatibility; including the old
objc/objc-api.h
header file automatically selects the old API, while including the newobjc/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. - Runtime support for
@synchronized
has been added. - Runtime support for Objective-C 2.0 synthesized property accessors has been added.
- Runtime support for Objective-C 2.0 fast enumeration has been added.
New Targets and Target Specific Improvements
ARM
- GCC now supports the Cortex-M4 processor implementing
the v7-em version of the architecture using the option
-mcpu=cortex-m4
. - Scheduling descriptions for the Cortex-M4, the Neon and the floating point units of the Cortex-A9 and a pipeline description for the Cortex-A5 have been added.
- Synchronization primitives such as
__sync_fetch_and_add
and friends are now inlined for supported architectures rather than calling into a kernel helper function. - SSA loop prefetching is enabled by default for the
Cortex-A9 at
-O3
. - Several improvements were committed to improve code generation for the ARM architecture including a rewritten implementation for load and store multiples.
- Several enhancements were committed to improve SIMD code generation for NEON by adding support for widening instructions, misaligned loads and stores, vector conditionals and support for 64-bit arithmetic.
- Support was added for the Faraday cores fa526, fa606te,
fa626te, fmp626te, fmp626 and fa726te and can be used with the
respective names as parameters to the
-mcpu=
option. - Basic support was added for Cortex-A15 and is available through
-mcpu=cortex-a15
. - GCC for AAPCS configurations now more closely adheres to the AAPCS
specification by enabling
-fstrict-volatile-bitfields
by default.
IA-32/x86-64
-
The new
-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. - Support for emitting profiler counter calls before function
prologues. This is enabled via a new command-line option
-mfentry
. - Optimization for the Intel Core 2 processors is now available through
the
-march=core2
and-mtune=core2
options. - Support for Intel Core i3/i5/i7 processors is now available through
the
-march=corei7
and-mtune=corei7
options. - Support for Intel Core i3/i5/i7 processors with AVX is now
available through the
-march=corei7-avx
and-mtune=corei7-avx
options. - Support for AMD Bobcat (family 14) processors is now available through
the
-march=btver1
and-mtune=btver1
options. - Support for AMD Bulldozer (family 15) processors is now available
through the
-march=bdver1
and-mtune=bdver1
options. - The default setting (when not optimizing for size) for 32-bit
GNU/Linux and Darwin x86 targets has been changed to
-fomit-frame-pointer
. The default can be reverted to-fno-omit-frame-pointer
by configuring GCC with the--enable-frame-pointer
configure option. - Darwin, FreeBSD, Solaris 2, MinGW and Cygwin now all support
__float128
on 32-bit and 64-bit x86 targets. - AVX floating-point arithmetic can now be enabled by default at
configure time with the new
--with-fpmath=avx
option. - The SSA loop prefetching pass is enabled when
using
-O3
when optimizing for CPUs where prefetching is beneficial (AMD CPUs newer than K6). - Support for TBM (Trailing Bit Manipulation) built-in functions
and code generation is available via
-mtbm
. - Support for AMD's BMI (Bit Manipulation) built-in functions and
code generation is available via
-mbmi
.
MicroBlaze
- Support has been added for the Xilinx MicroBlaze softcore processor (microblaze-elf) embedded target. This configurable processor is supported on several Xilinx Spartan and Virtex FPGAs.
MIPS
- GCC now supports the Loongson 3A processor. Its canonical
-march=
and-mtune=
name isloongson3a
.
MN10300 / AM33
- The inline assembly register constraint
"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. - New inline assembly register constraints
"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. - The
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 theRETF
instruction if the function does not modify theMDR
register, so it is important that inline assembly properly annotate any usage of the register.
PowerPC/PowerPC64
- GCC now supports the Applied Micro Titan processor
with
-mcpu=titan
. - The
-mrecip
option has been added, which indicates whether the reciprocal and reciprocal square root instructions should be used. - The
-mveclibabi=mass
option can be used to enable the compiler to autovectorize mathematical functions using the Mathematical Acceleration Subsystem library. - The
-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. - The
-mblock-move-inline-limit
option has been added, which enables the user to control the maximum size of inlinedmemcpy
calls and similar. - PowerPC64 GNU/Linux support for applications requiring a large
TOC section has been improved. A new command-line option,
-mcmodel=MODEL
, controls this feature; valid values forMODEL
aresmall
,medium
, orlarge
. - The Altivec builtin functions
vec_ld
andvec_st
have been modified to generate the Altivec memory instructionsLVX
andSTVX
, 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 functionsvec_vsx_ld
andvec_vsx_st
which always generates the VSX memory instructions. - The GCC compiler on AIX now defaults to a process layout with a larger data space allowing larger programs to be compiled.
- The GCC long double type on AIX 6.1 and above has reverted to 64-bit double precision, matching the AIX XL compiler default, because of missing C99 symbols required by the GCC runtime.
- The default processor scheduling model and tuning for PowerPC64 GNU/Linux and for AIX 6.1 and above now is POWER7.
- Starting with GCC 4.6.1, vectors of type vector long long or vector long are passed and returned in the same method as other vectors with the VSX instruction set. Previously the GCC compiler did not adhere to the ABI for 128-bit vectors with 64-bit integer base types (PR 48857). This is also fixed in the GCC 4.5.4 release.
S/390, zSeries and System z9/z10, IBM zEnterprise z196
- Support for the zEnterprise z196 processor has been added.
When using the
-march=z196
option, the compiler will generate code making use of the following instruction facilities:- Conditional load/store
- Distinct-operands
- Floating-point-extension
- Interlocked-access
- Population-count
-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. - When using the
-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
. - The SSA loop prefetching pass is enabled when
using
-O3
.
SPARC
- GCC now supports the LEON series of SPARC V8 processors. The
code generated by the compiler can either be tuned to it by means
of the
--with-tune=leon
configure option and-mtune=leon
compilation option, or the compiler can be built for thesparc-leon-{elf,linux}
andsparc-leon3-{elf,linux}
targets directly. - GCC has stopped sign/zero-extending parameter registers in the callee for functions taking parameters with sub-word size in 32-bit mode, since this is redundant with the specification of the ABI. GCC has never done so in 64-bit mode since this is also redundant.
- The command-line option
-mfix-at697f
has been added to enable the documented workaround for the single erratum of the Atmel AT697F processor.
Operating Systems
Android
- GCC now supports the Bionic C library and provides a convenient
way of building native libraries and applications for the Android
platform.
Refer to the documentation of the
-mandroid
and-mbionic
options for details on building native code. At the moment, Android support is enabled only for ARM.
Darwin/Mac OS X
- General
- Initial support for
CFString
types has been added.
This allows GCC to build projects including the system Core Foundation frameworks. The GCC Objective-C family supportsCFString
"toll-free bridged" as per the Mac OS X system tools.CFString
is also recognized in the context offormat
attributes and arguments (see the documentation forformat
attributes for limitations). At present, 8-bit character types are supported. - Object file size reduction.
The Darwin zeroed memory allocators have been re-written to make more use of.zerofill
sections. For non-debug code, this can reduce object file size significantly. - Objective-C family 64-bit support (NeXT ABI 2).
Initial support has been added to support 64-bit Objective-C code using the Darwin/OS X native (NeXT) runtime. ABI version 2 will be selected automatically when 64-bit code is built. - Objective-C family 32-bit ABI 1.
For 32-bit code ABI 1 is also now also allowed. At present it must be selected manually using-fobjc-abi-version=1
where applicable - i.e. on Darwin 9/10 (OS X 10.5/10.6).
- Initial support for
- x86 Architecture
- The
-mdynamic-no-pic
option has been enabled.
Code supporting-mdynamic-no-pic
optimization has been added and is applicable to-m32
builds. The compiler bootstrap uses the option where appropriate. - The default value for
-mtune=
has been changed.
Since Darwin systems are primarily Xeon, Core-2 or similar the default tuning has been changed to-mtune=core2
. - Enable 128-bit long double (
__float128
) support on Darwin.
- The
- PPC Architecture
- Darwin64 ABI.
Several significant bugs have been fixed, such that GCC now produces code compatible with the Darwin64 PowerPC ABI. - libffi and boehm-gc.
The Darwin ports of the libffi and boehm-gc libraries have been upgraded to include a Darwin64 implementation. This means that powerpc*-*-darwin9 platforms may now, for example, build Java applications with-m64
enabled. - Plug-in support has been enabled.
- The
-fsection-anchors
option is now available although, presently, not heavily tested.
- Darwin64 ABI.
Solaris 2
New Features
- Support symbol versioning with the Sun linker.
- Allow libstdc++ to leverage full ISO C99 support on Solaris 10+.
- Support thread-local storage (TLS) with the Sun assembler on Solaris 2/x86.
- Support TLS on Solaris 8/9 if prerequisites are met.
- Support COMDAT group with the GNU assembler and recent Sun linker.
- Support the Sun assembler visibility syntax.
- Default Solaris 2/x86 to
-march=pentium4
(Solaris 10+) resp.-march=pentiumpro
(Solaris 8/9). - Don't use SSE on Solaris 8/9 x86 by default.
- Enable 128-bit long double (
__float128
) support on Solaris 2/x86.
ABI Change
- Change the ABI for returning 8-byte vectors like
__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.
Windows x86/x86_64
- Initial support for decimal floating point.
- Support for the
__thiscall
calling-convention. - Support for hot-patchable function prologues via the
ms_hook_prologue
attribute for x86_64 in addition to 32-bit x86. - Improvements of stack-probing and stack-allocation mechanisms.
- Support of push/pop-macro pragma as preprocessor command.
With#pragma push_macro("macro-name")
the current definition ofmacro-name
is saved and can be restored with#pragma pop_macro("macro-name")
to its saved definition. - Enable 128-bit long double (
__float128
) support on MinGW and Cygwin.
Other significant improvements
Installation changes
-
An
install-strip
make
target is provided that installs stripped executables, and may install libraries with unneeded or debugging sections stripped. -
On Power7 systems, there is a potential problem if you build the GCC
compiler with a host compiler using options that enable the VSX
instruction set generation. If the host compiler has been patched so that
the
vec_ld
andvec_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.
Changes for GCC Developers
Note: these changes concern developers that develop GCC itself or software that integrates with GCC, such as plugins, and not the general GCC users.
-
The
gengtype
utility, which previously was internal to the GCC build process, has been enchanced to provide GC root information for plugins as necessary. -
The old GC allocation interface of
ggc_alloc
and friends was replaced with a type-safe alternative.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.6.1 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
GCC 4.6.2
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.6.2 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
GCC 4.6.3
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.6.3 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
GCC 4.6.4
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.6.4 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).