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.
array_allocator extensions
have been removed from libstdc++.
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.
-frepo)
has been removed.
--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.
__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.
-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.
-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.
lto-dump
has been added. The program can dump various
information about a LTO bytecode object file.
zstd
algorithm. Configure script can automatically detect the zstd support.
--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.
-fprofile-values,
an instrumented binary can track multiple
values (up to 4) for e.g. indirect calls and provide more precise
profile information.
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.
fiji)
and the fifth-generation VEGA 10/VEGA 20 (gfx900 or
gfx906).
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.
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.
-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.
-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.
\uNNNN or \UNNNNNNNN) that is already
supported:
static const int π = 3;
int get_naïve_pi() {
return π;
}-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.
[[]] 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.u8'' syntax
are supported.<float.h> defines
macros FLT_NORM_MAX, DBL_NORM_MAX
and LDBL_NORM_MAX.<float.h> 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 <float.h>.strftime format checking supports
the %OB and %Ob formats.-fno-fp-int-builtin-inexact is
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 -fcommon such definitions are silently merged during
linking.
a[b,c]constinit keywordvolatileconstexpr new[[nodiscard("with reason")]]-fcoroutines)?:__is_standard_layout for a class with repeated
basestypename in conversion-function-idsinitializer-list-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-conversion warnings with explicit
casts.
case
values).
noexcept-specifier is now properly treated as a
complete-class context as per
[class.mem].
deprecated can now be used on
namespaces too.
[[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.
<concepts> and
<iterator>.
<ranges>,
<algorithm>, and
<memory> (thanks to Patrick Palka).
shift_left and shift_right
(thanks to Patrick Palka).
std::span (thanks to JeanHeyd Meneide). <compare>
and throughout the library.
<algorithm> and elsewhere
(thanks to Edward Smith-Rowland).
<stop_token> and std::jthread
(thanks to Thomas Rodgers).
std::atomic_ref and
std::atomic<floating point>.
cmp_equal, cmp_less etc.).
std::ssize, std::to_array. std::construct_at, std::destroy,
constexpr std::allocator.
<numbers>. std::random_device.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.
GFORTRAN_FORMATTED_BUFFER_SIZE and
GFORTRAN_UNFORMATTED_BUFFER_SIZE for formatted
and unformatted files, respectively.
-fallow-argument-mismatch to turn these
errors into warnings; this option is implied
with -std=legacy. -Wargument-mismatch
has 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, -fno-inline-arg-packing
can be used to disable inline argument packing.
I, F and G have been
omitted, default widths are used.
-fdec-blank-format-item; this option is implied with
-fdec.
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.
DATA statements
for numeric (INTEGER, REAL, or
COMPLEX) or LOGICAL variables. Use the option
-fdec-char-conversions; this option is implied with
-fdec.
INTEGER, REAL, COMPLEX and
CHARACTER expressions. Use the option -fdec.
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.
__GCC_ASM_FLAG_OUTPUTS__.
On arm this feature is only available for A32 and T32 targets.
Please refer to the documentation for more details. arm_sve.h.
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.
-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.
-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.
+tme option
extension (for example, -march=armv8.5-a+tme).
+rng option
extension.-march=armv8.5-a or later.+memtag option extension.-march=armv8.6-a).
It can also be enabled for Armv8.2-A and later using the
+bf16 option extension.
+i8mm option extension.
+f32mm
option extension, which also has the effect of enabling SVE.
+f64mm
option extension, which likewise has the effect of enabling SVE.
+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.
cortex-a77).cortex-a76ae).cortex-a65).cortex-a65ae).cortex-a34).thunderx3t110).-mcpu or -mtune options,
for example: -mcpu=cortex-a77 or
-mtune=cortex-a65ae or as arguments to the equivalent target
attributes and pragmas.
arm-uclinuxfdpiceabi, and the C library is uclibc-ng.
arm*-*-netbsdelf-*eabi* triplet.
-mneon-for-64bits is now
deprecated and will be removed in a future release.cortex-a77).cortex-a76ae).cortex-m35p).-mcpu or -mtune options,
for example: -mcpu=cortex-a77 or
-mtune=cortex-m35p.
-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.mov or ior instruction when its
long immediate constant is known.uncached attribute.-mq-class option.ATtiny202, ATtiny204, ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATmega808, ATmega809, ATmega1608, ATmega1609, ATmega3208, ATmega3209, ATmega4808, ATmega4809has been added.
-nodevicespecs has been added.
It allows to provide a custom device-specs file by means of
avr-gcc -nodevicespecs -specs=my-spec-file <options>
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+.
-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=.
--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_roundeven into the appropriate
SSE 4.1 instruction has been added.
-menqcmd compiler switch.
-march=cooperlake.
The switch enables the AVX512BF16 ISA extensions.
-march=tigerlake.
The switch enables the MOVDIRI MOVDIR64B AVX512VP2INTERSECT ISA extensions.
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.
riscv*-*-* targets now require GNU binutils version 2.30
or later, to support new assembly instructions produced by GCC.
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.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 10.1 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
These pages are maintained by the GCC team. Last modified 2020-05-07.