GCC Changelog

What's new in GCC 12.1.0

May 6, 2022
  • Caveats:
  • An ABI incompatibility between C and C++ when passing or returning by value certain aggregates containing zero width bit-fields has been discovered on various targets. As mentioned in PR102024, since the PR42217 fix in GCC 4.5 the C++ front-end has been removing zero width bit-fields from the internal representation of the aggregates after the layout of those aggregates, but the C front-end kept them, so passing e.g. struct S { float a; int : 0; float b; } or struct T { float c; int : 0; } by value could differ between C and C++. Starting with GCC 12 the C++ front-end no longer removes those bit-fields from the internal representation and per clarified psABI some targets have been changed, so that they either ignore those bit-fields in the argument passing by value decisions in both C and C++, or they always take them into account. x86-64, ARM and AArch64 will always ignore them (so there is a C ABI incompatibility between GCC 11 and earlier with GCC 12 or later), PowerPC64 ELFv2 and S/390 always take them into account (so there is a C++ ABI incompatibility, GCC 4.4 and earlier compatible with GCC 12 or later, incompatible with GCC 4.5 through GCC 11). RISC-V has changed the handling of these already starting with GCC 10. As the ABI requires, MIPS takes them into account handling function return values so there is a C++ ABI incompatibility with GCC 4.5 through 11. For function arguments on MIPS, refer to the MIPS specific entry. GCC 12 on the above targets will report such incompatibilities as warnings or other diagnostics unless -Wno-psabi is used.
  • C: Computed gotos require a pointer type now.
  • C++: Two non-standard std::pair constructors have been deprecated. These allowed the use of an rvalue and a literal 0 to construct a pair containing a move-only type and a pointer. The nullptr keyword should be used to initialize the pointer member instead of a literal 0, as this is portable to other C++ implementations.
  • The configuration option --enable-libstdcxx-allocator no longer supports the bitmap, mt, and pool arguments. Those configurations had been broken for some time.
  • Fortran: OpenMP code using the omp_lib.h include file can no longer be compiled with -std=f95 but now requires at least -std=f2003. Alternatively, use the omp_lib module, which still supports -std=f95 and is recommended to be used instead in general.
  • OpenMP offloading to Intel MIC has been deprecated and will be removed in a future release.
  • The cr16 target with the cr16-*-* configuration has been obsoleted and will be removed in a future release.
  • The hppa[12]*-*-hpux10* and hppa[12]*-*-hpux11* configurations targeting 32-bit PA-RISC with HP-UX have been obsoleted and will be removed in a future release.
  • The m32c*-*-rtems* configuration has been obsoleted and will be removed in a future release.
  • The support for the m32r-*-linux*, m32rle-*-linux*, m68k*-*-openbsd* and vax-*-openbsd* configurations has been removed.
  • STABS: Support for emitting the STABS debugging format is deprecated and will be removed in the next release. All ports now default to emit DWARF (version 2 or later) debugging info or are obsoleted.
  • The optimization level -Ofast now implies -fno-semantic-interposition.
  • General Improvements:
  • Vectorization is enabled at -O2 which is now equivalent to the original -O2 -ftree-vectorize -fvect-cost-model=very-cheap. Note that default vectorizer cost model has been changed which used to behave as -fvect-cost-model=cheap were specified.
  • GCC now supports the ShadowCallStack sanitizer, which can be enabled using the command-line option -fsanitize=shadow-call-stack. This sanitizer currently only works on AArch64 targets and it requires an environment in which all code has been compiled with -ffixed-r18. Its primary initial user is the Linux kernel.
  • New Languages and Language specific improvements:
  • OpenMP:
  • OpenMP 5.0 support has been extended: The close map modifier and the affinity clause are now supported. In addition Fortran gained additionally the following features which were available in C and C++ before: declare variant is now available, depobj, mutexinoutset and iterator can now also be used with the depend clause, defaultmap has been updated for OpenMP 5.0, and the loop directive and combined directives involving the master directive have been added.
  • The following OpenMP 5.1 features have been added: support for expressing OpenMP directives as C++ 11 attributes, the masked and scope construct, the nothing and error directives, and using primary with the proc_bind clause and OMP_PROC_BIND environment variable, the reproducible and unconstrained modifiers to the order clause, and, for C/C++ only, the align and allocator modifiers to the allocate clause and the atomic extensions are now available. The OMP_PLACE environment variable supports the OpenMP 5.1 features. In addition the OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT environment variables and their associated API routines are now supported as well as the memory-allocation routines added for Fortran and extended for C/C++ in OpenMP 5.1. In Fortran code, strictly structured blocks can be used.
  • The OpenMP Implementation Status can be found in the libgomp manual.
  • Version 2.6 of the OpenACC specification continues to be maintained and improved in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information. In addition to general performance tuning and bug fixing, new features include:
  • OpenACC worker parallelism for AMD GPUs (already for a long time supported for Nvidia GPUs).
  • Data privatization/sharing at the OpenACC gang level.
  • Considerable improvements for the experimental OpenACC 'kernels' decomposition (--param openacc-kernels=decompose).
  • A new warning flag -Wopenacc-parallelism to warn about potentially suboptimal choices related to OpenACC parallelism.
  • The offload target code generation for OpenMP and OpenACC can now be better adjusted using the new -foffload-options= flag and the pre-existing but now documented -foffload= flag.
  • Ada:
  • Ada 2022:
  • Added the -gnat2022 flag to indicate strict Ada 2022 compliance. The old -gnat2020 flag is now deprecated.
  • Support for Big Numbers (Annex G) has seen continuous improvements. It is now considered complete. It is compatible with SPARK, i.e. can be used from SPARK code.
  • Continuous improvements to the Ada 2022 standard since GCC 11.
  • Greatly improved compile time support. More functions can now have the with Static aspect and can be used in more contexts.
  • Ada 2022 extensions. The use of the -gnatX flag is necessary to access these features as they are not considered stable or standard.
  • Fixed lower bound for unconstrained arrays.
  • type Matrix is array (Natural range 0 .. , Natural range 0 .. ) of Integer; is now valid.
  • Subtypes can also specify a lower bound: subtype String_1 is String (1 .. );. Boundaries from slices will "slide" to the correct lower bound of the subtype.
  • Generalized Object.Operand notation. The follwing code is now valid V.Add_Element(42);, with V being a vector, for example.
  • Additional when constructs. Keywords return, goto and raise can now use when in addition to the existing exit when. The following expression is therefore now valid raise Constraint_Error with "Element is null" when Element = null;
  • Pattern matching
  • The case statement has been extended to cover records and arrays as well as finer grained casing on scalar types. In the future it is expected to provide more compile time guarantees when accessing discriminated fields. Case exhaustion is supported for pattern matching.
  • gnatfind and gnatxref, which were already deprecated, have been removed.
  • Greatly expanded code covered by contracts. Thanks to this work, there are now several Ada standard libraries fully proven in SPARK which means they have no runtime nor logical errors. They are mostly numeric and string handling libraries.
  • Enable return-slot optimization for Pure functions.
  • General optimizations, improvements and additions to the standard library. Performance, correctness and in some cases stability was improved. Memory pools have also seen some minor enhancements.
  • Improvements to embedded-RTOS targets such as RTEMS, VxWorks and QNX. Older targets were removed or cleaned.
  • Added some hardening features.
  • C family:
  • Support for __builtin_shufflevector compatible with the clang language extension was added.
  • Support for attribute unavailable was added.
  • A new built-in function, __builtin_assoc_barrier, was added. It can be used to inhibit re-association of floating-point expressions.
  • Support for __builtin_dynamic_object_size compatible with the clang language extension was added.
  • New warnings:
  • -Wbidi-chars warns about potentially misleading UTF-8 bidirectional control characters. The default is -Wbidi-chars=unpaired (PR103026)
  • -Warray-compare warns about comparisons between two operands of array type (PR97573)
  • Enhancements to existing warnings:
  • -Wattributes has been extended so that it's possible to use -Wno-attributes=ns::attr or -Wno-attributes=ns:: to suppress warnings about unknown scoped attributes (in C++11 and C2X). Similarly, #pragma GCC diagnostic ignored_attributes "vendor::attr" can be used to achieve the same effect (PR101940)
  • Some new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • Digit separators (as in C++) are supported for C2X.
  • The #elifdef and #elifndef preprocessing directives are now supported.
  • The printf and scanf format checking with -Wformat now supports the %b format specified by C2X for binary integers, and the %B format recommended by C2X for printf.
  • C++:
  • Several C++23 features have been implemented:
  • P1938R3, if consteval (PR100974)
  • P0849R8, auto(x): decay-copy in the language (PR103049)
  • P2242R3, Non-literal variables (and labels and gotos) in constexpr functions (PR102612)
  • P2334R1, Support for preprocessing directives elifdef and elifndef (PR102616)
  • P2360R0, Extend init-statement to allow alias-declaration (PR102617)
  • P2128R6, Multidimensional subscript operator
  • DR 2397, auto specifier for pointers and references to arrays (PR100975)
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 960, Covariant functions and lvalue/rvalue references
  • DR 1227, Mixing immediate and non-immediate contexts in deduction failure
  • DR 1315, Restrictions on non-type template arguments in partial specializations
  • DR 2082, Referring to parameters in unevaluated operands of default arguments
  • DR 2351, void{}
  • DR 2374, Overly permissive specification of enum direct-list-initialization
  • DR 2397, auto specifier for pointers and references to arrays
  • DR 2446, Questionable type-dependency of concept-ids
  • New command-line option -fimplicit-constexpr can be used to make inline functions implicitly constexpr (git)
  • New command-line option -ffold-simple-inlines can be used to fold calls to certain trivial inline functions (currently std::move, std::forward, std::addressof and std::as_const). In contrast to inlining such calls, folding means that no intermediate code or debug information will be generated for them; this minimizes the abstraction penalty incurred for using these functions versus using the fundamental operations from which they're defined (e.g. std::move versus static_cast). This flag is enabled by default when -fno-inline is not active.
  • Deduction guides can be declared at class scope (PR79501)
  • -Wuninitialized warns about using uninitialized variables in member initializer lists (PR19808)
  • -Wint-in-bool-context is now disabled when instantiating a template (git)
  • Stricter checking of attributes on friend declarations: if a friend declaration has an attribute, that declaration must be a definition. Moreover, a C++11 attribute cannot appear in the middle of the decl-specifier-seq. (PR99032)
  • New warning options for C++ language mismatches: -Wc++11-extensions, -Wc++14-extensions, -Wc++17-extensions, -Wc++20-extensions, and -Wc++23-extensions. They are enabled by default and can be used to control existing pedwarns about occurrences of new C++ constructs in code using an old C++ standard dialect.
  • New warning -Wmissing-requires warns about missing requires (git)
  • The existing std::is_constant_evaluated in if warning was extended to warn in more cases (PR100995)
  • -Waddress has been enhanced so that it now warns about, for instance, comparing the address of a nonstatic member function to null (PR102103)
  • Errors about narrowing are no longer hidden if they occur in system headers
  • Ordered comparison of null pointers is now rejected (PR99701)
  • Anonymous structs with bases are now rejected (git)
  • The compiler rejects taking the address of an immediate member function (PR102753)
  • The compiler has support for C++20 __cpp_lib_is_pointer_interconvertible and __cpp_lib_is_layout_compatible to help the C++ library implement P0466, Layout-compatibility and Pointer-interconvertibility Traits (PR101539)
  • Memory usage of constraint subsumption has been improved (PR100828)
  • constinit thread_local variables are optimized better (PR101786)
  • Support for C++17 std::hardware_destructive_interference_size was added, along with the -Winterference-size warning (git)
  • Many bugs in the CTAD handling have been fixed (PR101344, PR101883, PR89062, PR101233, PR88252, PR86439, PR98832, PR102933 ...)
  • Two-stage name lookup for dependent operator expressions has been corrected (PR51577)
  • Several issues with constrained variable templates have been fixed (PR98486)
  • The compiler performs less instantiating when doing speculative constant evaluation (git)
  • Various diagnostic improvements; e.g., a more precise caret location for pointer-to-member expressions
  • The new -fconstexpr-fp-except flag allows IEC559 floating point exceptions in constant-expressions.
  • Runtime Library (libstdc++):
  • Improved experimental C++20 support, including:
  • std::vector, std::basic_string, std::optional, and std::variant can be used in constexpr functions.
  • std::make_shared for arrays with default initialization, and std::atomic.
  • Layout-compatibility and pointer-interconvertibility traits.
  • Improved experimental C++23 support, including:
  • Monadic operations for std::optional.
  • std::move_only_function
  • std::basic_string::resize_and_overwrite
  • std::unique_ptr can be used in constexpr functions.
  • (not built by default, requires linking to an extra library).
  • std::invoke_r
  • constexpr std::type_info::operator==
  • Fortran:
  • WG5/N1942, "TS 29113 Further Interoperability of Fortran with C", is now fully supported. In addition to implementing previously missing functionality, such as support for character arguments of length greater than one in functions marked bind(c) and gaps in the handling for assumed-rank arrays, numerous other bugs have been fixed, and an extensive set of new conformance test cases has been added.
  • GCC 12 now uses OPERATION as the name of the function to the CO_REDUCE intrinsic for the pairwise reduction, thus conforming to the Fortran 2018 standard. Previous versions used OPERATOR which conforms to TS 18508.
  • On POWER systems which support it, the -mabi=ieeelongdouble option now selects the IEEE 128-bit floating point format for REAL(KIND=16). R16_IBM and R16_IEEE have been added to the -fconvert option, the CONVERT specifyer of the OPEN statement and the GFORTRAN_CONVERT_UNIT environment variable.
  • libgccjit:
  • The libgccjit API gained 30 new entry points:
  • 17 new "reflection" entrypoints for querying functions and types (LIBGCCJIT_ABI_16)
  • gcc_jit_lvalue_set_tls_model for supporting thread-local variables (LIBGCCJIT_ABI_17)
  • gcc_jit_lvalue_set_link_section for setting the link section of global variables, analogous to __attribute__((section(".section"))) (LIBGCCJIT_ABI_18)
  • 4 new entrypoints for initializing global variables and creating constructors for rvalues (LIBGCCJIT_ABI_19)
  • Support for sized integer types, including 128-bit integers and helper functions for such types (LIBGCCJIT_ABI_20)
  • gcc_jit_context_new_bitcast for reinterpreting the bits of an rvalue as a different type (LIBGCCJIT_ABI_21)
  • gcc_jit_lvalue_set_register_name for setting a specific register for a variable (LIBGCCJIT_ABI_22)
  • gcc_jit_context_set_bool_print_errors_to_stderr (LIBGCCJIT_ABI_23)
  • 2 new entrypoints for setting the alignment of a variable (LIBGCCJIT_ABI_24)
  • libgccjit has gained support for the use of various atomic builtins (PR96066, PR96067)
  • gcc_jit_context_new_cast is now able to handle truncation and extension between different integer types (PR95498)
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • Newer revisions of the Arm Architecture are supported as arguments to the -march option: armv8.7-a, armv8.8-a, armv9-a.
  • The Arm Cortex-A510 CPU is now supported through the cortex-a510 argument to the -mcpu and -mtune options.
  • GCC can now auto-vectorize operations performing sign-differing dot-product operations, taking advantage of instructions in the Advanced SIMD (AArch64/AArch32) and SVE (AArch64) instruction sets.
  • AArch64:
  • A number of new CPUs are supported through the -mcpu and -mtune options (GCC identifiers in parentheses).
  • Ampere-1 (ampere1).
  • Arm Cortex-A710 (cortex-a710).
  • Arm Cortex-X2 (cortex-x2).
  • The 64-byte atomic load/store intrinsics to accelerator memory from the 2020 Arm Architecture extensions are supported through the +ls64 option extension.
  • Initial code generation support is supported for hardware instructions used to accelerate the memcpy,memmove and memset standard functions. These instructions can be generated when compiling with the +mopsoption extension.
  • The ACLE Advanced SIMD intrinsics accessible through the arm_neon.h header have been significantly reimplemented and generate higher-performing code than previous GCC versions.
  • The option -mtune=neoverse-512tvb is added to tune for Arm Neoverse cores that have a total vector bandwidth of 512 bits. Please refer to the documentation for more details.
  • AMD Radeon (GCN):
  • Debug experience with ROCGDB has been improved.
  • Support for the type __int128_t/integer(kind=16) was added.
  • For offloading, the limitation of using only one wavefront per compute unit (CU) has been lifted. Up to 40 workgroups per CU and 16 wavefronts per workgroup are supported (up to a limit of 40 wavefronts in total, per CU). Additionally, the number of used wavefronts and workgroups was tuned for performance.
  • arm:
  • Support is added for accessing the stack canary value via the TLS register through the -fstack-protector-guard=tls and -mstack-protector-guard-offset= options. This intended for use in Linux kernel development. Please refer to the documentation for more details.
  • BPF:
  • Support for CO-RE (compile-once, run-everywhere) has been added to the BPF backend. CO-RE allows to compile portable BPF programs that are able to run among different versions of the Linux kernel.
  • IA-32/x86-64:
  • New ISA extension support for Intel AVX512-FP16 was added. AVX512FP16 intrinsics are available via the -mavx512fp16 compiler switch.
  • For both C and C++ the _Float16 type is supported on x86 systems with SSE2 enabled. Without {-mavx512fp16}, all operations will be emulated in software and float instructions.
  • Mitigation against straight line speculation (SLS) for function return and indirect jump is supported via -mharden-sls=[none|all|return|indirect-jmp].
  • Add CS prefix to call and jmp to indirect thunk with branch target in r8-r15 registers via -mindirect-branch-cs-prefix.
  • Always use global offset table (GOT) to access external data and function symbols when the new -mno-direct-extern-access command-line option is specified.
  • MIPS:
  • The ABI passing arguments containing zero-width fields (for example, C/C++ zero-width bit-fields, GNU C/C++ zero-length arrays, and GNU C empty structs) has changed. Now a zero-width field will not prevent an aligned 64-bit floating-point field next to it from being passed through FPR. This is compatible with LLVM, but incompatible with previous GCC releases. GCC 12 on MIPS will report such incompatibilities as an inform unless -Wno-psabi is used.
  • The ABI returning values containing C++17 empty bases has changed. Now an empty base will not prevent an aggregate containing only one or two floating-point fields from being returned through FPR. This is compatible with GCC 6 and earlier, but incompatible with GCC 7 through 11. GCC 12 on MIPS will report such incompatibilities as an inform unless -Wno-psabi is used.
  • NVPTX:
  • The -march flag has been added. The -misa flag is now considered an alias of the -march flag.
  • Support for PTX ISA target architectures sm_53, sm_70, sm_75 and sm_80 has been added. These can be specified using the -march flag.
  • The default PTX ISA target architecture has been set back to sm_30, to fix support for sm_30 boards.
  • The -march-map flag has been added. The -march-map value will be mapped to an valid -march flag value. For instance, -march-map=sm_50 maps to -march=sm_35. This can be used to specify that generated code is to be executed on a board with at least some specific compute capability, without having to know the valid values for the -march flag.
  • The -mptx flag has been added to specify the PTX ISA version for the generated code; permitted values are 3.1 (matches previous GCC versions), 6.0, 6.3, and 7.0. If not specified, the used version is the minimal version required for -march but at least 6.0.
  • An mptx-3.1 multilib was added. This allows using older drivers which do not support PTX ISA version 6.0.
  • The new __PTX_SM__ predefined macro allows code to check the PTX ISA target architecture being targeted by the compiler.
  • The new __PTX_ISA_VERSION_MAJOR__ and __PTX_ISA_VERSION_MINOR__ predefined macros allows code to check the PTX ISA version being targeted by the compiler.
  • PowerPC / PowerPC64 / RS6000:
  • The internal implementation of Power's target-specific built-in functions has been rewritten to be easier and less error-prone to maintain. Every attempt has been made to ensure that the new behavior matches the old behavior, but inevitably some bugs can be expected. Please report any problems via GCC Bugzilla.
  • The built-in functions __builtin_get_texasr, __builtin_get_texasru, __builtin_get_tfhar, __builtin_get_tfiar, __builtin_set_texasr, __builtin_set_texasru, __builtin_set_tfhar, and __builtin_set_tfiar now behave as documented in all supported configurations. On prior releases, the arguments and return values of these functions were treated as unsigned long long instead of as unsigned long, when the options -m32 -mpowerpc64 were in effect.
  • The overloaded built-in functions vec_cntlz_lsbb and vec_cnttz_lsbb now behave as documented. On prior releases, these built-in functions had incorrect semantics on little-endian targets.
  • PRU:
  • The __regio_symbol variable qualifier has been added. It allows easier access in C programs to the __R30 and __R31 CPU I/O registers.
  • RISC-V:
  • Default ISA spec version was bump to 20191213, more detail see this announcement
  • New ISA extension support for zba, zbb, zbc, zbs was added.
  • New ISA extension support for vector and scalar crypto was added, only support architecture testing marco and -march= parsing.
  • The option -mtune=thead-c906 is added to tune for T-HEAD c906 cores.
  • Operating Systems:
  • Improvements to Static Analyzer:
  • The analyzer has gained a -Wanalyzer-use-of-uninitialized-value warning, similar to -Wuninitialized and -Wmaybe-uninitialized, but based on an interprocedural path-sensitive analysis (PR95006).
  • Such warnings are not disabled by the new -ftrivial-auto-var-init (see below), as the latter is considered a mitigation option.
  • -Wanalyzer-write-to-const and -Wanalyzer-write-to-string-literal will now check for __attribute__ ((access, ....)) on calls to externally-defined functions, and complain about read-only regions pointed to by arguments marked with a write_only or read_write attribute (PR104793).
  • The analyzer's "taint" mode, activated by -fanalyzer-checker=taint (in addition to -fanalyzer), has gained four new taint-based warnings:
  • -Wanalyzer-tainted-allocation-size for e.g. attacker-controlled malloc and alloca,
  • -Wanalyzer-tainted-divisor for detecting where an attacker can inject a divide-by-zero,
  • -Wanalyzer-tainted-offset for attacker-controlled pointer offsets,
  • -Wanalyzer-tainted-size for attacker-controlled values being used as a size parameter to calls to memset or to functions marked with __attribute__ ((access, ....)).
  • The existing -Wanalyzer-tainted-array-index has been reworded to talk about "attacker-controlled" rather than "tainted" values, for consistency with the new warnings.
  • A new __attribute__ ((tainted_args)) has been added to the C and C++ frontends, usable on functions, and on function pointer callback fields in structs. The analyzer's taint mode will treat all parameters and buffers pointed to by parameters of such functions as being attacked-controlled, such as for annotating system calls in an operating system kernel as being an "attack surface".
  • The analyzer now respects __attribute__((const)): it will treat such functions as returning the same value when given the same inputs (PR104434), and as having no side effects (PR104576).
  • The analyzer is now able to split its analysis into multiple execution paths in places where there isn't a split in the control flow graph. For example, it now handles realloc calls by splitting the execution path into three possible outcomes for the call:
  • failure, returning NULL
  • success, growing the buffer in-place without moving it
  • success, allocating a new buffer, copying the content of the old buffer to it, and freeing the old buffer
  • The analyzer's interprocedural path exploration logic is now able to track calls through function pointers.
  • The analyzer now makes the assumption that if we know PTR is non-NULL, then (PTR + OFFSET) is also non-NULL. This isn't strictly true, but eliminates false positives in practice (PR101962).
  • The analyzer has gained some initial support for inline assembler code. This is extremely limited, and is purely to help suppress false positives when analyzing the Linux kernel, which makes heavy use of inline assembler (PR101570).
  • The way the analyzer tracks the state of memory along an execution path has been improved in various ways for GCC 12:
  • An optimization for representing bulk updates to memory (e.g. zero fills) has been removed as it never worked well. In GCC 12 it has been replaced with a simpler and more accurate approach, eliminating many false positives (PR95006).
  • Various optimizations have been added, speeding up the analysis on a particularly problematic source file from 4 minutes down to 17 seconds (PR104943, PR104954, and PR104955).
  • The analyzer now tracks the sizes of dynamically-allocated regions, both on the heap (via malloc etc) and stack (via alloca), though none of the analyzer warnings make use of this yet in GCC 12.
  • The analyzer's handling of switch statements has been rewritten, fixing various bugs.
  • Other significant improvements:
  • Eliminating uninitialized variables:
  • GCC can now initialize all stack variables implicitly, including padding. This is intended to eliminate all classes of uninitialized stack variable flaws. Lack of explicit initialization will still warn when -Wuninitialized is active. For best debugging, use of the new command-line option -ftrivial-auto-var-init=pattern can be used to fill variables with a repeated 0xFE pattern, which tends to illuminate many bugs (e.g. pointers receive invalid addresses, sizes and indices are very large). For best production results, the new command-line option -ftrivial-auto-var-init=zero can be used to fill variables with 0x00, which tends to provide a safer state for bugs (e.g. pointers are NULL, strings are NUL filled, and sizes and indices are 0).
  • Debugging formats:
  • GCC can now generate debugging information in CTF, a lightweight debugging format that provides information about C types and the association between functions and data symbols and types. This format is designed to be embedded in ELF files and to be very compact and simple. A new command-line option -gctf enables the generation of CTF.
  • GCC can now generate debugging information in BTF. This is a debugging format mainly used in BPF programs and the Linux kernel. The compiler can generate BTF for any target, when enabled with the command-line option -gbtf

New in GCC 11.3.0 (Apr 21, 2022)

  • Caveats:
  • The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14. Note that C++17 changes to template template parameter matching can be disabled independently of other features with -fno-new-ttp-matching.
  • When building GCC itself, the host compiler must now support C++11, rather than C++98. In particular bootstrapping GCC 11 using an older version of GCC requires a binary of GCC 4.8 or later, rather than of GCC 3.4 or later as was the case for bootstrapping GCC 10.
  • Naming and location of auxiliary and dump output files changed. If you compile multiple input files in a single command, if you enable Link Time Optimization, or if you use -dumpbase, -dumpdir, -save-temps=*, and you expect any file other than the primary output file(s) to be created as a side effect, watch out for improvements and a few surprises. See the patch, particularly its textual description, for more details about the changes.
  • -gsplit-dwarf no longer enables debug info generation on its own but requires a separate -g for this.
  • The libstdc++ configure option --enable-cheaders=c_std is deprecated and will be removed in a future release. It should be possible to use --enable-cheaders=c_global (the default) with no change in behaviour.
  • The front end for compiling BRIG format of Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • Some short options of the gcov tool have been renamed: -i to -j and -j to -H.
  • General Improvements:
  • ThreadSanitizer improvements to support alternative runtimes and environments. The Linux Kernel Concurrency Sanitizer (KCSAN) is now supported.
  • Add --param tsan-distinguish-volatile to optionally emit instrumentation distinguishing volatile accesses.
  • Add --param tsan-instrument-func-entry-exit to optionally control if function entries and exits should be instrumented.
  • In previous releases of GCC, the "column numbers" emitted in diagnostics were actually a count of bytes from the start of the source line. This could be problematic, both because of:
  • multibyte characters (requiring more than one byte to encode), and
  • multicolumn characters (requiring more than one column to display in a monospace font)
  • For example, the character π ("GREEK SMALL LETTER PI (U+03C0)") occupies one column, and its UTF-8 encoding requires two bytes; the character 🙂 ("SLIGHTLY SMILING FACE (U+1F642)") occupies two columns, and its UTF-8 encoding requires four bytes.
  • In GCC 11 the column numbers default to being column numbers, respecting multi-column characters. The old behavior can be restored using a new option -fdiagnostics-column-unit=byte. There is also a new option -fdiagnostics-column-origin=, allowing the pre-existing default of the left-hand column being column 1 to be overridden if desired (e.g. for 0-based columns). The output of -fdiagnostics-format=json has been extended to supply both byte counts and column numbers for all source locations.
  • Additionally, in previous releases of GCC, tab characters in the source would be emitted verbatim when quoting source code, but be prefixed with whitespace or line number information, leading to misalignments in the resulting output when compared with the actual source. Tab characters are now printed as an appropriate number of spaces, using the -ftabstop option (which defaults to 8 spaces per tab stop).
  • Introduce Hardware-assisted AddressSanitizer support. This sanitizer currently only works for the AArch64 target. It helps debug address problems similarly to AddressSanitizer but is based on partial hardware assistance and provides probabilistic protection to use less RAM at run time. Hardware-assisted AddressSanitizer is not production-ready for user space, and is provided mainly for use compiling the Linux Kernel.
  • To use this sanitizer the command line arguments are:
  • -fsanitize=hwaddress to instrument userspace code.
  • -fsanitize=kernel-hwaddress to instrument kernel code.
  • For targets that produce DWARF debugging information GCC now defaults to DWARF version 5 (with the exception of VxWorks and Darwin/Mac OS X which default to version 2 and AIX which defaults to version 4). This can produce up to 25% more compact debug information compared to earlier versions.
  • To take full advantage of DWARF version 5 GCC needs to be built against binutils version 2.35.2 or higher. When GCC is built against earlier versions of binutils GCC will still emit DWARF version 5 for most debuginfo data, but will generate version 4 debug line tables (even when explicitly given -gdwarf-5).
  • The following debug information consumers can process DWARF version 5:
  • GDB 8.0, or higher
  • valgrind 3.17.0
  • elfutils 0.172, or higher (for use with systemtap, dwarves/pahole, perf and libabigail)
  • dwz 0.14
  • Programs embedding libbacktrace are urged to upgrade to the version shipping with GCC 11.
  • To make GCC 11 generate an older DWARF version use -g together with -gdwarf-2, -gdwarf-3 or -gdwarf-4.
  • Vectorizer improvements:
  • The straight-line code vectorizer now considers the whole function when vectorizing and can handle opportunities crossing CFG merges and backedges.
  • A series of conditional expressions that compare the same variable can be transformed into a switch statement if each of them contains a comparison expression.
  • This statement can be transformed into a switch statement and then expanded into a bit-test.
  • New command-line options:
  • -fbit-tests, enabled by default, can be used to enable or disable switch expansion using bit-tests.
  • Inter-procedural optimization improvements:
  • A new IPA-modref pass was added to track side effects of function calls and improve precision of points-to-analysis. The pass can be controlled by the -fipa-modref option.
  • The identical code folding pass (controlled by -fipa-icf) was significantly improved to increase the number of unified functions and to reduce compile-time memory use.
  • IPA-CP (Interprocedural constant propagation) heuristics improved its estimation of potential usefulness of known loop bounds and strides by taking the estimated frequency of these loops into account.
  • Link-time optimization improvements:
  • The LTO bytecode format was optimized for smaller object files and faster streaming.
  • Memory allocation of the linking stage was improved to reduce peak memory use.
  • Profile driven optimization improvements:
  • Using -fprofile-values, was improved by tracking more target values for e.g. indirect calls.
  • GCOV data file format outputs smaller files by representing zero counters in a more compact way.
  • New Languages and Language specific improvements:
  • GCC 11 adds support for non-rectangular loop nests in OpenMP constructs and the allocator routines of OpenMP 5.0, including initial allocate clause support in C/C++. The OMP_TARGET_OFFLOAD environment variable and the active-levels routines are now supported. For C/C++, the declare variant and map support has been extended. For Fortran, OpenMP 4.5 is now fully supported and OpenMP 5.0 support has been extended, including the following features which were before only available in C and C++: order(concurrent), device_type, memorder-clauses for flush, lastprivate with conditional modifier, atomic construct and reduction clause extensions of OpenMP 5.0, if clause with simd and cancel modifiers, target data without map clause, and limited support for the requires construct.
  • Version 2.6 of the OpenACC specification continues to be maintained and improved in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information.
  • C family:
  • New attributes:
  • The no_stack_protector attribute has been added to mark functions which should not be instrumented with stack protection (-fstack-protector).
  • The existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. A pair of new -Wmismatched-dealloc and -Wmismatched-new-delete warnings will complain about mismatched calls, and -Wfree-nonheap-object about deallocation calls with pointers not obtained from allocation functions. Additionally, the static analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
  • New warnings:
  • -Wmismatched-dealloc, enabled by default, warns about calls to deallocation functions with pointers returned from mismatched allocation functions.
  • -Wsizeof-array-div, enabled by -Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.
  • -Wstringop-overread, enabled by default, warns about calls to string functions reading past the end of the arrays passed to them as arguments. In prior GCC releases most instances of his warning are diagnosed by -Wstringop-overflow.
  • -Wtsan, enabled by default, warns about unsupported features in ThreadSanitizer (currently std::atomic_thread_fence).
  • Enhancements to existing warnings:
  • -Wfree-nonheap-object detects many more instances of calls to deallocation functions with pointers not returned from a dynamic memory allocation function.
  • -Wmaybe-uninitialized diagnoses passing pointers or references to uninitialized memory to functions taking const-qualified arguments.
  • -Wuninitialized detects reads from uninitialized dynamically allocated memory.
  • For ELF targets that support the GNU or FreeBSD OSABIs, the used attribute will now save the symbol declaration it is applied to from linker garbage collection.
  • To support this behavior, used symbols that have not been placed in specific sections (e.g. with the section attribute, or the -f{function,data}-sections options) will be placed in new, unique sections.
  • This functionality requires Binutils version 2.36 or later.
  • Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • The BOOL_MAX and BOOL_WIDTH macros are provided in .
  • As in C++, function definitions no longer need to give names for unused function parameters.
  • The expansions of the true and false macros in have changed so that they have type bool.
  • The [[nodiscard]] standard attribute is now supported.
  • The __has_c_attribute preprocessor operator is now supported.
  • Macros INFINITY, NAN, FLT_SNAN, DBL_SNAN, LDBL_SNAN, DEC_INFINITY, DEC_NAN, and corresponding signaling NaN macros for _FloatN, _FloatNx and _DecimalN types, are provided in . There are also corresponding built-in functions __builtin_nansdN for decimal signaling NaNs.
  • Macros FLT_IS_IEC_60559, DBL_IS_IEC_60559 and LDBL_IS_IEC_60559 are provided in .
  • The feature test macro __STDC_WANT_IEC_60559_EXT__ is supported by .
  • Labels may appear before declarations and at the end of a compound statement.
  • New warnings:
  • -Warray-parameter, enabled by -Wall, warns about redeclarations of functions with ordinary array arguments declared using inconsistent forms. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
  • -Wvla-parameter, enabled by -Wall, warns redeclarations of functions with variable length array arguments declared using inconsistent forms or with mismatched bounds. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
  • C++:
  • The default mode has been changed to -std=gnu++17.
  • Several C++20 features have been implemented:
  • the compiler now supports consteval virtual functions
  • P2082R1, Fixing CTAD for aggregates
  • P0593R6, Pseudo-destructors end object lifetimes
  • P1907R1, Inconsistencies with non-type template parameters (complete implementation)
  • P1975R0, Fixing the wording of parenthesized aggregate-initialization
  • P1009R2, Array size deduction in new-expressions
  • P1099R5, using enum
  • Modules, Requires -fmodules-ts and some aspects are incomplete. Refer to C++ 20 Status
  • The C++ front end has experimental support for some of the upcoming C++23 draft features with the -std=c++23, -std=gnu++23, -std=c++2b or -std=gnu++2b flags, including
  • P0330R8, Literal Suffix for (signed) size_t.
  • For a full list of new features, see the C++ status page.
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 625, Use of auto as a template-argument
  • DR 1512, Pointer comparison vs qualification conversions
  • DR 1722, Should lambda to function pointer conversion function be noexcept?
  • DR 1914, Duplicate standard attributes
  • DR 2032, Default template-arguments of variable templates
  • DR 2289, Uniqueness of decomposition declaration names
  • DR 2237, Can a template-id name a constructor?
  • DR 2303, Partial ordering and recursive variadic inheritance
  • DR 2369, Ordering between constraints and substitution
  • DR 2450, braced-init-list as a template-argument
  • G++ now performs better access checking in templates (PR41437).
  • reinterpret_casts in constexpr evaluation are now checked more completely (PR95307).
  • The diagnostic for static_assert has been improved: the compiler now shows the expression including its template arguments (if there were any), and can point to the failing clause if the condition comprised of any logical AND operators (PR97518).
  • New warnings:
  • -Wctad-maybe-unsupported, disabled by default, warns about performing class template argument deduction on a type with no deduction guides.
  • -Wrange-loop-construct, enabled by -Wall, warns when a range-based for-loop is creating unnecessary and expensive copies.
  • -Wdeprecated-enum-enum-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands of enumeration types, as outlined in [depr.arith.conv.enum].
  • -Wdeprecated-enum-float-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands where one is of enumeration type and the other is of a floating-point type, as outlined in [depr.arith.conv.enum].
  • -Wmismatched-new-delete, enabled by -Wall, warns about calls to C++ operator delete with pointers returned from mismatched forms of operator new or from other mismatched allocation functions.
  • -Wvexing-parse, enabled by default, warns about the most vexing parse rule: the cases when a declaration looks like a variable definition, but the C++ language requires it to be interpreted as a function declaration.
  • Enhancements to existing warnings:
  • -Wnonnull considers the implicit this argument of every C++ nonstatic member function to have been implicitly declared with attribute nonnull and triggers warnings for calls where the pointer is null.
  • Runtime Library (libstdc++):
  • Improved C++17 support, including:
  • std::from_chars and std::to_chars for floating-point types.
  • Improved experimental C++20 support, including:
  • Calendar additions to . Thanks to Cassio Neri for optimizations.
  • std::bit_cast
  • std::source_location
  • Atomic wait and notify operations.
  • , , and
  • Efficient access to basic_stringbuf's buffer.
  • Heterogeneous lookup in unordered containers.
  • Experimental C++23 support, including:
  • contains member functions for strings, thanks to Paul Fee.
  • std::to_underlying, std::is_scoped_enum
  • Experimental support for Data-Parallel Types (simd) from the Parallelism 2 TS, thanks to Matthias Kretz.
  • Faster std::uniform_int_distribution, thanks to Daniel Lemire.
  • New features:
  • A new bottom type typeof(*null) has been added to represent run-time errors and non-terminating functions. This also introduces a new standard alias for the type named noreturn, and is implicitly imported into every module.
  • Printf-like and scanf-like functions are now detected by prefixing them with pragma(printf) for printf-like functions or pragma(scanf) for scanf-like functions.
  • The __traits() expression now supports the extensions isDeprecated, isDisabled, isFuture, isModule, isPackage, child, isReturnOnStack, isZeroInit, getTargetInfo, getLocation, hasPostblit, isCopyable, getVisibility, and totype.
  • An expression-based contract syntax has been added to the language.
  • Function literals can now return a value by reference with the ref keyword.
  • A new syntax is available to declare aliases to function types using the alias syntax based on the assignment operator.
  • New types __c_complex_float, __c_complex_double, __c_complex_real, and __c_wchar_t have been added for interfacing with C and C++ code, and are available from the core.stdc.config module.
  • User-defined attributes can now be used to annotate enum members, alias declarations, and function parameters.
  • Templates alias parameters can now be instantiated with basic types such as int or void function().
  • The mixin construct can now be used as types in the form mixin(string) var.
  • The mixin construct can now take an argument list, same as pragma(msg).
  • New intrinsics:
  • Bitwise rotate intrinsics core.bitop.rol and core.bitop.ror have been added.
  • Byte swap intrinsic core.bitop.byteswap for swapping bytes in a 2-byte ushort has been added.
  • Math intrinsics available from core.math now have overloads for float and double types.
  • Volatile intrinsics core.volatile.volatileLoad and core.volatile.volatileStore have been moved from the core.bitop module.
  • New attributes:
  • The following GCC attributes are now recognized and available from the gcc.attributes module with short-hand aliases for convenience:
  • @attribute("alloc_size", arguments) or @alloc_size(arguments).
  • @attribute("always_inline") or @always_inline.
  • @attribute("used") or @used.
  • @attribute("optimize", arguments) or @optimize(arguments).
  • @attribute("cold") or @cold.
  • @attribute("noplt") or @noplt.
  • @attribute("target_clones", arguments) or @target_clones(arguments).
  • @attribute("no_icf") or @no_icf.
  • @attribute("noipa") or @noipa.
  • @attribute("symver", arguments) or @symver(arguments).
  • New aliases have been added to gcc.attributes for compatibility with ldc.attributes.
  • The @allocSize(arguments) attribute is the same as @alloc_size(arguments), but uses a 0-based index for function arguments.
  • The @assumeUsed attribute is an alias for @attribute("used").
  • The @fastmath attribute is an alias for @optimize("Ofast").
  • The @naked attribute is an alias for @attribute("naked"). This attribute may not be available on all targets.
  • The @restrict attribute has been added to specify that a function parameter is to be restrict-qualified in the C99 sense of the term.
  • The @optStrategy(strategy) attribute is an alias for @optimize("O0") when the strategy is "none", otherwise @optimize("Os") for the "optsize" and "minsize" strategies.
  • The @polly attribute is an alias for @optimize("loop-parallelize-all").
  • The @section(name) attribute is an alias for @attribute("section", name).
  • The @target(arguments) attribute is an alias for attribute("target", arguments).
  • The @weak attribute is an alias for @attribute("weak").
  • New language options:
  • -fweak-templates, added to control whether declarations that can be defined in multiple objects should be emitted as weak symbols. The default is to emit all symbols with extern linkage as weak, unless the target lacks support for weak symbols.
  • -Wdeprecated, this option is now enabled by default.
  • -Wextra, this option now turns on all warnings that are not part of the core D language front-end - -Waddress, -Wcast-result, -Wunknown-pragmas.
  • -Wvarargs, added to turn on warnings about questionable usage of the va_start intrinsic.
  • Deprecated and removed features:
  • Compiler-recognized attributes are now made available from the gcc.attributes module, the former module gcc.attribute has been deprecated and will be removed in a future release.
  • The @attribute("alias") attribute has been removed, as it had been superseded by pragma(mangle).
  • The @attribute("forceinline") attribute has been removed and renamed to @always_inline.
  • __vector types that are not supported in hardware are now rejected at compile-time. Previously all vector types were accepted by the compiler and emulated when target support was absent.
  • The extern(Pascal) linkage attribute has been removed.
  • The deprecation phase for -ftransition=import and -ftransition=checkimports is finished. These switches no longer have an effect and are now removed. Symbols that are not visible in a particular scope will no longer be found by the compiler.
  • It is now an error to use private variables selectively imported from other modules. Due to a bug, some imported private members were visible from other modules, violating the specification.
  • The -fweak compiler switch has been removed, as it existed only for testing.
  • Fortran:
  • Added DEPRECATED to !GCC$'s attributes directive.
  • Go:
  • GCC 11 provides a complete implementation of the Go 1.16.3 user packages.
  • libgccjit:
  • libgccjit was marked as merely "Alpha" quality when originally added in GCC 5. Given that we have maintained API and ABI compatibility since then and it is in use by various projects, we have removed that caveat.
  • libgccjit can now be built for MinGW
  • The libgccjit API gained 10 new entry points:
  • gcc_jit_global_set_initializer
  • 9 entrypoints for directly embedding asm statements into a compile, analogous to inline asm in the C front end
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • A number of new CPUs are supported through arguments to the -mcpu and -mtune options in both the arm and aarch64 backends (GCC identifiers in parentheses):
  • Arm Cortex-A78 (cortex-a78).
  • Arm Cortex-A78AE (cortex-a78ae).
  • Arm Cortex-A78C (cortex-a78c).
  • Arm Cortex-X1 (cortex-x1).
  • Arm Neoverse V1 (neoverse-v1).
  • Arm Neoverse N2 (neoverse-n2).
  • GCC can now auto-vectorize operations performing addition, subtraction, multiplication and the accumulate/subtract variants on complex numbers, taking advantage of the Advanced SIMD instructions in the Armv8.3-a (AArch64/AArch32), SVE (AArch64), SVE2 (AArch64) and MVE (AArch32 M-profile) instruction sets.
  • AArch64:
  • In addition to the above, the following AArch64-only CPUs are now supported:
  • Fujitsu A64FX (a64fx).
  • Arm Cortex-R82 (cortex-r82).
  • The AArch64 Armv8-R architecture is now supported through the -march=armv8-r option.
  • Mitigation against the Straight-line Speculation vulnerability is supported with the -mharden-sls= option. Please refer to the documentation for usage instructions.
  • The availability of Advanced SIMD intrinsics available through the arm_neon.h header is improved and GCC 11 supports the full set of intrinsics defined by ACLE Q3 2020.
  • AMD Radeon (GCN):
  • Initial support for gfx908 GPUs has been added.
  • arm:
  • Initial auto-vectorization is now available when targeting the MVE instruction set.
  • GCC can now make use of the Low Overhead Branch instruction in Armv8.1-M to optimize loop counters and checks.
  • The -mcpu=cortex-m55 option now supports the extensions +nomve and +nomve.fp to control generation of MVE and MVE floating-point instructions.
  • IA-32/x86-64:
  • New ISA extension support for Intel TSXLDTRK was added to GCC. TSXLDTRK intrinsics are available via the -mtsxldtrk compiler switch.
  • New ISA extension support for Intel SERIALIZE was added to GCC. SERIALIZE intrinsics are available via the -mserialize compiler switch.
  • New ISA extension support for Intel HRESET was added to GCC. HRESET intrinsics are available via the -mhreset compiler switch.
  • New ISA extension support for Intel UINTR was added to GCC. UINTR intrinsics are available via the -muintr compiler switch.
  • New ISA extension support for Intel KEYLOCKER was added to GCC. KEYLOCKER intrinsics are available via the -mkeylocker compiler switch.
  • New ISA extension support for Intel AMX-TILE, AMX-INT8, AMX-BF16 was added to GCC. AMX-TILE, AMX-INT8, AMX-BF16 intrinsics are available via the -mamx-tile, -mamx-int8, -mamx-bf16 compiler switches.
  • New ISA extension support for Intel AVX-VNNI was added to GCC. AVX-VNNI intrinsics are available via the -mavxvnni compiler switch.
  • GCC now supports the Intel CPU named Sapphire Rapids through -march=sapphirerapids. The switch enables the MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, SERIALIZE, PTWRITE, WAITPKG, TSXLDTRK, AMT-TILE, AMX-INT8, AMX-BF16, and AVX-VNNI ISA extensions.
  • GCC now supports the Intel CPU named Alderlake through -march=alderlake. The switch enables the CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, KEYLOCKER, AVX-VNNI, and HRESET ISA extensions.
  • GCC now supports the Intel CPU named Rocketlake through -march=rocketlake. Rocket Lake is based on Icelake client and minus SGX.
  • GCC now supports AMD CPUs based on the znver3 core via -march=znver3.
  • GCC now supports micro-architecture levels defined in the x86-64 psABI via -march=x86-64-v2, -march=x86-64-v3 and -march=x86-64-v4.
  • Nios II:
  • The options -mcustom-insn=N no longer produce compiler warnings if the custom instruction is not generated due to missing optimization options such as -fno-math-errno, -ffinite-math-only, or -funsafe-math-optimizations. These warnings were not consistently emitted for all custom instructions.
  • The -mcustom-fpu-cfg=fph2 option has been added to enable the custom instructions supported by the Nios II Floating Point Hardware 2 Component.
  • NVPTX:
  • The -misa default has changed from sm_30 to sm_35.
  • The -m32 compiler switch has been removed.
  • The -msoft-stack-reserve-local format has been fixed. Previously, it accepted -msoft-stack-reserve-local. It now accepts -msoft-stack-reserve-local=.
  • S/390, System z, IBM Z Systems:
  • The behavior when compiling with -fexcess-precision=standard (e.g., implied by -std=c99) on s390(x) targets can now be controlled at configure time with the flag --enable-s390-excess-float-precision. When enabled, GCC will maintain previous behavior and evaluate float expressions in double precision, which aligns with the definition of float_t as double. With the flag disabled, GCC will always evaluate float expressions in single precision. In native builds and cross compiles that have target libc headers, GCC will by default match the definition of float_t in the installed glibc.
  • RISC-V:
  • Support address sanitizer for RISC-V.
  • Support big-endian for RISC-V, thanks to Marcus Comstedt.
  • Implement new style of architecture extension test macros: each architecture extension has a corresponding feature test macro, which can be used to test its existence and version information.
  • Legacy architecture extension test macros like __riscv_atomic are deprecated, but will still be supported for at least 2 release cycles.
  • Support IFUNC for riscv*-*-linux*.
  • Add new option -misa-spec=* to control ISA spec version. This controls the default version of each extensions. It defaults to 2.2.
  • Introduce the --with-multilib-generator configure time option. This allows for flexible config multi-lib settings. Its syntax is the same as RISC-V's multilib-generator.
  • Extend the sytax for multilib-generator, support expansion operator * to reduce the complexity of complicated multi-lib re-use rules.
  • Support -mcpu=* option aligned with RISC-V clang/LLVM. It sets the pipeline model and architecture extensions, like -mtune=* plus -march=*.
  • Support for TLS stack protector canary access, thanks to Cooper Qu.
  • Support __builtin_thread_pointer for RISC-V.
  • Introduce shorten_memrefs optimization, which reduces the code size for memory access, thanks to Craig Blackmore.
  • Operating Systems:
  • AIX:
  • GCC for AIX can be built as a 64 bit application and the runtime is built as FAT libraries containing both 32 bit and 64 bit objects.
  • Support AIX Vector Extended ABI with -mabi=vec-extabi.
  • Thread-Local uninitiated data placed in local common section.
  • Use thread-safe access in ctype.
  • Link with libc128.a when long-double-128 enabled.
  • Improvements to Static Analyzer:
  • The implementation of how program state is tracked within -fanalyzer has been completely rewritten for GCC 11, fixing numerous bugs, and allowing for the analyzer to scale to larger C source files.
  • The analysis of allocations and deallocations has been generalized beyond malloc and free.
  • As preliminary work towards eventually supporting C++, the malloc/free checking will also check new/delete and new[]/delete[]. However, C++ is not yet properly supported by -fanalyzer (for example, exception-handling is unimplemented).
  • As noted above, the existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. The analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
  • A new -Wanalyzer-mismatching-deallocation warning has been added, covering such mismatches as using scalar delete rather vector delete[].
  • The analyzer has gained warnings -Wanalyzer-shift-count-negative, -Wanalyzer-shift-count-overflow, -Wanalyzer-write-to-const, and -Wanalyzer-write-to-string-literal, all enabled by default when -fanalyzer is enabled.
  • The analyzer can now be extended by GCC plugins, allowing for domain-specific path-sensitive warnings. An example of using a GCC plugin to check for misuses of CPython's global interpreter lock can be seen in the test suite
  • The analyzer has gained new debugging options -fdump-analyzer-json and -fno-analyzer-feasibility.
  • Other significant improvements:
  • GCC has gained a new environment variable GCC_EXTRA_DIAGNOSTIC_OUTPUT which can be used by IDEs to request machine-readable fix-it hints without needing to adjust build flags.

New in GCC 11.2.0 (Jul 30, 2021)

  • Caveats:
  • The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14. Note that C++17 changes to template template parameter matching can be disabled independently of other features with -fno-new-ttp-matching.
  • When building GCC itself, the host compiler must now support C++11, rather than C++98. In particular bootstrapping GCC 11 using an older version of GCC requires a binary of GCC 4.8 or later, rather than of GCC 3.4 or later as was the case for bootstrapping GCC 10.
  • Naming and location of auxiliary and dump output files changed. If you compile multiple input files in a single command, if you enable Link Time Optimization, or if you use -dumpbase, -dumpdir, -save-temps=*, and you expect any file other than the primary output file(s) to be created as a side effect, watch out for improvements and a few surprises. See the patch, particularly its textual description, for more details about the changes.
  • -gsplit-dwarf no longer enables debug info generation on its own but requires a separate -g for this.
  • The libstdc++ configure option --enable-cheaders=c_std is deprecated and will be removed in a future release. It should be possible to use --enable-cheaders=c_global (the default) with no change in behaviour.
  • The front end for compiling BRIG format of Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • Some short options of the gcov tool have been renamed: -i to -j and -j to -H.
  • General Improvements:
  • ThreadSanitizer improvements to support alternative runtimes and environments. The Linux Kernel Concurrency Sanitizer (KCSAN) is now supported.
  • Add --param tsan-distinguish-volatile to optionally emit instrumentation distinguishing volatile accesses.
  • Add --param tsan-instrument-func-entry-exit to optionally control if function entries and exits should be instrumented.
  • In previous releases of GCC, the "column numbers" emitted in diagnostics were actually a count of bytes from the start of the source line. This could be problematic, both because of:
  • multibyte characters (requiring more than one byte to encode), and
  • multicolumn characters (requiring more than one column to display in a monospace font)
  • For example, the character π ("GREEK SMALL LETTER PI (U+03C0)") occupies one column, and its UTF-8 encoding requires two bytes; the character 🙂 ("SLIGHTLY SMILING FACE (U+1F642)") occupies two columns, and its UTF-8 encoding requires four bytes.
  • In GCC 11 the column numbers default to being column numbers, respecting multi-column characters. The old behavior can be restored using a new option -fdiagnostics-column-unit=byte. There is also a new option -fdiagnostics-column-origin=, allowing the pre-existing default of the left-hand column being column 1 to be overridden if desired (e.g. for 0-based columns). The output of -fdiagnostics-format=json has been extended to supply both byte counts and column numbers for all source locations.
  • Additionally, in previous releases of GCC, tab characters in the source would be emitted verbatim when quoting source code, but be prefixed with whitespace or line number information, leading to misalignments in the resulting output when compared with the actual source. Tab characters are now printed as an appropriate number of spaces, using the -ftabstop option (which defaults to 8 spaces per tab stop).
  • Introduce Hardware-assisted AddressSanitizer support. This sanitizer currently only works for the AArch64 target. It helps debug address problems similarly to AddressSanitizer but is based on partial hardware assistance and provides probabilistic protection to use less RAM at run time. Hardware-assisted AddressSanitizer is not production-ready for user space, and is provided mainly for use compiling the Linux Kernel.
  • To use this sanitizer the command line arguments are:
  • -fsanitize=hwaddress to instrument userspace code.
  • -fsanitize=kernel-hwaddress to instrument kernel code.
  • For targets that produce DWARF debugging information GCC now defaults to DWARF version 5 (with the exception of VxWorks and Darwin/Mac OS X which default to version 2 and AIX which defaults to version 4). This can produce up to 25% more compact debug information compared to earlier versions.
  • To take full advantage of DWARF version 5 GCC needs to be build against binutils version 2.35.2 or higher. When GCC is build against earlier versions of binutils GCC will still emit DWARF version 5 for most debuginfo data, but will generate version 4 debug line tables (even when explicitly given -gdwarf-5).
  • The following debug information consumers can process DWARF version 5:
  • GDB 8.0, or higher
  • valgrind 3.17.0
  • elfutils 0.172, or higher (for use with systemtap, dwarves/pahole, perf and libabigail)
  • dwz 0.14
  • Programs embedding libbacktrace are urged to upgrade to the version shipping with GCC 11.
  • To make GCC 11 generate an older DWARF version use -g together with -gdwarf-2, -gdwarf-3 or -gdwarf-4.
  • Vectorizer improvements:
  • The straight-line code vectorizer now considers the whole function when vectorizing and can handle opportunities crossing CFG merges and backedges.
  • A series of conditional expressions that compare the same variable can be transformed into a switch statement if each of them contains a comparison expression.
  • This statement can be transformed into a switch statement and then expanded into a bit-test.
  • New command-line options:
  • -fbit-tests, enabled by default, can be used to enable or disable switch expansion using bit-tests.
  • Inter-procedural optimization improvements:
  • A new IPA-modref pass was added to track side effects of function calls and improve precision of points-to-analysis. The pass can be controlled by the -fipa-modref option.
  • The identical code folding pass (controlled by -fipa-icf) was significantly improved to increase the number of unified functions and to reduce compile-time memory use.
  • IPA-CP (Interprocedural constant propagation) heuristics improved its estimation of potential usefulness of known loop bounds and strides by taking the estimated frequency of these loops into account.
  • Link-time optimization improvements:
  • The LTO bytecode format was optimized for smaller object files and faster streaming.
  • Memory allocation of the linking stage was improved to reduce peak memory use.
  • Profile driven optimization improvements:
  • Using -fprofile-values, was improved by tracking more target values for e.g. indirect calls.
  • GCOV data file format outputs smaller files by representing zero counters in a more compact way.
  • New Languages and Language specific improvements:
  • GCC 11 adds support for non-rectangular loop nests in OpenMP constructs and the allocator routines of OpenMP 5.0, including initial allocate clause support in C/C++. The OMP_TARGET_OFFLOAD environment variable and the active-levels routines are now supported. For C/C++, the declare variant and map support has been extended. For Fortran, OpenMP 4.5 is now fully supported and OpenMP 5.0 support has been extended, including the following features which were before only available in C and C++: order(concurrent), device_type, memorder-clauses for flush, lastprivate with conditional modifier, atomic construct and reduction clause extensions of OpenMP 5.0, if clause with simd and cancel modifiers, target data without map clause, and limited support for the requires construct.
  • Version 2.6 of the OpenACC specification continues to be maintained and improved in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information.
  • C family:
  • New attributes:
  • The no_stack_protector attribute has been added to mark functions which should not be instrumented with stack protection (-fstack-protector).
  • The existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. A pair of new -Wmismatched-dealloc and -Wmismatched-new-delete warnings will complain about mismatched calls, and -Wfree-nonheap-object about deallocation calls with pointers not obtained from allocation functions. Additionally, the static analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
  • New warnings:
  • -Wmismatched-dealloc, enabled by default, warns about calls to deallocation functions with pointers returned from mismatched allocation functions.
  • -Wsizeof-array-div, enabled by -Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.
  • -Wstringop-overread, enabled by default, warns about calls to string functions reading past the end of the arrays passed to them as arguments. In prior GCC releases most instances of his warning are diagnosed by -Wstringop-overflow.
  • -Wtsan, enabled by default, warns about unsupported features in ThreadSanitizer (currently std::atomic_thread_fence).
  • Enhancements to existing warnings:
  • -Wfree-nonheap-object detects many more instances of calls to deallocation functions with pointers not returned from a dynamic memory allocation function.
  • -Wmaybe-uninitialized diagnoses passing pointers or references to uninitialized memory to functions taking const-qualified arguments.
  • -Wuninitialized detects reads from uninitialized dynamically allocated memory.
  • For ELF targets that support the GNU or FreeBSD OSABIs, the used attribute will now save the symbol declaration it is applied to from linker garbage collection.
  • To support this behavior, used symbols that have not been placed in specific sections (e.g. with the section attribute, or the -f{function,data}-sections options) will be placed in new, unique sections.
  • This functionality requires Binutils version 2.36 or later.
  • Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • The BOOL_MAX and BOOL_WIDTH macros are provided in .
  • As in C++, function definitions no longer need to give names for unused function parameters.
  • The expansions of the true and false macros in have changed so that they have type bool.
  • The [[nodiscard]] standard attribute is now supported.
  • The __has_c_attribute preprocessor operator is now supported.
  • Macros INFINITY, NAN, FLT_SNAN, DBL_SNAN, LDBL_SNAN, DEC_INFINITY, DEC_NAN, and corresponding signaling NaN macros for _FloatN, _FloatNx and _DecimalN types, are provided in . There are also corresponding built-in functions __builtin_nansdN for decimal signaling NaNs.
  • Macros FLT_IS_IEC_60559, DBL_IS_IEC_60559 and LDBL_IS_IEC_60559 are provided in .
  • The feature test macro __STDC_WANT_IEC_60559_EXT__ is supported by .
  • Labels may appear before declarations and at the end of a compound statement.
  • New warnings:
  • -Warray-parameter, enabled by -Wall, warns about redeclarations of functions with ordinary array arguments declared using inconsistent forms. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
  • -Wvla-parameter, enabled by -Wall, warns redeclarations of functions with variable length array arguments declared using inconsistent forms or with mismatched bounds. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
  • C++:
  • The default mode has been changed to -std=gnu++17.
  • Several C++20 features have been implemented:
  • the compiler now supports consteval virtual functions
  • P2082R1, Fixing CTAD for aggregates
  • P0593R6, Pseudo-destructors end object lifetimes
  • P1907R1, Inconsistencies with non-type template parameters (complete implementation)
  • P1975R0, Fixing the wording of parenthesized aggregate-initialization
  • P1009R2, Array size deduction in new-expressions
  • P1099R5, using enum
  • Modules, Requires -fmodules-ts and some aspects are incomplete. Refer to C++ 20 Status
  • The C++ front end has experimental support for some of the upcoming C++23 draft features with the -std=c++23, -std=gnu++23, -std=c++2b or -std=gnu++2b flags, including
  • P0330R8, Literal Suffix for (signed) size_t.
  • For a full list of new features, see the C++ status page.
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 625, Use of auto as a template-argument
  • DR 1512, Pointer comparison vs qualification conversions
  • DR 1722, Should lambda to function pointer conversion function be noexcept?
  • DR 1914, Duplicate standard attributes
  • DR 2032, Default template-arguments of variable templates
  • DR 2289, Uniqueness of decomposition declaration names
  • DR 2237, Can a template-id name a constructor?
  • DR 2303, Partial ordering and recursive variadic inheritance
  • DR 2369, Ordering between constraints and substitution
  • DR 2450, braced-init-list as a template-argument
  • G++ now performs better access checking in templates (PR41437).
  • reinterpret_casts in constexpr evaluation are now checked more completely (PR95307).
  • The diagnostic for static_assert has been improved: the compiler now shows the expression including its template arguments (if there were any), and can point to the failing clause if the condition comprised of any logical AND operators (PR97518).
  • New warnings:
  • -Wctad-maybe-unsupported, disabled by default, warns about performing class template argument deduction on a type with no deduction guides.
  • -Wrange-loop-construct, enabled by -Wall, warns when a range-based for-loop is creating unnecessary and expensive copies.
  • -Wdeprecated-enum-enum-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands of enumeration types, as outlined in [depr.arith.conv.enum].
  • -Wdeprecated-enum-float-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands where one is of enumeration type and the other is of a floating-point type, as outlined in [depr.arith.conv.enum].
  • -Wmismatched-new-delete, enabled by -Wall, warns about calls to C++ operator delete with pointers returned from mismatched forms of operator new or from other mismatched allocation functions.
  • -Wvexing-parse, enabled by default, warns about the most vexing parse rule: the cases when a declaration looks like a variable definition, but the C++ language requires it to be interpreted as a function declaration.
  • Enhancements to existing warnings:
  • -Wnonnull considers the implicit this argument of every C++ nonstatic member function to have been implicitly declared with attribute nonnull and triggers warnings for calls where the pointer is null.
  • Runtime Library (libstdc++):
  • Improved C++17 support, including:
  • std::from_chars and std::to_chars for floating-point types.
  • Improved experimental C++20 support, including:
  • Calendar additions to . Thanks to Cassio Neri for optimizations.
  • std::bit_cast
  • std::source_location
  • Atomic wait and notify operations.
  • , , and
  • Efficient access to basic_stringbuf's buffer.
  • Heterogeneous lookup in unordered containers.
  • Experimental C++23 support, including:
  • contains member functions for strings, thanks to Paul Fee.
  • std::to_underlying, std::is_scoped_enum
  • Experimental support for Data-Parallel Types (simd) from the Parallelism 2 TS, thanks to Matthias Kretz.
  • Faster std::uniform_int_distribution, thanks to Daniel Lemire.
  • New features:
  • A new bottom type typeof(*null) has been added to represent run-time errors and non-terminating functions. This also introduces a new standard alias for the type named noreturn, and is implicitly imported into every module.
  • Printf-like and scanf-like functions are now detected by prefixing them with pragma(printf) for printf-like functions or pragma(scanf) for scanf-like functions.
  • The __traits() expression now supports the extensions isDeprecated, isDisabled, isFuture, isModule, isPackage, child, isReturnOnStack, isZeroInit, getTargetInfo, getLocation, hasPostblit, isCopyable, getVisibility, and totype.
  • An expression-based contract syntax has been added to the language.
  • Function literals can now return a value by reference with the ref keyword.
  • A new syntax is available to declare aliases to function types using the alias syntax based on the assignment operator.
  • New types __c_complex_float, __c_complex_double, __c_complex_real, and __c_wchar_t have been added for interfacing with C and C++ code, and are available from the core.stdc.config module.
  • User-defined attributes can now be used to annotate enum members, alias declarations, and function parameters.
  • Templates alias parameters can now be instantiated with basic types such as int or void function().
  • The mixin construct can now be used as types in the form mixin(string) var.
  • The mixin construct can now take an argument list, same as pragma(msg).
  • New intrinsics:
  • Bitwise rotate intrinsics core.bitop.rol and core.bitop.ror have been added.
  • Byte swap intrinsic core.bitop.byteswap for swapping bytes in a 2-byte ushort has been added.
  • Math intrinsics available from core.math now have overloads for float and double types.
  • Volatile intrinsics core.volatile.volatileLoad and core.volatile.volatileStore have been moved from the core.bitop module.
  • New attributes:
  • The following GCC attributes are now recognized and available from the gcc.attributes module with short-hand aliases for convenience:
  • @attribute("alloc_size", arguments) or @alloc_size(arguments).
  • @attribute("always_inline") or @always_inline.
  • @attribute("used") or @used.
  • @attribute("optimize", arguments) or @optimize(arguments).
  • @attribute("cold") or @cold.
  • @attribute("noplt") or @noplt.
  • @attribute("target_clones", arguments) or @target_clones(arguments).
  • @attribute("no_icf") or @no_icf.
  • @attribute("noipa") or @noipa.
  • @attribute("symver", arguments) or @symver(arguments).
  • New aliases have been added to gcc.attributes for compatibility with ldc.attributes.
  • The @allocSize(arguments) attribute is the same as @alloc_size(arguments), but uses a 0-based index for function arguments.
  • The @assumeUsed attribute is an alias for @attribute("used").
  • The @fastmath attribute is an alias for @optimize("Ofast").
  • The @naked attribute is an alias for @attribute("naked"). This attribute may not be available on all targets.
  • The @restrict attribute has been added to specify that a function parameter is to be restrict-qualified in the C99 sense of the term.
  • The @optStrategy(strategy) attribute is an alias for @optimize("O0") when the strategy is "none", otherwise @optimize("Os") for the "optsize" and "minsize" strategies.
  • The @polly attribute is an alias for @optimize("loop-parallelize-all").
  • The @section(name) attribute is an alias for @attribute("section", name).
  • The @target(arguments) attribute is an alias for attribute("target", arguments).
  • The @weak attribute is an alias for @attribute("weak").
  • New language options:
  • -fweak-templates, added to control whether declarations that can be defined in multiple objects should be emitted as weak symbols. The default is to emit all symbols with extern linkage as weak, unless the target lacks support for weak symbols.
  • -Wdeprecated, this option is now enabled by default.
  • -Wextra, this option now turns on all warnings that are not part of the core D language front-end - -Waddress, -Wcast-result, -Wunknown-pragmas.
  • -Wvarargs, added to turn on warnings about questionable usage of the va_start intrinsic.
  • Deprecated and removed features:
  • Compiler-recognized attributes are now made available from the gcc.attributes module, the former module gcc.attribute has been deprecated and will be removed in a future release.
  • The @attribute("alias") attribute has been removed, as it had been superseded by pragma(mangle).
  • The @attribute("forceinline") attribute has been removed and renamed to @always_inline.
  • __vector types that are not supported in hardware are now rejected at compile-time. Previously all vector types were accepted by the compiler and emulated when target support was absent.
  • The extern(Pascal) linkage attribute has been removed.
  • The deprecation phase for -ftransition=import and -ftransition=checkimports is finished. These switches no longer have an effect and are now removed. Symbols that are not visible in a particular scope will no longer be found by the compiler.
  • It is now an error to use private variables selectively imported from other modules. Due to a bug, some imported private members were visible from other modules, violating the specification.
  • The -fweak compiler switch has been removed, as it existed only for testing.
  • Fortran:
  • Added DEPRECATED to !GCC$'s attributes directive.
  • Go:
  • GCC 11 provides a complete implementation of the Go 1.16.3 user packages.
  • libgccjit:
  • libgccjit was marked as merely "Alpha" quality when originally added in GCC 5. Given that we have maintained API and ABI compatibility since then and it is in use by various projects, we have removed that caveat.
  • libgccjit can now be built for MinGW
  • The libgccjit API gained 10 new entry points:
  • gcc_jit_global_set_initializer
  • 9 entrypoints for directly embedding asm statements into a compile, analogous to inline asm in the C front end
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • A number of new CPUs are supported through arguments to the -mcpu and -mtune options in both the arm and aarch64 backends (GCC identifiers in parentheses):
  • Arm Cortex-A78 (cortex-a78).
  • Arm Cortex-A78AE (cortex-a78ae).
  • Arm Cortex-A78C (cortex-a78c).
  • Arm Cortex-X1 (cortex-x1).
  • Arm Neoverse V1 (neoverse-v1).
  • Arm Neoverse N2 (neoverse-n2).
  • GCC can now auto-vectorize operations performing addition, subtraction, multiplication and the accumulate/subtract variants on complex numbers, taking advantage of the Advanced SIMD instructions in the Armv8.3-a (AArch64/AArch32), SVE (AArch64), SVE2 (AArch64) and MVE (AArch32 M-profile) instruction sets.
  • AArch64:
  • In addition to the above, the following AArch64-only CPUs are now supported:
  • Fujitsu A64FX (a64fx).
  • Arm Cortex-R82 (cortex-r82).
  • The AArch64 Armv8-R architecture is now supported through the -march=armv8-r option.
  • Mitigation against the Straight-line Speculation vulnerability is supported with the -mharden-sls= option. Please refer to the documentation for usage instructions.
  • The availability of Advanced SIMD intrinsics available through the arm_neon.h header is improved and GCC 11 supports the full set of intrinsics defined by ACLE Q3 2020.
  • AMD Radeon (GCN):
  • Initial support for gfx908 GPUs has been added.
  • arm:
  • Initial auto-vectorization is now available when targeting the MVE instruction set.
  • GCC can now make use of the Low Overhead Branch instruction in Armv8.1-M to optimize loop counters and checks.
  • The -mcpu=cortex-m55 option now supports the extensions +nomve and +nomve.fp to control generation of MVE and MVE floating-point instructions.
  • IA-32/x86-64:
  • New ISA extension support for Intel TSXLDTRK was added to GCC. TSXLDTRK intrinsics are available via the -mtsxldtrk compiler switch.
  • New ISA extension support for Intel SERIALIZE was added to GCC. SERIALIZE intrinsics are available via the -mserialize compiler switch.
  • New ISA extension support for Intel HRESET was added to GCC. HRESET intrinsics are available via the -mhreset compiler switch.
  • New ISA extension support for Intel UINTR was added to GCC. UINTR intrinsics are available via the -muintr compiler switch.
  • New ISA extension support for Intel KEYLOCKER was added to GCC. KEYLOCKER intrinsics are available via the -mkeylocker compiler switch.
  • New ISA extension support for Intel AMX-TILE, AMX-INT8, AMX-BF16 was added to GCC. AMX-TILE, AMX-INT8, AMX-BF16 intrinsics are available via the -mamx-tile, -mamx-int8, -mamx-bf16 compiler switches.
  • New ISA extension support for Intel AVX-VNNI was added to GCC. AVX-VNNI intrinsics are available via the -mavxvnni compiler switch.
  • GCC now supports the Intel CPU named Sapphire Rapids through -march=sapphirerapids. The switch enables the MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, SERIALIZE, PTWRITE, WAITPKG, TSXLDTRK, AMT-TILE, AMX-INT8, AMX-BF16, and AVX-VNNI ISA extensions.
  • GCC now supports the Intel CPU named Alderlake through -march=alderlake. The switch enables the CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, KEYLOCKER, AVX-VNNI, and HRESET ISA extensions.
  • GCC now supports the Intel CPU named Rocketlake through -march=rocketlake. Rocket Lake is based on Icelake client and minus SGX.
  • GCC now supports AMD CPUs based on the znver3 core via -march=znver3.
  • GCC now supports micro-architecture levels defined in the x86-64 psABI via -march=x86-64-v2, -march=x86-64-v3 and -march=x86-64-v4.
  • Nios II:
  • The options -mcustom-insn=N no longer produce compiler warnings if the custom instruction is not generated due to missing optimization options such as -fno-math-errno, -ffinite-math-only, or -funsafe-math-optimizations. These warnings were not consistently emitted for all custom instructions.
  • The -mcustom-fpu-cfg=fph2 option has been added to enable the custom instructions supported by the Nios II Floating Point Hardware 2 Component.
  • NVPTX:
  • The -misa default has changed from sm_30 to sm_35.
  • The -m32 compiler switch has been removed.
  • The -msoft-stack-reserve-local format has been fixed. Previously, it accepted -msoft-stack-reserve-local. It now accepts -msoft-stack-reserve-local=.
  • S/390, System z, IBM Z Systems:
  • The behavior when compiling with -fexcess-precision=standard (e.g., implied by -std=c99) on s390(x) targets can now be controlled at configure time with the flag --enable-s390-excess-float-precision. When enabled, GCC will maintain previous behavior and evaluate float expressions in double precision, which aligns with the definition of float_t as double. With the flag disabled, GCC will always evaluate float expressions in single precision. In native builds and cross compiles that have target libc headers, GCC will by default match the definition of float_t in the installed glibc.
  • RISC-V:
  • Support address sanitizer for RISC-V.
  • Support big-endian for RISC-V, thanks to Marcus Comstedt.
  • Implement new style of architecture extension test macros: each architecture extension has a corresponding feature test macro, which can be used to test its existence and version information.
  • Legacy architecture extension test macros like __riscv_atomic are deprecated, but will still be supported for at least 2 release cycles.
  • Support IFUNC for riscv*-*-linux*.
  • Add new option -misa-spec=* to control ISA spec version. This controls the default version of each extensions. It defaults to 2.2.
  • Introduce the --with-multilib-generator configure time option. This allows for flexible config multi-lib settings. Its syntax is the same as RISC-V's multilib-generator.
  • Extend the sytax for multilib-generator, support expansion operator * to reduce the complexity of complicated multi-lib re-use rules.
  • Support -mcpu=* option aligned with RISC-V clang/LLVM. It sets the pipeline model and architecture extensions, like -mtune=* plus -march=*.
  • Support for TLS stack protector canary access, thanks to Cooper Qu.
  • Support __builtin_thread_pointer for RISC-V.
  • Introduce shorten_memrefs optimization, which reduces the code size for memory access, thanks to Craig Blackmore.
  • Operating Systems:
  • AIX:
  • GCC for AIX can be built as a 64 bit application and the runtime is built as FAT libraries containing both 32 bit and 64 bit objects.
  • Support AIX Vector Extended ABI with -mabi=vec-extabi.
  • Thread-Local uninitiated data placed in local common section.
  • Use thread-safe access in ctype.
  • Link with libc128.a when long-double-128 enabled.
  • Improvements to Static Analyzer:
  • The implementation of how program state is tracked within -fanalyzer has been completely rewritten for GCC 11, fixing numerous bugs, and allowing for the analyzer to scale to larger C source files.
  • The analysis of allocations and deallocations has been generalized beyond malloc and free.
  • As preliminary work towards eventually supporting C++, the malloc/free checking will also check new/delete and new[]/delete[]. However, C++ is not yet properly supported by -fanalyzer (for example, exception-handling is unimplemented).
  • As noted above, the existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. The analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
  • A new -Wanalyzer-mismatching-deallocation warning has been added, covering such mismatches as using scalar delete rather vector delete[].
  • The analyzer has gained warnings -Wanalyzer-shift-count-negative, -Wanalyzer-shift-count-overflow, -Wanalyzer-write-to-const, and -Wanalyzer-write-to-string-literal, all enabled by default when -fanalyzer is enabled.
  • The analyzer can now be extended by GCC plugins, allowing for domain-specific path-sensitive warnings. An example of using a GCC plugin to check for misuses of CPython's global interpreter lock can be seen in the test suite
  • The analyzer has gained new debugging options -fdump-analyzer-json and -fno-analyzer-feasibility.
  • Other significant improvements:
  • GCC has gained a new environment variable GCC_EXTRA_DIAGNOSTIC_OUTPUT which can be used by IDEs to request machine-readable fix-it hints without needing to adjust build flags.

New in GCC 11.1.0 (Apr 27, 2021)

  • Caveats:
  • The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14. Note that C++17 changes to template template parameter matching can be disabled independently of other features with -fno-new-ttp-matching.
  • When building GCC itself, the host compiler must now support C++11, rather than C++98. In particular bootstrapping GCC 11 using an older version of GCC requires a binary of GCC 4.8 or later, rather than of GCC 3.4 or later as was the case for bootstrapping GCC 10.
  • Naming and location of auxiliary and dump output files changed. If you compile multiple input files in a single command, if you enable Link Time Optimization, or if you use -dumpbase, -dumpdir, -save-temps=*, and you expect any file other than the primary output file(s) to be created as a side effect, watch out for improvements and a few surprises. See the patch, particularly its textual description, for more details about the changes.
  • -gsplit-dwarf no longer enables debug info generation on its own but requires a separate -g for this.
  • The libstdc++ configure option --enable-cheaders=c_std is deprecated and will be removed in a future release. It should be possible to use --enable-cheaders=c_global (the default) with no change in behaviour.
  • The front end for compiling BRIG format of Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • Some short options of the gcov tool have been renamed: -i to -j and -j to -H.
  • General Improvements:
  • ThreadSanitizer improvements to support alternative runtimes and environments. The Linux Kernel Concurrency Sanitizer (KCSAN) is now supported.
  • Add --param tsan-distinguish-volatile to optionally emit instrumentation distinguishing volatile accesses.
  • Add --param tsan-instrument-func-entry-exit to optionally control if function entries and exits should be instrumented.
  • In previous releases of GCC, the "column numbers" emitted in diagnostics were actually a count of bytes from the start of the source line. This could be problematic, both because of:
  • multibyte characters (requiring more than one byte to encode), and
  • multicolumn characters (requiring more than one column to display in a monospace font)
  • For example, the character π ("GREEK SMALL LETTER PI (U+03C0)") occupies one column, and its UTF-8 encoding requires two bytes; the character 🙂 ("SLIGHTLY SMILING FACE (U+1F642)") occupies two columns, and its UTF-8 encoding requires four bytes.
  • In GCC 11 the column numbers default to being column numbers, respecting multi-column characters. The old behavior can be restored using a new option -fdiagnostics-column-unit=byte. There is also a new option -fdiagnostics-column-origin=, allowing the pre-existing default of the left-hand column being column 1 to be overridden if desired (e.g. for 0-based columns). The output of -fdiagnostics-format=json has been extended to supply both byte counts and column numbers for all source locations.
  • Additionally, in previous releases of GCC, tab characters in the source would be emitted verbatim when quoting source code, but be prefixed with whitespace or line number information, leading to misalignments in the resulting output when compared with the actual source. Tab characters are now printed as an appropriate number of spaces, using the -ftabstop option (which defaults to 8 spaces per tab stop).
  • Introduce Hardware-assisted AddressSanitizer support. This sanitizer currently only works for the AArch64 target. It helps debug address problems similarly to AddressSanitizer but is based on partial hardware assistance and provides probabilistic protection to use less RAM at run time. Hardware-assisted AddressSanitizer is not production-ready for user space, and is provided mainly for use compiling the Linux Kernel.
  • To use this sanitizer the command line arguments are:
  • -fsanitize=hwaddress to instrument userspace code.
  • -fsanitize=kernel-hwaddress to instrument kernel code.
  • For targets that produce DWARF debugging information GCC now defaults to DWARF version 5 (with the exception of VxWorks and Darwin/Mac OS X which default to version 2 and AIX which defaults to version 4). This can produce up to 25% more compact debug information compared to earlier versions.
  • To take full advantage of DWARF version 5 GCC needs to be build against binutils version 2.35.2 or higher. When GCC is build against earlier versions of binutils GCC will still emit DWARF version 5 for most debuginfo data, but will generate version 4 debug line tables (even when explicitly given -gdwarf-5).
  • The following debug information consumers can process DWARF version 5:
  • GDB 8.0, or higher
  • valgrind 3.17.0
  • elfutils 0.172, or higher (for use with systemtap, dwarves/pahole, perf and libabigail)
  • dwz 0.14
  • Programs embedding libbacktrace are urged to upgrade to the version shipping with GCC 11.
  • To make GCC 11 generate an older DWARF version use -g together with -gdwarf-2, -gdwarf-3 or -gdwarf-4.
  • Vectorizer improvements:
  • The straight-line code vectorizer now considers the whole function when vectorizing and can handle opportunities crossing CFG merges and backedges.
  • A series of conditional expressions that compare the same variable can be transformed into a switch statement if each of them contains a comparison expression.
  • This statement can be transformed into a switch statement and then expanded into a bit-test.
  • New command-line options:
  • -fbit-tests, enabled by default, can be used to enable or disable switch expansion using bit-tests.
  • Inter-procedural optimization improvements:
  • A new IPA-modref pass was added to track side effects of function calls and improve precision of points-to-analysis. The pass can be controlled by the -fipa-modref option.
  • The identical code folding pass (controlled by -fipa-icf) was significantly improved to increase the number of unified functions and to reduce compile-time memory use.
  • IPA-CP (Interprocedural constant propagation) heuristics improved its estimation of potential usefulness of known loop bounds and strides by taking the estimated frequency of these loops into account.
  • Link-time optimization improvements:
  • The LTO bytecode format was optimized for smaller object files and faster streaming.
  • Memory allocation of the linking stage was improved to reduce peak memory use.
  • Profile driven optimization improvements:
  • Using -fprofile-values, was improved by tracking more target values for e.g. indirect calls.
  • GCOV data file format outputs smaller files by representing zero counters in a more compact way.
  • New Languages and Language specific improvements:
  • GCC 11 adds support for non-rectangular loop nests in OpenMP constructs and the allocator routines of OpenMP 5.0, including initial allocate clause support in C/C++. The OMP_TARGET_OFFLOAD environment variable and the active-levels routines are now supported. For C/C++, the declare variant and map support has been extended. For Fortran, OpenMP 4.5 is now fully supported and OpenMP 5.0 support has been extended, including the following features which were before only available in C and C++: order(concurrent), device_type, memorder-clauses for flush, lastprivate with conditional modifier, atomic construct and reduction clause extensions of OpenMP 5.0, if clause with simd and cancel modifiers, target data without map clause, and limited support for the requires construct.
  • Version 2.6 of the OpenACC specification continues to be maintained and improved in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information.
  • C family:
  • New attributes:
  • The no_stack_protector attribute has been added to mark functions which should not be instrumented with stack protection (-fstack-protector).
  • The existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. A pair of new -Wmismatched-dealloc and -Wmismatched-new-delete warnings will complain about mismatched calls, and -Wfree-nonheap-object about deallocation calls with pointers not obtained from allocation functions. Additionally, the static analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
  • New warnings:
  • -Wmismatched-dealloc, enabled by default, warns about calls to deallocation functions with pointers returned from mismatched allocation functions.
  • -Wsizeof-array-div, enabled by -Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.
  • -Wstringop-overread, enabled by default, warns about calls to string functions reading past the end of the arrays passed to them as arguments. In prior GCC releases most instances of his warning are diagnosed by -Wstringop-overflow.
  • -Wtsan, enabled by default, warns about unsupported features in ThreadSanitizer (currently std::atomic_thread_fence).
  • Enhancements to existing warnings:
  • -Wfree-nonheap-object detects many more instances of calls to deallocation functions with pointers not returned from a dynamic memory allocation function.
  • -Wmaybe-uninitialized diagnoses passing pointers or references to uninitialized memory to functions taking const-qualified arguments.
  • -Wuninitialized detects reads from uninitialized dynamically allocated memory.
  • For ELF targets that support the GNU or FreeBSD OSABIs, the used attribute will now save the symbol declaration it is applied to from linker garbage collection.
  • To support this behavior, used symbols that have not been placed in specific sections (e.g. with the section attribute, or the -f{function,data}-sections options) will be placed in new, unique sections.
  • This functionality requires Binutils version 2.36 or later.
  • Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • The BOOL_MAX and BOOL_WIDTH macros are provided in .
  • As in C++, function definitions no longer need to give names for unused function parameters.
  • The expansions of the true and false macros in have changed so that they have type bool.
  • The [[nodiscard]] standard attribute is now supported.
  • The __has_c_attribute preprocessor operator is now supported.
  • Macros INFINITY, NAN, FLT_SNAN, DBL_SNAN, LDBL_SNAN, DEC_INFINITY, DEC_NAN, and corresponding signaling NaN macros for _FloatN, _FloatNx and _DecimalN types, are provided in . There are also corresponding built-in functions __builtin_nansdN for decimal signaling NaNs.
  • Macros FLT_IS_IEC_60559, DBL_IS_IEC_60559 and LDBL_IS_IEC_60559 are provided in .
  • The feature test macro __STDC_WANT_IEC_60559_EXT__ is supported by .
  • Labels may appear before declarations and at the end of a compound statement.
  • New warnings:
  • -Warray-parameter, enabled by -Wall, warns about redeclarations of functions with ordinary array arguments declared using inconsistent forms. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
  • -Wvla-parameter, enabled by -Wall, warns redeclarations of functions with variable length array arguments declared using inconsistent forms or with mismatched bounds. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
  • C++:
  • The default mode has been changed to -std=gnu++17.
  • Several C++20 features have been implemented:
  • the compiler now supports consteval virtual functions
  • P2082R1, Fixing CTAD for aggregates
  • P0593R6, Pseudo-destructors end object lifetimes
  • P1907R1, Inconsistencies with non-type template parameters (complete implementation)
  • P1975R0, Fixing the wording of parenthesized aggregate-initialization
  • P1009R2, Array size deduction in new-expressions
  • P1099R5, using enum
  • Modules, Requires -fmodules-ts and some aspects are incomplete. Refer to C++ 20 Status
  • The C++ front end has experimental support for some of the upcoming C++23 draft features with the -std=c++23, -std=gnu++23, -std=c++2b or -std=gnu++2b flags, including
  • P0330R8, Literal Suffix for (signed) size_t.
  • For a full list of new features, see the C++ status page.
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 625, Use of auto as a template-argument
  • DR 1512, Pointer comparison vs qualification conversions
  • DR 1722, Should lambda to function pointer conversion function be noexcept?
  • DR 1914, Duplicate standard attributes
  • DR 2032, Default template-arguments of variable templates
  • DR 2289, Uniqueness of decomposition declaration names
  • DR 2237, Can a template-id name a constructor?
  • DR 2303, Partial ordering and recursive variadic inheritance
  • DR 2369, Ordering between constraints and substitution
  • DR 2450, braced-init-list as a template-argument
  • G++ now performs better access checking in templates (PR41437).
  • reinterpret_casts in constexpr evaluation are now checked more completely (PR95307).
  • The diagnostic for static_assert has been improved: the compiler now shows the expression including its template arguments (if there were any), and can point to the failing clause if the condition comprised of any logical AND operators (PR97518).
  • New warnings:
  • -Wctad-maybe-unsupported, disabled by default, warns about performing class template argument deduction on a type with no deduction guides.
  • -Wrange-loop-construct, enabled by -Wall, warns when a range-based for-loop is creating unnecessary and expensive copies.
  • -Wdeprecated-enum-enum-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands of enumeration types, as outlined in [depr.arith.conv.enum].
  • -Wdeprecated-enum-float-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands where one is of enumeration type and the other is of a floating-point type, as outlined in [depr.arith.conv.enum].
  • -Wmismatched-new-delete, enabled by -Wall, warns about calls to C++ operator delete with pointers returned from mismatched forms of operator new or from other mismatched allocation functions.
  • -Wvexing-parse, enabled by default, warns about the most vexing parse rule: the cases when a declaration looks like a variable definition, but the C++ language requires it to be interpreted as a function declaration.
  • Enhancements to existing warnings:
  • -Wnonnull considers the implicit this argument of every C++ nonstatic member function to have been implicitly declared with attribute nonnull and triggers warnings for calls where the pointer is null.
  • Runtime Library (libstdc++):
  • Improved C++17 support, including:
  • std::from_chars and std::to_chars for floating-point types.
  • Improved experimental C++20 support, including:
  • Calendar additions to . Thanks to Cassio Neri for optimizations.
  • std::bit_cast
  • std::source_location
  • Atomic wait and notify operations.
  • , , and
  • Efficient access to basic_stringbuf's buffer.
  • Experimental C++23 support, including:
  • contains member functions for strings, thanks to Paul Fee.
  • std::to_underlying, std::is_scoped_enum
  • Experimental support for Data-Parallel Types (simd) from the Parallelism 2 TS, thanks to Matthias Kretz.
  • Faster std::uniform_int_distribution, thanks to Daniel Lemire.
  • Fortran:
  • Added DEPRECATED to !GCC$'s attributes directive.
  • libgccjit:
  • libgccjit was marked as merely "Alpha" quality when originally added in GCC 5. Given that we have maintained API and ABI compatibility since then and it is in use by various projects, we have removed that caveat.
  • libgccjit can now be built for MinGW
  • The libgccjit API gained 10 new entry points:
  • gcc_jit_global_set_initializer
  • 9 entrypoints for directly embedding asm statements into a compile, analogous to inline asm in the C front end
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • A number of new CPUs are supported through arguments to the -mcpu and -mtune options in both the arm and aarch64 backends (GCC identifiers in parentheses):
  • Arm Cortex-A78 (cortex-a78).
  • Arm Cortex-A78AE (cortex-a78ae).
  • Arm Cortex-A78C (cortex-a78c).
  • Arm Cortex-X1 (cortex-x1).
  • Arm Neoverse V1 (neoverse-v1).
  • Arm Neoverse N2 (neoverse-n2).
  • GCC can now auto-vectorize operations performing addition, subtraction, multiplication and the accumulate/subtract variants on complex numbers, taking advantage of the Advanced SIMD instructions in the Armv8.3-a (AArch64/AArch32), SVE (AArch64), SVE2 (AArch64) and MVE (AArch32 M-profile) instruction sets.
  • AArch64:
  • In addition to the above, the following AArch64-only CPUs are now supported:
  • Fujitsu A64FX (a64fx).
  • Arm Cortex-R82 (cortex-r82).
  • The AArch64 Armv8-R architecture is now supported through the -march=armv8-r option.
  • Mitigation against the Straight-line Speculation vulnerability is supported with the -mharden-sls= option. Please refer to the documentation for usage instructions.
  • The availability of Advanced SIMD intrinsics available through the arm_neon.h header is improved and GCC 11 supports the full set of intrinsics defined by ACLE Q3 2020.
  • AMD Radeon (GCN):
  • Initial support for gfx908 GPUs has been added.
  • arm:
  • Initial auto-vectorization is now available when targeting the MVE instruction set.
  • GCC can now make use of the Low Overhead Branch instruction in Armv8.1-M to optimize loop counters and checks.
  • The -mcpu=cortex-m55 option now supports the extensions +nomve and +nomve.fp to control generation of MVE and MVE floating-point instructions.
  • IA-32/x86-64:
  • New ISA extension support for Intel TSXLDTRK was added to GCC. TSXLDTRK intrinsics are available via the -mtsxldtrk compiler switch.
  • New ISA extension support for Intel SERIALIZE was added to GCC. SERIALIZE intrinsics are available via the -mserialize compiler switch.
  • New ISA extension support for Intel HRESET was added to GCC. HRESET intrinsics are available via the -mhreset compiler switch.
  • New ISA extension support for Intel UINTR was added to GCC. UINTR intrinsics are available via the -muintr compiler switch.
  • New ISA extension support for Intel KEYLOCKER was added to GCC. KEYLOCKER intrinsics are available via the -mkeylocker compiler switch.
  • New ISA extension support for Intel AMX-TILE, AMX-INT8, AMX-BF16 was added to GCC. AMX-TILE, AMX-INT8, AMX-BF16 intrinsics are available via the -mamx-tile, -mamx-int8, -mamx-bf16 compiler switches.
  • New ISA extension support for Intel AVX-VNNI was added to GCC. AVX-VNNI intrinsics are available via the -mavxvnni compiler switch.
  • GCC now supports the Intel CPU named Sapphire Rapids through -march=sapphirerapids. The switch enables the MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, SERIALIZE, PTWRITE, WAITPKG, TSXLDTRK, AMT-TILE, AMX-INT8, AMX-BF16, and AVX-VNNI ISA extensions.
  • GCC now supports the Intel CPU named Alderlake through -march=alderlake. The switch enables the CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, KEYLOCKER, AVX-VNNI, and HRESET ISA extensions.
  • GCC now supports the Intel CPU named Rocketlake through -march=rocketlake. Rocket Lake is based on Icelake client and minus SGX.
  • GCC now supports AMD CPUs based on the znver3 core via -march=znver3.
  • GCC now supports micro-architecture levels defined in the x86-64 psABI via -march=x86-64-v2, -march=x86-64-v3 and -march=x86-64-v4.
  • Nios II:
  • The options -mcustom-insn=N no longer produce compiler warnings if the custom instruction is not generated due to missing optimization options such as -fno-math-errno, -ffinite-math-only, or -funsafe-math-optimizations. These warnings were not consistently emitted for all custom instructions.
  • The -mcustom-fpu-cfg=fph2 option has been added to enable the custom instructions supported by the Nios II Floating Point Hardware 2 Component.
  • NVPTX:
  • The -misa default has changed from sm_30 to sm_35.
  • The -m32 compiler switch has been removed.
  • The -msoft-stack-reserve-local format has been fixed. Previously, it accepted -msoft-stack-reserve-local. It now accepts -msoft-stack-reserve-local=.
  • S/390, System z, IBM Z Systems:
  • The behavior when compiling with -fexcess-precision=standard (e.g., implied by -std=c99) on s390(x) targets can now be controlled at configure time with the flag --enable-s390-excess-float-precision. When enabled, GCC will maintain previous behavior and evaluate float expressions in double precision, which aligns with the definition of float_t as double. With the flag disabled, GCC will always evaluate float expressions in single precision. In native builds and cross compiles that have target libc headers, GCC will by default match the definition of float_t in the installed glibc.
  • RISC-V:
  • Support address sanitizer for RISC-V.
  • Support big-endian for RISC-V, thanks to Marcus Comstedt.
  • Implement new style of architecture extension test macros, each architecture extension has corresponding feature test macro, which could use to test its existence and version information.
  • Legacy architecture extension test macro like __riscv_atomic, are deprecated, but it will still supported for at least 2 release cycles.
  • Support IFUNC for riscv*-*-linux*.
  • Add new option -misa-spec=* to control ISA spec version, default is 2.2, this option could control the default version of each extensions.
  • Introduce --with-multilib-generator to configure time option, this option could flexible config multi-lib settings, syntax is same as RISC-V's multilib-generator.
  • Extend the sytax for multilib-generator, support expansion operator * to reduce the complexity of complicated multi-lib re-use rule.
  • Support -mcpu=* option, the behavior is aligned to RISC-V clang/LLVM, it will set pipeline model and architecture extension, like -mtune=* plus -march=*.
  • Support for TLS stack protector canary access, thanks to Cooper Qu.
  • Support __builtin_thread_pointer for RISC-V.
  • Introduce shorten_memrefs optimization, which could reduce the code size for memory access, thanks to Craig Blackmore.
  • Operating Systems:
  • AIX:
  • GCC for AIX can be built as a 64 bit application and the runtime is built as FAT libraries containing both 32 bit and 64 bit objects.
  • Support AIX Vector Extended ABI with -mabi=vec-extabi.
  • Thread-Local uninitiated data placed in local common section.
  • Use thread-safe access in ctype.
  • Link with libc128.a when long-double-128 enabled.
  • Improvements to Static Analyzer:
  • The implementation of how program state is tracked within -fanalyzer has been completely rewritten for GCC 11, fixing numerous bugs, and allowing for the analyzer to scale to larger C source files.
  • The analysis of allocations and deallocations has been generalized beyond malloc and free.
  • As preliminary work towards eventually supporting C++, the malloc/free checking will also check new/delete and new[]/delete[]. However, C++ is not yet properly supported by -fanalyzer (for example, exception-handling is unimplemented).
  • As noted above, the existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. The analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
  • A new -Wanalyzer-mismatching-deallocation warning has been added, covering such mismatches as using scalar delete rather vector delete[].
  • The analyzer has gained warnings -Wanalyzer-shift-count-negative, -Wanalyzer-shift-count-overflow, -Wanalyzer-write-to-const, and -Wanalyzer-write-to-string-literal, all enabled by default when -fanalyzer is enabled.
  • The analyzer can now be extended by GCC plugins, allowing for domain-specific path-sensitive warnings. An example of using a GCC plugin to check for misuses of CPython's global interpreter lock can be seen in the test suite
  • The analyzer has gained new debugging options -fdump-analyzer-json and -fno-analyzer-feasibility.
  • Other significant improvements:
  • GCC has gained a new environment variable GCC_EXTRA_DIAGNOSTIC_OUTPUT which can be used by IDEs to request machine-readable fix-it hints without needing to adjust build flags.

New in GCC 10.3.0 (Apr 9, 2021)

  • Caveats:
  • An ABI incompatibility between C++14 and C++17 has been fixed. On some targets a class with a zero-sized subobject would be passed incorrectly when compiled as C++17 or C++20. See the C++ notes below for more details.
  • The deprecated Profile Mode and array_allocator extensions have been removed from libstdc++.
  • The non-standard std::__is_nullptr_t type trait is deprecated and will be removed from libstdc++ in a future release. The standard trait std::is_null_pointer should be instead.
  • The minimum version of the MPFR library required for building GCC has been increased to version 3.1.0 (released 2011-10-03).
  • The automatic template instantiation at link time (-frepo) has been removed.
  • The --param allow-store-data-races internal parameter has been removed in favor of a new official option -fallow-store-data-races. While default behavior is unchanged and the new option allows to correctly maintain a per compilation unit setting across link-time optimization, alteration of the default via --param allow-store-data-races will now be diagnosed and build systems have to be adjusted accordingly.
  • Offloading to Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • The type of the std::iterator base class of std::istreambuf_iterator was changed in C++98 mode to be consistent with C++11 and later standards. See the libstdc++ notes below for more details.
  • General Improvements:
  • New built-in functions:
  • The __has_builtin built-in preprocessor operator can be used to query support for built-in functions provided by GCC and other compilers that support it.
  • __builtin_roundeven for the corresponding function from ISO/IEC TS 18661.
  • New command-line options:
  • -fallocation-dce removes unneeded pairs of new and delete operators.
  • -fprofile-partial-training can now be used to inform the compiler that code paths not covered by the training run should not be optimized for size.
  • -fprofile-reproducible controls level of reproducibility of profile gathered by -fprofile-generate. This makes it possible to rebuild program with same outcome which is useful, for example, for distribution packages.
  • -fprofile-prefix-path can be used in combination with -fprofile-generate=profile_dir and -fprofile-use=profile_dir to inform GCC where the base directory of build source tree is in case it differs between instrumentation and optimized builds.
  • -fanalyzer enables a new static analysis pass and associated warnings. This pass performs a time-consuming exploration of paths through the code in the hope of detecting various common errors, such as double-free bugs. This option should be regarded as experimental in this release. In particular, analysis of non-C code is unlikely to work.
  • Inter-procedural optimization improvements:
  • The inter-procedural scalar replacement of aggregates (IPA-SRA) pass was re-implemented to work at link-time and can now also remove computing and returning unused return values.
  • -finline-functions is now enabled at -O2 and was retuned for better code size versus runtime performance trade-offs. Inliner heuristics was also significantly sped up to avoid negative impact to -flto -O2 compile times.
  • Inliner heuristics and function cloning can now use value-range information to predict effectivity of individual transformations.
  • During link-time optimization the C++ One Definition Rule is used to increase precision of type based alias analysis.
  • Link-time optimization improvements:
  • A new binary lto-dump has been added. It dumps various information about LTO bytecode object files.
  • The parallel phase of the LTO can automatically detect a running make's jobserver or fall back to number of available cores.
  • The LTO bytecode can be compressed with the zstd algorithm. The configure script automatically detects zstd support.
  • Most --param values can now be specified at translation unit granularity. This includes all parameters controlling the inliner and other inter-procedural optimizations. Unlike earlier releases, GCC 10 will ignore parameters controlling optimizations specified at link-time and apply parameters specified at compile-time in the same manner as done for optimization flags.
  • Profile driven optimization improvements:
  • Profile maintenance during compilation and hot/cold code partitioning have been improved.
  • Using -fprofile-values, an instrumented binary can track multiple values (up to 4) for e.g. indirect calls and provide more precise profile information.
  • New Languages and Language-Specific Improvements:
  • Version 2.6 of the OpenACC specification is now supported in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information.
  • GCC 10 adds a number of newly implemented OpenMP 5.0 features on top of the GCC 9 release such as conditional lastprivate clause, scan and loop directives, order(concurrent) and use_device_addr clauses support, if clause on simd construct or partial support for the declare variant directive, getting closer to full support of the OpenMP 5.0 standard.
  • OpenMP and OpenACC now support offloading to AMD Radeon (GCN) GPUs; supported are the third-generation Fiji (fiji) and the fifth-generation VEGA 10/VEGA 20 (gfx900 or gfx906).
  • C family:
  • New attributes:
  • The access function and type attribute has been added to describe how a function accesses objects passed to it by pointer or reference, and to associate such arguments with integer arguments denoting the objects' sizes. The attribute is used to enable the detection of invalid accesses by user-defined functions, such as those diagnosed by -Wstringop-overflow.
  • The symver attribute can be used to bind symbols to specific version nodes on ELF platforms. This is preferred to using inline assembly with GNU as symver directive because the latter is not compatible with link-time optimizations.
  • New warnings:
  • -Wstring-compare, enabled by -Wextra, warns about equality and inequality expressions between zero and the result of a call to either strcmp and strncmp that evaluate to a constant as a result of the length of one argument being greater than the size of the array pointed to by the other.
  • -Wzero-length-bounds, enabled by -Warray-bounds, warns about accesses to elements of zero-length arrays that might overlap other members of the same object.
  • Enhancements to existing warnings:
  • -Warray-bounds detects more out-of-bounds accesses to member arrays as well as accesses to elements of zero-length arrays.
  • -Wformat-overflow makes full use of string length information computed by the strlen optimization pass.
  • -Wrestrict detects overlapping accesses to dynamically allocated objects.
  • -Wreturn-local-addr diagnoses more instances of return statements returning addresses of automatic variables.
  • -Wstringop-overflow detects more out-of-bounds stores to member arrays including zero-length arrays, dynamically allocated objects and variable length arrays, as well as more instances of reads of unterminated character arrays by string built-in functions. The warning also detects out-of-bounds accesses by calls to user-defined functions declared with the new attribute access.
  • -Warith-conversion re-enables warnings from -Wconversion, -Wfloat-conversion, and -Wsign-conversion that are now off by default for an expression where the result of an arithmetic operation will not fit in the target type due to promotion, but the operands of the expression do fit in the target type.
  • Extended characters in identifiers may now be specified directly in the input encoding (UTF-8, by default), in addition to the UCN syntax (uNNNN or UNNNNNNNN) that is already supported
  • Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • The [[]] attribute syntax is supported, as in C++. Existing attributes can be used with this syntax in forms such as [[gnu::const]]. The standard attributes [[deprecated]], [[fallthrough]] and [[maybe_unused]] are supported.
  • UTF-8 character constants using the u8'' syntax are supported.
  • defines macros FLT_NORM_MAX, DBL_NORM_MAX and LDBL_NORM_MAX.
  • When decimal floating-point arithmetic is supported, defines macros DEC32_TRUE_MIN, DEC64_TRUE_MIN and DEC128_TRUE_MIN, in addition to the macros that were previously only defined if __STDC_WANT_DEC_FP__ was defined before including .
  • In C2X mode, empty parentheses in a function definition give that function a type with a prototype for subsequent calls; other old-style function definitions are diagnosed by default in C2X mode.
  • The strftime format checking supports the %OB and %Ob formats.
  • In C2X mode, -fno-fp-int-builtin-inexact is enabled by default.
  • GCC now defaults to -fno-common. As a result, global variable accesses are more efficient on various targets. In C, global variables with multiple tentative definitions now result in linker errors. With -fcommon such definitions are silently merged during linking.
  • C++:
  • Several C++20 features have been implemented:
  • Concepts, including P0734R0, P0857R0, P1084R2, P1141R2, P0848R3, P1616R1, P1452R2
  • P1668R1, Permitting Unevaluated inline-assembly in constexpr Functions
  • P1161R3, Deprecate a[b,c]
  • P0848R3, Conditionally Trivial Special Member Functions
  • P1091R3, Extending structured bindings
  • P1143R2, Adding the constinit keyword
  • P1152R4, Deprecating volatile
  • P0388R4, Permit conversions to arrays of unknown bound
  • P0784R7, constexpr new
  • P1301R4, [[nodiscard("with reason")]]
  • P1814R0, class template argument deduction for alias templates
  • P1816R0, class template argument deduction for aggregates
  • P0960R3, Parenthesized initialization of aggregates
  • P1331R2, Allow trivial default initialization in constexpr contexts
  • P1327R1, Allowing dynamic_cast and polymorphic typeid in constexpr contexts
  • P0912R5, Coroutines (requires -fcoroutines)
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 1560, lvalue-to-rvalue conversion in ?:
  • DR 1813, __is_standard_layout for a class with repeated bases
  • DR 2094, volatile scalars are trivially copyable,
  • DR 2096, constraints on literal unions
  • DR 2413, typename in conversion-function-ids
  • DR 2352, Similar types and reference binding
  • DR 1601, Promotion of enumeration with fixed underlying type
  • DR 330, Qualification conversions and pointers to arrays of pointers
  • DR 1307, Overload resolution based on size of array initializer-list
  • DR 1710, Missing template keyword in class-or-decltype
  • New warnings:
  • -Wmismatched-tags, disabled by default, warns about declarations of structs, classes, and class templates and their specializations with a class-key that does not match either the definition or the first declaration if no definition is provided. The option is provided to ease portability to Windows-based compilers.
  • -Wredundant-tags, disabled by default, warns about redundant class-key and enum-key in contexts where the key can be eliminated without causing an syntactic ambiguity.
  • G++ can now detect modifying constant objects in constexpr evaluation (which is undefined behavior).
  • G++ no longer emits bogus -Wsign-conversion warnings with explicit casts.
  • Narrowing is now detected in more contexts (e.g., case values).
  • Memory consumption of the compiler has been reduced in constexpr evaluation.
  • The noexcept-specifier is now properly treated as a complete-class context as per [class.mem].
  • The attribute deprecated can now be used on namespaces too.
  • The ABI of passing and returning certain C++ classes by value changed on several targets in GCC 10, including AArch64, ARM, PowerPC ELFv2, S/390 and Itanium. These changes affect classes with a zero-sized subobject (an empty base class, or data member with the [[no_unique_address]] attribute) where all other non-static data members have the same type (this is called a "homogeneous aggregate" in some ABI specifications, or if there is only one such member, a "single element"). In -std=c++17 and -std=c++20 modes, classes with an empty base class were not considered to have a single element or to be a homogeneous aggregate, and so could be passed differently (in the wrong registers or at the wrong stack address). This could make code compiled with -std=c++17 and -std=c++14 ABI incompatible. This has been corrected and the empty bases are ignored in those ABI decisions, so functions compiled with -std=c++14 and -std=c++17 are now ABI compatible again. Example: struct empty {}; struct S : empty { float f; }; void f(S);. Similarly, in classes containing non-static data members with empty class types using the C++20 [[no_unique_address]] attribute, those members weren't ignored in the ABI argument passing decisions as they should be. Both of these ABI changes are now diagnosed with -Wpsabi.
  • Runtime Library (libstdc++)
  • Improved experimental C++2a support, including:
  • Library concepts in and .
  • Constrained algorithms in , , and (thanks to Patrick Palka).
  • New algorithms shift_left and shift_right (thanks to Patrick Palka).
  • std::span (thanks to JeanHeyd Meneide).
  • Three-way comparisons in and throughout the library.
  • Constexpr support in and elsewhere (thanks to Edward Smith-Rowland).
  • and std::jthread (thanks to Thomas Rodgers).
  • std::atomic_ref and std::atomic.
  • Integer comparison functions (cmp_equal, cmp_less etc.).
  • std::ssize, std::to_array.
  • std::construct_at, std::destroy, constexpr std::allocator.
  • Mathematical constants in .
  • Support for RDSEED in std::random_device.
  • Reduced header dependencies, leading to faster compilation for some code.
  • The std::iterator base class of std::istreambuf_iterator was changed in C++98 mode to be consistent with C++11 and later standards. This is expected to have no noticeable effect except in the unlikely case of a class which has potentially overlapping subobjects of type std::istreambuf_iterator and another iterator type with a std::iterator base class. The layout of such a type might change when compiled as C++98. Bug 92285 has more details and concrete examples.
  • Support for static foreach has been implemented.
  • Aliases can now be created directly from any __traits that return symbols or tuples. Previously, an AliasSeq was necessary in order to alias their return.
  • It is now possible to detect the language ABI specified for a struct, class, or interface using __traits(getLinkage, ...).
  • Support for core.math.toPrec intrinsics has been added. These intrinsics guarantee the rounding to specific floating-point precisions at specified points in the code.
  • Support for pragma(inline) has been implemented. Previously the pragma was recognized, but had no effect on the compilation.
  • Optional parentheses in asm operands are deprecated and will be removed in a future release.
  • All content imported files are now included in the make dependency list when compiling with -M.
  • Compiler recognized attributes provided by the gcc.attribute module will now take effect when applied to function prototypes as well as when applied to full function declarations.
  • Added a --enable-libphobos-checking configure option to control whether run-time checks are compiled into the D runtime library.
  • Added a --with-libphobos-druntime-only configure option to indicate whether to build only the core D runtime library, or both the core and standard libraries into libphobos.
  • Fortran:
  • use_device_addr of version 5.0 of the OpenMP specification is now supported. Note that otherwise OpenMP 4.5 is partially supported in the Fortran compiler; the largest missing item is structure element mapping.
  • The default buffer size for I/O using unformatted files has been increased to 1048576. The buffer size for can now be set at runtime via the environment variables GFORTRAN_FORMATTED_BUFFER_SIZE and GFORTRAN_UNFORMATTED_BUFFER_SIZE for formatted and unformatted files, respectively.
  • Mismatches between actual and dummy argument lists in a single file are now rejected with an error. Use the new option -fallow-argument-mismatch to turn these errors into warnings; this option is implied with -std=legacy. -Wargument-mismatch has been removed.
  • The handling of a BOZ literal constant has been reworked to provide better conformance to the Fortran 2008 and 2018 standards. In these Fortran standards, a BOZ literal constant is a typeless and kindless entity. As a part of the rework, documented and undocumented extensions to the Fortran standard now emit errors during compilation. Some of these extensions are permitted with the -fallow-invalid-boz option, which degrades the error to a warning and the code is compiled as with older gfortran.
  • At any optimization level except-Os, gfortran now uses inline packing for arguments instead of calling a library routine. If the source contains a large number of arguments that need to be repacked, code size or time for compilation can become excessive. If that is the case, -fno-inline-arg-packing can be used to disable inline argument packing.
  • Legacy extensions:
  • For formatted input/output, if the explicit widths after the data-edit descriptors I, F and G have been omitted, default widths are used.
  • A blank format item at the end of a format specification, i.e. nothing following the final comma, is allowed. Use the option -fdec-blank-format-item; this option is implied with -fdec.
  • The existing support for AUTOMATIC and STATIC attributes has been extended to allow variables with the AUTOMATIC attribute to be used in EQUIVALENCE statements. Use -fdec-static; this option is implied by -fdec.
  • Allow character literals in assignments and DATA statements for numeric (INTEGER, REAL, or COMPLEX) or LOGICAL variables. Use the option -fdec-char-conversions; this option is implied with -fdec.
  • DEC comparisons, i.e. allow Hollerith constants to be used in comparisons with INTEGER, REAL, COMPLEX and CHARACTER expressions. Use the option -fdec.
  • Character type names in errors and warnings now include len in addition to kind; * is used for assumed length. The kind is omitted if it is the default kind. Examples: CHARACTER(12), CHARACTER(6,4).
  • CO_BROADCAST now supports derived type variables including objects with allocatable components. In this case, the optional arguments STAT= and ERRMSG= are currently ignored.
  • The handling of module and submodule names has been reworked to allow the full 63-character length mandated by the standard. Previously symbol names were truncated if the combined length of module, submodule, and function name exceeded 126 characters. This change therefore breaks the ABI, but only for cases where this 126 character limit was exceeded.
  • libgccjit:
  • The libgccjit API gained four new entry points:
  • gcc_jit_version_major, gcc_jit_version_minor, and gcc_jit_version_patchlevel for programmatically checking the libgccjit version from client code, and
  • gcc_jit_context_new_bitfield
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • The AArch64 and arm ports now support condition flag output constraints in inline assembly, as indicated by the __GCC_ASM_FLAG_OUTPUTS__. On arm this feature is only available for A32 and T32 targets. Please refer to the documentation for more details.
  • AArch64:
  • There have been several improvements related to the Scalable Vector Extension (SVE):
  • The SVE ACLE types and intrinsics are now supported. They can be accessed using the header file arm_sve.h.
  • It is now possible to create fixed-length SVE types using the arm_sve_vector_bits attribute.
  • mlow-precision-div, -mlow-precision-sqrt and -mlow-precision-recip-sqrt now work for SVE.
  • msve-vector-bits=128 now generates vector-length-specific code for little-endian targets. It continues to generate vector-length-agnostic code for big-endian targets, just as previous releases did for all targets.
  • The vectorizer is now able to use extending loads and truncating stores, including gather loads and scatter stores.
  • The vectorizer now compares the cost of vectorizing with SVE and vectorizing with Advanced SIMD and tries to pick the best one. Previously it would always use SVE if possible.
  • If a vector loop uses Advanced SIMD rather than SVE, the vectorizer now considers using SVE to vectorize the left-over elements (the “scalar tail” or “epilog”).
  • Besides these specific points, there have been many general improvements to the way that the vectorizer uses SVE.
  • The -mbranch-protection=pac-ret option now accepts the optional argument +b-key extension to perform return address signing with the B-key instead of the A-key.
  • The option -moutline-atomics has been added to aid deployment of the Large System Extensions (LSE) on GNU/Linux systems built with a baseline architecture targeting Armv8-A. When the option is specified code is emitted to detect the presence of LSE instructions at runtime and use them for standard atomic operations. For more information please refer to the documentation.
  • The Transactional Memory Extension is now supported through ACLE intrinsics. It can be enabled through the +tme option extension (for example, -march=armv8.5-a+tme).
  • A number of features from Armv8.5-A are now supported through ACLE intrinsics. These include:
  • The random number instructions that can be enabled through the (already present in GCC 9.1) +rng option extension.
  • Floating-point intrinsics to round to integer instructions from Armv8.5-A when targeting -march=armv8.5-a or later.
  • Memory Tagging Extension intrinsics enabled through the +memtag option extension.
  • Similarly, the following Armv8.6-A features are now supported through ACLE intrinsics:
  • The bfloat16 extension. This extension is enabled automatically when Armv8.6-A is selected (such as by -march=armv8.6-a). It can also be enabled for Armv8.2-A and later using the +bf16 option extension.
  • The Matrix Multiply extension. This extension is split into three parts, one for each supported data type:
  • Support for 8-bit integer matrix multiply instructions. This extension is enabled automatically when Armv8.6-A is selected. It can also be enabled for Armv8.2-A and later using the +i8mm option extension.
  • Support for 32-bit floating-point matrix multiply instructions. This extension can be enabled using the +f32mm option extension, which also has the effect of enabling SVE.
  • Support for 64-bit floating-point matrix multiply instructions. This extension can be enabled using the +f64mm option extension, which likewise has the effect of enabling SVE.
  • SVE2 is now supported through ACLE intrinsics and (to a limited extent) through autovectorization. It can be enabled through the +sve2 option extension (for example, -march=armv8.5-a+sve2). Additional extensions can be enabled through +sve2-sm4, +sve2-aes, +sve2-sha3 and +sve2-bitperm.
  • Support has been added for the following processors (GCC identifiers in parentheses):
  • Arm Cortex-A77 (cortex-a77).
  • Arm Cortex-A76AE (cortex-a76ae).
  • Arm Cortex-A65 (cortex-a65).
  • Arm Cortex-A65AE (cortex-a65ae).
  • Arm Cortex-A34 (cortex-a34).
  • Marvell ThunderX3 (thunderx3t110).
  • The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=cortex-a77 or -mtune=cortex-a65ae or as arguments to the equivalent target attributes and pragmas.
  • arm:
  • Support for the FDPIC ABI has been added. It uses 64-bit function descriptors to represent pointers to functions, and enables code sharing on MMU-less systems. The corresponding target triple is arm-uclinuxfdpiceabi, and the C library is uclibc-ng.
  • Support has been added for the Arm EABI on NetBSD through the arm*-*-netbsdelf-*eabi* triplet.
  • The handling of 64-bit integer operations has been significantly reworked and improved leading to improved performance and reduced stack usage when using 64-bit integral data types. The option -mneon-for-64bits is now deprecated and will be removed in a future release.
  • Support has been added for the following processors (GCC identifiers in parentheses):
  • Arm Cortex-A77 (cortex-a77).
  • Arm Cortex-A76AE (cortex-a76ae).
  • Arm Cortex-M35P (cortex-m35p).
  • Arm Cortex-M55 (cortex-m55).
  • The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=cortex-a77 or -mtune=cortex-m35p.
  • Support has been extended for the ACLE data-processing intrinsics to include 32-bit SIMD, saturating arithmetic, 16-bit multiplication and other related intrinsics aimed at DSP algorithm optimization.
  • Support for -mpure-code in Thumb-1 (v6m) has been added: this M-profile feature is no longer restricted to targets with MOVT. For example, -mcpu=cortex-m0 now supports this option.
  • Support for the Armv8.1-M Mainline Architecture has been added.
  • Armv8.1-M Mainline can be enabled by using the -march=armv8.1-m.main command-line option.
  • Support for the MVE beta ACLE intrinsics has been added. These intrinsics can be enabled by including the arm_mve.h header file and passing the +mve or +mve.fp option extensions (for example: -march=armv8.1-m.main+mve).
  • Support for the Custom Datapath Extension beta ACLE intrinsics has been added.
  • Support for Armv8.1-M Mainline Security Extensions architecture has been added. The -mcmse option, when used in combination with an Armv8.1-M Mainline architecture (for example: -march=armv8.1-m.main -mcmse), now leads to the generation of improved code sequences when changing security states.
  • AMD Radeon (GCN):
  • The code generation and in particular the vectorization support has been much improved.
  • ARC:
  • The interrupt service routine functions save all used registers, including extension registers and auxiliary registers used by Zero Overhead Loops.
  • Improve code size by using multiple short instructions instead of a single long mov or ior instruction when its long immediate constant is known.
  • Fix usage of the accumulator register for ARC600.
  • Fix issues with uncached attribute.
  • Remove -mq-class option.
  • Improve 64-bit integer addition and subtraction operations.
  • AVR:
  • Support for the XMEGA-like devices:
  • ATtiny202, ATtiny204, ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATmega808, ATmega809, ATmega1608, ATmega1609, ATmega3208, ATmega3209, ATmega4808, ATmega4809 has been added.
  • A new command-line option -nodevicespecs has been added. It allows to provide a custom device-specs file by means of avr-gcc -nodevicespecs -specs=my-spec-file
  • and without the need to provide options -B and -mmcu=. See AVR command-line options for details. This feature is also available in GCC 9.3+ and GCC 8.4+.
  • New command-line options -mdouble=[32,64] and -mlong-double=[32,64] have been added. They allow to choose the size (in bits) of the double and long double types, respectively. Whether or not the mentioned layouts are available, whether the options act as a multilib option, and the default for either option are controlled by the new AVR configure options --with-double= and --with-long-double=.
  • A new configure option --with-libf7= has been added. It controls to which level avr-libgcc provides 64-bit floating point support by means of Libf7.
  • A new configure option --with-double-comparison= has been added. It's unlikely you need to set this option by hand.
  • IA-32/x86-64:
  • Support to expand __builtin_roundeven into the appropriate SSE 4.1 instruction has been added.
  • New ISA extension support for Intel ENQCMD was added to GCC. ENQCMD intrinsics are available via the -menqcmd compiler switch.
  • GCC now supports the Intel CPU named Cooperlake through -march=cooperlake. The switch enables the AVX512BF16 ISA extensions.
  • GCC now supports the Intel CPU named Tigerlake through -march=tigerlake. The switch enables the MOVDIRI MOVDIR64B AVX512VP2INTERSECT ISA extensions.
  • MIPS:
  • The mips*-*-linux* targets now mark object files with appropriate GNU-stack note, facilitating use of non-executable stack hardening on GNU/Linux. The soft-float targets have this feature enabled by default, while for hard-float targets it is required for GCC to be configured with --with-glibc-version=2.31 against glibc 2.31 or later.
  • PowerPC / PowerPC64 / RS6000:
  • Many vector builtins have been listed as deprecated in the 64-Bit ELF V2 ABI Specification for quite a number of years. The vector builtins listed in Tables A.8 through A.10 are now deprecated for GCC 10, and will likely be removed from support in GCC 11. Note that this does not result in any loss of function. These deprecated builtins generally provide somewhat nonsensical argument lists (for example, mixing signed, unsigned, and bool vector arguments arbitrarily), or are duplicate builtins that are inconsistent with the expected naming scheme. We expect that this will be unlikely to affect much if any code, and any required code changes will be trivial.
  • PRU:
  • A new back end targeting TI PRU I/O processors has been contributed to GCC.
  • RISC-V:
  • The riscv*-*-* targets now require GNU binutils version 2.30 or later, to support new assembly instructions produced by GCC.
  • V850:
  • The ABI for V850 nested functions has been changed. Previously the V850 port used %r20 for the static chain pointer, now the port uses %r19. This corrects a long standing latent bug in the v850 port where a call to a nested function would unexpectedly change the value in %r20.
  • Operating Systems:
  • Improvements for plugin authors:
  • GCC diagnostics can now have a chain of events associated with them, describing a path through the code that triggers the problem. These can be printed by the diagnostics subsystem in various ways, controlled by the -fdiagnostics-path-format option, or captured in JSON form via -fdiagnostics-format=json.
  • GCC diagnostics can now be associated with CWE weakness identifiers, which will appear on the standard error stream, and in the JSON output from -fdiagnostics-format=json.
  • Other significant improvements:
  • To allow inline expansion of both memcpy and memmove, the existing movmem instruction patterns used for non-overlapping memory copies have been renamed to cpymem. The movmem name is now used for overlapping memory moves, consistent with the library functions memcpy and memmove.
  • For many releases, when GCC emits a warning it prints the option controlling that warning. As of GCC 10, that option text is now a clickable hyperlink for the documentation of that option (assuming a sufficiently capable terminal). This behavior can be controlled via a new -fdiagnostics-urls option (along with various environment variables and heuristics documented with that option).

New in GCC 10.2.0 (Jul 24, 2020)

  • Caveats:
  • An ABI incompatibility between C++14 and C++17 has been fixed. On some targets a class with a zero-sized subobject would be passed incorrectly when compiled as C++17 or C++20. See the C++ notes below for more details.
  • The deprecated Profile Mode and array_allocator extensions have been removed from libstdc++.
  • The non-standard std::__is_nullptr_t type trait is deprecated and will be removed from libstdc++ in a future release. The standard trait std::is_null_pointer should be instead.
  • The minimum version of the MPFR library required for building GCC has been increased to version 3.1.0 (released 2011-10-03).
  • The automatic template instantiation at link time (-frepo) has been removed.
  • The --param allow-store-data-races internal parameter has been removed in favor of a new official option -fallow-store-data-races. While default behavior is unchanged and the new option allows to correctly maintain a per compilation unit setting across link-time optimization, alteration of the default via --param allow-store-data-races will now be diagnosed and build systems have to be adjusted accordingly.
  • Offloading to Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • General Improvements:
  • New built-in functions:
  • The __has_builtin built-in preprocessor operator can be used to query support for built-in functions provided by GCC and other compilers that support it.
  • __builtin_roundeven for the corresponding function from ISO/IEC TS 18661.
  • New command-line options:
  • -fallocation-dce removes unneeded pairs of new and delete operators.
  • -fprofile-partial-training can now be used to inform the compiler that code paths not covered by the training run should not be optimized for size.
  • -fprofile-reproducible controls level of reproducibility of profile gathered by -fprofile-generate. This makes it possible to rebuild program with same outcome which is useful, for example, for distribution packages.
  • -fprofile-prefix-path can be used in combination with -fprofile-generate=profile_dir and -fprofile-use=profile_dir to inform GCC where the base directory of build source tree is in case it differs between instrumentation and optimized builds.
  • -fanalyzer enables a new static analysis pass and associated warnings. This pass performs a time-consuming exploration of paths through the code in the hope of detecting various common errors, such as double-free bugs. This option should be regarded as experimental in this release. In particular, analysis of non-C code is unlikely to work.
  • Inter-procedural optimization improvements:
  • The inter-procedural scalar replacement of aggregates (IPA-SRA) pass was re-implemented to work at link-time and can now also remove computing and returning unused return values.
  • -finline-functions is now enabled at -O2 and was retuned for better code size versus runtime performance trade-offs. Inliner heuristics was also significantly sped up to avoid negative impact to -flto -O2 compile times.
  • Inliner heuristics and function cloning can now use value-range information to predict effectivity of individual transformations.
  • During link-time optimization the C++ One Definition Rule is used to increase precision of type based alias analysis.
  • Link-time optimization improvements:
  • A new binary lto-dump has been added. It dumps various information about LTO bytecode object files.
  • The parallel phase of the LTO can automatically detect a running make's jobserver or fall back to number of available cores.
  • The LTO bytecode can be compressed with the zstd algorithm. The configure script automatically detects zstd support.
  • Most --param values can now be specified at translation unit granularity. This includes all parameters controlling the inliner and other inter-procedural optimizations. Unlike earlier releases, GCC 10 will ignore parameters controlling optimizations specified at link-time and apply parameters specified at compile-time in the same manner as done for optimization flags.
  • Profile driven optimization improvements:
  • Profile maintenance during compilation and hot/cold code partitioning have been improved.
  • Using -fprofile-values, an instrumented binary can track multiple values (up to 4) for e.g. indirect calls and provide more precise profile information.
  • New Languages and Language-Specific Improvements:
  • Version 2.6 of the OpenACC specification is now supported in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information.
  • GCC 10 adds a number of newly implemented OpenMP 5.0 features on top of the GCC 9 release such as conditional lastprivate clause, scan and loop directives, order(concurrent) and use_device_addr clauses support, if clause on simd construct or partial support for the declare variant directive, getting closer to full support of the OpenMP 5.0 standard.
  • OpenMP and OpenACC now support offloading to AMD Radeon (GCN) GPUs; supported are the third-generation Fiji (fiji) and the fifth-generation VEGA 10/VEGA 20 (gfx900 or gfx906).
  • C family:
  • New attributes:
  • The access function and type attribute has been added to describe how a function accesses objects passed to it by pointer or reference, and to associate such arguments with integer arguments denoting the objects' sizes. The attribute is used to enable the detection of invalid accesses by user-defined functions, such as those diagnosed by -Wstringop-overflow.
  • The symver attribute can be used to bind symbols to specific version nodes on ELF platforms. This is preferred to using inline assembly with GNU as symver directive because the latter is not compatible with link-time optimizations.
  • New warnings:
  • -Wstring-compare, enabled by -Wextra, warns about equality and inequality expressions between zero and the result of a call to either strcmp and strncmp that evaluate to a constant as a result of the length of one argument being greater than the size of the array pointed to by the other.
  • -Wzero-length-bounds, enabled by -Warray-bounds, warns about accesses to elements of zero-length arrays that might overlap other members of the same object.
  • Enhancements to existing warnings:
  • -Warray-bounds detects more out-of-bounds accesses to member arrays as well as accesses to elements of zero-length arrays.
  • -Wformat-overflow makes full use of string length information computed by the strlen optimization pass.
  • -Wrestrict detects overlapping accesses to dynamically allocated objects.
  • -Wreturn-local-addr diagnoses more instances of return statements returning addresses of automatic variables.
  • -Wstringop-overflow detects more out-of-bounds stores to member arrays including zero-length arrays, dynamically allocated objects and variable length arrays, as well as more instances of reads of unterminated character arrays by string built-in functions. The warning also detects out-of-bounds accesses by calls to user-defined functions declared with the new attribute access.
  • -Warith-conversion re-enables warnings from -Wconversion, -Wfloat-conversion, and -Wsign-conversion that are now off by default for an expression where the result of an arithmetic operation will not fit in the target type due to promotion, but the operands of the expression do fit in the target type.
  • Extended characters in identifiers may now be specified directly in the input encoding (UTF-8, by default), in addition to the UCN syntax (uNNNN or UNNNNNNNN) that is already supported
  • Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • The [[]] attribute syntax is supported, as in C++. Existing attributes can be used with this syntax in forms such as [[gnu::const]]. The standard attributes [[deprecated]], [[fallthrough]] and [[maybe_unused]] are supported.
  • UTF-8 character constants using the u8'' syntax are supported.
  • defines macros FLT_NORM_MAX, DBL_NORM_MAX and LDBL_NORM_MAX.
  • When decimal floating-point arithmetic is supported, defines macros DEC32_TRUE_MIN, DEC64_TRUE_MIN and DEC128_TRUE_MIN, in addition to the macros that were previously only defined if __STDC_WANT_DEC_FP__ was defined before including .
  • In C2X mode, empty parentheses in a function definition give that function a type with a prototype for subsequent calls; other old-style function definitions are diagnosed by default in C2X mode.
  • The strftime format checking supports the %OB and %Ob formats.
  • In C2X mode, -fno-fp-int-builtin-inexact is enabled by default.
  • GCC now defaults to -fno-common. As a result, global variable accesses are more efficient on various targets. In C, global variables with multiple tentative definitions now result in linker errors. With -fcommon such definitions are silently merged during linking.
  • C++:
  • Several C++20 features have been implemented:
  • Concepts, including P0734R0, P0857R0, P1084R2, P1141R2, P0848R3, P1616R1, P1452R2
  • P1668R1, Permitting Unevaluated inline-assembly in constexpr Functions
  • P1161R3, Deprecate a[b,c]
  • P0848R3, Conditionally Trivial Special Member Functions
  • P1091R3, Extending structured bindings
  • P1143R2, Adding the constinit keyword
  • P1152R4, Deprecating volatile
  • P0388R4, Permit conversions to arrays of unknown bound
  • P0784R7, constexpr new
  • P1301R4, [[nodiscard("with reason")]]
  • P1814R0, class template argument deduction for alias templates
  • P1816R0, class template argument deduction for aggregates
  • P0960R3, Parenthesized initialization of aggregates
  • P1331R2, Allow trivial default initialization in constexpr contexts
  • P1327R1, Allowing dynamic_cast and polymorphic typeid in constexpr contexts
  • P0912R5, Coroutines (requires -fcoroutines)
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 1560, lvalue-to-rvalue conversion in ?:
  • DR 1813, __is_standard_layout for a class with repeated bases
  • DR 2094, volatile scalars are trivially copyable,
  • DR 2096, constraints on literal unions
  • DR 2413, typename in conversion-function-ids
  • DR 2352, Similar types and reference binding
  • DR 1601, Promotion of enumeration with fixed underlying type
  • DR 330, Qualification conversions and pointers to arrays of pointers
  • DR 1307, Overload resolution based on size of array initializer-list
  • DR 1710, Missing template keyword in class-or-decltype
  • New warnings:
  • -Wmismatched-tags, disabled by default, warns about declarations of structs, classes, and class templates and their specializations with a class-key that does not match either the definition or the first declaration if no definition is provided. The option is provided to ease portability to Windows-based compilers.
  • -Wredundant-tags, disabled by default, warns about redundant class-key and enum-key in contexts where the key can be eliminated without causing an syntactic ambiguity.
  • G++ can now detect modifying constant objects in constexpr evaluation (which is undefined behavior).
  • G++ no longer emits bogus -Wsign-conversion warnings with explicit casts.
  • Narrowing is now detected in more contexts (e.g., case values).
  • Memory consumption of the compiler has been reduced in constexpr evaluation.
  • The noexcept-specifier is now properly treated as a complete-class context as per [class.mem].
  • The attribute deprecated can now be used on namespaces too.
  • The ABI of passing and returning certain C++ classes by value changed on several targets in GCC 10, including AArch64, ARM, PowerPC ELFv2, S/390 and Itanium. These changes affect classes with a zero-sized subobject (an empty base class, or data member with the [[no_unique_address]] attribute) where all other non-static data members have the same type (this is called a "homogeneous aggregate" in some ABI specifications, or if there is only one such member, a "single element"). In -std=c++17 and -std=c++20 modes, classes with an empty base class were not considered to have a single element or to be a homogeneous aggregate, and so could be passed differently (in the wrong registers or at the wrong stack address). This could make code compiled with -std=c++17 and -std=c++14 ABI incompatible. This has been corrected and the empty bases are ignored in those ABI decisions, so functions compiled with -std=c++14 and -std=c++17 are now ABI compatible again. Example: struct empty {}; struct S : empty { float f; }; void f(S);. Similarly, in classes containing non-static data members with empty class types using the C++20 [[no_unique_address]] attribute, those members weren't ignored in the ABI argument passing decisions as they should be. Both of these ABI changes are now diagnosed with -Wpsabi.
  • Runtime Library (libstdc++):
  • Improved experimental C++2a support, including:
  • Library concepts in and .
  • Constrained algorithms in , , and (thanks to Patrick Palka).
  • New algorithms shift_left and shift_right (thanks to Patrick Palka).
  • std::span (thanks to JeanHeyd Meneide).
  • Three-way comparisons in and throughout the library.
  • Constexpr support in and elsewhere (thanks to Edward Smith-Rowland).
  • and std::jthread (thanks to Thomas Rodgers).
  • std::atomic_ref and std::atomic.
  • Integer comparison functions (cmp_equal, cmp_less etc.).
  • std::ssize, std::to_array.
  • std::construct_at, std::destroy, constexpr std::allocator.
  • Mathematical constants in .
  • Support for RDSEED in std::random_device.
  • Reduced header dependencies, leading to faster compilation for some code.
  • Support for static foreach has been implemented.
  • Aliases can now be created directly from any __traits that return symbols or tuples. Previously, an AliasSeq was necessary in order to alias their return.
  • It is now possible to detect the language ABI specified for a struct, class, or interface using __traits(getLinkage, ...).
  • Support for core.math.toPrec intrinsics has been added. These intrinsics guarantee the rounding to specific floating-point precisions at specified points in the code.
  • Support for pragma(inline) has been implemented. Previously the pragma was recognized, but had no effect on the compilation.
  • Optional parentheses in asm operands are deprecated and will be removed in a future release.
  • All content imported files are now included in the make dependency list when compiling with -M.
  • Compiler recognized attributes provided by the gcc.attribute module will now take effect when applied to function prototypes as well as when applied to full function declarations.
  • Added a --enable-libphobos-checking configure option to control whether run-time checks are compiled into the D runtime library.
  • Added a --with-libphobos-druntime-only configure option to indicate whether to build only the core D runtime library, or both the core and standard libraries into libphobos.
  • Fortran:
  • use_device_addr of version 5.0 of the OpenMP specification is now supported. Note that otherwise OpenMP 4.5 is partially supported in the Fortran compiler; the largest missing item is structure element mapping.
  • The default buffer size for I/O using unformatted files has been increased to 1048576. The buffer size for can now be set at runtime via the environment variables GFORTRAN_FORMATTED_BUFFER_SIZE and GFORTRAN_UNFORMATTED_BUFFER_SIZE for formatted and unformatted files, respectively.
  • Mismatches between actual and dummy argument lists in a single file are now rejected with an error. Use the new option -fallow-argument-mismatch to turn these errors into warnings; this option is implied with -std=legacy. -Wargument-mismatch has been removed.
  • The handling of a BOZ literal constant has been reworked to provide better conformance to the Fortran 2008 and 2018 standards. In these Fortran standards, a BOZ literal constant is a typeless and kindless entity. As a part of the rework, documented and undocumented extensions to the Fortran standard now emit errors during compilation. Some of these extensions are permitted with the -fallow-invalid-boz option, which degrades the error to a warning and the code is compiled as with older gfortran.
  • At any optimization level except-Os, gfortran now uses inline packing for arguments instead of calling a library routine. If the source contains a large number of arguments that need to be repacked, code size or time for compilation can become excessive. If that is the case, -fno-inline-arg-packing can be used to disable inline argument packing.
  • Legacy extensions:
  • For formatted input/output, if the explicit widths after the data-edit descriptors I, F and G have been omitted, default widths are used.
  • A blank format item at the end of a format specification, i.e. nothing following the final comma, is allowed. Use the option -fdec-blank-format-item; this option is implied with -fdec.
  • The existing support for AUTOMATIC and STATIC attributes has been extended to allow variables with the AUTOMATIC attribute to be used in EQUIVALENCE statements. Use -fdec-static; this option is implied by -fdec.
  • Allow character literals in assignments and DATA statements for numeric (INTEGER, REAL, or COMPLEX) or LOGICAL variables. Use the option -fdec-char-conversions; this option is implied with -fdec.
  • DEC comparisons, i.e. allow Hollerith constants to be used in comparisons with INTEGER, REAL, COMPLEX and CHARACTER expressions. Use the option -fdec.
  • Character type names in errors and warnings now include len in addition to kind; * is used for assumed length. The kind is omitted if it is the default kind. Examples: CHARACTER(12), CHARACTER(6,4).
  • CO_BROADCAST now supports derived type variables including objects with allocatable components. In this case, the optional arguments STAT= and ERRMSG= are currently ignored.
  • The handling of module and submodule names has been reworked to allow the full 63-character length mandated by the standard. Previously symbol names were truncated if the combined length of module, submodule, and function name exceeded 126 characters. This change therefore breaks the ABI, but only for cases where this 126 character limit was exceeded.
  • libgccjit:
  • The libgccjit API gained four new entry points:
  • gcc_jit_version_major, gcc_jit_version_minor, and gcc_jit_version_patchlevel for programmatically checking the libgccjit version from client code, and
  • gcc_jit_context_new_bitfield
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • The AArch64 and arm ports now support condition flag output constraints in inline assembly, as indicated by the __GCC_ASM_FLAG_OUTPUTS__. On arm this feature is only available for A32 and T32 targets. Please refer to the documentation for more details.
  • AArch64:
  • There have been several improvements related to the Scalable Vector Extension (SVE):
  • The SVE ACLE types and intrinsics are now supported. They can be accessed using the header file arm_sve.h.
  • It is now possible to create fixed-length SVE types using the arm_sve_vector_bits attribute.
  • -mlow-precision-div, -mlow-precision-sqrt and -mlow-precision-recip-sqrt now work for SVE.
  • -msve-vector-bits=128 now generates vector-length-specific code for little-endian targets. It continues to generate vector-length-agnostic code for big-endian targets, just as previous releases did for all targets.
  • The vectorizer is now able to use extending loads and truncating stores, including gather loads and scatter stores.
  • The vectorizer now compares the cost of vectorizing with SVE and vectorizing with Advanced SIMD and tries to pick the best one. Previously it would always use SVE if possible.
  • If a vector loop uses Advanced SIMD rather than SVE, the vectorizer now considers using SVE to vectorize the left-over elements (the “scalar tail” or “epilog”).
  • Besides these specific points, there have been many general improvements to the way that the vectorizer uses SVE.
  • The -mbranch-protection=pac-ret option now accepts the optional argument +b-key extension to perform return address signing with the B-key instead of the A-key.
  • The option -moutline-atomics has been added to aid deployment of the Large System Extensions (LSE) on GNU/Linux systems built with a baseline architecture targeting Armv8-A. When the option is specified code is emitted to detect the presence of LSE instructions at runtime and use them for standard atomic operations. For more information please refer to the documentation.
  • The Transactional Memory Extension is now supported through ACLE intrinsics. It can be enabled through the +tme option extension (for example, -march=armv8.5-a+tme).
  • A number of features from Armv8.5-A are now supported through ACLE intrinsics. These include:
  • The random number instructions that can be enabled through the (already present in GCC 9.1) +rng option extension.
  • Floating-point intrinsics to round to integer instructions from Armv8.5-A when targeting -march=armv8.5-a or later.
  • Memory Tagging Extension intrinsics enabled through the +memtag option extension.
  • Similarly, the following Armv8.6-A features are now supported through ACLE intrinsics:
  • The bfloat16 extension. This extension is enabled automatically when Armv8.6-A is selected (such as by -march=armv8.6-a). It can also be enabled for Armv8.2-A and later using the +bf16 option extension.
  • The Matrix Multiply extension. This extension is split into three parts, one for each supported data type:
  • Support for 8-bit integer matrix multiply instructions. This extension is enabled automatically when Armv8.6-A is selected. It can also be enabled for Armv8.2-A and later using the +i8mm option extension.
  • Support for 32-bit floating-point matrix multiply instructions. This extension can be enabled using the +f32mm option extension, which also has the effect of enabling SVE.
  • Support for 64-bit floating-point matrix multiply instructions. This extension can be enabled using the +f64mm option extension, which likewise has the effect of enabling SVE.
  • SVE2 is now supported through ACLE intrinsics and (to a limited extent) through autovectorization. It can be enabled through the +sve2 option extension (for example, -march=armv8.5-a+sve2). Additional extensions can be enabled through +sve2-sm4, +sve2-aes, +sve2-sha3 and +sve2-bitperm.
  • Support has been added for the following processors (GCC identifiers in parentheses)
  • Arm Cortex-A77 (cortex-a77).
  • Arm Cortex-A76AE (cortex-a76ae).
  • Arm Cortex-A65 (cortex-a65).
  • Arm Cortex-A65AE (cortex-a65ae).
  • Arm Cortex-A34 (cortex-a34).
  • Marvell ThunderX3 (thunderx3t110).
  • The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=cortex-a77 or -mtune=cortex-a65ae or as arguments to the equivalent target attributes and pragmas.
  • arm:
  • Support for the FDPIC ABI has been added. It uses 64-bit function descriptors to represent pointers to functions, and enables code sharing on MMU-less systems. The corresponding target triple is arm-uclinuxfdpiceabi, and the C library is uclibc-ng.
  • Support has been added for the Arm EABI on NetBSD through the arm*-*-netbsdelf-*eabi* triplet.
  • The handling of 64-bit integer operations has been significantly reworked and improved leading to improved performance and reduced stack usage when using 64-bit integral data types. The option -mneon-for-64bits is now deprecated and will be removed in a future release.
  • Support has been added for the following processors (GCC identifiers in parentheses)
  • Arm Cortex-A77 (cortex-a77).
  • Arm Cortex-A76AE (cortex-a76ae).
  • Arm Cortex-M35P (cortex-m35p).
  • Arm Cortex-M55 (cortex-m55).
  • The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=cortex-a77 or -mtune=cortex-m35p.
  • Support has been extended for the ACLE data-processing intrinsics to include 32-bit SIMD, saturating arithmetic, 16-bit multiplication and other related intrinsics aimed at DSP algorithm optimization.
  • Support for -mpure-code in Thumb-1 (v6m) has been added: this M-profile feature is no longer restricted to targets with MOVT. For example, -mcpu=cortex-m0 now supports this option.
  • Support for the Armv8.1-M Mainline Architecture has been added.
  • Armv8.1-M Mainline can be enabled by using the -march=armv8.1-m.main command-line option.
  • Support for the MVE beta ACLE intrinsics has been added. These intrinsics can be enabled by including the arm_mve.h header file and passing the +mve or +mve.fp option extensions (for example: -march=armv8.1-m.main+mve).
  • Support for the Custom Datapath Extension beta ACLE intrinsics has been added.
  • Support for Armv8.1-M Mainline Security Extensions architecture has been added. The -mcmse option, when used in combination with an Armv8.1-M Mainline architecture (for example: -march=armv8.1-m.main -mcmse), now leads to the generation of improved code sequences when changing security states.
  • AMD Radeon (GCN):
  • The code generation and in particular the vectorization support has been much improved.
  • ARC:
  • The interrupt service routine functions save all used registers, including extension registers and auxiliary registers used by Zero Overhead Loops.
  • Improve code size by using multiple short instructions instead of a single long mov or ior instruction when its long immediate constant is known.
  • Fix usage of the accumulator register for ARC600.
  • Fix issues with uncached attribute.
  • Remove -mq-class option.
  • Improve 64-bit integer addition and subtraction operations.
  • AVR:
  • Support for the XMEGA-like devices
  • ATtiny202, ATtiny204, ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATmega808, ATmega809, ATmega1608, ATmega1609, ATmega3208, ATmega3209, ATmega4808, ATmega4809 has been added.
  • A new command-line option -nodevicespecs has been added. It allows to provide a custom device-specs file by means of avr-gcc -nodevicespecs -specs=my-spec-file
  • and without the need to provide options -B and -mmcu=. See AVR command-line options for details. This feature is also available in GCC 9.3+ and GCC 8.4+.
  • New command-line options -mdouble=[32,64] and -mlong-double=[32,64] have been added. They allow to choose the size (in bits) of the double and long double types, respectively. Whether or not the mentioned layouts are available, whether the options act as a multilib option, and the default for either option are controlled by the new AVR configure options --with-double= and --with-long-double=.
  • A new configure option --with-libf7= has been added. It controls to which level avr-libgcc provides 64-bit floating point support by means of Libf7.
  • A new configure option --with-double-comparison= has been added. It's unlikely you need to set this option by hand.
  • IA-32/x86-64:
  • Support to expand __builtin_roundeven into the appropriate SSE 4.1 instruction has been added.
  • New ISA extension support for Intel ENQCMD was added to GCC. ENQCMD intrinsics are available via the -menqcmd compiler switch.
  • GCC now supports the Intel CPU named Cooperlake through -march=cooperlake. The switch enables the AVX512BF16 ISA extensions.
  • GCC now supports the Intel CPU named Tigerlake through -march=tigerlake. The switch enables the MOVDIRI MOVDIR64B AVX512VP2INTERSECT ISA extensions.
  • MIPS:
  • The mips*-*-linux* targets now mark object files with appropriate GNU-stack note, facilitating use of non-executable stack hardening on GNU/Linux. The soft-float targets have this feature enabled by default, while for hard-float targets it is required for GCC to be configured with --with-glibc-version=2.31 against glibc 2.31 or later.
  • PowerPC / PowerPC64 / RS6000:
  • Many vector builtins have been listed as deprecated in the 64-Bit ELF V2 ABI Specification for quite a number of years. The vector builtins listed in Tables A.8 through A.10 are now deprecated for GCC 10, and will likely be removed from support in GCC 11.
  • PRU:
  • A new back end targeting TI PRU I/O processors has been contributed to GCC.
  • RISC-V:
  • The riscv*-*-* targets now require GNU binutils version 2.30 or later, to support new assembly instructions produced by GCC.
  • V850:
  • The ABI for V850 nested functions has been changed. Previously the V850 port used %r20 for the static chain pointer, now the port uses %r19. This corrects a long standing latent bug in the v850 port where a call to a nested function would unexpectedly change the value in %r20.
  • Operating Systems:
  • Improvements for plugin authors:
  • GCC diagnostics can now have a chain of events associated with them, describing a path through the code that triggers the problem. These can be printed by the diagnostics subsystem in various ways, controlled by the -fdiagnostics-path-format option, or captured in JSON form via -fdiagnostics-format=json.
  • GCC diagnostics can now be associated with CWE weakness identifiers, which will appear on the standard error stream, and in the JSON output from -fdiagnostics-format=json.
  • Other significant improvements:
  • To allow inline expansion of both memcpy and memmove, the existing movmem instruction patterns used for non-overlapping memory copies have been renamed to cpymem. The movmem name is now used for overlapping memory moves, consistent with the library functions memcpy and memmove.
  • For many releases, when GCC emits a warning it prints the option controlling that warning. As of GCC 10, that option text is now a clickable hyperlink for the documentation of that option (assuming a sufficiently capable terminal). This behavior can be controlled via a new -fdiagnostics-urls option (along with various environment variables and heuristics documented with that option).

New in GCC 10.1.0 (May 10, 2020)

  • Caveats:
  • An ABI incompatibility between C++14 and C++17 has been fixed. On some targets a class with a zero-sized subobject would be passed incorrectly when compiled as C++17 or C++20. See the C++ notes below for more details.
  • The deprecated Profile Mode and array_allocator extensions have been removed from libstdc++.
  • The non-standard std::__is_nullptr_t type trait is deprecated and will be removed from libstdc++ in a future release. The standard trait std::is_null_pointer should be instead.
  • The minimum version of the MPFR library required for building GCC has been increased to version 3.1.0 (released 2011-10-03).
  • The automatic template instantiation at link time (-frepo) has been removed.
  • The --param allow-store-data-races internal parameter has been removed in favor of a new official option -fallow-store-data-races. While default behavior is unchanged and the new option allows to correctly maintain a per compilation unit setting across link-time optimization, alteration of the default via --param allow-store-data-races will now be diagnosed and build systems have to be adjusted accordingly.
  • Offloading to Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • General Improvements:
  • New built-in functions:
  • The __has_builtin built-in preprocessor operator can be used to query support for built-in functions provided by GCC and other compilers that support it.
  • __builtin_roundeven for the corresponding function from ISO/IEC TS 18661.
  • New command-line options:
  • -fallocation-dce removes unneeded pairs of new and delete operators.
  • -fprofile-partial-training can now be used to inform the compiler that code paths not covered by the training run should not be optimized for size.
  • -fprofile-reproducible controls level of reproducibility of profile gathered by -fprofile-generate. This makes it possible to rebuild program with same outcome which is useful, for example, for distribution packages.
  • -fprofile-prefix-path can be used in combination with -fprofile-generate=profile_dir and -fprofile-use=profile_dir to inform GCC where the base directory of build source tree is in case it differs between instrumentation and optimized builds.
  • -fanalyzer enables a new static analysis pass and associated warnings. This pass performs a time-consuming exploration of paths through the code in the hope of detecting various common errors, such as double-free bugs. This option should be regarded as experimental in this release. In particular, analysis of non-C code is unlikely to work.
  • Inter-procedural optimization improvements:
  • The inter-procedural scalar replacement of aggregates (IPA-SRA) pass was re-implemented to work at link-time and can now also remove computing and returning unused return values.
  • -finline-functions is now enabled at -O2 and was retuned for better code size versus runtime performance trade-offs. Inliner heuristics was also significantly sped up to avoid negative impact to -flto -O2 compile times.
  • Inliner heuristics and function cloning can now use value-range information to predict effectivity of individual transformations.
  • During link-time optimization the C++ One Definition Rule is used to increase precision of type based alias analysis.
  • Link-time optimization improvements:
  • A new binary lto-dump has been added. The program can dump various information about a LTO bytecode object file.
  • Parallel phase of the LTO can automatically detect a running make's jobserver or can fall back to number of available cores.
  • The LTO bytecode can be compressed with zstd algorithm. Configure script can automatically detect the zstd support.
  • Most --param values can now be specified at translation unit granularity. This includes all parameters controlling the inliner and other inter-procedural optimizations. Unlike earlier releases, GCC 10 will ignore parameters controlling optimizations specified at link-time and apply parameters specified at compile-time in the same manner as done for optimization flags.
  • Profile driven optimization improvements:
  • Profile maintenance during compilation and hot/cold code partitioning have been improved.
  • Using -fprofile-values, an instrumented binary can track multiple values (up to 4) for e.g. indirect calls and provide more precise profile information.
  • New Languages and Language-Specific Improvements:
  • Version 2.6 of the OpenACC specification is now supported in the C, C++ and Fortran compilers. See the implementation status section on the OpenACC wiki page and the run-time library documentation for further information.
  • GCC 10 adds a number of newly implemented OpenMP 5.0 features on top of the GCC 9 release such as conditional lastprivate clause, scan and loop directives, order(concurrent) and use_device_addr clauses support, if clause on simd construct or partial support for the declare variant directive, getting closer to full support of the OpenMP 5.0 standard.
  • OpenMP and OpenACC now support offloading to AMD Radeon (GCN) GPUs; supported are the third-generation Fiji (fiji) and the fifth-generation VEGA 10/VEGA 20 (gfx900 or gfx906).
  • C family:
  • New attributes:
  • The access function and type attribute has been added to describe how a function accesses objects passed to it by pointer or reference, and to associate such arguments with integer arguments denoting the objects' sizes. The attribute is used to enable the detection of invalid accesses by user-defined functions, such as those diagnosed by -Wstringop-overflow.
  • The symver attribute can be used to bind symbols to specific version nodes on ELF platforms. This is preferred to using inline assembly with GNU as symver directive because the latter is not compatible with link-time optimizations.
  • New warnings:
  • -Wstring-compare, enabled by -Wextra, warns about equality and inequality expressions between zero and the result of a call to either strcmp and strncmp that evaluate to a constant as a result of the length of one argument being greater than the size of the array pointed to by the other.
  • -Wzero-length-bounds, enabled by -Warray-bounds, warns about accesses to elements of zero-length arrays that might overlap other members of the same object.
  • Enhancements to existing warnings:
  • -Warray-bounds detects more out-of-bounds accesses to member arrays as well as accesses to elements of zero-length arrays.
  • -Wformat-overflow makes full use of string length information computed by the strlen optimization pass.
  • -Wrestrict detects overlapping accesses to dynamically allocated objects.
  • -Wreturn-local-addr diagnoses more instances of return statements returning addresses of automatic variables.
  • -Wstringop-overflow detects more out-of-bounds stores to member arrays including zero-length arrays, dynamically allocated objects and variable length arrays, as well as more instances of reads of unterminated character arrays by string built-in functions. The warning also detects out-of-bounds accesses by calls to user-defined functions declared with the new attribute access.
  • Extended characters in identifiers may now be specified directly in the input encoding (UTF-8, by default), in addition to the UCN syntax (uNNNN or UNNNNNNNN) that is already supported:
  • static const int π = 3;
  • int get_naïve_pi() {
  • return π;
  • Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
  • The [[]] attribute syntax is supported, as in C++. Existing attributes can be used with this syntax in forms such as [[gnu::const]]. The standard attributes [[deprecated]], [[fallthrough]] and [[maybe_unused]] are supported.
  • UTF-8 character constants using the u8'' syntax are supported.
  • defines macros FLT_NORM_MAX, DBL_NORM_MAX and LDBL_NORM_MAX.
  • When decimal floating-point arithmetic is supported, defines macros DEC32_TRUE_MIN, DEC64_TRUE_MIN and DEC128_TRUE_MIN, in addition to the macros that were previously only defined if __STDC_WANT_DEC_FP__ was defined before including .
  • In C2X mode, empty parentheses in a function definition give that function a type with a prototype for subsequent calls; other old-style function definitions are diagnosed by default in C2X mode.
  • The strftime format checking supports the %OB and %Ob formats.
  • In C2X mode, -fno-fp-int-builtin-inexact is enabled by default.
  • GCC now defaults to -fno-common. As a result, global variable accesses are more efficient on various targets. In C, global variables with multiple tentative definitions now result in linker errors. With -fcommon such definitions are silently merged during linking.
  • C++:
  • Several C++20 features have been implemented:
  • P1668R1, Permitting Unevaluated inline-assembly in constexpr Functions
  • P1161R3, Deprecate a[b,c]
  • P0848R3, Conditionally Trivial Special Member Functions
  • P1091R3, Extending structured bindings
  • P1143R2, Adding the constinit keyword
  • P1152R4, Deprecating volatile
  • P0388R4, Permit conversions to arrays of unknown bound
  • P0784R7, constexpr new
  • Concepts, including P0734R0, P0857R0, P1084R2, P1141R2, P0848R3, P1616R1, P1452R2
  • P1301R4, [[nodiscard("with reason")]]
  • P1814R0, class template argument deduction for alias templates
  • P1816R0, class template argument deduction for aggregates
  • P0960R3, Parenthesized initialization of aggregates
  • P1331R2, Allow trivial default initialization in constexpr contexts
  • P1327R1, Allowing dynamic_cast and polymorphic typeid in constexpr contexts
  • P0912R5, Coroutines (requires -fcoroutines)
  • Several C++ Defect Reports have been resolved, e.g.:
  • DR 1560, lvalue-to-rvalue conversion in ?:
  • DR 1813, __is_standard_layout for a class with repeated bases
  • DR 2094, volatile scalars are trivially copyable,
  • DR 2096, constraints on literal unions
  • DR 2413, typename in conversion-function-ids
  • DR 2352, Similar types and reference binding
  • DR 1601, Promotion of enumeration with fixed underlying type
  • DR 330, Qualification conversions and pointers to arrays of pointers
  • DR 1307, Overload resolution based on size of array initializer-list
  • DR 1710, Missing template keyword in class-or-decltype
  • New warnings:
  • -Wmismatched-tags, disabled by default, warns about declarations of structs, classes, and class templates and their specializations with a class-key that does not match either the definition or the first declaration if no definition is provided. The option is provided to ease portability to Windows-based compilers.
  • -Wredundant-tags, disabled by default, warns about redundant class-key and enum-key in contexts where the key can be eliminated without causing an syntactic ambiguity.
  • G++ can now detect modifying constant objects in constexpr evaluation (which is undefined behavior).
  • G++ no longer emits bogus -Wsign-conversion warnings with explicit casts.
  • Narrowing is now detected in more contexts (e.g., case values).
  • Memory consumption of the compiler has been reduced in constexpr evaluation.
  • The noexcept-specifier is now properly treated as a complete-class context as per [class.mem].
  • The attribute deprecated can now be used on namespaces too.
  • The ABI of passing and returning certain C++ classes by value changed on several targets in GCC 10, including AArch64, ARM, PowerPC ELFv2, S/390 and Itanium. These changes affect classes with a zero-sized subobject (an empty base class, or data member with the [[no_unique_address]] attribute) where all other non-static data members have the same type (this is called a "homogeneous aggregate" in some ABI specifications, or if there is only one such member, a "single element"). In -std=c++17 and -std=c++20 modes, classes with an empty base class were not considered to have a single element or to be a homogeneous aggregate, and so could be passed differently (in the wrong registers or at the wrong stack address). This could make code compiled with -std=c++17 and -std=c++14 ABI incompatible. This has been corrected and the empty bases are ignored in those ABI decisions, so functions compiled with -std=c++14 and -std=c++17 are now ABI compatible again. Example: struct empty {}; struct S : empty { float f; }; void f(S);. Similarly, in classes containing non-static data members with empty class types using the C++20 [[no_unique_address]] attribute, those members weren't ignored in the ABI argument passing decisions as they should be. Both of these ABI changes are now diagnosed with -Wpsabi.
  • Runtime Library (libstdc++):
  • Improved experimental C++2a support, including:
  • Library concepts in and .
  • Constrained algorithms in , , and (thanks to Patrick Palka).
  • New algorithms shift_left and shift_right (thanks to Patrick Palka).
  • std::span (thanks to JeanHeyd Meneide).
  • Three-way comparisons in and throughout the library.
  • Constexpr support in and elsewhere (thanks to Edward Smith-Rowland).
  • and std::jthread (thanks to Thomas Rodgers).
  • std::atomic_ref and std::atomic.
  • Integer comparison functions (cmp_equal, cmp_less etc.).
  • std::ssize, std::to_array.
  • std::construct_at, std::destroy, constexpr std::allocator.
  • Mathematical constants in .
  • Support for RDSEED in std::random_device.
  • Reduced header dependencies, leading to faster compilation for some code.
  • Fortran:
  • use_device_addr of version 5.0 of the OpenMP specification is now supported. Note that otherwise OpenMP 4.5 is partially supported in the Fortran compiler; the largest missing item is structure element mapping.
  • The default buffer size for I/O using unformatted files has been increased to 1048576. The buffer size for can now be set at runtime via the environment variables GFORTRAN_FORMATTED_BUFFER_SIZE and GFORTRAN_UNFORMATTED_BUFFER_SIZE for formatted and unformatted files, respectively.
  • Mismatches between actual and dummy argument lists in a single file are now rejected with an error. Use the new option -fallow-argument-mismatch to turn these errors into warnings; this option is implied with -std=legacy. -Wargument-mismatch has been removed.
  • The handling of a BOZ literal constant has been reworked to provide better conformance to the Fortran 2008 and 2018 standards. In these Fortran standards, a BOZ literal constant is a typeless and kindless entity. As a part of the rework, documented and undocumented extensions to the Fortran standard now emit errors during compilation. Some of these extensions are permitted with the -fallow-invalid-boz, where the error is degraded to a warning and the code is compiled as with older gfortran.
  • At any optimization level except-Os, gfortran now uses inline packing for arguments instead of calling a library routine. If the source contains a large number of arguments that need to be repacked, code size or time for compilation can become excessive. If that is the case, -fno-inline-arg-packing can be used to disable inline argument packing.
  • Legacy extensions:
  • For formatted input/output, if the explicit widths after the data-edit descriptors I, F and G have been omitted, default widths are used.
  • A blank format item at the end of a format specification, i.e. nothing following the final comma, is allowed. Use the option -fdec-blank-format-item; this option is implied with -fdec.
  • The existing support for AUTOMATIC and STATIC attributes has been extended to allow variables with the AUTOMATIC attribute to be used in EQUIVALENCE statements. Use -fdec-static; this option is implied by -fdec.
  • Allow character literals in assignments and DATA statements for numeric (INTEGER, REAL, or COMPLEX) or LOGICAL variables. Use the option -fdec-char-conversions; this option is implied with -fdec.
  • DEC comparisons, i.e. allow Hollerith constants to be used in comparisons with INTEGER, REAL, COMPLEX and CHARACTER expressions. Use the option -fdec.
  • Character type names in errors and warnings now include len in addition to kind; * is used for assumed length. The kind is omitted if it is the default kind. Examples: CHARACTER(12), CHARACTER(6,4).
  • CO_BROADCAST now supports derived type variables including objects with allocatable components. In this case, the optional arguments STAT= and ERRMSG= are currently ignored.
  • The handling of module and submodule names has been reworked to allow the full 63-character length mandated by the standard. Previously symbol names were truncated if the combined length of module, submodule, and function name exceeded 126 characters. This change therefore breaks the ABI, but only for cases where this 126 character limit was exceeded.
  • New Targets and Target Specific Improvements:
  • AArch64 & arm:
  • The AArch64 and arm ports now support condition flag output constraints in inline assembly, as indicated by the __GCC_ASM_FLAG_OUTPUTS__. On arm this feature is only available for A32 and T32 targets. Please refer to the documentation for more details.
  • AArch64:
  • There have been several improvements related to the Scalable Vector Extension (SVE):
  • The SVE ACLE types and intrinsics are now supported. They can be accessed using the header file arm_sve.h.
  • It is now possible to create fixed-length SVE types using the arm_sve_vector_bits attribute. For example:
  • #if __ARM_FEATURE_SVE_BITS==512
  • typedef svint32_t vec512 __attribute__((arm_sve_vector_bits(512)));
  • typedef svbool_t pred512 __attribute__((arm_sve_vector_bits(512)));
  • #endif
  • -mlow-precision-div, -mlow-precision-sqrt and -mlow-precision-recip-sqrt now work for SVE.
  • -msve-vector-bits=128 now generates vector-length-specific code for little-endian targets. It continues to generate vector-length-agnostic code for big-endian targets, just as previous releases did for all targets.
  • The vectorizer is now able to use extending loads and truncating stores, including gather loads and scatter stores.
  • The vectorizer now compares the cost of vectorizing with SVE and vectorizing with Advanced SIMD and tries to pick the best one. Previously it would always use SVE if possible.
  • If a vector loop uses Advanced SIMD rather than SVE, the vectorizer now considers using SVE to vectorize the left-over elements (the “scalar tail” or “epilog”).
  • Besides these specific points, there have been many general improvements to the way that the vectorizer uses SVE.
  • The -mbranch-protection=pac-ret option now accepts the optional argument +b-key extension to perform return address signing with the B-key instead of the A-key.
  • The option -moutline-atomics has been added to aid deployment of the Large System Extensions (LSE) on GNU/Linux systems built with a baseline architecture targeting Armv8-A. When the option is specified code is emitted to detect the presence of LSE instructions at runtime and use them for standard atomic operations. For more information please refer to the documentation.
  • The Transactional Memory Extension is now supported through ACLE intrinsics. It can be enabled through the +tme option extension (for example, -march=armv8.5-a+tme).
  • A number of features from Armv8.5-A are now supported through ACLE intrinsics. These include:
  • The random number instructions that can be enabled through the (already present in GCC 9.1) +rng option extension.
  • Floating-point intrinsics to round to integer instructions from Armv8.5-A when targeting -march=armv8.5-a or later.
  • Memory Tagging Extension intrinsics enabled through the +memtag option extension.
  • Similarly, the following Armv8.6-A features are now supported through ACLE intrinsics:
  • The bfloat16 extension. This extension is enabled automatically when Armv8.6-A is selected (such as by -march=armv8.6-a). It can also be enabled for Armv8.2-A and later using the +bf16 option extension.
  • The Matrix Multiply extension. This extension is split into three parts, one for each supported data type:
  • Support for 8-bit integer matrix multiply instructions. This extension is enabled automatically when Armv8.6-A is selected. It can also be enabled for Armv8.2-A and later using the +i8mm option extension.
  • Support for 32-bit floating-point matrix multiply instructions. This extension can be enabled using the +f32mm option extension, which also has the effect of enabling SVE.
  • Support for 64-bit floating-point matrix multiply instructions. This extension can be enabled using the +f64mm option extension, which likewise has the effect of enabling SVE.
  • SVE2 is now supported through ACLE intrinsics and (to a limited extent) through autovectorization. It can be enabled through the +sve2 option extension (for example, -march=armv8.5-a+sve2). Additional extensions can be enabled through +sve2-sm4, +sve2-aes, +sve2-sha3 and +sve2-bitperm.
  • Support has been added for the following processors (GCC identifiers in parentheses):
  • Arm Cortex-A77 (cortex-a77).
  • Arm Cortex-A76AE (cortex-a76ae).
  • Arm Cortex-A65 (cortex-a65).
  • Arm Cortex-A65AE (cortex-a65ae).
  • Arm Cortex-A34 (cortex-a34).
  • Marvell ThunderX3 (thunderx3t110).
  • The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=cortex-a77 or -mtune=cortex-a65ae or as arguments to the equivalent target attributes and pragmas.
  • arm:
  • Support for the FDPIC ABI has been added. It uses 64-bit function descriptors to represent pointers to functions, and enables code sharing on MMU-less systems. The corresponding target triple is arm-uclinuxfdpiceabi, and the C library is uclibc-ng.
  • Support has been added for the Arm EABI on NetBSD through the arm*-*-netbsdelf-*eabi* triplet.
  • The handling of 64-bit integer operations has been significantly reworked and improved leading to improved performance and reduced stack usage when using 64-bit integral data types. The option -mneon-for-64bits is now deprecated and will be removed in a future release.
  • Support has been added for the following processors (GCC identifiers in parentheses):
  • Arm Cortex-A77 (cortex-a77).
  • Arm Cortex-A76AE (cortex-a76ae).
  • Arm Cortex-M35P (cortex-m35p).
  • The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=cortex-a77 or -mtune=cortex-m35p.
  • Support has been extended for the ACLE data-processing intrinsics to include 32-bit SIMD, saturating arithmetic, 16-bit multiplication and other related intrinsics aimed at DSP algorithm optimization.
  • Support for -mpure-code in Thumb-1 (v6m) has been added: this M-profile feature is no longer restricted to targets with MOVT. For example, -mcpu=cortex-m0 now supports this option.
  • Support for the Custom Datapath Extension beta ACLE intrinsics has been added.
  • AMD Radeon (GCN):
  • The code generation and in particular the vectorization support has been much improved.
  • ARC:
  • The interrupt service routine functions save all used registers, including extension registers and auxiliary registers used by Zero Overhead Loops.
  • Improve code size by using multiple short instructions instead of a single long mov or ior instruction when its long immediate constant is known.
  • Fix usage of the accumulator register for ARC600.
  • Fix issues with uncached attribute.
  • Remove -mq-class option.
  • Improve 64-bit integer addition and subtraction operations.
  • AVR:
  • Support for the XMEGA-like devices:
  • ATtiny202, ATtiny204, ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATmega808, ATmega809, ATmega1608, ATmega1609, ATmega3208, ATmega3209, ATmega4808, ATmega4809 has been added.
  • A new command-line option -nodevicespecs has been added. It allows to provide a custom device-specs file by means of avr-gcc -nodevicespecs -specs=my-spec-file and without the need to provide options -B and -mmcu=. See AVR command-line options for details. This feature is also available in GCC 9.3+ and GCC 8.4+.
  • New command-line options -mdouble=[32,64] and -mlong-double=[32,64] have been added. They allow to choose the size (in bits) of the double and long double types, respectively. Whether or not the mentioned layouts are available, whether the options act as a multilib option, and the default for either option are controlled by the new AVR configure options --with-double= and --with-long-double=.
  • A new configure option --with-libf7= has been added. It controls to which level avr-libgcc provides 64-bit floating point support by means of Libf7.
  • A new configure option --with-double-comparison= has been added. It's unlikely you need to set this option by hand.
  • IA-32/x86-64:
  • Support to expand __builtin_roundeven into the appropriate SSE 4.1 instruction has been added.
  • New ISA extension support for Intel ENQCMD was added to GCC. ENQCMD intrinsics are available via the -menqcmd compiler switch.
  • GCC now supports the Intel CPU named Cooperlake through -march=cooperlake. The switch enables the AVX512BF16 ISA extensions.
  • GCC now supports the Intel CPU named Tigerlake through -march=tigerlake. The switch enables the MOVDIRI MOVDIR64B AVX512VP2INTERSECT ISA extensions.
  • MIPS:
  • The mips*-*-linux* targets now mark object files with appropriate GNU-stack note, facilitating use of non-executable stack hardening on GNU/Linux. The soft-float targets have this feature enabled by default, while for hard-float targets it is required for GCC to be configured with --with-glibc-version=2.31 against glibc 2.31 or later.
  • PowerPC / PowerPC64 / RS6000:
  • Many vector builtins have been listed as deprecated in the 64-Bit ELF V2 ABI Specification for quite a number of years. The vector builtins listed in Tables A.8 through A.10 are now deprecated for GCC 10, and will likely be removed from support in GCC 11.
  • PRU:
  • A new back end targeting TI PRU I/O processors has been contributed to GCC.
  • RISC-V:
  • The riscv*-*-* targets now require GNU binutils version 2.30 or later, to support new assembly instructions produced by GCC.
  • V850:
  • The ABI for V850 nested functions has been changed. Previously the V850 port used %r20 for the static chain pointer, now the port uses %r19. This corrects a long standing latent bug in the v850 port where a call to a nested function would unexpectedly change the value in %r20.
  • Operating Systems:
  • Improvements for plugin authors:
  • GCC diagnostics can now have a chain of events associated with them, describing a path through the code that triggers the problem. These can be printed by the diagnostics subsystem in various ways, controlled by the -fdiagnostics-path-format option, or captured in JSON form via -fdiagnostics-format=json.
  • GCC diagnostics can now be associated with CWE weakness identifiers, which will appear on the standard error stream, and in the JSON output from -fdiagnostics-format=json.
  • Other significant improvements:
  • To allow inline expansion of both memcpy and memmove, the existing movmem instruction patterns used for non-overlapping memory copies have been renamed to cpymem. The movmem name is now used for overlapping memory moves, consistent with the library functions memcpy and memmove.
  • For many releases, when GCC emits a warning it prints the option controlling that warning. As of GCC 10, that option text is now a clickable hyperlink for the documentation of that option (assuming a sufficiently capable terminal). This behavior can be controlled via a new -fdiagnostics-urls option (along with various environment variables and heuristics documented with that option).

New in GCC 8.2.0 (Jul 27, 2018)

  • Inter-procedural optimization improvements:
  • Reworked run-time estimation metrics leading to more realistic guesses driving inliner and cloning heuristics.
  • The ipa-pure-const pass is extended to propagate the malloc attribute, and the corresponding warning option -Wsuggest-attribute=malloc emits a diagnostic for functions which can be annotated with the malloc attribute.
  • Profile driven optimization improvements:
  • New infrastructure for representing profiles (both statically guessed and profile feedback) which allows propagation of additional information about the reliability of the profile.
  • A number of improvements in the profile updating code solving problems found by new verification code.
  • Static detection of code which is not executed in a valid run of the program. This includes paths which trigger undefined behavior as well as calls to functions declared with the cold attribute. Newly the noreturn attribute does not imply all effects of cold to differentiate between exit (which is noreturn) and abort (which is in addition not executed in valid runs).
  • -freorder-blocks-and-partition, a pass splitting function bodies into hot and cold regions, is now enabled by default at -O2 and higher for x86 and x86-64.
  • Link-time optimization improvements:
  • We have significantly improved debug information on ELF targets using DWARF by properly preserving language-specific information. This allows for example the libstdc++ pretty-printers to work with LTO optimized executables.
  • Caveats:
  • Support for the obsolete SDB/coff debug info format has been removed. The option -gcoff no longer does anything.
  • The Cilk+ extensions to the C and C++ languages have been removed.
  • The MPX extensions to the C and C++ languages have been deprecated and will be removed in a future release.
  • The extension allowing arithmetic on std::atomic and types like std::atomic has been deprecated.
  • The non-standard C++0x std::copy_exception function was removed. std::make_exception_ptr should be used instead.
  • Support for the powerpc*-*-*spe* target ports which have been recently unmaintained and untested in GCC has been declared obsolete in GCC 8 as announced here. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
  • Further details on this release are available at:
  • https://gcc.gnu.org/gcc-8/changes.html

New in GCC 8.1.0 (May 6, 2018)

  • A new option -fcf-protection=[full|branch|return|none] is introduced to perform code instrumentation to increase program security by checking that target addresses of control-flow transfer instructions (such as indirect function call, function return, indirect jump) are valid. Currently the instrumentation is supported on x86 GNU/Linux targets only. See the user guide for further information about the option syntax and section "New Targets and Target Specific Improvements" for IA-32/x86-64 for more details.
  • The -gcolumn-info option is now enabled by default. It includes column information in addition to just filenames and line numbers in DWARF debugging information.
  • The polyhedral-based loop nest optimization pass -floop-nest-optimize has been overhauled. It's still considered experimental and may not result in any runtime improvements.
  • Two new classical loop nest optimization passes have been added. -floop-unroll-and-jam performs outer loop unrolling and fusing of the inner loop copies. -floop-interchange exchanges loops in a loop nest to improve data locality. Both passes are enabled by default at -O3 and above.
  • The classic loop nest optimization pass -ftree-loop-distribution has been improved and enabled by default at -O3 and above. It supports loop nest distribution in some restricted scenarios; it also supports cancellable innermost loop distribution with loop versioning under run-time alias checks.
  • The new option -fstack-clash-protection causes the compiler to insert probes whenever stack space is allocated statically or dynamically to reliably detect stack overflows and thus mitigate the attack vector that relies on jumping over a stack guard page as provided by the operating system.
  • A new pragma GCC unroll has been implemented in the C family of languages, as well as Fortran and Ada, so as to make it possible for the user to have a finer-grained control over the loop unrolling optimization.
  • GCC has been enhanced to detect more instances of meaningless or mutually exclusive attribute specifications and handle such conflicts more consistently. Mutually exclusive attribute specifications are ignored with a warning regardless of whether they appear on the same declaration or on distinct declarations of the same entity. For example, because the noreturn attribute on the second declaration below is mutually exclusive with the malloc attribute on the first, it is ignored and a warning is issued.
  • The gcov tool can distinguish functions that begin on a same line in a source file.
  • The gcov tool has more accurate numbers for execution of lines in a source file.
  • The gcov tool can use TERM colors to provide more readable output.
  • AddressSanitizer gained a new pair of sanitization options, -fsanitize=pointer-compare and -fsanitize=pointer-subtract, which warn about subtraction (or comparison) of pointers that point to a different memory objec.
  • The store merging pass has been enhanced to handle bit-fields and not just constant stores, but also data copying from adjacent memory locations into other adjacent memory locations, including bitwise logical operations on the data. The pass can also handle byte swapping into memory locations.
  • The undefined behavior sanitizer gained two new options included in -fsanitize=undefined: -fsanitize=builtin which diagnoses at run time invalid arguments to __builtin_clz or __builtin_ctz prefixed builtins, and -fsanitize=pointer-overflow which performs cheap run time tests for pointer wrapping.
  • Inter-procedural optimization improvements:
  • Reworked run-time estimation metrics leading to more realistic guesses driving inliner and cloning heuristics.
  • The ipa-pure-const pass is extended to propagate the malloc attribute, and the corresponding warning option -Wsuggest-attribute=malloc emits a diagnostic for functions which can be annotated with the malloc attribute.
  • Profile driven optimization improvements:
  • New infrastructure for representing profiles (both statically guessed and profile feedback) which allows propagation of additional information about the reliability of the profile.
  • A number of improvements in the profile updating code solving problems found by new verification code.
  • Static detection of code which is not executed in a valid run of the program. This includes paths which trigger undefined behavior as well as calls to functions declared with the cold attribute. Newly the noreturn attribute does not imply all effects of cold to differentiate between exit (which is noreturn) and abort (which is in addition not executed in valid runs).
  • -freorder-blocks-and-partition, a pass splitting function bodies into hot and cold regions, is now enabled by default at -O2 and higher for x86 and x86-64.
  • Link-time optimization improvements:
  • We have significantly improved debug information on ELF targets using DWARF by properly preserving language-specific information. This allows for example the libstdc++ pretty-printers to work with LTO optimized executables.
  • Further details on this release are available at:
  • https://gcc.gnu.org/gcc-8/changes.html

New in GCC 7.3.0 (Jan 26, 2018)

  • General Optimizer Improvements:
  • GCC 7 can determine the return value or range of return values of some calls to the sprintf family of functions and make it available to other optimization passes. Some calls to the snprintf function with a zero size argument can be folded into constants. This optimization is included in -O1 and can be selectively controlled by the -fprintf-return-value option.
  • A new store merging pass has been added. It merges constant stores to adjacent memory locations into fewer, wider, stores. It is enabled by the -fstore-merging option and at the -O2 optimization level or higher (and -Os).
  • A new code hoisting optimization has been added to the partial redundancy elimination pass. It attempts to move evaluation of expressions executed on all paths to the function exit as early as possible. This primarily helps improve code size, but can improve the speed of the generated code as well. It is enabled by the -fcode-hoisting option and at the -O2 optimization level or higher (and -Os).
  • A new interprocedural bitwise constant propagation optimization has been added, which propagates knowledge about which bits of variables are known to be zero (including pointer alignment information) across the call graph. It is enabled by the -fipa-bit-cp option if -fipa-cp is enabled as well, and is enabled at the -O2 optimization level and higher (and -Os). This optimization supersedes interprocedural alignment propagation of GCC 6, and therefore the option -fipa-cp-alignment is now deprecated and ignored.
  • A new interprocedural value range propagation optimization has been added, which propagates integral range information across the call graph when variable values can be proven to be within those ranges. It is enabled by the -fipa-vrp option and at the -O2 optimization level and higher (and -Os).
  • A new loop splitting optimization pass has been added. Certain loops which contain a condition that is always true on one side of the iteration space and always false on the other are split into two loops, such that each of the two new loops iterates on just one side of the iteration space and the condition does not need to be checked inside of the loop. It is enabled by the -fsplit-loops option and at the -O3 optimization level or higher.
  • The shrink-wrapping optimization can now separate portions of prologues and epilogues to improve performance if some of the work done traditionally by prologues and epilogues is not needed on certain paths. This is controlled by the -fshrink-wrap-separate option, enabled by default. It requires target support, which is currently only implemented in the PowerPC and AArch64 ports.
  • AddressSanitizer gained a new sanitization option, -fsanitize-address-use-after-scope, which enables sanitization of variables whose address is taken and used after a scope where the variable is defined.
  • The option is enabled by default with -fsanitize=address and disabled by default with -fsanitize=kernel-address.
  • The -fsanitize=signed-integer-overflow suboption of the UndefinedBehavior Sanitizer now diagnoses arithmetic overflows even on arithmetic operations with generic vectors.
  • Version 5 of the DWARF debugging information standard is supported through the -gdwarf-5 option. The DWARF version 4 debugging information remains the default until consumers of debugging information are adjusted.
  • Detailed release notes are available at:
  • https://gcc.gnu.org/gcc-7/changes.html

New in GCC 7.1.0 (May 3, 2017)

  • Caveats:
  • GCC now uses LRA (a new local register allocator) by default for new targets.
  • The non-standard C++0x type traits has_trivial_default_constructor, has_trivial_copy_constructor and has_trivial_copy_assign have been removed.
  • The libstdc++ Profile Mode has been deprecated and will be removed in a future version.
  • The Cilk+ extensions to the C and C++ languages have been deprecated.
  • On ARM targets (arm*-*-*), a bug introduced in GCC 5 that affects conformance to the procedure call standard (AAPCS) has been fixed. The bug affects some C++ code where class objects are passed by value to functions and could result in incorrect or inconsistent code being generated. This is an ABI change. If the option -Wpsabi is enabled (on by default) the compiler will emit a diagnostic note for code that might be affected.
  • General Optimizer Improvements:
  • GCC 7 can determine the return value or range of return values of some calls to the sprintf family of functions and make it available to other optimization passes. Some calls to the snprintf function with a zero size argument can be folded into constants. This optimization is included in -O1 and can be selectively controlled by the -fprintf-return-value option.
  • A new store merging pass has been added. It merges constant stores to adjacent memory locations into fewer, wider, stores. It is enabled by the -fstore-merging option and at the -O2 optimization level or higher (and -Os).
  • A new code hoisting optimization has been added to the partial redundancy elimination pass. It attempts to move evaluation of expressions executed on all paths to the function exit as early as possible. This primarily helps improve code size, but can improve the speed of the generated code as well. It is enabled by the -fcode-hoisting option and at the -O2 optimization level or higher (and -Os).
  • A new interprocedural bitwise constant propagation optimization has been added, which propagates knowledge about which bits of variables are known to be zero (including pointer alignment information) across the call graph. It is enabled by the -fipa-bit-cp option if -fipa-cp is enabled as well, and is enabled at the -O2 optimization level and higher (and -Os). This optimization supersedes interprocedural alignment propagation of GCC 6, and therefore the option -fipa-cp-alignment is now deprecated and ignored.
  • A new interprocedural value range propagation optimization has been added, which propagates integral range information across the call graph when variable values can be proven to be within those ranges. It is enabled by the -fipa-vrp option and at the -O2 optimization level and higher (and -Os).
  • A new loop splitting optimization pass has been added. Certain loops which contain a condition that is always true on one side of the iteration space and always false on the other are split into two loops, such that each of the two new loops iterates on just one side of the iteration space and the condition does not need to be checked inside of the loop. It is enabled by the -fsplit-loops option and at the -O3 optimization level or higher.
  • The shrink-wrapping optimization can now separate portions of prologues and epilogues to improve performance if some of the work done traditionally by prologues and epilogues is not needed on certain paths. This is controlled by the -fshrink-wrap-separate option, enabled by default. It requires target support, which is currently only implemented in the PowerPC and AArch64 ports.
  • AddressSanitizer gained a new sanitization option, -fsanitize-address-use-after-scope, which enables sanitization of variables whose address is taken and used after a scope where the variable is defined.
  • The -fsanitize=signed-integer-overflow suboption of the UndefinedBehavior Sanitizer now diagnoses arithmetic overflows even on arithmetic operations with generic vectors.
  • Version 5 of the DWARF debugging information standard is supported through the -gdwarf-5 option. The DWARF version 4 debugging information remains the default until consumers of debugging information are adjusted.
  • New Languages and Language specific improvements:
  • OpenACC support in C, C++, and Fortran continues to be maintained and improved. See the OpenACC and Offloading wiki pages for further information.
  • Detailed release notes are available at:
  • https://gcc.gnu.org/gcc-7/changes.html

New in GCC 6.3.0 (Dec 23, 2016)

  • GENERAL OPTIMIZER IMPROVEMENTS:
  • UndefinedBehaviorSanitizer gained a new sanitization option, -fsanitize=bounds-strict, which enables strict checking of array bounds. In particular, it enables -fsanitize=bounds as well as instrumentation of flexible array member-like arrays.
  • Type-based alias analysis now disambiguates accesses to different pointers. This improves precision of the alias oracle by about 20-30% on higher-level C++ programs. Programs doing invalid type punning of pointer types may now need -fno-strict-aliasing to work correctly.
  • Alias analysis now correctly supports weakref and alias attributes. This makes it possible to access both a variable and its alias in one translation unit which is common with link-time optimization.
  • Value range propagation now assumes that the this pointer of C++ member functions is non-null. This eliminates common null pointer checks but also breaks some non-conforming code-bases (such as Qt-5, Chromium, KDevelop). As a temporary work-around -fno-delete-null-pointer-checks can be used. Wrong code can be identified by using -fsanitize=undefined.
  • Inter-procedural optimization improvements:
  • Basic jump threading is now performed before profile construction and inline analysis, resulting in more realistic size and time estimates that drive the heuristics of the of inliner and function cloning passes.
  • Function cloning now more aggressively eliminates unused function parameters.
  • Link-time optimization improvements:
  • warning and error attributes are now correctly preserved by declaration linking and thus -D_FORTIFY_SOURCE=2 is now supported with -flto.
  • Type merging was fixed to handle C and Fortran interoperability rules as defined by the Fortran 2008 language standard.
  • As an exception, CHARACTER(KIND=C_CHAR) is not inter-operable with char in all cases because it is an array while char is scalar. INTEGER(KIND=C_SIGNED_CHAR) should be used instead. In general, this inter-operability cannot be implemented, for example, on targets where function passing conventions of arrays differs from scalars.
  • More type information is now preserved at link time reducing the loss of accuracy of the type based alias analysis compared to builds without link-time optimization.
  • Invalid type punning on global variables and declarations is now reported with -Wodr-type-mismatch.
  • The size of LTO object files was reduced by about 11% (measured by compiling Firefox 46.0).
  • Link-time parallelization (enabled using -flto=n) was significantly improved by decreasing the size of streamed data when partitioning programs. The size of streamed IL while compiling Firefox 46.0 was reduced by 66%.
  • The linker plugin was extended to pass information about type of binary produced to GCC back end (that can be also manually controlled by -flinker-output). This makes it possible to properly configure the code generator and support incremental linking. Incremental linking of LTO objects by gcc -r is now supported on plugin-enabled setups.
  • GCC 7 will support incremental link-time optimization with gcc -r.
  • There are two ways to perform incremental linking:
  • Linking by ld -r will result in an object file with all sections from individual object files mechanically merged. This delays the actual link time optimization to final linking step and thus permits whole program optimization. Linking final binary with such object files is however slower.
  • Linking by gcc -r will lead to link time optimization and produce final binary into the object file. Linking such object file is fast but avoids any benefits from whole program optimization.
  • NEW LANGUAGES AND LANGUAGE SPECIFIC IMPROVEMENTS
  • In addition to single-threaded host-fallback execution, offloading is supported for nvptx (Nvidia GPUs) on x86_64 and PowerPC 64-bit little-endian GNU/Linux host systems. For nvptx offloading, with the OpenACC parallel construct, the execution model allows for an arbitrary number of gangs, up to 32 workers, and 32 vectors.
  • Typically, using the OpenACC parallel construct gives much better performance, compared to the initial support of the OpenACC kernels construct.
  • The device_type clause is not supported. The bind and nohost clauses are not supported. The host_data directive is not supported in Fortran.
  • Nested parallelism (cf. CUDA dynamic parallelism) is not supported.
  • Usage of OpenACC constructs inside multithreaded contexts (such as created by OpenMP, or pthread programming) is not supported.
  • If a call to the acc_on_device function has a compile-time constant argument, the function call evaluates to a compile-time constant value only for C and C++ but not for Fortran.
  • Initial support for parallelized execution of OpenACC kernels constructs:
  • Parallelization of a kernels region is switched on by -fopenacc combined with -O2 or higher.
  • Code is offloaded onto multiple gangs, but executes with just one worker, and a vector length of 1.
  • Directives inside a kernels region are not supported.
  • Loops with reductions can be parallelized.
  • Only kernels regions with one loop nest are parallelized.
  • Only the outer-most loop of a loop nest can be parallelized.
  • Loop nests containing sibling loops are not parallelized.
  • Further details on the changes made in GCC 6.3.0 are available at:
  • https://gcc.gnu.org/gcc-6/changes.html.

New in GCC 6.2.0 (Aug 23, 2016)

  • Target Specific Changes:
  • SPARC:
  • Support for --with-cpu-32 and --with-cpu-64 configure options has been added on bi-architecture platforms.
  • Support for the SPARC M7 (Niagara 7) processor has been added.
  • Support for the VIS 4.0 instruction set has been added.

New in GCC 5.2.0 (Jul 17, 2015)

  • CAVEATS:
  • The default mode for C is now -std=gnu11 instead of -std=gnu89.
  • The C++ runtime library (libstdc++) uses a new ABI by default (see below).
  • The Graphite framework for loop optimizations no longer requires the CLooG library, only ISL version 0.14 (recommended) or 0.12.2. The installation manual contains more information about requirements to build GCC.
  • The non-standard C++0x type traits has_trivial_default_constructor, has_trivial_copy_constructor and has_trivial_copy_assign have been deprecated and will be removed in a future version. The standard C++11 traits is_trivially_default_constructible, is_trivially_copy_constructible and is_trivially_copy_assignable should be used instead.
  • On AVR, support has been added for the devices ATtiny4/5/9/10/20/40. This requires Binutils 2.25 or newer.
  • The AVR port uses a new scheme to describe supported devices: For each supported device the compiler provides a device-specific spec file. If the compiler is used together with AVR-LibC, this requires at least GCC 5.2 and a version of AVR-LibC which implements feature #44574.
  • GENERAL OPTIMIZER IMPROVEMENTS:
  • Inter-procedural optimization improvements:
  • An Identical Code Folding (ICF) pass (controlled via -fipa-icf) has been added. Compared to the identical code folding performed by the Gold linker this pass does not require function sections. It also performs merging before inlining, so inter-procedural optimizations are aware of the code re-use. On the other hand not all unifications performed by a linker are doable by GCC which must honor aliasing information. During link-time optimization of Firefox, this pass unifies about 31000 functions, that is 14% overall.
  • The devirtualization pass was significantly improved by adding better support for speculative devirtualization and dynamic type detection. About 50% of virtual calls in Firefox are now speculatively devirtualized during link-time optimization.
  • A new comdat localization pass allows the linker to eliminate more dead code in presence of C++ inline functions.
  • Virtual tables are now optimized. Local aliases are used to reduce dynamic linking time of C++ virtual tables on ELF targets and data alignment has been reduced to limit data segment bloat.
  • A new -fno-semantic-interposition option can be used to improve code quality of shared libraries where interposition of exported symbols is not allowed.
  • Write-only variables are now detected and optimized out.
  • With profile feedback the function inliner can now bypass --param inline-insns-auto and --param inline-insns-single limits for hot calls.
  • The IPA reference pass was significantly sped up making it feasible to enable -fipa-reference with -fprofile-generate. This also solves a bottleneck seen when building Chromium with link-time optimization.
  • The symbol table and call-graph API was reworked to C++ and simplified.
  • The interprocedural propagation of constants now also propagates alignments of pointer parameters. This for example means that the vectorizer often does not need to generate loop prologues and epilogues to make up for potential misalignments.
  • Link-time optimization improvements:
  • One Definition Rule based merging of C++ types has been implemented. Type merging enables better devirtualization and alias analysis. Streaming extra information needed to merge types adds about 2-6% of memory size and object size increase. This can be controlled by -flto-odr-type-merging.
  • Command-line optimization and target options are now streamed on a per-function basis and honored by the link-time optimizer. This change makes link-time optimization a more transparent replacement of per-file optimizations. It is now possible to build projects that require different optimization settings for different translation units (such as -ffast-math, -mavx, or -finline). Contrary to earlier GCC releases, the optimization and target options passed on the link command line are ignored.
  • Note that this applies only to those command-line options that can be passed to optimize and target attributes. Command-line options affecting global code generation (such as -fpic), warnings (such as -Wodr), optimizations affecting the way static variables are optimized (such as -fcommon), debug output (such as -g), and --param parameters can be applied only to the whole link-time optimization unit. In these cases, it is recommended to consistently use the same options at both compile time and link time. GCC bootstrap now uses slim LTO object files.
  • Memory usage and link times were improved. Tree merging was sped up, memory usage of GIMPLE declarations and types was reduced, and, support for on-demand streaming of variable constructors was added.
  • Feedback directed optimization improvements:
  • A new auto-FDO mode uses profiles collected by low overhead profiling tools (perf) instead of more expensive program instrumentation (via -fprofile-generate). SPEC2006 benchmarks on x86-64 improve by 4.7% with auto-FDO and by 7.3% with traditional feedback directed optimization.
  • Profile precision was improved in presence of C++ inline and extern inline functions.
  • The new gcov-tool utility allows manipulating profiles.
  • Profiles are now more tolerant to source file changes (this can be controlled by --param profile-func-internal-id).
  • Register allocation improvements:
  • A new local register allocator (LRA) sub-pass, controlled by -flra-remat, implements control-flow sensitive global register rematerialization. Instead of spilling and restoring a register value, it is recalculated if it is profitable. The sub-pass improved SPEC2000 generated code by 1% and 0.5% correspondingly on ARM and x86-64.
  • Reuse of the PIC hard register, instead of using a fixed register, was implemented on x86/x86-64 targets. This improves generated PIC code performance as more hard registers can be used. Shared libraries can significantly benefit from this optimization. Currently it is switched on only for x86/x86-64 targets. As RA infrastructure is already implemented for PIC register reuse, other targets might follow this in the future.
  • A simple form of inter-procedural RA was implemented. When it is known that a called function does not use caller-saved registers, save/restore code is not generated around the call for such registers. This optimization can be controlled by -fipa-ra
  • LRA is now much more effective at generating spills of general registers into vector registers instead of memory on architectures (e.g., modern Intel processors) where this is profitable.
  • UndefinedBehaviorSanitizer gained a few new sanitization options:
  • -fsanitize=float-divide-by-zero: detect floating-point division by zero;
  • -fsanitize=float-cast-overflow: check that the result of floating-point type to integer conversions do not overflow;
  • -fsanitize=bounds: enable instrumentation of array bounds and detect out-of-bounds accesses;
  • -fsanitize=alignment: enable alignment checking, detect various misaligned objects;
  • -fsanitize=object-size: enable object size checking, detect various out-of-bounds accesses.
  • -fsanitize=vptr: enable checking of C++ member function calls, member accesses and some conversions between pointers to base and derived classes, detect if the referenced object does not have the correct dynamic type.
  • Pointer Bounds Checker, a bounds violation detector, has been added and can be enabled via -fcheck-pointer-bounds. Memory accesses are instrumented with run-time checks of used pointers against their bounds to detect pointer bounds violations (overflows). The Pointer Bounds Checker is available on x86/x86-64 GNU/Linux targets with a new ISA extension Intel MPX support. See the Pointer Bounds Checker Wiki page for more details.
  • NEW LANGUAGES AND LANGUAGE SPECIFIC IMPROVEMENTS:
  • OpenMP 4.0 specification offloading features are now supported by the C, C++, and Fortran compilers. Generic changes:
  • Infrastructure (suitable for any vendor).
  • Testsuite which covers offloading from the OpenMP 4.0 Examples document.
  • Specific for upcoming Intel Xeon Phi products:
  • Run-time library.
  • Card emulator.
  • GCC 5 includes a preliminary implementation of the OpenACC 2.0a specification. OpenACC is intended for programming accelerator devices such as GPUs. See the OpenACC wiki page for more information.
  • C family:
  • The default setting of the -fdiagnostics-color= command-line option is now configurable when building GCC using configuration option --with-diagnostics-color=. The possible values are: never, always, auto and auto-if-env. The new default auto uses color only when the standard error is a terminal. The default in GCC 4.9 was auto-if-env, which is equivalent to auto if there is a non-empty GCC_COLORS environment variable, and never otherwise. As in GCC 4.9, an empty GCC_COLORS variable in the environment will always disable colors, no matter what the default is or what command-line options are used.
  • A new command-line option -Wswitch-bool has been added for the C and C++ compilers, which warns whenever a switch statement has an index of boolean type.
  • A new command-line option -Wlogical-not-parentheses has been added for the C and C++ compilers, which warns about "logical not" used on the left hand side operand of a comparison.
  • A new command-line option -Wsizeof-array-argument has been added for the C and C++ compilers, which warns when the sizeof operator is applied to a parameter that has been declared as an array in a function definition.
  • A new command-line option -Wbool-compare has been added for the C and C++ compilers, which warns about boolean expressions compared with an integer value different from true/false.
  • Full support for Cilk Plus has been added to the GCC compiler. Cilk Plus is an extension to the C and C++ languages to support data and task parallelism.
  • A new attribute no_reorder prevents reordering of selected symbols against other such symbols or inline assembler. This enables to link-time optimize the Linux kernel without having to resort to -fno-toplevel-reorder that disables several optimizations.
  • New preprocessor constructs, __has_include and __has_include_next, to test the availability of headers have been added.
  • A new built-in function-like macro to determine the existence of an attribute, __has_attribute, has been added. The equivalent built-in macro __has_cpp_attribute was added to C++ to support Feature-testing recommendations for C++. If an attribute exists, a nonzero constant integer is returned. For standardized C++ attributes a date is returned, otherwise the constant returned is 1. Both __has_attribute and __has_cpp_attribute will add underscores to an attribute name if necessary to resolve the name. For C++11 and onwards the attribute may be scoped.
  • A new set of built-in functions for arithmetics with overflow checking has been added: __builtin_add_overflow, __builtin_sub_overflow and __builtin_mul_overflow and for compatibility with clang also other variants. These builtins have two integral arguments (which don't need to have the same type), the arguments are extended to infinite precision signed type, +, - or * is performed on those, and the result is stored in an integer variable pointed to by the last argument. If the stored value is equal to the infinite precision result, the built-in functions return false, otherwise true. The type of the integer variable that will hold the result can be different from the types of the first two arguments.
  • The option -fextended-identifiers is now enabled by default for C++, and for C99 and later C versions. Various bugs in the implementation of extended identifiers have been fixed.
  • The default mode has been changed to -std=gnu11.
  • A new command-line option -Wc90-c99-compat has been added to warn about features not present in ISO C90, but present in ISO C99.
  • A new command-line option -Wc99-c11-compat has been added to warn about features not present in ISO C99, but present in ISO C11.
  • It is possible to disable warnings about conversions between pointers that have incompatible types via a new warning option -Wno-incompatible-pointer-types; warnings about implicit incompatible integer to pointer and pointer to integer conversions via a new warning option -Wno-int-conversion; and warnings about qualifiers on pointers being discarded via a new warning option -Wno-discarded-qualifiers.
  • To allow proper use of const qualifiers with multidimensional arrays, GCC will not warn about incompatible pointer types anymore for conversions between pointers to arrays with and without const qualifier (except when using -pedantic). Instead, a new warning is emitted only if the const qualifier is lost. This can be controlled with a new warning option -Wno-discarded-array-qualifiers.
  • The C front end now generates more precise caret diagnostics.
  • The -pg command-line option now only affects the current file in an LTO build.
  • C++:
  • G++ now supports C++14 variable templates.
  • -Wnon-virtual-dtor doesn't warn anymore for final classes.
  • Excessive template instantiation depth is now a fatal error. This prevents excessive diagnostics that usually do not help to identify the problem.
  • G++ and libstdc++ now implement the feature-testing macros from Feature-testing recommendations for C++.
  • G++ now allows typename in a template template parameter: template struct D; // OK
  • G++ now supports C++14 aggregates with non-static data member initializers.
  • G++ now supports C++14 extended constexpr.
  • G++ now supports the C++14 sized deallocation functions.
  • A new One Definition Rule violation warning (controlled by -Wodr) detects mismatches in type definitions and virtual table contents during link-time optimization.
  • New warnings -Wsuggest-final-types and -Wsuggest-final-methods help developers to annotate programs with final specifiers (or anonymous namespaces) to improve code generation. These warnings can be used at compile time, but they are more useful in combination with link-time optimization.
  • G++ no longer supports N3639 variable length arrays, as they were removed from the C++14 working paper prior to ratification. GNU VLAs are still supported, so VLA support is now the same in C++14 mode as in C++98 and C++11 modes.
  • G++ now allows passing a non-trivially-copyable class via C varargs, which is conditionally-supported with implementation-defined semantics in the standard. This uses the same calling convention as a normal value parameter.
  • G++ now defaults to -fabi-version=9 and -fabi-compat-version=2. So various mangling bugs are fixed, but G++ will still emit aliases with the old, wrong mangling where feasible. -Wabi=2 will warn about differences between ABI version 2 and the current setting.
  • G++ 5.2 fixes the alignment of std::nullptr_t. Most code is likely to be unaffected, but -Wabi=8 will warn about a non-static data member with type std::nullptr_t which changes position due to this change.
  • Runtime Library (libstdc++):
  • A Dual ABI is provided by the library. A new ABI is enabled by default. The old ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers.
  • A new implementation of std::string is enabled by default, using the small string optimization instead of copy-on-write reference counting.
  • A new implementation of std::list is enabled by default, with an O(1) size() function;
  • Support for the C++11 hexfloat manipulator changes how the num_put facet formats floating point types when ios_base::fixed|ios_base::scientific is set in a stream's fmtflags. This change affects all language modes, even though the C++98 standard gave no special meaning to that combination of flags. To prevent the use of hexadecimal notation for floating point types use str.unsetf(std::ios_base::floatfield) to clear the relevant bits in str.flags().
  • New random number distributions logistic_distribution and uniform_on_sphere_distribution as extensions.
  • GDB Xmethods for containers and std::unique_ptr.
  • Full support for C++11, including the following new features:
  • std::deque and std::vector meet the allocator-aware container requirements;
  • movable and swappable iostream classes;
  • support for std::align and std::aligned_union;
  • type traits std::is_trivially_copyable, std::is_trivially_constructible, std::is_trivially_assignable etc.;
  • I/O manipulators std::put_time, std::get_time, std::hexfloat and std::defaultfloat;
  • generic locale-aware std::isblank;
  • locale facets for Unicode conversion;
  • atomic operations for std::shared_ptr;
  • std::notify_all_at_thread_exit() and functions for making futures ready at thread exit.
  • Full experimental support for C++14, including the following new features:
  • std::is_final type trait;
  • heterogeneous comparison lookup in associative containers.
  • global functions cbegin, cend, rbegin, rend, crbegin, and crend for range access to containers, arrays and initializer lists.
  • Improved experimental support for the Library Fundamentals TS, including:
  • class std::experimental::any;
  • function template std::experimental::apply;
  • function template std::experimental::sample;
  • function template std::experimental::search and related searcher types;
  • variable templates for type traits;
  • function template std::experimental::not_fn.
  • Fortran:
  • Compatibility notice:
  • The version of the module files (.mod) has been incremented.
  • For free-form source files, -Werror=line-truncation is now enabled by default; note that comments exceeding the line length are not diagnosed. (For fixed-form source code, the same warning is available but turned off by default, such that excess characters are ignored. -ffree-line-length-n and -ffixed-line-length-n can be used to modify the default line lengths of 132 and 72 columns, respectively.)
  • The -Wtabs option is now more sensible: with -Wtabs the compiler warns if it encounters tabs and with -Wno-tabs this warning is turned off. Before, -Wno-tabs warned and -Wtabs turned the warning off. As before, the warning is also enabled by -Wall, -pedantic and the f95, f2003, f2008 and f2008ts options of -std=.
  • Incomplete support for colorizing diagnostics emitted by gfortran has been added. The option -fdiagnostics-color controls when color is used in diagnostics. The default value of this option can be configured when building GCC. The GCC_COLORS environment variable can be used to customize the colors or disable coloring completely.
  • The -Wuse-without-only option has been added to warn when a USE statement has no ONLY qualifier and thus implicitly imports all public entities of the used module.
  • Formatted READ and WRITE statements now work correctly in locale-aware programs. For more information and potential caveats, see Section 5.3 Thread-safety of the runtime library in the manual.
  • Fortran 2003:
  • The intrinsic IEEE modules (IEEE_FEATURES, IEEE_EXCEPTIONS and IEEE_ARITHMETIC) are now supported.
  • Fortran 2008:
  • Coarrays: Full experimental support of Fortran 2008's coarrays with -fcoarray=lib except for allocatable/pointer components of derived-type coarrays. GCC currently only ships with a single-image library (libcaf_single), but multi-image support based on MPI and GASNet is provided by the libraries of the OpenCoarrays project.
  • TS18508 Additional Parallel Features in Fortran:
  • Support for the collective intrinsic subroutines CO_MAX, CO_MIN, CO_SUM, CO_BROADCAST and CO_REDUCE has been added, including -fcoarray=lib support.
  • Support for the new atomic intrinsics has been added, including -fcoarray=lib support.
  • Fortran 2015:
  • Support for IMPLICIT NONE (external, type).
  • ERROR STOP is now permitted in pure procedures.
  • Go:
  • GCC 5 provides a complete implementation of the Go 1.4.2 release.
  • Building GCC 5 with Go enabled will install two new programs: go and gofmt.
  • libgccjit:
  • New in GCC 5 is the ability to build GCC as a shared library for embedding in other processes (such as interpreters), suitable for Just-In-Time compilation to machine code.
  • The shared library has a C API and a C++ wrapper API providing some "syntactic sugar". There are also bindings available from 3rd parties for Python and for D.
  • For example, this library can be used by interpreters for compiling functions from bytecode to machine code.
  • The library can also be used for ahead-of-time compilation, enabling GCC to be plugged into a pre-existing frontend. An example of using this to build a compiler for an esoteric language we'll refer to as "brainf" can be seen here.
  • libgccjit is licensed under the GPLv3 (or at your option, any later version)
  • It should be regarded as experimental at this time.
  • NEW TARGETS AND TARGET SPECIFIC IMPROVEMENTS:
  • AArch64:
  • Code generation for the ARM Cortex-A57 processor has been improved. A more accurate instruction scheduling model for the processor is now used, and a number of compiler tuning parameters have been set to offer increased performance when compiling with -mcpu=cortex-a57 or -mtune=cortex-a57.
  • A workaround for the ARM Cortex-A53 erratum 835769 has been added and can be enabled by giving the -mfix-cortex-a53-835769 option. Alternatively it can be enabled by default by configuring GCC with the --enable-fix-cortex-a53-835769 option.
  • The optional cryptographic extensions to the ARMv8-A architecture are no longer enabled by default when specifying the -mcpu=cortex-a53, -mcpu=cortex-a57 or -mcpu=cortex-a57.cortex-a53 options. To enable these extensions add +crypto to the value of -mcpu or -march e.g. -mcpu=cortex-a53+crypto.
  • Support has been added for the following processors (GCC identifiers in parentheses): ARM Cortex-A72 (cortex-a72) and initial support for its big.LITTLE combination with the ARM Cortex-A53 (cortex-a72.cortex-a53), Cavium ThunderX (thunderx), Applied Micro X-Gene 1 (xgene1), and Samsung Exynos M1 (exynos-m1). The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=xgene1 or -mtune=cortex-a72.cortex-a53. Using -mcpu=cortex-a72 requires a version of GNU binutils that has support for the Cortex-A72.
  • The transitional options -mlra and -mno-lra have been removed. The AArch64 backend now uses the local register allocator (LRA) only.
  • ARM:
  • Thumb-1 assembly code is now generated in unified syntax. The new option -masm-syntax-unified specifies whether inline assembly code is using unified syntax. By default the option is off which means non-unified syntax is used. However this is subject to change in future releases. Eventually the non-unified syntax will be deprecated.
  • It is now a configure-time error to use the --with-cpu configure option with either of --with-tune or --with-arch.
  • Code generation for the ARM Cortex-A57 processor has been improved. A more accurate instruction scheduling model for the processor is now used, and a number of compiler tuning parameters have been set to offer increased performance when compiling with -mcpu=cortex-a57 or -mtune=cortex-a57.
  • Support has been added for the following processors (GCC identifiers in parentheses): ARM Cortex-A17 (cortex-a17) and initial support for its big.LITTLE combination with the ARM Cortex-A7 (cortex-a17.cortex-a7), ARM Cortex-A72 (cortex-a72) and initial support for its big.LITTLE combination with the ARM Cortex-A53 (cortex-a72.cortex-a53), ARM Cortex-M7 (cortex-m7), Applied Micro X-Gene 1 (xgene1), and Samsung Exynos M1 (exynos-m1). The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=xgene1 or -mtune=cortex-a72.cortex-a53. Using -mcpu=cortex-a72 requires a version of GNU binutils that has support for the Cortex-A72.
  • The deprecated option -mwords-little-endian has been removed.
  • The options -mapcs, -mapcs-frame, -mtpcs-frame and -mtpcs-leaf-frame which are only applicable to the old ABI have been deprecated.
  • The transitional options -mlra and -mno-lra have been removed. The ARM backend now uses the local register allocator (LRA) only.
  • AVR:
  • The compiler no more supports individual devices like ATmega8. Specifying, say, -mmcu=atmega8 triggers the usage of the device-specific spec file specs-atmega8 which is part of the installation and describes options for the sub-processes like compiler proper, assembler and linker. You can add support for a new device -mmcu=mydevice as follows:
  • In an empty directory /someplace, create a new directory device-specs.
  • Copy a device spec file from the installed device-specs folder, follow the comments in that file and then save it as /someplace/device-specs/specs-mydevice.
  • Add -B /someplace -mmcu=mydevice to the compiler's command-line options. Notice that /someplace must specify an absolute path and that mydevice must not start with "avr".
  • Provided you have a device-specific library libmydevice.a available, you can put it at /someplace, dito for a device-specific startup file crtmydevice.o.
  • The contents of the device spec files depend on the compiler's configuration, in particular on --with-avrlibc=no and whether or not it is configured for RTEMS.
  • A new command-line option -nodevicelib has been added. It prevents the compiler from linking against AVR-LibC's device-specific library libdevice.a.
  • The following three command-line options have been added:
  • -mrmw
  • Set if the device supports the read-modify-write instructions LAC, LAS, LAT and XCH.
  • -mn-flash=size
  • Specify the flash size of the device in units of 64 KiB, rounded up to the next integer as needed. This option affects the availability of the AVR address-spaces.
  • -mskip-bug
  • Set if the device is affected by the respective silicon bug.
  • In general, you don't need to set these options by hand. The new device-specific spec file will set them as needed.
  • IA-32/x86-64:
  • New ISA extensions support AVX-512{BW,DQ,VL,IFMA,VBMI} of Intel's CPU codenamed Skylake Server was added to GCC. That includes inline assembly support, new intrinsics, and basic autovectorization. These new AVX-512 extensions are available via the following GCC switches: AVX-512 Vector Length EVEX feature: -mavx512vl, AVX-512 Byte and Word instructions: -mavx512bw, AVX-512 Dword and Qword instructions: -mavx512dq, AVX-512 FMA-52 instructions: -mavx512ifma and for AVX-512 Vector Bit Manipulation Instructions: -mavx512vbmi.
  • New ISA extensions support Intel MPX was added to GCC. This new extension is available via the -mmpx compiler switch. Intel MPX is a set of processor features which, with compiler, run-time library and OS support, brings increased robustness to software by run-time checking pointer references against their bounds. In GCC Intel MPX is supported by Pointer Bounds Checker and libmpx run-time libraries.
  • The new -mrecord-mcount option for -pg generates a Linux kernel style table of pointers to mcount or __fentry__ calls at the beginning of functions. The new -mnop-mcount option in addition also generates nops in place of the __fentry__ or mcount call, so that a call per function can be later patched in. This can be used for low overhead tracing or hot code patching.
  • The new -malign-data option controls how GCC aligns variables. -malign-data=compat uses increased alignment compatible with GCC 4.8 and earlier, -malign-data=abi uses alignment as specified by the psABI, and -malign-data=cacheline uses increased alignment to match the cache line size. -malign-data=compat is the default.
  • The new -mskip-rax-setup option skips setting up the RAX register when SSE is disabled and there are no variable arguments passed in vector registers. This can be used to optimize the Linux kernel.
  • MIPS:
  • MIPS Releases 3 and 5 are now directly supported. Use the command-line options -mips32r3, -mips64r3, -mips32r5 and -mips64r5 to enable code-generation for these processors.
  • The Imagination P5600 processor is now supported using the -march=p5600 command-line option.
  • The Cavium Octeon3 processor is now supported using the -march=octeon3 command-line option.
  • MIPS Release 6 is now supported using the -mips32r6 and -mips64r6 command-line options.
  • The o32 ABI has been modified and extended. The o32 64-bit floating-point register support is now obsolete and has been removed. It has been replaced by three ABI extensions FPXX, FP64A, and FP64. The meaning of the -mfp64 command-line option has changed. It is now used to enable the FP64A and FP64 ABI extensions.
  • The FPXX extension requires that code generated to access double-precision values use even-numbered registers. Code that adheres to this extension is link-compatible with all other o32 double-precision ABI variants and will execute correctly in all hardware FPU modes. The command-line options -mabi=32 -mfpxx can be used to enable this extension. MIPS II is the minimum processor required.
  • The o32 FP64A extension requires that floating-point registers be 64-bit and odd-numbered single-precision registers are not allowed. Code that adheres to the o32 FP64A variant is link-compatible with all other o32 double-precision ABI variants. The command-line options -mabi=32 -mfp64 -mno-odd-spreg can be used to enable this extension. MIPS32R2 is the minimum processor required.
  • The o32 FP64 extension also requires that floating-point registers be 64-bit, but permits the use of single-precision registers. Code that adheres to the o32 FP64 variant is link-compatible with o32 FPXX and o32 FP64A variants only, i.e. it is not compatible with the original o32 double-precision ABI. The command-line options -mabi=32 -mfp64 -modd-spreg can be used to enable this extension. MIPS32R2 is the minimum processor required.
  • The new ABI variants can be enabled by default using the configure time options --with-fp-32=[32|xx|64] and --with(out)-odd-sp-reg-32. It is strongly recommended that all vendors begin to set o32 FPXX as the default ABI. This will be required to run the generated code on MIPSR5 cores in conjunction with future MIPS SIMD (MSA) code and MIPSR6 cores.
  • GCC will now pass all floating-point options to the assembler if GNU binutils 2.25 is used. As a result, any inline assembly code that uses hard-float instructions should be amended to include a .set directive to override the global assembler options when compiling for soft-float targets.
  • NDS32:
  • The variadic function ABI implementation is now compatible with past Andes toolchains where the caller uses registers to pass arguments and the callee is in charge of pushing them on stack.
  • The options -mforce-fp-as-gp, -mforbid-fp-as-gp, and -mex9 have been removed since they are not yet available in the nds32 port of GNU binutils.
  • A new option -mcmodel=[small|medium|large] supports varied code models on code generation. The -mgp-direct option became meaningless and can be discarded.
  • RX:
  • A new command line option -mno-allow-string-insns can be used to disable the generation of the SCMPU, SMOVU, SMOVB, SMOVF, SUNTIL, SWHILE and RMPA instructions. An erratum released by Renesas shows that it is unsafe to use these instructions on addresses within the I/O space of the processor. The new option can be used when the programmer is concerned that the I/O space might be accessed. The default is still to enable these instructions.
  • SH:
  • The compiler will now pass the appropriate --isa= option to the assembler.
  • The default handling for the GBR has been changed from call clobbered to call preserved. The old behavior can be reinstated by specifying the option -fcall-used-gbr.
  • Support for the SH4A fpchg instruction has been added which will be utilized when switching between single and double precision FPU modes.
  • The compiler no longer uses the __fpscr_values array for switching between single and double FPU precision modes on non-SH4A targets. Instead mode switching will now be performed by storing, modifying and reloading the FPSCR, so that other FPSCR bits are preserved across mode switches. The __fpscr_values array that is defined in libgcc is still present for backwards compatibility, but it will not be referenced by compiler generated code anymore.
  • New builtin functions __builtin_sh_get_fpscr and __builtin_sh_set_fpscr have been added. The __builtin_sh_set_fpscr function will mask the specified bits in such a way that the SZ, PR and FR mode bits will be preserved, while changing the other bits. These new functions do not reference the __fpscr_values array. The old functions __set_fpscr and __get_fpscr in libgcc which access the __fpscr_values array are still present for backwards compatibility, but their usage is highly discouraged.
  • Some improvements to code generated for __atomic built-in functions.
  • When compiling for SH2E the compiler will no longer force the usage of delay slots for conditional branch instructions bt and bf. The old behavior can be reinstated (e.g. to work around a hardware bug in the original SH7055) by specifying the new option -mcbranch-force-delay-slot.

New in GCC 5.1.0 (Apr 23, 2015)

  • CAVEATS:
  • The default mode for C is now -std=gnu11 instead of -std=gnu89.
  • The C++ runtime library (libstdc++) uses a new ABI by default (see below).
  • The Graphite framework for loop optimizations no longer requires the CLooG library, only ISL version 0.14 (recommended) or 0.12.2. The installation manual contains more information about requirements to build GCC.
  • The non-standard C++0x type traits has_trivial_default_constructor, has_trivial_copy_constructor and has_trivial_copy_assign have been deprecated and will be removed in a future version. The standard C++11 traits is_trivially_default_constructible, is_trivially_copy_constructible and is_trivially_copy_assignable should be used instead.
  • GENERAL OPTIMIZER IMPROVEMENTS:
  • Inter-procedural optimization improvements:
  • An Identical Code Folding (ICF) pass (controlled via -fipa-icf) has been added. Compared to the identical code folding performed by the Gold linker this pass does not require function sections. It also performs merging before inlining, so inter-procedural optimizations are aware of the code re-use. On the other hand not all unifications performed by a linker are doable by GCC which must honor aliasing information. During link-time optimization of Firefox, this pass unifies about 31000 functions, that is 14% overall.
  • The devirtualization pass was significantly improved by adding better support for speculative devirtualization and dynamic type detection. About 50% of virtual calls in Firefox are now speculatively devirtualized during link-time optimization.
  • A new comdat localization pass allows the linker to eliminate more dead code in presence of C++ inline functions.
  • Virtual tables are now optimized. Local aliases are used to reduce dynamic linking time of C++ virtual tables on ELF targets and data alignment has been reduced to limit data segment bloat.
  • A new -fno-semantic-interposition option can be used to improve code quality of shared libraries where interposition of exported symbols is not allowed.
  • Write-only variables are now detected and optimized out.
  • With profile feedback the function inliner can now bypass --param inline-insns-auto and --param inline-insns-single limits for hot calls.
  • The IPA reference pass was significantly sped up making it feasible to enable -fipa-reference with -fprofile-generate. This also solves a bottleneck seen when building Chromium with link-time optimization.
  • The symbol table and call-graph API was reworked to C++ and simplified.
  • The interprocedural propagation of constants now also propagates alignments of pointer parameters. This for example means that the vectorizer often does not need to generate loop prologues and epilogues to make up for potential misalignments.
  • Link-time optimization improvements:
  • One Definition Rule based merging of C++ types has been implemented. Type merging enables better devirtualization and alias analysis. Streaming extra information needed to merge types adds about 2-6% of memory size and object size increase. This can be controlled by -flto-odr-type-merging.
  • Command-line optimization and target options are now streamed on a per-function basis and honored by the link-time optimizer. This change makes link-time optimization a more transparent replacement of per-file optimizations. It is now possible to build projects that require different optimization settings for different translation units (such as -ffast-math, -mavx, or -finline). Contrary to earlier GCC releases, the optimization and target options passed on the link command line are ignored. Note that this applies only to those command-line options that can be passed to optimize and target attributes. Command-line options affecting global code generation (such as -fpic), warnings (such as -Wodr), optimizations affecting the way static variables are optimized (such as -fcommon), debug output (such as -g), and --param parameters can be applied only to the whole link-time optimization unit. In these cases, it is recommended to consistently use the same options at both compile time and link time.
  • GCC bootstrap now uses slim LTO object files.
  • Memory usage and link times were improved. Tree merging was sped up, memory usage of GIMPLE declarations and types was reduced, and, support for on-demand streaming of variable constructors was added.
  • Feedback directed optimization improvements:
  • A new auto-FDO mode uses profiles collected by low overhead profiling tools (perf) instead of more expensive program instrumentation (via -fprofile-generate). SPEC2006 benchmarks on x86-64 improve by 4.7% with auto-FDO and by 7.3% with traditional feedback directed optimization.
  • Profile precision was improved in presence of C++ inline and extern inline functions.
  • The new gcov-tool utility allows manipulating profiles.
  • Profiles are now more tolerant to source file changes (this can be controlled by --param profile-func-internal-id).
  • Register allocation improvements:
  • A new local register allocator (LRA) sub-pass, controlled by -flra-remat, implements control-flow sensitive global register rematerialization. Instead of spilling and restoring a register value, it is recalculated if it is profitable. The sub-pass improved SPEC2000 generated code by 1% and 0.5% correspondingly on ARM and x86-64.
  • Reuse of the PIC hard register, instead of using a fixed register, was implemented on x86/x86-64 targets. This improves generated PIC code performance as more hard registers can be used. Shared libraries can significantly benefit from this optimization. Currently it is switched on only for x86/x86-64 targets. As RA infrastructure is already implemented for PIC register reuse, other targets might follow this in the future.
  • A simple form of inter-procedural RA was implemented. When it is known that a called function does not use caller-saved registers, save/restore code is not generated around the call for such registers. This optimization can be controlled by -fipa-ra
  • LRA is now much more effective at generating spills of general registers into vector registers instead of memory on architectures (e.g., modern Intel processors) where this is profitable.
  • UndefinedBehaviorSanitizer gained a few new sanitization options:
  • -fsanitize=float-divide-by-zero: detect floating-point division by zero;
  • -fsanitize=float-cast-overflow: check that the result of floating-point type to integer conversions do not overflow;
  • -fsanitize=bounds: enable instrumentation of array bounds and detect out-of-bounds accesses;
  • -fsanitize=alignment: enable alignment checking, detect various misaligned objects;
  • -fsanitize=object-size: enable object size checking, detect various out-of-bounds accesses.
  • -fsanitize=vptr: enable checking of C++ member function calls, member accesses and some conversions between pointers to base and derived classes, detect if the referenced object does not have the correct dynamic type.
  • Pointer Bounds Checker, a bounds violation detector, has been added and can be enabled via -fcheck-pointer-bounds. Memory accesses are instrumented with run-time checks of used pointers against their bounds to detect pointer bounds violations (overflows). The Pointer Bounds Checker is available on x86/x86-64 GNU/Linux targets with a new ISA extension Intel MPX support. See the Pointer Bounds Checker Wiki page for more details.
  • NEW LANGUAGES AND LANGUAGE SPECIFIC IMPROVEMENTS:
  • OpenMP 4.0 specification offloading features are now supported by the C, C++, and Fortran compilers. Generic changes:
  • Infrastructure (suitable for any vendor).
  • Testsuite which covers offloading from the OpenMP 4.0 Examples document.
  • Specific for upcoming Intel Xeon Phi products:
  • Run-time library.
  • Card emulator.
  • GCC 5 includes a preliminary implementation of the OpenACC 2.0a specification. OpenACC is intended for programming accelerator devices such as GPUs. See the OpenACC wiki page for more information.
  • C FAMILY:
  • The default setting of the -fdiagnostics-color= command-line option is now configurable when building GCC using configuration option --with-diagnostics-color=. The possible values are: never, always, auto and auto-if-env. The new default auto uses color only when the standard error is a terminal. The default in GCC 4.9 was auto-if-env, which is equivalent to auto if there is a non-empty GCC_COLORS environment variable, and never otherwise. As in GCC 4.9, an empty GCC_COLORS variable in the environment will always disable colors, no matter what the default is or what command-line options are used.
  • A new command-line option -Wswitch-bool has been added for the C and C++ compilers, which warns whenever a switch statement has an index of boolean type.
  • A new command-line option -Wlogical-not-parentheses has been added for the C and C++ compilers, which warns about "logical not" used on the left hand side operand of a comparison.
  • A new command-line option -Wsizeof-array-argument has been added for the C and C++ compilers, which warns when the sizeof operator is applied to a parameter that has been declared as an array in a function definition.
  • A new command-line option -Wbool-compare has been added for the C and C++ compilers, which warns about boolean expressions compared with an integer value different from true/false.
  • Full support for Cilk Plus has been added to the GCC compiler. Cilk Plus is an extension to the C and C++ languages to support data and task parallelism.
  • A new attribute no_reorder prevents reordering of selected symbols against other such symbols or inline assembler. This enables to link-time optimize the Linux kernel without having to resort to -fno-toplevel-reorder that disables several optimizations.
  • New preprocessor constructs, __has_include and __has_include_next, to test the availability of headers have been added.
  • The header search paths for __has_include and __has_include_next are equivalent to those of the standard directive #include and the extension #include_next respectively.
  • A new built-in function-like macro to determine the existence of an attribute, __has_attribute, has been added. The equivalent built-in macro __has_cpp_attribute was added to C++ to support Feature-testing recommendations for C++.
  • If an attribute exists, a nonzero constant integer is returned. For standardized C++ attributes a date is returned, otherwise the constant returned is 1. Both __has_attribute and __has_cpp_attribute will add underscores to an attribute name if necessary to resolve the name. For C++11 and onwards the attribute may be scoped.
  • A new set of built-in functions for arithmetics with overflow checking has been added: __builtin_add_overflow, __builtin_sub_overflow and __builtin_mul_overflow and for compatibility with clang also other variants. These builtins have two integral arguments (which don't need to have the same type), the arguments are extended to infinite precision signed type, +, - or * is performed on those, and the result is stored in an integer variable pointed to by the last argument. If the stored value is equal to the infinite precision result, the built-in functions return false, otherwise true. The type of the integer variable that will hold the result can be different from the types of the first two arguments.
  • The option -fextended-identifiers is now enabled by default for C++, and for C99 and later C versions. Various bugs in the implementation of extended identifiers have been fixed.
  • The default mode has been changed to -std=gnu11.
  • A new command-line option -Wc90-c99-compat has been added to warn about features not present in ISO C90, but present in ISO C99.
  • A new command-line option -Wc99-c11-compat has been added to warn about features not present in ISO C99, but present in ISO C11.
  • It is possible to disable warnings about conversions between pointers that have incompatible types via a new warning option -Wno-incompatible-pointer-types; warnings about implicit incompatible integer to pointer and pointer to integer conversions via a new warning option -Wno-int-conversion; and warnings about qualifiers on pointers being discarded via a new warning option -Wno-discarded-qualifiers.
  • To allow proper use of const qualifiers with multidimensional arrays, GCC will not warn about incompatible pointer types anymore for conversions between pointers to arrays with and without const qualifier (except when using -pedantic). Instead, a new warning is emitted only if the const qualifier is lost. This can be controlled with a new warning option -Wno-discarded-array-qualifiers.
  • The C front end now generates more precise caret diagnostics.
  • The -pg command-line option now only affects the current file in an LTO build.
  • C++:
  • G++ now supports C++14 variable templates.
  • -Wnon-virtual-dtor doesn't warn anymore for final classes.
  • Excessive template instantiation depth is now a fatal error. This prevents excessive diagnostics that usually do not help to identify the problem.
  • G++ and libstdc++ now implement the feature-testing macros from Feature-testing recommendations for C++.
  • G++ now allows typename in a template template parameter.
  • G++ now supports C++14 aggregates with non-static data member initializers.
  • G++ now supports C++14 extended constexpr.
  • G++ now supports the C++14 sized deallocation functions.
  • A new One Definition Rule violation warning (controlled by -Wodr) detects mismatches in type definitions and virtual table contents during link-time optimization.
  • New warnings -Wsuggest-final-types and -Wsuggest-final-methods help developers to annotate programs with final specifiers (or anonymous namespaces) to improve code generation. These warnings can be used at compile time, but they are more useful in combination with link-time optimization.
  • G++ no longer supports N3639 variable length arrays, as they were removed from the C++14 working paper prior to ratification. GNU VLAs are still supported, so VLA support is now the same in C++14 mode as in C++98 and C++11 modes.
  • G++ now allows passing a non-trivially-copyable class via C varargs, which is conditionally-supported with implementation-defined semantics in the standard. This uses the same calling convention as a normal value parameter.
  • G++ now defaults to -fabi-version=0 and -fabi-compat-version=2. So various mangling bugs are fixed, but G++ will still emit aliases with the old, wrong mangling where feasible. -Wabi continues to warn about differences.
  • RUNTIME LIBRARY (LIBSTDC++):
  • A Dual ABI is provided by the library. A new ABI is enabled by default. The old ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers.
  • A new implementation of std::string is enabled by default, using the small string optimization instead of copy-on-write reference counting.
  • A new implementation of std::list is enabled by default, with an O(1) size() function;
  • Full support for C++11, including the following new features:
  • std::deque and std::vector meet the allocator-aware container requirements;
  • movable and swappable iostream classes;
  • support for std::align and std::aligned_union;
  • type traits std::is_trivially_copyable, std::is_trivially_constructible, std::is_trivially_assignable etc.;
  • I/O manipulators std::put_time, std::get_time, std::hexfloat and std::defaultfloat;
  • generic locale-aware std::isblank;
  • locale facets for Unicode conversion;
  • atomic operations for std::shared_ptr;
  • std::notify_all_at_thread_exit() and functions for making futures ready at thread exit.
  • Support for the C++11 hexfloat manipulator changes how the num_put facet formats floating point types when ios_base::fixed|ios_base::scientific is set in a stream's fmtflags. This change affects all language modes, even though the C++98 standard gave no special meaning to that combination of flags. To prevent the use of hexadecimal notation for floating point types use str.unsetf(std::ios_base::floatfield) to clear the relevant bits in str.flags().
  • Full experimental support for C++14, including the following new features:
  • std::is_final type trait;
  • heterogeneous comparison lookup in associative containers.
  • global functions cbegin, cend, rbegin, rend, crbegin, and crend for range access to containers, arrays and initializer lists.
  • Improved experimental support for the Library Fundamentals TS, including:
  • class std::experimental::any;
  • function template std::experimental::apply;
  • function template std::experimental::sample;
  • function template std::experimental::search and related searcher types;
  • variable templates for type traits;
  • function template std::experimental::not_fn.
  • New random number distributions logistic_distribution and uniform_on_sphere_distribution as extensions.
  • GDB Xmethods for containers and std::unique_ptr.
  • FORTRAN:
  • Compatibility notice:
  • The version of the module files (.mod) has been incremented.
  • For free-form source files, -Werror=line-truncation is now enabled by default; note that comments exceeding the line length are not diagnosed. (For fixed-form source code, the same warning is available but turned off by default, such that excess characters are ignored. -ffree-line-length-n and -ffixed-line-length-n can be used to modify the default line lengths of 132 and 72 columns, respectively.)
  • The -Wtabs option is now more sensible: with -Wtabs the compiler warns if it encounters tabs and with -Wno-tabs this warning is turned off. Before, -Wno-tabs warned and -Wtabs turned the warning off. As before, the warning is also enabled by -Wall, -pedantic and the f95, f2003, f2008 and f2008ts options of -std=.
  • Incomplete support for colorizing diagnostics emitted by gfortran has been added. The option -fdiagnostics-color controls when color is used in diagnostics. The default value of this option can be configured when building GCC. The GCC_COLORS environment variable can be used to customize the colors or disable coloring completely.
  • The -Wuse-without-only option has been added to warn when a USE statement has no ONLY qualifier and, thus, implicitly imports all public entities of the used module.
  • Formatted READ and WRITE statements now work correctly in locale-aware programs. For more information and potential caveats, see Section 5.3 Thread-safety of the runtime library in the manual.
  • Fortran 2003:
  • The intrinsic IEEE modules (IEEE_FEATURES, IEEE_EXCEPTIONS and IEEE_ARITHMETIC) are now supported.
  • Fortran 2008:
  • Coarrays: Full experimental support of Fortran 2008's coarrays with -fcoarray=lib except for allocatable/pointer components of derived-type coarrays. GCC currently only ships with a single-image library (libcaf_single), but multi-image support based on MPI and GASNet is provided by the libraries of the OpenCoarrays project.
  • TS18508 Additional Parallel Features in Fortran:
  • Support for the collective intrinsic subroutines CO_MAX, CO_MIN, CO_SUM, CO_BROADCAST and CO_REDUCE has been added, including -fcoarray=lib support.
  • Support for the new atomic intrinsics has been added, including -fcoarray=lib support.
  • Fortran 2015:
  • Support for IMPLICIT NONE (external, type).
  • ERROR STOP is now permitted in pure procedures.
  • GO:
  • GCC 5 provides a complete implementation of the Go 1.4.2 release.
  • Building GCC 5 with Go enabled will install two new programs: go and gofmt.
  • LIBGCCJIT:
  • New in GCC 5 is the ability to build GCC as a shared library for embedding in other processes (such as interpreters), suitable for Just-In-Time compilation to machine code.
  • The shared library has a C API and a C++ wrapper API providing some "syntactic sugar". There are also bindings available from 3rd parties for Python and for D.
  • The library can also be used for ahead-of-time compilation, enabling GCC to be plugged into a pre-existing frontend. An example of using this to build a compiler for an esoteric language we'll refer to as "brainf" can be seen here.
  • libgccjit is licensed under the GPLv3 (or at your option, any later version)
  • It should be regarded as experimental at this time.
  • NEW TARGETS AND TARGET SPECIFIC IMPROVEMENTS:
  • AArch64:
  • Code generation for the ARM Cortex-A57 processor has been improved. A more accurate instruction scheduling model for the processor is now used, and a number of compiler tuning parameters have been set to offer increased performance when compiling with -mcpu=cortex-a57 or -mtune=cortex-a57.
  • A workaround for the ARM Cortex-A53 erratum 835769 has been added and can be enabled by giving the -mfix-cortex-a53-835769 option. Alternatively it can be enabled by default by configuring GCC with the --enable-fix-cortex-a53-835769 option.
  • The optional cryptographic extensions to the ARMv8-A architecture are no longer enabled by default when specifying the -mcpu=cortex-a53, -mcpu=cortex-a57 or -mcpu=cortex-a57.cortex-a53 options. To enable these extensions add +crypto to the value of -mcpu or -march e.g. -mcpu=cortex-a53+crypto.
  • Support has been added for the following processors (GCC identifiers in parentheses): ARM Cortex-A72 (cortex-a72) and initial support for its big.LITTLE combination with the ARM Cortex-A53 (cortex-a72.cortex-a53), Cavium ThunderX (thunderx), Applied Micro X-Gene 1 (xgene1), and Samsung Exynos M1 (exynos-m1). The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=xgene1 or -mtune=cortex-a72.cortex-a53. Using -mcpu=cortex-a72 requires a version of GNU binutils that has support for the Cortex-A72.
  • The transitional options -mlra and -mno-lra have been removed. The AArch64 backend now uses the local register allocator (LRA) only.
  • ARM:
  • Thumb-1 assembly code is now generated in unified syntax. The new option -masm-syntax-unified specifies whether inline assembly code is using unified syntax. By default the option is off which means non-unified syntax is used. However this is subject to change in future releases. Eventually the non-unified syntax will be deprecated.
  • It is now a configure-time error to use the --with-cpu configure option with either of --with-tune or --with-arch.
  • Code generation for the ARM Cortex-A57 processor has been improved. A more accurate instruction scheduling model for the processor is now used, and a number of compiler tuning parameters have been set to offer increased performance when compiling with -mcpu=cortex-a57 or -mtune=cortex-a57.
  • Support has been added for the following processors (GCC identifiers in parentheses): ARM Cortex-A17 (cortex-a17) and initial support for its big.LITTLE combination with the ARM Cortex-A7 (cortex-a17.cortex-a7), ARM Cortex-A72 (cortex-a72) and initial support for its big.LITTLE combination with the ARM Cortex-A53 (cortex-a72.cortex-a53), ARM Cortex-M7 (cortex-m7), Applied Micro X-Gene 1 (xgene1), and Samsung Exynos M1 (exynos-m1). The GCC identifiers can be used as arguments to the -mcpu or -mtune options, for example: -mcpu=xgene1 or -mtune=cortex-a72.cortex-a53. Using -mcpu=cortex-a72 requires a version of GNU binutils that has support for the Cortex-A72.
  • The deprecated option -mwords-little-endian has been removed.
  • The options -mapcs, -mapcs-frame, -mtpcs-frame and -mtpcs-leaf-frame which are only applicable to the old ABI have been deprecated.
  • The transitional options -mlra and -mno-lra have been removed. The ARM backend now uses the local register allocator (LRA) only.
  • IA-32/x86-64:
  • New ISA extensions support AVX-512{BW,DQ,VL,IFMA,VBMI} of Intel's CPU codenamed Skylake Server was added to GCC. That includes inline assembly support, new intrinsics, and basic autovectorization. These new AVX-512 extensions are available via the following GCC switches: AVX-512 Vector Length EVEX feature: -mavx512vl, AVX-512 Byte and Word instructions: -mavx512bw, AVX-512 Dword and Qword instructions: -mavx512dq, AVX-512 FMA-52 instructions: -mavx512ifma and for AVX-512 Vector Bit Manipulation Instructions: -mavx512vbmi.
  • New ISA extensions support Intel MPX was added to GCC. This new extension is available via the -mmpx compiler switch. Intel MPX is a set of processor features which, with compiler, run-time library and OS support, brings increased robustness to software by run-time checking pointer references against their bounds. In GCC Intel MPX is supported by Pointer Bounds Checker and libmpx run-time libraries.
  • The new -mrecord-mcount option for -pg generates a Linux kernel style table of pointers to mcount or __fentry__ calls at the beginning of functions. The new -mnop-mcount option in addition also generates nops in place of the __fentry__ or mcount call, so that a call per function can be later patched in. This can be used for low overhead tracing or hot code patching.
  • The new -malign-data option controls how GCC aligns variables. -malign-data=compat uses increased alignment compatible with GCC 4.8 and earlier, -malign-data=abi uses alignment as specified by the psABI, and -malign-data=cacheline uses increased alignment to match the cache line size. -malign-data=compat is the default.
  • The new -mskip-rax-setup option skips setting up the RAX register when SSE is disabled and there are no variable arguments passed in vector registers. This can be used to optimize the Linux kernel.
  • MIPS:
  • MIPS Releases 3 and 5 are now directly supported. Use the command-line options -mips32r3, -mips64r3, -mips32r5 and -mips64r5 to enable code-generation for these processors.
  • The Imagination P5600 processor is now supported using the -march=p5600 command-line option.
  • The Cavium Octeon3 processor is now supported using the -march=octeon3 command-line option.
  • MIPS Release 6 is now supported using the -mips32r6 and -mips64r6 command-line options.
  • The o32 ABI has been modified and extended. The o32 64-bit floating-point register support is now obsolete and has been removed. It has been replaced by three ABI extensions FPXX, FP64A, and FP64. The meaning of the -mfp64 command-line option has changed. It is now used to enable the FP64A and FP64 ABI extensions.
  • The FPXX extension requires that code generated to access double-precision values use even-numbered registers. Code that adheres to this extension is link-compatible with all other o32 double-precision ABI variants and will execute correctly in all hardware FPU modes. The command-line options -mabi=32 -mfpxx can be used to enable this extension. MIPS II is the minimum processor required.
  • The o32 FP64A extension requires that floating-point registers be 64-bit and odd-numbered single-precision registers are not allowed. Code that adheres to the o32 FP64A variant is link-compatible with all other o32 double-precision ABI variants. The command-line options -mabi=32 -mfp64 -mno-odd-spreg can be used to enable this extension. MIPS32R2 is the minimum processor required.
  • The o32 FP64 extension also requires that floating-point registers be 64-bit, but permits the use of single-precision registers. Code that adheres to the o32 FP64 variant is link-compatible with o32 FPXX and o32 FP64A variants only, i.e. it is not compatible with the original o32 double-precision ABI. The command-line options -mabi=32 -mfp64 -modd-spreg can be used to enable this extension. MIPS32R2 is the minimum processor required.
  • The new ABI variants can be enabled by default using the configure time options --with-fp-32=[32|xx|64] and --with(out)-odd-sp-reg-32. It is strongly recommended that all vendors begin to set o32 FPXX as the default ABI. This will be required to run the generated code on MIPSR5 cores in conjunction with future MIPS SIMD (MSA) code and MIPSR6 cores.
  • GCC will now pass all floating-point options to the assembler if GNU binutils 2.25 is used. As a result, any inline assembly code that uses hard-float instructions should be amended to include a .set directive to override the global assembler options when compiling for soft-float targets.
  • NDS32:
  • The variadic function ABI implementation is now compatible with past Andes toolchains where the caller uses registers to pass arguments and the callee is in charge of pushing them on stack.
  • The options -mforce-fp-as-gp, -mforbid-fp-as-gp, and -mex9 have been removed since they are not yet available in the nds32 port of GNU binutils.
  • A new option -mcmodel=[small|medium|large] supports varied code models on code generation. The -mgp-direct option became meaningless and can be discarded.
  • RX:
  • A new command line option -mno-allow-string-insns can be used to disable the generation of the SCMPU, SMOVU, SMOVB, SMOVF, SUNTIL, SWHILE and RMPA instructions. An erratum released by Renesas shows that it is unsafe to use these instructions on addresses within the I/O space of the processor. The new option can be used when the programmer is concerned that the I/O space might be accessed. The default is still to enable these instructions.
  • SH:
  • The compiler will now pass the appropriate --isa= option to the assembler.
  • The default handling for the GBR has been changed from call clobbered to call preserved. The old behavior can be reinstated by specifying the option -fcall-used-gbr.
  • Support for the SH4A fpchg instruction has been added which will be utilized when switching between single and double precision FPU modes.
  • The compiler no longer uses the __fpscr_values array for switching between single and double FPU precision modes on non-SH4A targets. Instead mode switching will now be performed by storing, modifying and reloading the FPSCR, so that other FPSCR bits are preserved across mode switches. The __fpscr_values array that is defined in libgcc is still present for backwards compatibility, but it will not be referenced by compiler generated code anymore.
  • New builtin functions __builtin_sh_get_fpscr and __builtin_sh_set_fpscr have been added. The __builtin_sh_set_fpscr function will mask the specified bits in such a way that the SZ, PR and FR mode bits will be preserved, while changing the other bits. These new functions do not reference the __fpscr_values array. The old functions __set_fpscr and __get_fpscr in libgcc which access the __fpscr_values array are still present for backwards compatibility, but their usage is highly discouraged.
  • Some improvements to code generated for __atomic built-in functions.
  • When compiling for SH2E the compiler will no longer force the usage of delay slots for conditional branch instructions bt and bf. The old behavior can be reinstated (e.g. to work around a hardware bug in the original SH7055) by specifying the new option -mcbranch-force-delay-slot.
  • OPERATING SYSTEMS:
  • DragonFly BSD:
  • GCC now supports the DragonFly BSD operating system.
  • FreeBSD:
  • GCC now supports the FreeBSD operating system for the arm port through the arm*-*-freebsd* target triplets.
  • VxWorks MILS:
  • GCC now supports the MILS (Multiple Independent Levels of Security) variant of WindRiver's VxWorks operating system for PowerPC targets.
  • OTHER SIGNIFICANT IMPROVEMENTS:
  • The gcc-ar, gcc-nm, gcc-ranlib wrappers now understand a -B option to set the compiler to use.
  • When the new command-line option -freport-bug is used, GCC automatically generates a developer-friendly reproducer whenever an internal compiler error is encountered.

New in GCC 4.9.2 (Nov 3, 2014)

  • FIXED BUGS:
  • 62129 - [4.9/5 Regression] internal compiler error: in output_constant, at varasm.c:4755
  • 62662 - [4.9/5 Regression] Miscompilation of Qt on s390x
  • 62224 - [4.9 Regression] Possible regression in gcc-4.9-20140820
  • 63448 - [4.9/5 Regression] ICE when compiling atlas 3.10.2
  • 61654 - [4.9/5 Regression] ICE in release_function_body, at cgraph.c:1699
  • 61566 - [4.9/4.10 Regression] ICE in write_unscoped_name
  • 61144 - [4.9/5 Regression] Invalid optimizations for extern vars with local weak definitions
  • 63190 - Assembler errors when building md5 code from fbb on aarch64
  • 61667 - setting max_load_factor of unordered_map cause buckets shrink
  • 63456 - unordered_map incorrectly frees _M_single_bucket. Patch Included
  • 61737 - ICE when building libgcc for cris cross-compiler
  • 62026 - [5 Regression] Crash in lto_get_decl_name_mapping
  • 62121 - [4.9 Regression] ICE: Segmentation fault in ipa-devirt.c:997
  • 63186 - [4.9 Regression] Undefined .L* symbols because of fnsplit
  • 63306 - [4.9 Regression] ICE: Segmentation fault in analyze_functions()
  • 60874 - FAIL: go.test/test/recover.go execution
  • 61880 - Linking with external functions in C does not work in GO when using gccgo, while it works in gc
  • 63248 - Crash when OpenMP target's array section handling is used with templates
  • 63284 - [4.9/5 Regression] -fcompare-debug issue due to redirection to __builtin_unreachable ()
  • 63495 - struct __attribute__ ((aligned (8))) broken on x86
  • 63563 - [4.9/5 Regression] ICE: in vectorizable_store, at tree-vect-stmts.c:5106 with -mavx2
  • 60417 - [DR 1518] Bogus error on C++03 aggregate initialization
  • 60872 - Cannot memcpy array of restricted pointers
  • 61659 - [4.9 Regression] Extra undefined symbol because of devirtualization
  • 61994 - [4.9 Regression] constexpr vector array ICE
  • 62659 - [4.9/5 regression] Regression in template argument substitution in 4.9+
  • 63437 - [4.9/5 regression][C++14] Parenthesized "movable but not copyable" object doesn't compile in return statement
  • 62294 - [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
  • 63323 - "confused by earlier errors, bailing out" with no other errors
  • 63531 - gcc segfaults on some sourcefiles when using '-Weffc++' and '-fsanitize=undefined' together
  • 62098 - [4.9/5 regression] incorrect code generated by arm gcc
  • 61374 - string_view::operator string() is buggy
  • 61390 - error in nested template parameter in ext/pb_ds header file
  • 62264 - std::experimental::string_view won't compile with -pedantic-errors
  • 63219 - Superfluous template parameter in match_result::format overload
  • 61320 - [4.10 regression] ICE in jcf-parse.c:1622 (parse_class_file
  • 61418 - [4.9/4.10 Regression] HDF5 build failure with -flto: libgfortran.spec: attempt to rename spec 'lib' to already defined spec 'liborig'
  • 61672 - [4.9 Regression] Less redundant instructions deleted by pre_delete after r208113.
  • 61741 - wrong code with -fno-strict-overflow
  • 61779 - gcc -Og fails with impossible constraint on legal C code
  • 62079 - [4.9 Regression] ICE: in calc_dfs_tree, at dominance.c:401 with -fnon-call-exceptions
  • 62175 - [4.9 Regression] Internal compiler error in gimplify_modify_expr gimplify.c:4616
  • 62142 - [4.9/5 Regression] internal compiler error: Segmentation fault (X = X - L*floor(X/L))
  • 63632 - [4.9/5 Regression] bootstrap-lto/profiledbootstrap broken by r216566
  • 61794 - internal error: unrecognizable insn, from avx512 extract instruction
  • 61855 - _MM_MANTISSA_NORM_ENUM in avx512intrin.h disabled when optimization off
  • 60037 - SIGFPE in std::generate_canonical
  • 60080 - gcc.dg/vect/vect-nop-move.c FAILs
  • 61214 - [4.9/5 regression] Weird interaction between -fvisibility-inlines-hidden, inline virtuals and devirtualization
  • 61656 - Undefined behavior in classify_argument
  • 61853 - [4.9/5 Regression] ICE: SIGSEGV in store_field
  • 62011 - False Data Dependency in popcnt instruction
  • 62025 - [4.9/5 Regression] Miscompilation of openssl sha512.c
  • 62131 - [4.9/5 Regression] OpenMP: Subobject of an allocatable array not allowed in OMP ATOMIC
  • 62219 - [c++11] Spurious error for lambda in a friend function of a class template with a default template parameters
  • 62262 - aarch64 gcc generates invalid assembler
  • 62312 - [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  • 63228 - -m16 doesn't work if gcc is compiled for x32
  • 63241 - Internal error in gimplify_init_constructor when using constexr and multidimensional arrays
  • 63285 - [4.9 Regression] -fcompare-debug scheduler related failure
  • 63500 - [4.9/5 Regression] bug in debug version of std::make_move_iterator?
  • 63530 - GCC generates incorrect aligned store on ARM after the loop is unrolled.
  • 63603 - [4.9/5 Regression] Linking with -fno-lto still invokes LTO
  • 63223 - [avr] Make jumptables work with -Wl,--section-start,.text=
  • 59758 - [4.9/5 Regression] bootstrap failure in libsanitizer/asan on sparc-linux-gnu