This page is a "brief" summary of some of the huge number of improvements in GCC 10. You may also want to check out our Porting to GCC 10 page and the full GCC documentation.
Note: GCC 10 has not been released yet, so this document is a work-in-progress.
array_allocatorextensions have been removed from libstdc++.
std::__is_nullptr_ttype trait is deprecated and will be removed from libstdc++ in a future release. The standard trait
std::is_null_pointershould be instead.
-frepo) has been removed.
__has_builtinbuilt-in preprocessor operator can be used to query support for built-in functions provided by GCC and other compilers that support it.
__builtin_roundevenfor the corresponding function from ISO/IEC TS 18661.
-finline-functionsis now enabled at
-O2and was retuned for better code size versus runtime performance trade-offs. Inliner heuristics was also significantly sped up to avoid negative impact to
-flto -O2compile times.
lto-dumphas been added. The program can dump various information about a LTO bytecode object file.
zstdalgorithm. Configure script can automatically detect the
--paramvalues can now be specified at translation unit granuality. 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.
-fprofile-values, an instrumented binary can track multiple values (up to 4) for e.g. indirect calls and provide more precise profile information.
accessfunction 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
-Wstring-compare, enabled by
-Wextra, warns about equality and inequality expressions between zero and the result of a call to either
strncmpthat 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.
-Warray-boundsdetects more out-of-bounds accesses to member arrays as well as accesses to elements of zero-length arrays.
-Wformat-overflowmakes full use of string length information computed by the
-Wrestrictdetects overlapping accesses to dynamically allocated objects.
-Wreturn-local-addrdiagnoses more instances of
returnstatements returning addresses of automatic variables.
-Wstringop-overflowdetects 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
-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
[]attribute syntax is supported, as in C++. Existing attributes can be used with this syntax in forms such as
[[gnu::const]]. The standard attributes
u8''syntax are supported.
DEC128_TRUE_MIN, in addition to the macros that were previously only defined if
__STDC_WANT_DEC_FP__was defined before including
strftimeformat checking supports the
-fno-fp-int-builtin-inexactis enabled by default.
-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
-fcommonsuch definitions are silently merged during linking.
__is_standard_layoutfor a class with repeated bases
-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.
-Wsign-conversionwarnings with explicit casts.
noexcept-specifieris now properly treated as a complete-class context as per [class.mem].
deprecatedcan now be used on
std::span(thanks to JeanHeyd Meneide).
<algorithm>and elsewhere (thanks to Edward Smith-Rowland).
std::jthread(thanks to Thomas Rodgers).
<memory>(thanks to Patrick Palka).
use_device_addrof 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.
GFORTRAN_UNFORMATTED_BUFFER_SIZEfor formatted and unformatted files, respectively.
-fallow-argument-mismatchto turn these errors into warnings; this option is implied with
-Wargument-mismatchhas been removed.
-fallow-invalid-boz, where the error is degraded to a warning and the code is compiled as with older gfortran.
-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,
-finline-arg-packingcan be used to disable inline argument packing.
Ghave been omitted, default widths are used.
-fdec-blank-format-item; this option is implied with
STATICattributes has been extended to allow variables with the
AUTOMATICattribute to be used in
-fdec-static; this option is implied by
DATAstatements for numeric (
LOGICALvariables. Use the option
-fdec-char-conversions; this option is implied with
CHARACTERexpressions. Use the option
lenin addition to
*is used for assumed length. The kind is omitted if it is the default kind. Examples:
CO_BROADCASTnow supports derived type variables including objects with allocatable components. In this case, the optional arguments
ERRMSG=are currently ignored.
__GCC_ASM_FLAG_OUTPUTS__. On arm this feature is only available for A32 and T32 targets. Please refer to the documentation for more details.
-mbranch-protection=pac-retoption now accepts the optional argument
+b-keyextension to perform return address signing with the B-key instead of the A-key.
+tmeoption extension (for example,
+sve2option extension (for example,
-march=armv8.5-a+sve2). Additional extensions can be enabled through
-moutline-atomicshas 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.
-mtuneoptions, for example:
-mtune=cortex-a65aeor as arguments to the equivalent target attributes and pragmas.
arm-uclinuxfdpiceabi, and the C library is uclibc-ng.
-mneon-for-64bitsis now deprecated and will be removed in a future release.
-mtuneoptions, for example:
-mpure-codein Thumb-1 (v6m) has been added: this M-profile feature is no longer restricted to targets with
MOVT. For example,
-mcpu=cortex-m0now supports this option.
ATtiny202, ATtiny204, ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATmega808, ATmega809, ATmega1608, ATmega1609, ATmega3208, ATmega3209, ATmega4808, ATmega4809has been added.
-nodevicespecshas been added. It allows to provide a custom device-specs file by means of
and without the need to provide options
avr-gcc -nodevicespecs -specs=my-spec-file <options>
-mmcu=. See AVR command-line options for details. This feature is also available in GCC 9.3+ and GCC 8.4+.
-mlong-double=[32,64]have been added. They allow to choose the size (in bits) of the
long doubletypes, 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-libf7=has been added. It controls to which level avr-libgcc provides 64-bit floating point support by means of Libf7.
--with-double-comparison=has been added. It's unlikely you need to set this option by hand.
__builtin_roundeveninto the appropriate SSE 4.1 instruction has been added.
-march=cooperlake. The switch enables the AVX512BF16 ISA extensions.
-march=tigerlake. The switch enables the MOVDIRI MOVDIR64B AVX512VP2INTERSECT ISA extensions.
memmove, the existing
movmeminstruction patterns used for non-overlapping memory copies have been renamed to
movmemname is now used for overlapping memory moves, consistent with the library functions
Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.