GCC 11 Release Series — Changes, New Features, and Fixes
GCC 11 Release Series
Changes, New Features, and Fixes
This page is a "brief" summary of some of the huge number of improvements in GCC 11. You may also want to check out ourPorting to GCC 11 page and thefull GCC documentation.
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.
- Add
- 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. Example:
int IsHTMLWhitespace(int aChar) {
return aChar == 0x0009 || aChar == 0x000A ||
aChar == 0x000C || aChar == 0x000D ||
aChar == 0x0020;
}
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 ofOpenMP 5.0, including initial
allocate
clause support in C/C++. TheOMP_TARGET_OFFLOAD
environment variable and the active-levels routines are now supported. For C/C++, thedeclare variant
andmap
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 forflush
,lastprivate
withconditional
modifier,atomic
construct andreduction
clause extensions of OpenMP 5.0,if
clause withsimd
andcancel
modifiers,target data
withoutmap
clause, and limited support for therequires
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 existingmalloc 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.
- The no_stack_protector attribute has been added to mark functions which should not be instrumented with stack protection (
- 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 thesection
attribute, or the-f{function,data}-sections
options) will be placed in new, unique sections.
This functionality requires Binutils version 2.36 or later.
C
- 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
andBOOL_WIDTH
macros are provided in<limits.h>
. - As in C++, function definitions no longer need to give names for unused function parameters.
- The expansions of the
true
andfalse
macros in<stdbool.h>
have changed so that they have typebool
. - 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_Float_N_
,_Float_N_x
and_Decimal_N_
types, are provided in<float.h>
. There are also corresponding built-in functions__builtin_nansd_N_
for decimal signaling NaNs. - Macros
FLT_IS_IEC_60559
,DBL_IS_IEC_60559
andLDBL_IS_IEC_60559
are provided in<float.h>
. - The feature test macro
__STDC_WANT_IEC_60559_EXT__
is supported by<float.h>
. - Labels may appear before declarations and at the end of a compound statement.
- The
- 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.
- -Warray-parameter, enabled by
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-expression_s
- P1099R5,
using enum
- Modules, Requires
-fmodules-ts
and some aspects are incomplete. Refer to C++ 20 Status
- the compiler now supports
- 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.
- P0330R8, Literal Suffix for (signed) size_t.
- 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
- DR 625, Use of
- G++ now performs better access checking in templates (PR41437).
reinterpret_cast
s 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 ofoperator 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 attributenonnull
and triggers warnings for calls where the pointer is null.
- -Wnonnull considers the implicit
Runtime Library (libstdc++)
- Improved C++17 support, including:
std::from_chars
andstd::to_chars
for floating-point types.
- Improved experimental C++20 support, including:
- Calendar additions to
<chrono>
. Thanks to Cassio Neri for optimizations. std::bit_cast
std::source_location
- Atomic wait and notify operations.
<barrier>
,<latch>
, and<semaphore>
<syncstream>
- Efficient access to
basic_stringbuf
's buffer. - Heterogeneous lookup in unordered containers.
- Calendar additions to
- 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.
D
- 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 namednoreturn
, 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 orpragma(scanf)
for scanf-like functions. - The
__traits()
expression now supports the extensionsisDeprecated
,isDisabled
,isFuture
,isModule
,isPackage
,child
,isReturnOnStack
,isZeroInit
,getTargetInfo
,getLocation
,hasPostblit
,isCopyable
,getVisibility
, andtotype
. - 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 thecore.stdc.config
module. - User-defined attributes can now be used to annotate enum members, alias declarations, and function parameters.
- Template alias parameters can now be instantiated with basic types such as
int
orvoid function()
. - The
mixin
construct can now be used as types in the formmixin(string) var
. - The
mixin
construct can now take an argument list, same aspragma(msg)
.
- A new bottom type
- New intrinsics:
- Bitwise rotate intrinsics
core.bitop.rol
andcore.bitop.ror
have been added. - Byte swap intrinsic
core.bitop.byteswap
for swapping bytes in a 2-byteushort
has been added. - Math intrinsics available from
core.math
now have overloads forfloat
anddouble
types. - Volatile intrinsics
core.volatile.volatileLoad
andcore.volatile.volatileStore
have been moved from thecore.bitop
module.
- Bitwise rotate intrinsics
- 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 withldc.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 thestrategy
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 forattribute("target", arguments)
.
* The@weak
attribute is an alias for@attribute("weak")
.
- The following GCC attributes are now recognized and available from the
- 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 theva_start
intrinsic.
- Deprecated and removed features:
- Compiler-recognized attributes are now made available from the
gcc.attributes
module, the former modulegcc.attribute
has been deprecated and will be removed in a future release. - The
@attribute("alias")
attribute has been removed, as it had been superseded bypragma(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.
- Compiler-recognized attributes are now made available from the
Fortran
- Added
DEPRECATED
to!GCC$
'sattributes
directive.
Go
- GCC 11 provides a complete implementation of the Go 1.16.3 user packages.
libgccjit
- libgccjit was marked as merely "Alpha" quality whenoriginally added in GCC 5. Given that we have maintainedAPI 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 back ends (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
).
- Arm Cortex-A78 (
- 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
).
- Fujitsu A64FX (
- The AArch64 Armv8-R architecture is now supported through the
-march=armv8-r
option. - Mitigation against theStraight-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 fromsm_30
tosm_35
. - The
-m32
compiler switch has been removed. - The
-msoft-stack-reserve-local
format has been fixed. Previously, it accepted-msoft-stack-reserve-local<n>
. It now accepts-msoft-stack-reserve-local=<n>
.
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 offloat_t
asdouble
. 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 offloat_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'smultilib-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
andfree
.- As preliminary work towards eventually supporting C++, the
malloc
/free
checking will also checknew
/delete
andnew[]
/delete[]
. However, C++ is not yet properly supported by-fanalyzer (for example, exception-handling is unimplemented). - As noted above, the existingmalloc 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 vectordelete[]
.
- As preliminary work towards eventually supporting C++, the
- 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 aGCC 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 variableGCC_EXTRA_DIAGNOSTIC_OUTPUT which can be used by IDEs to request machine-readable fix-it hints without needing to adjust build flags.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 11.1 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
GCC 11.2
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 11.2 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
GCC 11.3
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 11.3 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
GCC 11.4
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 11.4 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
Target Specific Changes
x86-64
- The x86-64 ABI of passing and returning structure with a 64-bit single precision vector changed in GCC 11.1 when 3DNOW is disabled. Disabling 3DNOW no longer changes how they are passed nor returned. This ABI change is now diagnosed with
-Wpsabi
. - 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
.
GCC 11.5
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 11.5 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
Caveats
aarch64
- Due to a bug introduced a few weeks before the 11.5.0 release if the compiler is configured without explicit
--with-arch=
,--with=cpu=
and/or--with-tune=
configure options the compiler without explicit-march=
etc. options might act as if asked forcortex-a34
. This can be fixed by applying manually ther12-8060 commit patch on top of GCC 11.5.0. See PR116029 for more details. GCC 11.4.0 or earlier releases are not affected.