GCC Changelog

New in version 4.9.2

October 30th, 2014
  • General Optimizer Improvements:
  • AddressSanitizer, a fast memory error detector, is now available on ARM.
  • UndefinedBehaviorSanitizer (ubsan), a fast undefined behavior detector, has been added and can be enabled via -fsanitize=undefined. Various computations will be instrumented to detect undefined behavior at runtime. UndefinedBehaviorSanitizer is currently available for the C and C++ languages.
  • Link-time optimization (LTO) improvements:
  • Type merging was rewritten. The new implementation is significantly faster and uses less memory.
  • Better partitioning algorithm resulting in less streaming during link time.
  • Early removal of virtual methods reduces the size of object files and improves link-time memory usage and compile time.
  • Function bodies are now loaded on-demand and released early improving overall memory usage at link time.
  • C++ hidden keyed methods can now be optimized out.
  • When using a linker plugin, compiling with the -flto option now generates slim object files (.o) which only contain intermediate language representation for LTO. Use -ffat-lto-objects to create files which contain additionally the object code. To generate static libraries suitable for LTO processing, use gcc-ar and gcc-ranlib; to list symbols from a slim object file use gcc-nm. (This requires that ar, ranlib and nm have been compiled with plugin support.)
  • Memory usage building Firefox with debug enabled was reduced from 15GB to 3.5GB; link time from 1700 seconds to 350 seconds.
  • Inter-procedural optimization improvements:
  • New type inheritance analysis module improving devirtualization. Devirtualization now takes into account anonymous name-spaces and the C++11 final keyword.
  • New speculative devirtualization pass (controlled by -fdevirtualize-speculatively.
  • Calls that were speculatively made direct are turned back to indirect where direct call is not cheaper.
  • Local aliases are introduced for symbols that are known to be semantically equivalent across shared libraries improving dynamic linking times.
  • Feedback directed optimization improvements:
  • Profiling of programs using C++ inline functions is now more reliable.
  • New time profiling determines typical order in which functions are executed.
  • A new function reordering pass (controlled by -freorder-functions) significantly reduces startup time of large applications. Until binutils support is completed, it is effective only with link-time optimization.
  • Feedback driven indirect call removal and devirtualization now handle cross-module calls when link-time optimization is enabled.
  • New Languages and Language specific improvements:
  • Version 4.0 of the OpenMP specification is now supported in the C and C++ compilers and starting with the 4.9.1 release also in the Fortran compiler. The new -fopenmp-simd option can be used to enable OpenMP's SIMD directives, while ignoring other OpenMP directives. The new -fsimd-cost-model= option permits to tune the vectorization cost model for loops annotated with OpenMP and Cilk Plus simd directives; -Wopenmp-simd warns when the current cost model overrides simd directives set by the user.
  • The -Wdate-time option has been added for the C, C++ and Fortran compilers, which warns when the __DATE__, __TIME__ or __TIMESTAMP__ macros are used. Those macros might prevent bit-wise-identical reproducible compilations.
  • Ada:
  • GNAT switched to Ada 2012 instead of Ada 2005 by default.
  • C family:
  • Support for colorizing diagnostics emitted by GCC has been added. The -fdiagnostics-color=auto will enable it when outputting to terminals, -fdiagnostics-color=always unconditionally. The GCC_COLORS environment variable can be used to customize the colors or disable coloring. If GCC_COLORS variable is present in the environment, the default is -fdiagnostics-color=auto, otherwise -fdiagnostics-color=never.
  • Sample diagnostics output:
  • $ g++ -fdiagnostics-color=always -S -Wall test.C
  • test.C: In function ‘int foo()’:
  • test.C:1:14: warning: no return statement in function returning non-void [-Wreturn-type]
  • int foo () { }
  • test.C:2:46: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) instantiating ‘struct X’
  • template struct X { static const int value = X::value; }; template struct X;
  • test.C:2:46: recursively required from ‘const int X::value’
  • test.C:2:46: required from ‘const int X::value’
  • test.C:2:88: required from here
  • test.C:2:46: error: incomplete type ‘X’ used in nested name specifier
  • With the new #pragma GCC ivdep, the user can assert that there are no loop-carried dependencies which would prevent concurrent execution of consecutive iterations using SIMD (single instruction multiple data) instructions.
  • Support for Cilk Plus has been added and can be enabled with the -fcilkplus option. Cilk Plus is an extension to the C and C++ languages to support data and task parallelism. The present implementation follows ABI version 1.2; all features but _Cilk_for have been implemented.
  • ISO C11 atomics (the _Atomic type specifier and qualifier and the header) are now supported.
  • ISO C11 generic selections (_Generic keyword) are now supported.
  • ISO C11 thread-local storage (_Thread_local, similar to GNU C __thread) is now supported.
  • ISO C11 support is now at a similar level of completeness to ISO C99 support: substantially complete modulo bugs, extended identifiers (supported except for corner cases when -fextended-identifiers is used), floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability).
  • A new C extension __auto_type provides a subset of the functionality of C++11 auto in GNU C.
  • C++:
  • The G++ implementation of C++1y return type deduction for normal functions has been updated to conform to N3638, the proposal accepted into the working paper. Most notably, it adds decltype(auto) for getting decltype semantics rather than the template argument deduction semantics of plain auto:
  • int& f();
  • auto i1 = f(); // int
  • decltype(auto) i2 = f(); // int&
  • G++ supports C++1y lambda capture initializers:
  • [x = 42]{ ... };
  • Actually, they have been accepted since GCC 4.5, but now the compiler doesn't warn about them with -std=c++1y, and supports parenthesized and brace-enclosed initializers as well.
  • G++ supports C++1y variable length arrays. G++ has supported GNU/C99-style VLAs for a long time, but now additionally supports initializers and lambda capture by reference. In C++1y mode G++ will complain about VLA uses that are not permitted by the draft standard, such as forming a pointer to VLA type or applying sizeof to a VLA variable. Note that it now appears that VLAs will not be part of C++14, but will be part of a separate document and then perhaps C++17.
  • void f(int n) {
  • int a[n] = { 1, 2, 3 }; // throws std::bad_array_length if n < 3
  • [&a]{ for (int i : a) { cout

New in version 4.9.1 (July 16th, 2014)

  • GCC 4.9.1 is a bug-fix release from the GCC 4.9 branch containing important fixes for regressions and serious bugs in GCC 4.9.0 with more than 88 bugs fixed since the previous release. In addition to that, GCC 4.9.1 release supports OpenMP 4.0 also in Fortran, rather than just in C and C++.

New in version 4.9.0 (April 22nd, 2014)

  • General Optimizer Improvements:
  • AddressSanitizer, a fast memory error detector, is now available on ARM.
  • UndefinedBehaviorSanitizer (ubsan), a fast undefined behavior detector, has been added and can be enabled via -fsanitize=undefined. Various computations will be instrumented to detect undefined behavior at runtime. UndefinedBehaviorSanitizer is currently available for the C and C++ languages.
  • Link-time optimization (LTO) improvements:
  • Type merging was rewritten. The new implementation is significantly faster and uses less memory.
  • Better partitioning algorithm resulting in less streaming during link time.
  • Early removal of virtual methods reduces the size of object files and improves link-time memory usage and compile time.
  • Function bodies are now loaded on-demand and released early improving overall memory usage at link time.
  • C++ hidden keyed methods can now be optimized out.
  • When using a linker plugin, compiling with the -flto option now generates slim objects files (.o) which only contain intermediate language representation for LTO. Use -ffat-lto-objects to create files which contain additionally the object code. To generate static libraries suitable for LTO processing, use gcc-ar and gcc-ranlib; to list symbols from a slim object file use gcc-nm. (Requires that ar, ranlib and nm have been compiled with plugin support.)
  • Memory usage building Firefox with debug enabled was reduced from 15GB to 3.5GB; link time from 1700 seconds to 350 seconds.
  • Inter-procedural optimization improvements:
  • New type inheritance analysis module improving devirtualization. Devirtualization now takes into account anonymous name-spaces and the C++11 final keyword.
  • New speculative devirtualization pass (controlled by -fdevirtualize-speculatively.
  • Calls that were speculatively made direct are turned back to indirect where direct call is not cheaper.
  • Local aliases are introduced for symbols that are known to be semantically equivalent across shared libraries improving dynamic linking times.
  • Feedback directed optimization improvements:
  • Profiling of programs using C++ inline functions is now more reliable.
  • New time profiling determines typical order in which functions are executed.
  • A new function reordering pass (controlled by -freorder-functions) significantly reduces startup time of large applications. Until binutils support is completed, it is effective only with link-time optimization.
  • Feedback driven indirect call removal and devirtualization now handle cross-module calls when link-time optimization is enabled.
  • New Languages and Language specific improvements:
  • Version 4.0 of the OpenMP specification is now supported for the C and C++ compilers. The new -fopenmp-simd option can be used to enable OpenMP's SIMD directives, while ignoring other OpenMP directives. The new -fsimd-cost-model= option permits to tune the vectorization cost model for loops annotated with OpenMP and Cilk Plus simd directives; -Wopenmp-simd warns when the current costmodel overrides simd directives set by the user.
  • The -Wdate-time option has been added for the C, C++ and Fortran compilers, which warns when the __DATE__, __TIME__ or __TIMESTAMP__ macros are used. Those macros might prevent bit-wise-identical reproducible compilations.
  • Ada:
  • GNAT switched to Ada 2012 instead of Ada 2005 by default.
  • C family:
  • Support for colorizing diagnostics emitted by GCC has been added. The -fdiagnostics-color=auto will enable it when outputting to terminals, -fdiagnostics-color=always unconditionally. The GCC_COLORS environment variable can be used to customize the colors or disable coloring. If GCC_COLORS variable is present in the environment, the default is -fdiagnostics-color=auto, otherwise -fdiagnostics-color=never.
  • Sample diagnostics output:
  • $ g++ -fdiagnostics-color=always -S -Wall test.C
  • test.C: In function ‘int foo()’:
  • test.C:1:14: warning: no return statement in function returning non-void [-Wreturn-type]
  • int foo () { }
  • test.C:2:46: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) instantiating ‘struct X’
  • template struct X { static const int value = X::value; }; template struct X;
  • test.C:2:46: recursively required from ‘const int X::value’
  • test.C:2:46: required from ‘const int X::value’
  • test.C:2:88: required from here
  • test.C:2:46: error: incomplete type ‘X’ used in nested name specifier
  • With the new #pragma GCC ivdep, the user can assert that there are no loop-carried dependencies which would prevent concurrent execution of consecutive iterations using SIMD (single instruction multiple data) instructions.
  • Support for Cilk Plus has been added and can be enabled with the -fcilkplus option. Cilk Plus is an extension to the C and C++ languages to support data and task parallelism. The present implementation follows ABI version 1.2; all features but _Cilk_for have been implemented.
  • ISO C11 atomics (the _Atomic type specifier and qualifier and the header) are now supported.
  • ISO C11 generic selections (_Generic keyword) are now supported.
  • ISO C11 thread-local storage (_Thread_local, similar to GNU C __thread) is now supported.
  • ISO C11 support is now at a similar level of completeness to ISO C99 support: substantially complete modulo bugs, extended identifiers (supported except for corner cases when -fextended-identifiers is used), floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability).
  • A new C extension __auto_type provides a subset of the functionality of C++11 auto in GNU C.
  • C++:
  • The G++ implementation of C++1y return type deduction for normal functions has been updated to conform to N3638, the proposal accepted into the working paper. Most notably, it adds decltype(auto) for getting decltype semantics rather than the template argument deduction semantics of plain auto:
  • int& f();
  • auto i1 = f(); // int
  • decltype(auto) i2 = f(); // int&
  • G++ supports C++1y lambda capture initializers:
  • [x = 42]{ ... };
  • Actually, they have been accepted since GCC 4.5, but now the compiler doesn't warn about them with -std=c++1y, and supports parenthesized and brace-enclosed initializers as well.
  • G++ supports C++1y variable length arrays. G++ has supported GNU/C99-style VLAs for a long time, but now additionally supports initializers and lambda capture by reference. In C++1y mode G++ will complain about VLA uses that are not permitted by the draft standard, such as forming a pointer to VLA type or applying sizeof to a VLA variable. Note that it now appears that VLAs will not be part of C++14, but will be part of a separate document and then perhaps C++17.
  • void f(int n) {
  • int a[n] = { 1, 2, 3 }; // throws std::bad_array_length if n < 3
  • [&a]{ for (int i : a) { cout

New in version 4.8.2 (October 16th, 2013)

  • General Optimizer Improvements (and Changes):
  • DWARF4 is now the default when generating DWARF debug information. When -g is used on a platform that uses DWARF debugging information, GCC will now default to -gdwarf-4 -fno-debug-types-section.
  • GDB 7.5, Valgrind 3.8.0 and elfutils 0.154 debug information consumers support DWARF4 by default. Before GCC 4.8 the default version used was DWARF2. To make GCC 4.8 generate an older DWARF version use -g together with -gdwarf-2 or -gdwarf-3. The default for Darwin and VxWorks is still -gdwarf-2 -gstrict-dwarf.
  • A new general optimization level, -Og, has been introduced. It addresses the need for fast compilation and a superior debugging experience while providing a reasonable level of runtime performance. Overall experience for development should be better than the default optimization level -O0.
  • A new option -ftree-partial-pre was added to control the partial redundancy elimination (PRE) optimization. This option is enabled by default at the -O3 optimization level, and it makes PRE more aggressive.
  • The option -fconserve-space has been removed; it was no longer useful on most targets since GCC supports putting variables into BSS without making them common.
  • The struct reorg and matrix reorg optimizations (command-line options -fipa-struct-reorg and -fipa-matrix-reorg) have been removed. They did not always work correctly, nor did they work with link-time optimization (LTO), hence were only applicable to programs consisting of a single translation unit.
  • Several scalability bottle-necks have been removed from GCC's optimization passes. Compilation of extremely large functions, e.g. due to the use of the flatten attribute in the "Eigen" C++ linear algebra templates library, is significantly faster than previous releases of GCC.
  • Link-time optimization (LTO) improvements:
  • LTO partitioning has been rewritten for better reliability and maintanibility. Several important bugs leading to link failures have been fixed.
  • Interprocedural optimization improvements:
  • A new symbol table has been implemented. It builds on existing callgraph and varpool modules and provide a new API. Unusual symbol visibilities and aliases are handled more consistently leading to, for example, more aggressive unreachable code removal with LTO.
  • The inline heuristic can now bypass limits on the size of of inlined functions when the inlining is particularly profitable. This happens, for example, when loop bounds or array strides get propagated.
  • Values passed through aggregates (either by value or reference) are now propagated at the inter-procedural level leading to better inlining decisions (for example in the case of Fortran array descriptors) and devirtualization.
  • AddressSanitizer , a fast memory error detector, has been added and can be enabled via -fsanitize=address. Memory access instructions will be instrumented to detect heap-, stack-, and global-buffer overflow as well as use-after-free bugs. To get nicer stacktraces, use -fno-omit-frame-pointer. The AddressSanitizer is available on IA-32/x86-64/x32/PowerPC/PowerPC64 GNU/Linux and on x86-64 Darwin.
  • ThreadSanitizer has been added and can be enabled via -fsanitize=thread. Instructions will be instrumented to detect data races. The ThreadSanitizer is available on x86-64 GNU/Linux.
  • A new local register allocator (LRA) has been implemented, which replaces the 26 year old reload pass and improves generated code quality. For now it is active on the ia32 and x86-64 targets.
  • Support for transactional memory has been implemented on the following architectures: IA-32/x86-64, ARM, PowerPC, SH, Sparc, and Alpha.
  • New Languages and Language specific improvements:
  • C family:
  • Each diagnostic emitted now includes the original source line and a caret '^' indicating the column. The option -fno-diagnostics-show-caret suppresses this information.
  • The option -ftrack-macro-expansion=2 is now enabled by default. This allows the compiler to display the macro expansion stack in diagnostics. Combined with the caret information, an example diagnostic showing these two features is:
  • t.c:1:94: error: invalid operands to binary < (have ‘struct mystruct’ and ‘float’)
  • #define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
  • t.c:7:7: note: in expansion of macro 'MYMAX'
  • X = MYMAX(P, F);
  • A new -Wsizeof-pointer-memaccess warning has been added (also enabled by -Wall) to warn about suspicious length parameters to certain string and memory built-in functions if the argument uses sizeof. This warning warns e.g. about memset (ptr, 0, sizeof (ptr)); if ptr is not an array, but a pointer, and suggests a possible fix, or about memcpy (&foo, ptr, sizeof (&foo));.
  • The new option -Wpedantic is an alias for -pedantic, which is now deprecated. The forms -Wno-pedantic, -Werror=pedantic, and -Wno-error=pedantic work in the same way as for any other -W option. One caveat is that -Werror=pedantic is not equivalent to -pedantic-errors, since the latter makes into errors some warnings that are not controlled by -Wpedantic, and the former only affects diagnostics that are disabled when using -Wno-pedantic.
  • The option -Wshadow no longer warns if a declaration shadows a function declaration, unless the former declares a function or pointer to function, because this is a common and valid case in real-world code.
  • C++:
  • G++ now implements the C++11 thread_local keyword; this differs from the GNU __thread keyword primarily in that it allows dynamic initialization and destruction semantics. Unfortunately, this support requires a run-time penalty for references to non-function-local thread_local variables defined in a different translation unit even if they don't need dynamic initialization, so users may want to continue to use __thread for TLS variables with static initialization semantics.
  • If the programmer can be sure that no use of the variable in a non-defining TU needs to trigger dynamic initialization (either because the variable is statically initialized, or a use of the variable in the defining TU will be executed before any uses in another TU), they can avoid this overhead with the -fno-extern-tls-init option.
  • OpenMP threadprivate variables now also support dynamic initialization and destruction by the same mechanism.
  • G++ now implements the C++11 attribute syntax, e.g.
  • [[noreturn]] void f();
  • and also the alignment specifier, e.g.
  • alignas(double) int i;
  • G++ now implements C++11 inheriting constructors, e.g.
  • struct A { A(int); };
  • struct B: A { using A::A; }; // defines B::B(int)
  • B b(42); // OK
  • As of GCC 4.8.1, G++ implements the change to decltype semantics from N3276.
  • struct A f();
  • decltype(f()) g(); // OK, return type of f() is not required to be complete.
  • As of GCC 4.8.1, G++ implements C++11 ref-qualifiers, e.g.
  • struct A { int f() &; };
  • int i = A().f(); // error, f() requires an lvalue object
  • G++ now supports a -std=c++1y option for experimentation with features proposed for the next revision of the standard, expected around 2014. Currently the only difference from -std=c++11 is support for return type deduction in normal functions, as proposed in N3386. Status of C++1y features in GCC 4.8 can be found here.
  • The G++ namespace association extension, __attribute ((strong)), has been deprecated. Inline namespaces should be used instead.
  • G++ now supports a -fext-numeric-literal option to control whether GNU numeric literal suffixes are accepted as extensions or processed as C++11 user-defined numeric literal suffixes. The flag is on (use suffixes for GNU literals) by default for -std=gnu++*, and -std=c++98. The flag is off (use suffixes for user-defined literals) by default for -std=c++11 and later.
  • Runtime Library (libstdc++):
  • Improved experimental support for the new ISO C++ standard, C++11, including:
  • forward_list meets the allocator-aware container requirements;
  • this_thread::sleep_for(), this_thread::sleep_until() and this_thread::yield() are defined without requiring the configure option --enable-libstdcxx-time;
  • Improvements to :
  • SSE optimized normal_distribution.
  • Use of hardware RNG instruction for random_device on new x86 processors (requires the assembler to support the instruction.)
  • and :
  • New random number engine simd_fast_mersenne_twister_engine with an optimized SSE implementation.
  • New random number distributions beta_distribution, normal_mv_distribution, rice_distribution, nakagami_distribution, pareto_distribution, k_distribution, arcsine_distribution, hoyt_distribution.
  • Added --disable-libstdcxx-verbose configure option to disable diagnostic messages issued when a process terminates abnormally. This may be useful for embedded systems to reduce the size of executables that link statically to the library.
  • Fortran:
  • Compatibility notice:
  • Module files: The version of module files (.mod) has been incremented. Fortran MODULEs compiled by earlier GCC versions have to be recompiled, when they are USEd by files compiled with GCC 4.8. GCC 4.8 is not able to read .mod files created by earlier versions; attempting to do so gives an error message.
  • Note: The ABI of the produced assembler data itself has not changed; object files and libraries are fully compatible with older versions except as noted below.
  • ABI: Some internal names (used in the assembler/object file) have changed for symbols declared in the specification part of a module. If an affected module – or a file using it via use association – is recompiled, the module and all files which directly use such symbols have to be recompiled as well. This change only affects the following kind of module symbols:
  • Procedure pointers. Note: C-interoperable function pointers (type(c_funptr)) are not affected nor are procedure-pointer components.
  • Deferred-length character strings.
  • The BACKTRACE intrinsic subroutine has been added. It shows a backtrace at an arbitrary place in user code; program execution continues normally afterwards.
  • The -Wc-binding-type warning option has been added (disabled by default). It warns if the a variable might not be C interoperable; in particular, if the variable has been declared using an intrinsic type with default kind instead of using a kind parameter defined for C interoperability in the intrinsic ISO_C_Binding module. Before, this warning was always printed. The -Wc-binding-type option is enabled by -Wall.
  • The -Wrealloc-lhs and -Wrealloc-lhs-all warning command-line options have been added, which diagnose when code to is inserted for automatic (re)allocation of a variable during assignment. This option can be used to decide whether it is safe to use -fno-realloc-lhs. Additionally, it can be used to find automatic (re)allocation in hot loops. (For arrays, replacing "var=" by "var(:)=" disables the automatic reallocation.)
  • The -Wcompare-reals command-line option has been added. When this is set, warnings are issued when comparing REAL or COMPLEX types for equality and inequality; consider replacing a == b by abs(a−b) < eps with a suitable eps. -Wcompare-reals is enabled by -Wextra.
  • The -Wtarget-lifetime command-line option has been added (enabled with -Wall), which warns if the pointer in a pointer assignment might outlive its target.
  • Reading floating point numbers which use "q" for the exponential (such as 4.0q0) is now supported as vendor extension for better compatibility with old data files. It is strongly recommended to use for I/O the equivalent but standard conforming "e" (such as 4.0e0).
  • (For Fortran source code, consider replacing the "q" in floating-point literals by a kind parameter (e.g. 4.0e0_qp with a suitable qp). Note that – in Fortran source code – replacing "q" by a simple "e" is not equivalent.)
  • The GFORTRAN_TMPDIR environment variable for specifying a non-default directory for files opened with STATUS="SCRATCH", is not used anymore. Instead gfortran checks the POSIX/GNU standard TMPDIR environment variable. If TMPDIR is not defined, gfortran falls back to other methods to determine the directory for temporary files as documented in the user manual.
  • Fortran 2003:
  • Support for unlimited polymorphic variables (CLASS(*)) has been added. Nonconstant character lengths are not yet supported.
  • TS 29113:
  • Assumed types (TYPE(*)) are now supported.
  • Experimental support for assumed-rank arrays (dimension(..)) has been added. Note that currently gfortran's own array descriptor is used, which is different from the one defined in TS29113, see gfortran's header file or use the Chasm Language Interoperability Tools.
  • Go:
  • GCC 4.8.0 and 4.8.1 implement a preliminary version of the Go 1.1 release. The library support is not quite complete.
  • Go has been tested on GNU/Linux and Solaris platforms for various processors including x86, x86_64, PowerPC, SPARC, and Alpha. It may work on other platforms as well.
  • New Targets and Target Specific Improvements:
  • AArch64:
  • A new port has been added to support AArch64, the new 64-bit architecture from ARM. Note that this is a separate port from the existing 32-bit ARM port.
  • The port provides initial support for the Cortex-A53 and the Cortex-A57 processors with the command line options -mcpu=cortex-a53 and -mcpu=cortex-a57.
  • ARM:
  • Initial support has been added for the AArch32 extensions defined in the ARMv8 architecture.
  • Code generation improvements for the Cortex-A7 and Cortex-A15 CPUs.
  • A new option, -mcpu=marvell-pj4, has been added to generate code for the Marvell PJ4 processor.
  • The compiler can now automatically generate the VFMA, VFMS, REVSH and REV16 instructions.
  • A new vectorizer cost model for Advanced SIMD configurations to improve the auto-vectorization strategies used.
  • The scheduler now takes into account the number of live registers to reduce the amount of spilling that can occur. This should improve code performance in large functions. The limit can be removed by using the option -fno-sched-pressure.
  • Improvements have been made to the Marvell iWMMX code generation and support for the iWMMX2 SIMD unit has been added. The option -mcpu=iwmmxt2 can be used to enable code generation for the latter.
  • A number of code generation improvements for Thumb2 to reduce code size when compiling for the M-profile processors.
  • The RTEMS (arm-rtems) port has been updated to use the EABI.
  • Code generation support for the old FPA and Maverick floating-point architectures has been removed. Ports that previously relied on these features have also been removed. This includes the targets:
  • arm*-*-linux-gnu (use arm*-*-linux-gnueabi)
  • arm*-*-elf (use arm*-*-eabi)
  • arm*-*-uclinux* (use arm*-*-uclinux*eabi)
  • arm*-*-ecos-elf (no alternative)
  • arm*-*-freebsd (no alternative)
  • arm*-wince-pe* (no alternative).
  • AVR:
  • Support for the "Embedded C" fixed-point has been added. For details, see the GCC wiki and the user manual. The support is not complete.
  • A new print modifier %r for register operands in inline assembler is supported. It will print the raw register number without the register prefix 'r':
  • /* Return the most significant byte of 'val', a 64-bit value. */
  • unsigned char msb (long long val)
  • unsigned char c;
  • __asm__ ("mov %0, %r1+7" : "=r" (c) : "r" (val));
  • return c;
  • The inline assembler in this example will generate code like
  • mov r24, 8+7
  • provided c is allocated to R24 and val is allocated to R8…R15. This works because the GNU assembler accepts plain register numbers without register prefix.
  • Static initializers with 3-byte symbols are supported now:
  • extern const __memx char foo;
  • const __memx void *pfoo = &foo;
  • This requires at least Binutils 2.23.
  • IA-32/x86-64:
  • Allow -mpreferred-stack-boundary=3 for the x86-64 architecture with SSE extensions disabled. Since the x86-64 ABI requires 16 byte stack alignment, this is ABI incompatible and intended to be used in controlled environments where stack space is an important limitation. This option will lead to wrong code when functions compiled with 16 byte stack alignment (such as functions from a standard library) are called with misaligned stack. In this case, SSE instructions may lead to misaligned memory access traps. In addition, variable arguments will be handled incorrectly for 16 byte aligned objects (including x87 long double and __int128), leading to wrong results. You must build all modules with -mpreferred-stack-boundary=3, including any libraries. This includes the system libraries and startup modules.
  • Support for the new Intel processor codename Broadwell with RDSEED, ADCX, ADOX, PREFETCHW is available through -madx, -mprfchw, -mrdseed command-line options.
  • Support for the Intel RTM and HLE intrinsics, built-in functions and code generation is available via -mrtm and -mhle.
  • Support for the Intel FXSR, XSAVE and XSAVEOPT instruction sets. Intrinsics and built-in functions are available via -mfxsr, -mxsave and -mxsaveopt respectively.
  • New -maddress-mode=[short|long] options for x32. -maddress-mode=short overrides default 64-bit addresses to 32-bit by emitting the 0x67 address-size override prefix. This is the default address mode for x32.
  • New built-in functions to detect run-time CPU type and ISA:
  • A built-in function __builtin_cpu_is has been added to detect if the run-time CPU is of a particular type. It returns a positive integer on a match and zero otherwise. It accepts one string literal argument, the CPU name. For example, __builtin_cpu_is("westmere") returns a positive integer if the run-time CPU is an Intel Core i7 Westmere processor. Please refer to the user manual for the list of valid CPU names recognized.
  • A built-in function __builtin_cpu_supports has been added to detect if the run-time CPU supports a particular ISA feature. It returns a positive integer on a match and zero otherwise. It accepts one string literal argument, the ISA feature. For example, __builtin_cpu_supports("ssse3") returns a positive integer if the run-time CPU supports SSSE3 instructions. Please refer to the user manual for the list of valid ISA names recognized.
  • Caveat: If these built-in functions are called before any static constructors are invoked, like during IFUNC initialization, then the CPU detection initialization must be explicitly run using this newly provided built-in function, __builtin_cpu_init. The initialization needs to be done only once. For example, this is how the invocation would look like inside an IFUNC initializer:
  • static void (*some_ifunc_resolver(void))(void)
  • __builtin_cpu_init();
  • if (__builtin_cpu_is("amdfam10h") ...
  • if (__builtin_cpu_supports("popcnt") ...
  • Function Multiversioning Support with G++:
  • It is now possible to create multiple function versions each targeting a specific processor and/or ISA. Function versions have the same signature but different target attributes. For example, here is a program with function versions:
  • __attribute__ ((target ("default")))
  • int foo(void)
  • return 1;
  • __attribute__ ((target ("sse4.2")))
  • int foo(void)
  • return 2;
  • int main (void)
  • int (*p) = &foo;
  • assert ((*p)() == foo());
  • return 0;
  • Please refer to this wiki for more information.
  • The x86 backend has been improved to allow option -fschedule-insns to work reliably. This option can be used to schedule instructions better and leads to improved performace in certain cases.
  • Windows MinGW-w64 targets (*-w64-mingw*) require at least r5437 from the Mingw-w64 trunk.
  • Support for new AMD family 15h processors (Steamroller core) is now available through the -march=bdver3 and -mtune=bdver3 options.
  • Support for new AMD family 16h processors (Jaguar core) is now available through the -march=btver2 and -mtune=btver2 options.
  • FRV:
  • This target now supports the -fstack-usage command-line option.
  • MIPS:
  • GCC can now generate code specifically for the R4700, Broadcom XLP and MIPS 34kn processors. The associated -march options are -march=r4700, -march=xlp and -march=34kn respectively.
  • GCC now generates better DSP code for MIPS 74k cores thanks to further scheduling optimizations.
  • The MIPS port now supports the -fstack-check option.
  • GCC now passes the -mmcu and -mno-mcu options to the assembler.
  • Previous versions of GCC would silently accept -fpic and -fPIC for -mno-abicalls targets like mips*-elf. This combination was not intended or supported, and did not generate position-independent code. GCC 4.8 now reports an error when this combination is used.
  • PowerPC / PowerPC64 / RS6000:
  • SVR4 configurations (GNU/Linux, FreeBSD, NetBSD) no longer save, restore or update the VRSAVE register by default. The respective operating systems manage the VRSAVE register directly.
  • Large TOC support has been added for AIX through the command line option -mcmodel=large.
  • Native Thread-Local Storage support has been added for AIX.
  • VMX (Altivec) and VSX instruction sets now are enabled implicitly when targetting processors that support those hardware features on AIX 6.1 and above.
  • RX:
  • This target will now issue a warning message whenever multiple fast interrupt handlers are found in the same compilation unit. This feature can be turned off by the new -mno-warn-multiple-fast-interrupts command-line option.
  • S/390, System z:
  • Support for the IBM zEnterprise zEC12 processor has been added. When using the -march=zEC12 option, the compiler will generate code making use of the following new instructions:
  • load and trap instructions
  • 2 new compare and trap instructions
  • rotate and insert selected bits - without CC clobber
  • The -mtune=zEC12 option enables zEC12 specific instruction scheduling without making use of new instructions.
  • Register pressure sensitive instruction scheduling is enabled by default.
  • The ifunc function attribute is enabled by default.
  • memcpy and memcmp invokations on big memory chunks or with run time lengths are not generated inline anymore when tuning for z10 or higher. The purpose is to make use of the IFUNC optimized versions in Glibc.
  • SH:
  • The default alignment settings have been reduced to be less aggressive. This results in more compact code for optimization levels other than -Os.
  • Improved support for the __atomic built-in functions:
  • A new option -matomic-model=model selects the model for the generated atomic sequences. The following models are supported:
  • soft-gusa
  • Software gUSA sequences (SH3* and SH4* only). On SH4A targets this will now also partially utilize the movco.l and movli.l instructions. This is the default when the target is sh3*-*-linux* or sh4*-*-linux*.
  • hard-llcs
  • Hardware movco.l / movli.l sequences (SH4A only).
  • soft-tcb
  • Software thread control block sequences.
  • soft-imask
  • Software interrupt flipping sequences (privileged mode only). This is the default when the target is sh1*-*-linux* or sh2*-*-linux*.
  • none
  • Generates function calls to the respective __atomic built-in functions. This is the default for SH64 targets or when the target is not sh*-*-linux*.
  • The option -msoft-atomic has been deprecated. It is now an alias for -matomic-model=soft-gusa.
  • A new option -mtas makes the compiler generate the tas.b instruction for the __atomic_test_and_set built-in function regardless of the selected atomic model.
  • The __sync functions in libgcc now reflect the selected atomic model when building the toolchain.
  • Added support for the mov.b and mov.w instructions with displacement addressing.
  • Added support for the SH2A instructions movu.b and movu.w.
  • Various improvements to code generated for integer arithmetic.
  • Improvements to conditional branches and code that involves the T bit. A new option -mzdcbranch tells the compiler to favor zero-displacement branches. This is enabled by default for SH4* targets.
  • The pref instruction will now be emitted by the __builtin_prefetch built-in function for SH3* targets.
  • The fmac instruction will now be emitted by the fmaf standard function and the __builtin_fmaf built-in function.
  • The -mfused-madd option has been deprecated in favor of the machine-independent -ffp-contract option. Notice that the fmac instruction will now be generated by default for expressions like a * b + c. This is due to the compiler default setting -ffp-contract=fast.
  • Added new options -mfsrra and -mfsca to allow the compiler using the fsrra and fsca instructions on targets other than SH4A (where they are already enabled by default).
  • Added support for the __builtin_bswap32 built-in function. It is now expanded as a sequence of swap.b and swap.w instructions instead of a library function call.
  • The behavior of the -mieee option has been fixed and the negative form -mno-ieee has been added to control the IEEE conformance of floating point comparisons. By default -mieee is now enabled and the option -ffinite-math-only implicitly sets -mno-ieee.
  • Added support for the built-in functions __builtin_thread_pointer and __builtin_set_thread_pointer. This assumes that GBR is used to hold the thread pointer of the current thread. Memory loads and stores relative to the address returned by __builtin_thread_pointer will now also utilize GBR based displacement address modes.
  • The -mdiv= option for targets other than SHmedia has been fixed and documented.
  • SPARC:
  • Added optimized instruction scheduling for Niagara4.
  • TILE-Gx:
  • Added support for the -mcmodel=MODEL command-line option. The models supported are small and large.
  • V850:
  • This target now supports the E3V5 architecture via the use of the new -mv850e3v5 command-line option. It also has experimental support for the e3v5 LOOP instruction which can be enabled via the new -mloop command-line option.
  • XStormy16:
  • This target now supports the -fstack-usage command-line option.

New in version 4.8.0 (March 22nd, 2013)

  • General Optimizer Improvements (and Changes):
  • DWARF4 is now the default when generating DWARF debug information. When -g is used on a platform that uses DWARF debugging information, GCC will now default to -gdwarf-4 -fno-debug-types-section.
  • GDB 7.5, Valgrind 3.8.0 and elfutils 0.154 debug information consumers support DWARF4 by default. Before GCC 4.8 the default version used was DWARF2. To make GCC 4.8 generate an older DWARF version use -g together with -gdwarf-2 or -gdwarf-3. The default for Darwin and VxWorks is still -gdwarf-2 -gstrict-dwarf.
  • A new general optimization level, -Og, has been introduced. It addresses the need for fast compilation and a superior debugging experience while providing a reasonable level of runtime performance. Overall experience for development should be better than the default optimization level -O0.
  • A new option -ftree-partial-pre was added to control the partial redundancy elimination (PRE) optimization. This option is enabled by default at the -O3 optimization level, and it makes PRE more aggressive.
  • The option -fconserve-space has been removed; it was no longer useful on most targets since GCC supports putting variables into BSS without making them common.
  • The struct reorg and matrix reorg optimizations (command-line options -fipa-struct-reorg and -fipa-matrix-reorg) have been removed. They did not always work correctly, nor did they work with link-time optimization (LTO), hence were only applicable to programs consisting of a single translation unit.
  • Several scalability bottle-necks have been removed from GCC's optimization passes. Compilation of extremely large functions, e.g. due to the use of the flatten attribute in the "Eigen" C++ linear algebra templates library, is significantly faster than previous releases of GCC.
  • Link-time optimization (LTO) improvements:
  • LTO partitioning has been rewritten for better reliability and maintanibility. Several important bugs leading to link failures have been fixed.
  • Interprocedural optimization improvements:
  • A new symbol table has been implemented. It builds on existing callgraph and varpool modules and provide a new API. Unusual symbol visibilities and aliases are handled more consistently leading to, for example, more aggressive unreachable code removal with LTO.
  • The inline heuristic can now bypass limits on the size of of inlined functions when the inlining is particularly profitable. This happens, for example, when loop bounds or array strides get propagated.
  • Values passed through aggregates (either by value or reference) are now propagated at the inter-procedural level leading to better inlining decisions (for example in the case of Fortran array descriptors) and devirtualization.
  • AddressSanitizer , a fast memory error detector, has been added and can be enabled via -fsanitize=address. Memory access instructions will be instrumented to detect heap-, stack-, and global-buffer overflow as well as use-after-free bugs. To get nicer stacktraces, use -fno-omit-frame-pointer. The AddressSanitizer is available on IA-32/x86-64/x32/PowerPC/PowerPC64 GNU/Linux and on x86-64 Darwin.
  • ThreadSanitizer has been added and can be enabled via -fsanitize=thread. Instructions will be instrumented to detect data races. The ThreadSanitizer is available on x86-64 GNU/Linux.
  • New Languages and Language specific improvements:
  • C family:
  • Each diagnostic emitted now includes the original source line and a caret '^' indicating the column. The option -fno-diagnostics-show-caret suppresses this information.
  • The option -ftrack-macro-expansion=2 is now enabled by default. This allows the compiler to display the macro expansion stack in diagnostics. Combined with the caret information, an example diagnostic showing these two features is:
  • t.c:1:94: error: invalid operands to binary < (have ‘struct mystruct’ and ‘float’)
  • #define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
  • t.c:7:7: note: in expansion of macro 'MYMAX'
  • X = MYMAX(P, F);
  • A new -Wsizeof-pointer-memaccess warning has been added (also enabled by -Wall) to warn about suspicious length parameters to certain string and memory built-in functions if the argument uses sizeof. This warning warns e.g. about memset (ptr, 0, sizeof (ptr)); if ptr is not an array, but a pointer, and suggests a possible fix, or about memcpy (&foo, ptr, sizeof (&foo));.
  • The new option -Wpedantic is an alias for -pedantic, which is now deprecated. The forms -Wno-pedantic, -Werror=pedantic, and -Wno-error=pedantic work in the same way as for any other -W option. One caveat is that -Werror=pedantic is not equivalent to -pedantic-errors, since the latter makes into errors some warnings that are not controlled by -Wpedantic, and the former only affects diagnostics that are disabled when using -Wno-pedantic.
  • The option -Wshadow no longer warns if a declaration shadows a function declaration, unless the former declares a function or pointer to function, because this is a common and valid case in real-world code.
  • C++:
  • G++ now implements the C++11 thread_local keyword; this differs from the GNU __thread keyword primarily in that it allows dynamic initialization and destruction semantics. Unfortunately, this support requires a run-time penalty for references to non-function-local thread_local variables defined in a different translation unit even if they don't need dynamic initialization, so users may want to continue to use __thread for TLS variables with static initialization semantics.
  • If the programmer can be sure that no use of the variable in a non-defining TU needs to trigger dynamic initialization (either because the variable is statically initialized, or a use of the variable in the defining TU will be executed before any uses in another TU), they can avoid this overhead with the -fno-extern-tls-init option.
  • OpenMP threadprivate variables now also support dynamic initialization and destruction by the same mechanism.
  • G++ now implements the C++11 attribute syntax, e.g.
  • [[noreturn]] void f();
  • and also the alignment specifier, e.g.
  • alignas(double) int i;
  • G++ now implements C++11 inheriting constructors, e.g.
  • struct A { A(int); };
  • struct B: A { using A::A; }; // defines B::B(int)
  • B b(42); // OK
  • G++ now supports a -std=c++1y option for experimentation with features proposed for the next revision of the standard, expected around 2017. Currently the only difference from -std=c++11 is support for return type deduction in normal functions, as proposed in N3386.
  • The G++ namespace association extension, __attribute ((strong)), has been deprecated. Inline namespaces should be used instead.
  • G++ now supports a -fext-numeric-literal option to control whether GNU numeric literal suffixes are accepted as extensions or processed as C++11 user-defined numeric literal suffixes. The flag is on (use suffixes for GNU literals) by default for -std=gnu++*, and -std=c++98. The flag is off (use suffixes for user-defined literals) by default for -std=c++11 and later.
  • Runtime Library (libstdc++):
  • Improved experimental support for the new ISO C++ standard, C++11, including:
  • forward_list meets the allocator-aware container requirements;
  • this_thread::sleep_for(), this_thread::sleep_until() and this_thread::yield() are defined without requiring the configure option --enable-libstdcxx-time;
  • Improvements to :
  • SSE optimized normal_distribution.
  • Use of hardware RNG instruction for random_device on new x86 processors (requires the assembler to support the instruction.)
  • and :
  • New random number engine simd_fast_mersenne_twister_engine with an optimized SSE implementation.
  • New random number distributions beta_distribution, normal_mv_distribution, rice_distribution, nakagami_distribution, pareto_distribution, k_distribution, arcsine_distribution, hoyt_distribution.
  • Added --disable-libstdcxx-verbose configure option to disable diagnostic messages issued when a process terminates abnormally. This may be useful for embedded systems to reduce the size of executables that link statically to the library.
  • Fortran:
  • Compatibility notice:
  • Module files: The version of module files (.mod) has been incremented. Fortran MODULEs compiled by earlier GCC versions have to be recompiled, when they are USEd by files compiled with GCC 4.8. GCC 4.8 is not able to read .mod files created by earlier versions; attempting to do so gives an error message.
  • Note: The ABI of the produced assembler data itself has not changed; object files and libraries are fully compatible with older versions except as noted below.
  • ABI: Some internal names (used in the assembler/object file) have changed for symbols declared in the specification part of a module. If an affected module – or a file using it via use association – is recompiled, the module and all files which directly use such symbols have to be recompiled as well. This change only affects the following kind of module symbols:
  • Procedure pointers. Note: C-interoperable function pointers (type(c_funptr)) are not affected nor are procedure-pointer components.
  • Deferred-length character strings.
  • The BACKTRACE intrinsic subroutine has been added. It shows a backtrace at an arbitrary place in user code; program execution continues normally afterwards.
  • The -Wc-binding-type warning option has been added (disabled by default). It warns if the a variable might not be C interoperable; in particular, if the variable has been declared using an intrinsic type with default kind instead of using a kind parameter defined for C interoperability in the intrinsic ISO_C_Binding module. Before, this warning was always printed. The -Wc-binding-type option is enabled by -Wall.
  • The -Wrealloc-lhs and -Wrealloc-lhs-all warning command-line options have been added, which diagnose when code to is inserted for automatic (re)allocation of a variable during assignment. This option can be used to decide whether it is safe to use -fno-realloc-lhs. Additionally, it can be used to find automatic (re)allocation in hot loops. (For arrays, replacing "var=" by "var(:)=" disables the automatic reallocation.)
  • The -Wcompare-reals command-line option has been added. When this is set, warnings are issued when comparing REAL or COMPLEX types for equality and inequality; consider replacing a == b by abs(a−b) < eps with a suitable eps. -Wcompare-reals is enabled by -Wextra.
  • The -Wtarget-lifetime command-line option has been added (enabled with -Wall), which warns if the pointer in a pointer assignment might outlive its target.
  • Reading floating point numbers which use "q" for the exponential (such as 4.0q0) is now supported as vendor extension for better compatibility with old data files. It is strongly recommended to use for I/O the equivalent but standard conforming "e" (such as 4.0e0).
  • (For Fortran source code, consider replacing the "q" in floating-point literals by a kind parameter (e.g. 4.0e0_qp with a suitable qp). Note that – in Fortran source code – replacing "q" by a simple "e" is not equivalent.)
  • The GFORTRAN_TMPDIR environment variable for specifying a non-default directory for files opened with STATUS="SCRATCH", is not used anymore. Instead gfortran checks the POSIX/GNU standard TMPDIR environment variable. If TMPDIR is not defined, gfortran falls back to other methods to determine the directory for temporary files as documented in the user manual.
  • Fortran 2003:
  • Support for unlimited polymorphic variables (CLASS(*)) has been added. Nonconstant character lengths are not yet supported.
  • TS 29113:
  • Assumed types (TYPE(*)) are now supported.
  • Experimental support for assumed-rank arrays (dimension(..)) has been added. Note that currently gfortran's own array descriptor is used, which is different from the one defined in TS29113, see gfortran's header file or use the Chasm Language Interoperability Tools.
  • New Targets and Target Specific Improvements:
  • AArch64:
  • A new port has been added to support AArch64, the new 64-bit architecture from ARM. Note that this is a separate port from the existing 32-bit ARM port.
  • The port provides initial support for the Cortex-A53 and the Cortex-A57 processors with the command line options -mcpu=cortex-a53 and -mcpu=cortex-a57.
  • ARM:
  • Initial support has been added for the AArch32 extensions defined in the ARMv8 architecture.
  • Code generation improvements for the Cortex-A7 and Cortex-A15 CPUs.
  • A new option, -mcpu=marvell-pj4, has been added to generate code for the Marvell PJ4 processor.
  • The compiler can now automatically generate the VFMA, VFMS, REVSH and REV16 instructions.
  • A new vectorizer cost model for Advanced SIMD configurations to improve the auto-vectorization strategies used.
  • The scheduler now takes into account the number of live registers to reduce the amount of spilling that can occur. This should improve code performance in large functions. The limit can be removed by using the option -fno-sched-pressure.
  • Improvements have been made to the Marvell iWMMX code generation and support for the iWMMX2 SIMD unit has been added. The option -mcpu=iwmmxt2 can be used to enable code generation for the latter.
  • A number of code generation improvements for Thumb2 to reduce code size when compiling for the M-profile processors.
  • The RTEMS (arm-rtems) port has been updated to use the EABI.
  • Code generation support for the old FPA and Maverick floating-point architectures has been removed. Ports that previously relied on these features have also been removed. This includes the targets:
  • arm*-*-linux-gnu (use arm*-*-linux-gnueabi)
  • arm*-*-elf (use arm*-*-eabi)
  • arm*-*-uclinux* (use arm*-*-uclinux*eabi)
  • arm*-*-ecos-elf (no alternative)
  • arm*-*-freebsd (no alternative)
  • arm*-wince-pe* (no alternative).
  • AVR:
  • Support for the "Embedded C" fixed-point has been added. For details, see the GCC wiki and the user manual. The support is not complete.
  • A new print modifier %r for register operands in inline assembler is supported. It will print the raw register number without the register prefix 'r':
  • /* Return the most significant byte of 'val', a 64-bit value. */
  • unsigned char msb (long long val)
  • unsigned char c;
  • __asm__ ("mov %0, %r1+7" : "=r" (c) : "r" (val));
  • return c;
  • The inline assembler in this example will generate code like
  • mov r24, 8+7
  • provided c is allocated to R24 and val is allocated to R8…R15. This works because the GNU assembler accepts plain register numbers without register prefix.
  • Static initializers with 3-byte symbols are supported now:
  • extern const __memx char foo;
  • const __memx void *pfoo = &foo;
  • This requires at least Binutils 2.23.
  • IA-32/x86-64:
  • Allow -mpreferred-stack-boundary=3 for the x86-64 architecture with SSE extensions disabled. Since the x86-64 ABI requires 16 byte stack alignment, this is ABI incompatible and intended to be used in controlled environments where stack space is an important limitation. This option will lead to wrong code when functions compiled with 16 byte stack alignment (such as functions from a standard library) are called with misaligned stack. In this case, SSE instructions may lead to misaligned memory access traps. In addition, variable arguments will be handled incorrectly for 16 byte aligned objects (including x87 long double and __int128), leading to wrong results. You must build all modules with -mpreferred-stack-boundary=3, including any libraries. This includes the system libraries and startup modules.
  • Support for the new Intel processor codename Broadwell with RDSEED, ADCX, ADOX, PREFETCHW is available through -madx, -mprfchw, -mrdseed command-line options.
  • Support for the Intel RTM and HLE intrinsics, built-in functions and code generation is available via -mrtm and -mhle.
  • Support for the Intel FXSR, XSAVE and XSAVEOPT instruction sets. Intrinsics and built-in functions are available via -mfxsr, -mxsave and -mxsaveopt respectively.
  • New -maddress-mode=[short|long] options for x32. -maddress-mode=short overrides default 64-bit addresses to 32-bit by emitting the 0x67 address-size override prefix. This is the default address mode for x32.
  • New built-in functions to detect run-time CPU type and ISA:
  • A built-in function __builtin_cpu_is has been added to detect if the run-time CPU is of a particular type. It returns a positive integer on a match and zero otherwise. It accepts one string literal argument, the CPU name. For example, __builtin_cpu_is("westmere") returns a positive integer if the run-time CPU is an Intel Core i7 Westmere processor. Please refer to the user manual for the list of valid CPU names recognized.
  • A built-in function __builtin_cpu_supports has been added to detect if the run-time CPU supports a particular ISA feature. It returns a positive integer on a match and zero otherwise. It accepts one string literal argument, the ISA feature. For example, __builtin_cpu_supports("ssse3") returns a positive integer if the run-time CPU supports SSSE3 instructions. Please refer to the user manual for the list of valid ISA names recognized.
  • Caveat: If these built-in functions are called before any static constructors are invoked, like during IFUNC initialization, then the CPU detection initialization must be explicitly run using this newly provided built-in function, __builtin_cpu_init. The initialization needs to be done only once. For example, this is how the invocation would look like inside an IFUNC initializer:
  • static void (*some_ifunc_resolver(void))(void)
  • __builtin_cpu_init();
  • if (__builtin_cpu_is("amdfam10h") ...
  • if (__builtin_cpu_supports("popcnt") ...
  • Function Multiversioning Support with G++:
  • It is now possible to create multiple function versions each targeting a specific processor and/or ISA. Function versions have the same signature but different target attributes. For example, here is a program with function versions:
  • __attribute__ ((target ("default")))
  • int foo(void)
  • return 1;
  • __attribute__ ((target ("sse4.2")))
  • int foo(void)
  • return 2;
  • int main (void)
  • int (*p) = &foo;
  • assert ((*p)() == foo());
  • return 0;
  • Please refer to this wiki for more information.
  • The x86 backend has been improved to allow option -fschedule-insns to work reliably. This option can be used to schedule instructions better and leads to improved performace in certain cases.
  • Windows MinGW-w64 targets (*-w64-mingw*) require at least r5437 from the Mingw-w64 trunk.
  • Support for new AMD family 15h processors (Steamroller core) is now available through the -march=bdver3 and -mtune=bdver3 options.
  • Support for new AMD family 16h processors (Jaguar core) is now available through the -march=btver2 and -mtune=btver2 options.
  • FRV:
  • This target now supports the -fstack-usage command-line option.
  • MIPS:
  • GCC can now generate code specifically for the R4700, Broadcom XLP and MIPS 34kn processors. The associated -march options are -march=r4700, -march=xlp and -march=34kn respectively.
  • GCC now generates better DSP code for MIPS 74k cores thanks to further scheduling optimizations.
  • The MIPS port now supports the -fstack-check option.
  • GCC now passes the -mmcu and -mno-mcu options to the assembler.
  • Previous versions of GCC would silently accept -fpic and -fPIC for -mno-abicalls targets like mips*-elf. This combination was not intended or supported, and did not generate position-independent code. GCC 4.8 now reports an error when this combination is used.
  • PowerPC / PowerPC64 / RS6000:
  • SVR4 configurations (GNU/Linux, FreeBSD, NetBSD) no longer save, restore or update the VRSAVE register by default. The respective operating systems manage the VRSAVE register directly.
  • Large TOC support has been added for AIX through the command line option -mcmodel=large.
  • Native Thread-Local Storage support has been added for AIX.
  • VMX (Altivec) and VSX instruction sets now are enabled implicitly when targetting processors that support those hardware features on AIX 6.1 and above.
  • RX:
  • This target will now issue a warning message whenever multiple fast interrupt handlers are found in the same cpmpilation unit. This feature can be turned off by the new -mno-warn-multiple-fast-interrupts command-line option.
  • S/390, System z:
  • Support for the IBM zEnterprise zEC12 processor has been added. When using the -march=zEC12 option, the compiler will generate code making use of the following new instructions:
  • load and trap instructions
  • 2 new compare and trap instructions
  • rotate and insert selected bits - without CC clobber
  • The -mtune=zEC12 option enables zEC12 specific instruction scheduling without making use of new instructions.
  • Register pressure sensitive instruction scheduling is enabled by default.
  • The ifunc function attribute is enabled by default.
  • memcpy and memcmp invokations on big memory chunks or with run time lengths are not generated inline anymore when tuning for z10 or higher. The purpose is to make use of the IFUNC optimized versions in Glibc.
  • SH:
  • The default alignment settings have been reduced to be less aggressive. This results in more compact code for optimization levels other than -Os.
  • Improved support for the __atomic built-in functions:
  • A new option -matomic-model=model selects the model for the generated atomic sequences. The following models are supported:
  • soft-gusa
  • Software gUSA sequences (SH3* and SH4* only). On SH4A targets this will now also partially utilize the movco.l and movli.l instructions. This is the default when the target is sh3*-*-linux* or sh4*-*-linux*.
  • hard-llcs
  • Hardware movco.l / movli.l sequences (SH4A only).
  • soft-tcb
  • Software thread control block sequences.
  • soft-imask
  • Software interrupt flipping sequences (privileged mode only). This is the default when the target is sh1*-*-linux* or sh2*-*-linux*.
  • none
  • Generates function calls to the respective __atomic built-in functions. This is the default for SH64 targets or when the target is not sh*-*-linux*.
  • The option -msoft-atomic has been deprecated. It is now an alias for -matomic-model=soft-gusa.
  • A new option -mtas makes the compiler generate the tas.b instruction for the __atomic_test_and_set built-in function regardless of the selected atomic model.
  • The __sync functions in libgcc now reflect the selected atomic model when building the toolchain.
  • Added support for the mov.b and mov.w instructions with displacement addressing.
  • Added support for the SH2A instructions movu.b and movu.w.
  • Various improvements to code generated for integer arithmetic.
  • Improvements to conditional branches and code that involves the T bit. A new option -mzdcbranch tells the compiler to favor zero-displacement branches. This is enabled by default for SH4* targets.
  • The pref instruction will now be emitted by the __builtin_prefetch built-in function for SH3* targets.
  • The fmac instruction will now be emitted by the fmaf standard function and the __builtin_fmaf built-in function.
  • The -mfused-madd option has been deprecated in favor of the machine-independent -ffp-contract option. Notice that the fmac instruction will now be generated by default for expressions like a * b + c. This is due to the compiler default setting -ffp-contract=fast.
  • Added new options -mfsrra and -mfsca to allow the compiler using the fsrra and fsca instructions on targets other than SH4A (where they are already enabled by default).
  • Added support for the __builtin_bswap32 built-in function. It is now expanded as a sequence of swap.b and swap.w instructions instead of a library function call.
  • The behavior of the -mieee option has been fixed and the negative form -mno-ieee has been added to control the IEEE conformance of floating point comparisons. By default -mieee is now enabled and the option -ffinite-math-only implicitly sets -mno-ieee.
  • Added support for the built-in functions __builtin_thread_pointer and __builtin_set_thread_pointer. This assumes that GBR is used to hold the thread pointer of the current thread. Memory loads and stores relative to the address returned by __builtin_thread_pointer will now also utilize GBR based displacement address modes.
  • SPARC:
  • Added optimized instruction scheduling for Niagara4.
  • TILE-Gx:
  • Added support for the -mcmodel=MODEL command-line option. The models supported are small and large.
  • V850:
  • This target now supports the E3V5 architecture via the use of the new -mv850e3v5 command-line option. It also has experimental support for the e3v5 LOOP instruction which can be enabled via the new -mloop command-line option.
  • XStormy16:
  • This target now supports the -fstack-usage command-line option.

New in version 4.7 (September 21st, 2012)

  • The -fconserve-space flag has been deprecated. The flag had no effect for most targets: only targets without a global .bss section and without support for switchable sections. Furthermore, the flag only had an effect for G++, where it could result in wrong semantics (please refer to the GCC manual for further details). The flag will be removed in GCC 4.8
  • Support for a number of older systems and recently unmaintained or untested target ports of GCC has been declared obsolete in GCC 4.7. 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:
  • picoChip (picochip-*)
  • The following ports for individual systems on particular architectures have been obsoleted:
  • IRIX 6.5 (mips-sgi-irix6.5)
  • MIPS OpenBSD (mips*-*-openbsd*)
  • Solaris 8 (*-*-solaris2.8). Details can be found in the announcement.
  • Tru64 UNIX V5.1 (alpha*-dec-osf5.1*)
  • On ARM, when compiling for ARMv6 (but not ARMv6-M), ARMv7-A, ARMv7-R, or ARMv7-M, the new option -munaligned-access is active by default, which for some source codes generates code that accesses memory on unaligned addresses. This will require the kernel of those systems to enable such accesses (controlled by CP15 register c1, refer to ARM documentation). Alternatively or for compatibility with kernels where unaligned accesses are not supported, all code has to be compiled with -mno-unaligned-access. Linux/ARM in official releases has automatically and unconditionally supported unaligned accesses as emitted by GCC due to this option being active, since Linux version 2.6.28.
  • Support on ARM for the legacy floating-point accelerator (FPA) and the mixed-endian floating-point format that it used has been obsoleted. The ports that still use this format have been obsoleted as well. Many legacy ARM ports already provide an alternative that uses the VFP floating-point format. The obsolete ports will be deleted in the next release.
  • The obsolete ports with alternatives are:
  • arm*-*-rtems (use arm*-*-rtemseabi)
  • arm*-*-linux-gnu (use arm*-*-linux-gnueabi)
  • arm*-*-elf (use arm*-*-eabi)
  • arm*-*-uclinux* (use arm*-*-uclinux*eabi)
  • Note, however, that these alternatives are not binary compatible with their legacy counterparts (although some can support running legacy applications).
  • The obsolete ports that currently lack a modern alternative are:
  • arm*-*-ecos-elf
  • arm*-*-freebsd
  • arm*-wince-pe*
  • New ports that support more recent versions of the architecture are welcome.
  • Support for the Maverick co-processor on ARM has been obsoleted. Code to support it will be deleted in the next release.
  • Support has been removed for Unix International threads on Solaris 2, so the --enable-threads=solaris configure option and the -threads compiler option don't work any longer.
  • Support has been removed for the Solaris BSD Compatibility Package, which lives in /usr/ucbinclude and /usr/ucblib. It has been removed from Solaris 11, and was only intended as a migration aid from SunOS 4 to SunOS 5. The -compat-bsd compiler option is not recognized any longer.
  • The AVR port's libgcc has been improved and its multilib structure has been enhanced. As a result, all objects contributing to an application must either be compiled with GCC versions up to 4.6.x or with GCC versions 4.7.0 or later.
  • The ARM port's -mwords-little-endian option has been deprecated. It will be removed in a future release.
  • Support has been removed for the NetWare x86 configuration obsoleted in GCC 4.6.
  • It is no longer possible to use the "l" constraint in MIPS16 asm statements.
  • GCC versions 4.7.0 and 4.7.1 had changes to the C++ standard library which affected the ABI in C++11 mode: a data member was added to std::list changing its size and altering the definitions of some member functions, and std::pair's move constructor was non-trivial which altered the calling convention for functions with std::pair arguments or return types. The ABI incompatibilities have been fixed for GCC version 4.7.2 but as a result C++11 code compiled with GCC 4.7.0 or 4.7.1 may be incompatible with C++11 code compiled with different GCC versions and with C++98/C++03 code compiled with any version.
  • 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.7.2 and later.)
  • More information on porting to GCC 4.7 from previous versions of GCC can be found in the porting guide for this release.
  • General Optimizer Improvements
  • Support for a new parameter --param case-values-threshold=n was added to allow users to control the cutoff between doing switch statements as a series of if statements and using a jump table.
  • Link-time optimization (LTO) improvements:
  • Improved scalability and reduced memory usage. Link time optimization of Firefox now requires 3GB of RAM on a 64-bit system, while over 8GB was needed previously. Linking time has been improved, too. The serial stage of linking Firefox has been sped up by about a factor of 10.
  • Reduced size of object files and temporary storage used during linking.
  • Streaming performance (both outbound and inbound) has been improved.
  • ld -r is now supported with LTO.
  • Several bug fixes, especially in symbol table handling and merging.
  • Interprocedural optimization improvements:
  • Heuristics now take into account that after inlining code will be optimized out because of known values (or properties) of function parameters. For example:
  • void foo(int a)
  • if (a > 10)
  • ... huge code ...
  • void bar (void)
  • foo (0);
  • The call of foo will be inlined into bar even when optimizing for code size. Constructs based on __builtin_constant_p are now understood by the inliner and code size estimates are evaluated a lot more realistically.
  • The representation of C++ virtual thunks and aliases (both implicit and defined via the alias attribute) has been re-engineered. Aliases no longer pose optimization barriers and calls to an alias can be inlined and otherwise optimized.
  • The inter-procedural constant propagation pass has been rewritten. It now performs generic function specialization. For example when compiling the following:
  • void foo(bool flag)
  • if (flag)
  • ... do something ...
  • else
  • ... do something else ...
  • void bar (void)
  • foo (false);
  • foo (true);
  • foo (false);
  • foo (true);
  • foo (false);
  • foo (true);
  • GCC will now produce two copies of foo. One with flag being true, while other with flag being false. This leads to performance improvements previously possible only by inlining all calls. Cloning causes a lot less code size growth.
  • A string length optimization pass has been added. It attempts to track string lengths and optimize various standard C string functions like strlen, strchr, strcpy, strcat, stpcpy and their _FORTIFY_SOURCE counterparts into faster alternatives. This pass is enabled by default at -O2 or above, unless optimizing for size, and can be disabled by the -fno-optimize-strlen option. The pass can e.g. optimize
  • char *bar (const char *a)
  • size_t l = strlen (a) + 2;
  • char *p = malloc (l); if (p == NULL) return p;
  • strcpy (p, a); strcat (p, "/"); return p;
  • into:
  • char *bar (const char *a)
  • size_t tmp = strlen (a);
  • char *p = malloc (tmp + 2); if (p == NULL) return p;
  • memcpy (p, a, tmp); memcpy (p + tmp, "/", 2); return p;
  • or for hosted compilations where stpcpy is available in the runtime and headers provide its prototype, e.g.
  • void foo (char *a, const char *b, const char *c, const char *d)
  • strcpy (a, b); strcat (a, c); strcat (a, d);
  • can be optimized into:
  • void foo (char *a, const char *b, const char *c, const char *d)
  • strcpy (stpcpy (stpcpy (a, b), c), d);
  • New Languages and Language specific improvements
  • Version 3.1 of the OpenMP specification is now supported for the C, C++, and Fortran compilers.
  • Ada:
  • The command-line option -feliminate-unused-debug-types has been re-enabled by default, as it is for the other languages, leading to a reduction in debug info size of 12.5% and more for relevant cases, as well as to a small compilation speedup.
  • C family:
  • A new built-in, __builtin_assume_aligned, has been added, through which the compiler can be hinted about pointer alignment and can use it to improve generated code.
  • A new -Wunused-local-typedefs warning was added for C, C++, Objective-C and Objective-C++. This warning diagnoses typedefs locally defined in a function, and otherwise not used.
  • A new experimental -ftrack-macro-expansion option was added for C, C++, Objective-C, Objective-C++ and Fortran. It allows the compiler to emit diagnostic about the current macro expansion stack when a compilation error occurs in a macro expansion.
  • Experimental support for transactional memory has been added. It includes support in the compiler, as well as a supporting runtime library called libitm. To compile code with transactional memory constructs, use the -fgnu-tm option.
  • Support is currently available for Alpha, ARM, PowerPC, SH, SPARC, and 32-bit/64-bit x86 platforms.
  • For more details on transactional memory see the GCC WiKi.
  • Support for atomic operations specifying the C++11/C11 memory model has been added. These new __atomic routines replace the existing __sync built-in routines.
  • Atomic support is also available for memory blocks. Lock-free instructions will be used if a memory block is the same size and alignment as a supported integer type. Atomic operations which do not have lock-free support are left as function calls. A set of library functions is available on the GCC atomic wiki in the "External Atomics Library" section.
  • For more details on the memory models and features, see the atomic wiki.
  • When a binary operation is performed on vector types and one of the operands is a uniform vector, it is possible to replace the vector with the generating element. For example:
  • typedef int v4si __attribute__ ((vector_size (16)));
  • v4si res, a = {1,2,3,4};
  • int x;
  • res = 2 + a; /* means {2,2,2,2} + a */
  • res = a - x; /* means a - {x,x,x,x} */
  • There is support for some more features from the C11 revision of the ISO C standard. GCC now accepts the options -std=c11 and -std=gnu11, in addition to the previous -std=c1x and -std=gnu1x.
  • Unicode strings (previously supported only with options such as -std=gnu11, now supported with -std=c11), and the predefined macros __STDC_UTF_16__ and __STDC_UTF_32__.
  • Nonreturning functions (_Noreturn and ).
  • Alignment support (_Alignas, _Alignof, max_align_t, ).
  • A built-in function __builtin_complex is provided to support C library implementation of the CMPLX family of macros.
  • C++:
  • G++ now accepts the -std=c++11, -std=gnu++11, and -Wc++11-compat options, which are equivalent to -std=c++0x, -std=gnu++0x, and -Wc++0x-compat, respectively.
  • G++ now implements C++11 extended friend syntax:
  • template
  • class Q
  • static const int I = 2;
  • public:
  • friend W;
  • struct B
  • int ar[Q::I];
  • Thanks to Ville Voutilainen, G++ now implements C++11 explicit override control.
  • struct B {
  • virtual void f() const final;
  • virtual void f(int);
  • struct D : B {
  • void f() const; // error: D::f attempts to override final B::f
  • void f(long) override; // error: doesn't override anything
  • void f(int) override; // ok
  • struct E final { };
  • struct F: E { }; // error: deriving from final class
  • G++ now implements C++11 non-static data member initializers.
  • struct A {
  • int i = 42;
  • } a; // initializes a.i to 42
  • Thanks to Ed Smith-Rowland, G++ now implements C++11 user-defined literals.
  • // Not actually a good approximation. :)
  • constexpr long double operator"" _degrees (long double d) { return d * 0.0175; }
  • long double pi = 180.0_degrees;
  • G++ now implements C++11 alias-declarations.
  • template using Ptr = T*;
  • Ptr ip; // decltype(ip) is int*
  • Thanks to Ville Voutilainen and Pedro Lamarão, G++ now implements C++11 delegating constructors.
  • struct A {
  • A(int);
  • A(): A(42) { } // delegate to the A(int) constructor
  • G++ now fully implements C++11 atomic classes rather than just integer derived classes.
  • class POD {
  • int a;
  • int b;
  • std::atomic my_atomic_POD;
  • G++ now sets the predefined macro __cplusplus to the correct value, 199711L for C++98/03, and 201103L for C++11.
  • G++ now correctly implements the two-phase lookup rules such that an unqualified name used in a template must have an appropriate declaration found either in scope at the point of definition of the template or by argument-dependent lookup at the point of instantiation. As a result, code that relies on a second unqualified lookup at the point of instantiation to find functions declared after the template or in dependent bases will be rejected. The compiler will suggest ways to fix affected code, and using the -fpermissive compiler flag will allow the code to compile with a warning.
  • template
  • void f() { g(T()); } // error, g(int) not found by argument-dependent lookup
  • void g(int) { } // fix by moving this declaration before the declaration of f
  • template
  • struct A: T {
  • // error, B::g(B) not found by argument-dependent lookup
  • void f() { g(T()); } // fix by using this->g or A::g
  • struct B { void g(B); };
  • int main()
  • f();
  • A().f();
  • G++ now properly re-uses stack space allocated for temporary objects when their lifetime ends, which can significantly lower stack consumption for some C++ functions. As a result of this, some code with undefined behavior will now break:
  • const int &f(const int &i) { return i; }
  • ....
  • const int &x = f(1);
  • const int &y = f(2);
  • Here, x refers to the temporary allocated to hold the 1 argument, which only lives until the end of the initialization; it immediately becomes a dangling reference. So the next statement re-uses the stack slot to hold the 2 argument, and users of x get that value instead.
  • Note that this should not cause any change of behavior for temporaries of types with non-trivial destructors, as they are already destroyed at end of full-expression; the change is that now the storage is released as well.
  • A new command-line option -Wdelete-non-virtual-dtor has been added to warn when delete is used to destroy an instance of a class which has virtual functions and non-virtual destructor. It is unsafe to delete an instance of a derived class through a pointer to a base class if the base class does not have a virtual destructor. This warning is enabled by -Wall.
  • A new command-line option -Wzero-as-null-pointer-constant has been added to warn when a literal '0' is used as null pointer constant. It can be useful to facilitate the conversion to nullptr in C++11.
  • As per C++98, access-declarations are now deprecated by G++. Using-declarations are to be used instead. Furthermore, some efforts have been made to improve the support of class scope using-declarations. In particular, using-declarations referring to a dependent type now work as expected (bug c++/14258).
  • The ELF symbol visibility of a template instantiation is now properly constrained by the visibility of its template arguments (bug c++/35688).
  • Runtime Library (libstdc++):
  • Improved experimental support for the new ISO C++ standard, C++11, including:
  • using noexcept in most of the library;
  • implementations of pointer_traits, allocator_traits and scoped_allocator_adaptor;
  • uses-allocator construction for tuple;
  • vector meets the allocator-aware container requirements;
  • replacing monotonic_clock with steady_clock;
  • enabling the thread support library on most POSIX targets;
  • many small improvements to conform to the FDIS.
  • Added --enable-clocale=newlib configure option.
  • Debug Mode iterators for unordered associative containers.
  • Avoid polluting the global namespace and do not include .
  • Fortran:
  • The compile flag -fstack-arrays has been added, which causes all local arrays to be put on stack memory. For some programs this will improve the performance significantly. If your program uses very large local arrays, it is possible that you will have to extend your runtime limits for stack memory.
  • The -Ofast flag now also implies -fno-protect-parens and -fstack-arrays.
  • Front-end optimizations can now be selected by the -ffrontend-optimize option and deselected by the -fno-frontend-optimize option.
  • When front-end optimization removes a function call, -Wfunction-elimination warns about that.
  • When performing front-end-optimization, the -faggressive-function-elimination option allows the removal of duplicate function calls even for impure functions.
  • The flag -Wreal-q-constant has been added, which warns if floating-point literals have been specified using q (such as 1.0q0); the q marker is now supported as a vendor extension to denote quad precision (REAL(16) or, if not available, REAL(10)). Consider using a kind parameter (such as in 1.0_qp) instead, which can be obtained via SELECTED_REAL_KIND.
  • The GFORTRAN_USE_STDERR environment variable has been removed. GNU Fortran now always prints error messages to standard error. If you wish to redirect standard error, please consult the manual for your OS, shell, batch environment etc. as appropriate.
  • The -fdump-core option and GFORTRAN_ERROR_DUMPCORE environment variable have been removed. When encountering a serious error, gfortran will now always abort the program. Whether a core dump is generated depends on the user environment settings; see the ulimit -c setting for POSIX shells, limit coredumpsize for C shells, and the WER user-mode dumps settings on Windows.
  • The -fbacktrace option is now enabled by default. When encountering a fatal error, gfortran will attempt to print a backtrace to standard error before aborting. It can be disabled with -fno-backtrace. Note: On POSIX targets with the addr2line utility from GNU binutils, GNU Fortran can print a backtrace with function name, file name, line number information in addition to the addresses; otherwise only the addresses are printed.
  • Fortran 2003:
  • Generic interface names which have the same name as derived types are now supported, which allows to write constructor functions. Note that Fortran does not support static constructor functions; only default initialization or an explicit structure-constructor initialization are available.
  • Polymorphic (class) arrays are now supported.
  • Fortran 2008:
  • Support for the DO CONCURRENT construct has been added, which allows the user to specify that individual loop iterations have no interdependencies.
  • Coarrays: Full single-image support except for polymorphic coarrays. Additionally, preliminary support for multiple images via an MPI-based coarray communication library has been added. Note: The library version is not yet usable as remote coarray access is not yet possible.
  • TS 29113:
  • New flag -std=f2008ts permits programs that are expected to conform to the Fortran 2008 standard and the draft Technical Specification (TS) 29113 on Further Interoperability of Fortran with C.
  • The OPTIONAL attribute is now allowed for dummy arguments of BIND(C) procedures.
  • The RANK intrinsic has been added.
  • The implementation of the ASYNCHRONOUS attribute in GCC is compatible with the candidate draft of TS 29113 (since GCC 4.6).
  • Go:
  • GCC 4.7 implements the Go 1 language standard. The library support in 4.7.0 is not quite complete, due to release timing. Release 4.7.1 includes complete support for Go 1. The Go library is from the Go 1.0.1 release.
  • Go has been tested on GNU/Linux and Solaris platforms. It may work on other platforms as well.
  • New Targets and Target Specific Improvements:
  • ARM:
  • GCC now supports the Cortex-A7 processor implementing the v7-a version of the architecture using the option -mcpu=cortex-a7.
  • The default vector size in auto-vectorization for NEON is now 128 bits. If vectorization fails thusly, the vectorizer tries again with 64-bit vectors.
  • A new option -mvectorize-with-neon-double was added to allow users to change the vector size to 64 bits.
  • AVR:
  • GCC now supports the XMEGA architecture. This requires GNU binutils 2.22 or later.
  • Support for the named address spaces __flash, __flash1, …, __flash5 and __memx has been added. These address spaces locate read-only data in flash memory and allow reading from flash memory by means of ordinary C code, i.e. without the need of (inline) assembler code:
  • const __flash int values[] = { 42, 31 };
  • int add_values (const __flash int *p, int i)
  • return values[i] + *p;
  • Support has been added for a new AVR-specific configure option --with-avrlibc=yes in order to arrange for better integration of AVR-Libc. This configure option is supported in avr-gcc 4.7.2 and newer and will only take effect in non-RTEMS configurations. If avr-gcc is configured for RTEMS, the option will be ignored which is the same as specifying --with-avrlibc=no. See PR54461 for more technical details.
  • Support for AVR-specific built-in functions has been added.
  • Support has been added for the signed and unsigned 24-bit scalar integer types __int24 and __uint24.
  • New command-line options -maccumulate-args, -mbranch-cost=cost and -mstrict-X were added to allow better fine-tuning of code optimization.
  • The command option -fdata-sections now also takes affect on the section names of variables with the progmem attribute.
  • A new inline assembler print modifier %i to print a RAM address as I/O address has been added:
  • #include /* Port Definitions from AVR-LibC */
  • void set_portb (uint8_t value)
  • asm volatile ("out %0, %i1" :: "r" (value), "n" (&PORTB) : "memory");
  • The offset between an I/O address and the RAM address for that I/O location is device-specific. This offset is taken into account when printing a RAM address with the %i modifier so that the address is suitable to be used as operand in an I/O command. The address must be a constant integer known at compile time.
  • The inline assembler constraint "R" to represent integers in the range −6 … 5 has been removed without replacement.
  • Many optimizations to:
  • 64-bit integer arithmetic
  • Widening multiplication
  • Integer division by a constant
  • Avoid constant reloading in multi-byte instructions.
  • Micro-optimizations for special instruction sequences.
  • Generic built-in functions like __builtin_ffs*, __builtin_clz*, etc.
  • If-else decision trees generated by switch instructions
  • Merging of data located in flash memory
  • New libgcc variants for devices with 8-bit wide stack pointer
  • Better documentation:
  • Handling of EIND and indirect jumps on devices with more than 128 KiB of program memory.
  • Handling of the RAMPD, RAMPX, RAMPY and RAMPZ special function registers.
  • Function attributes OS_main and OS_task.
  • AVR-specific built-in macros.
  • C6X:
  • Support has been added for the Texas Instruments C6X family of processors.
  • CR16:
  • Support has been added for National Semiconductor's CR16 architecture.
  • Epiphany:
  • Support has been added for Adapteva's Epiphany architecture.
  • IA-32/x86-64:
  • Support for Intel AVX2 intrinsics, built-in functions and code generation is available via -mavx2.
  • Support for Intel BMI2 intrinsics, built-in functions and code generation is available via -mbmi2.
  • Implementation and automatic generation of __builtin_clz* using the lzcnt instruction is available via -mlzcnt.
  • Support for Intel FMA3 intrinsics and code generation is available via -mfma.
  • A new -mfsgsbase command-line option is available that makes GCC generate new segment register read/write instructions through dedicated built-ins.
  • Support for the new Intel rdrnd instruction is available via -mrdrnd.
  • Two additional AVX vector conversion instructions are available via -mf16c.
  • Support for new Intel processor codename IvyBridge with RDRND, FSGSBASE and F16C is available through -march=core-avx-i.
  • Support for the new Intel processor codename Haswell with AVX2, FMA, BMI, BMI2, LZCNT is available through -march=core-avx2.
  • Support for new AMD family 15h processors (Piledriver core) is now available through -march=bdver2 and -mtune=bdver2 options.
  • Support for the x32 psABI is now available through the -mx32 option.
  • Windows mingw targets are using the -mms-bitfields option by default.
  • Windows x86 targets are using the __thiscall calling convention for C++ class-member functions.
  • Support for the configure option --with-threads=posix for Windows mingw targets.
  • MIPS:
  • GCC now supports thread-local storage (TLS) for MIPS16. This requires GNU binutils 2.22 or later.
  • GCC can now generate code specifically for the Cavium Octeon+ and Octeon2 processors. The associated command-line options are -march=octeon+ and -march=octeon2 respectively. Both options require GNU binutils 2.22 or later.
  • GCC can now work around certain 24k errata, under the control of the command-line option -mfix-24k. These workarounds require GNU binutils 2.20 or later.
  • 32-bit MIPS GNU/Linux targets such as mips-linux-gnu can now build n32 and n64 multilibs. The result is effectively a 64-bit GNU/Linux toolchain that generates 32-bit code by default. Use the configure-time option --enable-targets=all to select these extra multilibs.
  • Passing -fno-delayed-branch now also stops the assembler from automatically filling delay slots.
  • PowerPC/PowerPC64:
  • Vectors of type vector long long or vector long are passed and returned using the same method as other vectors with the VSX instruction set. Previously GCC did not adhere to the ABI for 128-bit vectors with 64-bit integer base types (PR 48857). This will also be fixed in the GCC 4.6.1 and 4.5.4 releases.
  • A new option -mno-pointers-to-nested-functions was added to allow AIX 32-bit/64-bit and GNU/Linux 64-bit PowerPC users to specify that the compiler should not load up the chain register (r11) before calling a function through a pointer. If you use this option, you cannot call nested functions through a pointer, or call other languages that might use the static chain.
  • A new option msave-toc-indirect was added to allow AIX 32-bit/64-bit and GNU/Linux 64-bit PowerPC users control whether we save the TOC in the prologue for indirect calls or generate the save inline. This can speed up some programs that call through a function pointer a lot, but it can slow down other functions that only call through a function pointer in exceptional cases.
  • The PowerPC port will now enable machine-specific built-in functions when the user switches the target machine using the #pragma GCC target or __attribute__ ((__target__ ("target"))) code sequences. In addition, the target macros are updated. However, due to the way the -save-temps switch is implemented, you won't see the effect of these additional macros being defined in preprocessor output.
  • SH:
  • A new option -msoft-atomic has been added. When it is specified, GCC will generate GNU/Linux-compatible gUSA atomic sequences for the new __atomic routines.
  • Since it is neither supported by GAS nor officially documented, code generation for little endian SH2A has been disabled. Specifying -ml with -m2a* will now result in a compiler error.
  • The defunct -mbranch-cost option has been fixed.
  • Some improvements to the generated code of:
  • Utilization of the tst #imm,R0 instruction.
  • Dynamic shift instructions on SH2A.
  • Integer absolute value calculations.
  • SPARC:
  • The option -mflat has been reinstated. When it is specified, the compiler will generate code for a single register window model. This is essentially a new implementation and the corresponding debugger support has been added to GDB 7.4.
  • Support for the options -mtune=native and -mcpu=native has been added on selected native platforms (GNU/Linux and Solaris).
  • Support for the SPARC T3 (Niagara 3) processor has been added.
  • VIS:
  • An intrinsics header visintrin.h has been added.
  • Builtin intrinsics for the VIS 1.0 edge handling and pixel compare instructions have been added.
  • The little-endian version of alignaddr is now supported.
  • When possible, VIS builtins are marked const, which should increase the compiler's ability to optimize VIS operations.
  • The compiler now properly tracks the %gsr register and how it behaves as an input for various VIS instructions.
  • Akin to fzero, the compiler can now generate fone instructions in order to set all of the bits of a floating-point register to 1.
  • The documentation for the VIS intrinsics in the GCC manual has been brought up to date and many inaccuracies were fixed.
  • Intrinsics for the VIS 2.0 bmask, bshuffle, and non-condition-code setting edge instructions have been added. Their availability is controlled by the new -mvis2 and -mno-vis2 options. They are enabled by default on UltraSPARC-III and later CPUs.
  • Support for UltraSPARC Fused Multiply-Add floating-point extensions has been added. These instructions are enabled by default on SPARC T3 (Niagara 3) and later CPUs.
  • TILE-Gx/TILEPro:
  • Support has been added for the Tilera TILE-Gx and TILEPro families of processors.
  • Other significant improvements:
  • A new option (-grecord-gcc-switches) was added that appends compiler command-line options that might affect code generation to the DW_AT_producer attribute string in the DWARF debugging information.
  • GCC now supports various new GNU extensions to the DWARF debugging information format, like entry value and call site information, typed DWARF stack or a more compact macro representation. Support for these extensions has been added to GDB 7.4. They can be disabled through the -gstrict-dwarf command-line option.