GCC now uses C++ as its implementation language. This means thatto build GCC from sources, you will need a C++ compiler thatunderstands C++ 2003. For more details on the rationale and specificchanges, please refer to theC++ conversionpage.
To enable the Graphite framework for loop optimizations you nowneed CLooG version 0.18.0 and ISL version 0.11.1. Both can be obtainedfrom theGCC infrastructuredirectory. The installation manual containsmore information about requirements to build GCC.
GCC now uses a more aggressive analysis to derive an upper bound forthe number of iterations of loops using constraints imposed by languagestandards. This may cause non-conforming programs to no longer work asexpected, such as SPEC CPU 2006 464.h264ref and 416.gamess. A newoption,-fno-aggressive-loop-optimizations, was addedto disable this aggressive analysis. In some loops that have knownconstant number of iterations, but undefined behavior is known to occurin the loop before reaching or during the last iteration, GCC will warnabout the undefined behavior in the loop instead of deriving lower upperbound of the number of iterations for the loop. The warningcan be disabled with-Wno-aggressive-loop-optimizations.
On ARM, a bug has been fixed in GCC's implementation of the AAPCSrules for the layout of vectors that could lead to wrong code beinggenerated. Vectors larger than 8 bytes in size are now by defaultaligned to an 8-byte boundary. This is an ABI change: code that makesexplicit use of vector types may be incompatible with binary objectsbuilt with older versions of GCC. Auto-vectorized code is not affectedby this change.
More information on porting to GCC 4.8 from previous versions of GCC can be found in theporting guide for this release.
-g is used on a platform that uses DWARF debugging information, GCC will now default to-gdwarf-4 -fno-debug-types-section.-g together with-gdwarf-2 or-gdwarf-3. The default for Darwin and VxWorks is still-gdwarf-2 -gstrict-dwarf.-Og, has been introduced. It addresses the need for fast compilation and a superior debugging experience while providing a reasonable level of run-time performance. Overall experience for development should be better than the default optimization level-O0.-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.-fconserve-space has been removed; it was no longer useful on most targets since GCC supports putting variables into BSS without making them common.-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.flatten attribute in the "Eigen" C++ linear algebra templates library, is significantly faster than previous releases of GCC.-fsanitize=address. Memory accessinstructions will be instrumented to detect heap-, stack-, andglobal-buffer overflow as well as use-after-free bugs. To getnicer stacktraces, use-fno-omit-frame-pointer. TheAddressSanitizer is available on IA-32/x86-64/x32/PowerPC/PowerPC64GNU/Linux and on x86-64 Darwin.-fsanitize=thread. Instructions will be instrumented todetect data races. The ThreadSanitizer is available on x86-64GNU/Linux.-fno-diagnostics-show-caret suppresses this information.-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); ^-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 usessizeof. This warning warns e.g. aboutmemset (ptr, 0, sizeof (ptr)); ifptr is not an array, but a pointer, and suggests a possible fix, or aboutmemcpy (&foo, ptr, sizeof (&foo));.-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 isnot 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.-Wshadow no longer warns if a declaration shadows a function declaration, unless the former declares a function or pointer to function, because this isa common and valid case in real-world code.G++ now implements theC++11thread_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-localthread_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.
OpenMPthreadprivate variables now also support dynamic initialization and destruction by the same mechanism.
and also the alignment specifier, e.g.[[noreturn]] void f();
alignas(double) int i;
struct A { A(int); };struct B: A { using A::A; }; // defines B::B(int)B b(42); // OKdecltype semantics fromN3276.struct A f();decltype(f()) g(); // OK, return type of f() is not required to be complete.
struct A { int f() &; };int i = A().f(); // error, f() requires an lvalue object-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 inN3386. Status of C++1y features in GCC 4.8 can be foundhere.__attribute ((strong)), has been deprecated. Inline namespaces should be used instead.-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.forward_list meets the allocator-aware container requirements;this_thread::sleep_for(),this_thread::sleep_until() andthis_thread::yield() are defined without requiring the configure option--enable-libstdcxx-time;<random>:normal_distribution.random_device on new x86 processors (requires the assembler to support the instruction.)<ext/random>:simd_fast_mersenne_twister_engine with an optimized SSE implementation.beta_distribution,normal_mv_distribution,rice_distribution,nakagami_distribution,pareto_distribution,k_distribution,arcsine_distribution,hoyt_distribution.--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..mod) has been incremented. FortranMODULEs compiled by earlier GCC versions have to be recompiled, when they areUSEd by files compiled with GCC 4.8. GCC 4.8 is not able to read.mod files created by earlier versions; attempting to do sogives an error message.type(c_funptr)) are not affected nor are procedure-pointer components.BACKTRACE intrinsic subroutine has been added. It shows a backtrace at an arbitrary place in user code; program execution continues normally afterwards. -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 intrinsicISO_C_Binding module. Before, this warning was always printed. The-Wc-binding-type option is enabled by-Wall.-Wrealloc-lhs and-Wrealloc-lhs-all warning command-line options have been added, which diagnose when code 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, replacingvar= byvar(:)= disables the automatic reallocation.)-Wcompare-reals command-line option has been added. When this is set, warnings are issued when comparingREAL orCOMPLEX types for equality and inequality; consider replacinga == b byabs(a−b) < eps with a suitableeps.-Wcompare-reals is enabled by-Wextra.-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
for the exponential (such asq4.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
(such ase4.0e0).
(For Fortran source code, consider replacing the
in floating-point literals by a kind parameter (e.g.q4.0e0_qp with a suitableqp). Note that – in Fortran source code – replacing
by a simpleq
isnot equivalent.)e
GFORTRAN_TMPDIR environment variable for specifying a non-default directory for files opened withSTATUS="SCRATCH", is not used anymore. Instead gfortran checks the POSIX/GNU standardTMPDIR environment variable. IfTMPDIR is not defined, gfortran falls back to other methods to determine the directory for temporary files as documented in theuser manual.CLASS(*)) has been added. Nonconstant character lengths are not yet supported.TYPE(*)) are now supported.dimension(..)) has been added. Note that currently gfortran's own array descriptor is used, which is different from the one defined in TS29113, seegfortran's header file or use theChasm Language Interoperability Tools.-mcpu=cortex-a53 and-mcpu=cortex-a57.-mfix-cortex-a53-835769 option. Alternatively it can be enabled by default by configuring GCC with the--enable-fix-cortex-a53-835769 option.-mcpu=marvell-pj4, has been added to generate code for the Marvell PJ4 processor.VFMA,VFMS,REVSH andREV16 instructions.-fno-sched-pressure.-mcpu=iwmmxt2 can be used to enable code generation for the latter.arm-rtems) port has been updated to use the EABI.arm*-*-linux-gnu (usearm*-*-linux-gnueabi)arm*-*-elf (usearm*-*-eabi)arm*-*-uclinux* (usearm*-*-uclinux*eabi)arm*-*-ecos-elf (no alternative)arm*-*-freebsd (no alternative)arm*-wince-pe* (no alternative).-mshort-calls has been removed. It was deprecated in GCC 4.7.--with-avrlibc supported since GCC 4.7.2 is turned on per default for all non-RTEMS configurations. This option arranges for a better integration ofAVR-LibC with avr-gcc. For technical details, seePR54461. To turn off the option in non-AVR-LibC configurations, use--with-avrlibc=no. If the compiler is configured for RTEMS, the option is always turned off.%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 likemov r24, 8+7provided
c is allocated toR24 andval is allocated toR8…R15. This works because the GNU assembler accepts plain register numbers without register prefix.extern const __memx char foo; const __memx void *pfoo = &foo;This requires at least Binutils 2.23.
-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 x87long 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.RDSEED,ADCX,ADOX,PREFETCHW is available through-madx,-mprfchw,-mrdseed command-line options.-mrtm and-mhle.-mfxsr,-mxsave and-mxsaveopt respectively.-maddress-mode=[short|long] options for x32.-maddress-mode=short overrides default 64-bit addresses to 32-bit by emitting the0x67 address-size override prefix. This is the default address mode for x32.__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.__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") ... }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 thiswiki for more information.-fschedule-insns to work reliably. This option can be used to schedule instructions better and leads to improved performace in certain cases.*-w64-mingw*) require at least r5437 from the Mingw-w64 trunk.-march=bdver3 and-mtune=bdver3 options.-march=btver2 and-mtune=btver2 options.-fstack-usage command-line option.-march options are-march=r4700,-march=xlp and-march=34kn respectively.-fstack-check option.-mmcu and-mno-mcu options to the assembler.-fpic and-fPIC for-mno-abicalls targets likemips*-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.-mcmodel=large.-mno-warn-multiple-fast-interrupts command-line option.-march=zEC12 option, the compiler will generate code making use of the following new instructions:-mtune=zEC12 option enables zEC12 specific instruction scheduling without making use of new instructions.ifunc function attribute is enabled by default.memcpy andmemcmp 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.-Os.__atomic built-in functions:-matomic-model=model selects the model for the generated atomic sequences. The following models are supported:soft-gusamovco.l andmovli.l instructions. This is the default when the target issh3*-*-linux* orsh4*-*-linux*.hard-llcsmovco.l /movli.l sequences (SH4A only).soft-tcbsoft-imasksh1*-*-linux* orsh2*-*-linux*.none__atomic built-in functions. This is the default for SH64 targets or when the target is notsh*-*-linux*.-msoft-atomic has been deprecated. It is now an alias for-matomic-model=soft-gusa.-mtas makes the compiler generate thetas.b instruction for the__atomic_test_and_set built-in function regardless of the selected atomic model.__sync functions inlibgcc now reflect the selected atomic model when building the toolchain.mov.b andmov.w instructions with displacement addressing.movu.b andmovu.w.-mzdcbranch tells the compiler to favor zero-displacement branches. This is enabled by default for SH4* targets.pref instruction will now be emitted by the__builtin_prefetch built-in function for SH3* targets.fmac instruction will now be emitted by thefmaf standard function and the__builtin_fmaf built-in function.-mfused-madd option has been deprecated in favor of the machine-independent-ffp-contract option. Notice that thefmac instruction will now be generated by default for expressions likea * b + c. This is due to the compiler default setting-ffp-contract=fast.-mfsrra and-mfsca to allow the compiler using thefsrra andfsca instructions on targets other than SH4A (where they are already enabled by default).__builtin_bswap32 built-in function. It is now expanded as a sequence ofswap.b andswap.w instructions instead of a library function call.-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.__builtin_thread_pointer and__builtin_set_thread_pointer. This assumes thatGBR 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 utilizeGBR based displacement address modes.-mdiv= option for targets other than SHmedia has been fixed and documented.-mcmodel=MODEL command-line option. The models supported aresmall andlarge.E3V5 architecture via the use of the new-mv850e3v5 command-line option. It also has experimental support for the e3v5LOOP instruction which can be enabled via the new-mloop command-line option.-fstack-usage command-line option.-static orstatic-libgcc on the command line. However it is strongly advised against, as it will cause problems for any application that makes use of DLLs compiled by GCC. It should be alright for a monolithic stand-alone application that only links against the Windows DLLs, but offers little or no benefit.This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 4.8.1 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
The C++11<chrono>std::chrono::system_clock andstd::chrono::steady_clock classes have changed ABI inGCC 4.8.1, they both are now separate (never typedefs of each other),both usestd::chrono::nanoseconds resolution, on mostGNU/Linux configurationsstd::chrono::steady_clock is nowfinally monotonic, and both classes are mangled differently than inthe previous GCC releases.std::chrono::system_clock::now() withstd::chrono::microseconds resp.std::chrono::seconds resolution is still exported for backwardscompatibility with default configured libstdc++. Note that libstdc++configured with--enable-libstdcxx-time= used to be ABIincompatible with default configured libstdc++ for those two classes andno ABI compatibility can be offered for those configurations, so any C++11code that uses those classes and has been compiled and linked againstlibstdc++ configured with the non-default--enable-libstdcxx-time= configuration option needs to berecompiled.
This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 4.8.2 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 4.8.3 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
Support for the new powerpc64le-linux platform has been added. Itdefaults to generating code that conforms to the ELFV2 ABI.
This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 4.8.4 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 4.8.5 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
Copyright (C)Free Software Foundation, Inc.Verbatim copying and distribution of this entire article ispermitted in any medium, provided this notice is preserved.
These pages aremaintained by the GCC team.Last modified 2025-10-05.