GCC 13 Release Series — Changes, New Features, and Fixes
GCC 13 Release Series
Changes, New Features, and Fixes
This page is a "brief" summary of some of the huge number of improvements in GCC 13. You may also want to check out ourPorting to GCC 13 page and thefull GCC documentation.
Caveats
- OpenMP offloading to Intel MIC has been removed.
- The support for the
cr16-elf
,tilegx*-linux
,tilepro*-linux
,hppa[12]*-*-hpux10*
,hppa[12]*-*-hpux11*
andm32c-rtems
configurations has been removed. - Support for Solaris 11.3 (
*-*-solaris2.11.3
) has been declared obsolete. The next release of GCC will have corresponding code permanently removed. Details can be found in the announcement. - Support for emitting the STABS debugging format (including the
-gstabs
and-gxcoff
options) has been removed. (This means the dbx debugger is no longer supported, either.) - Legacy debug info compression option
-gz=zlib-gnu
was removed and the option is ignored right now. - -Warray-bounds=2 will no longer issue warnings for out of bounds accesses to trailing struct members of one-element array type anymore. Instead it diagnoses accesses to trailing arrays according to-fstrict-flex-arrays.
- -fanalyzer is still only suitable for analyzing C code. In particular, using it on C++ is unlikely to give meaningful output.
- In the arm port, support for the iWMMXt extensions, enabled through
-mcpu=iwmmxt
, has been deprecated and will be removed in a future release. This includes support for the iWMMXt built-in functions. - For C++, construction of the global iostream objects
std::cout
,std::cin
, etc. is now done inside the standard library, instead of in every source file that includes the<iostream>
header. This change improves the start-up performance of C++ programs, but it means that code compiled with GCC 13.1 will crash if the correct version oflibstdc++.so
is not used at run time. See thedocumentation about using the rightlibstdc++.so
at run time. Future GCC releases will mitigate the problem so that the program cannot be run at all with an olderlibstdc++.so
.
General Improvements
- OpenMP
- Reverse offload is now supported with AMD GCN and nvptx devices. Additionally, the
requires
handling has been improved and all clauses are now accepted. If a requirement cannot be fulfilled for an accessible device, this device is excluded from the list of available devices. This may imply that the only device left is the host (the initial device). In particular,unified_address
andunified_shared_memory
are unsupported by all non-host devices. - OpenMP 5.0: Fortran now supports some non-rectangular loop nests; for C/C++, the support was added in GCC 11.
- The following OpenMP 5.1 features have been added: the
omp_all_memory
reserved locator, theinoutset
modifier to thedepend
clause, thenowait
clause for thetaskwait
directive and theomp_target_is_accessible
,omp_target_memcpy_async
,omp_target_memcpy_rect_async
andomp_get_mapped_ptr
API routines. Theassume
andassumes
directives, thebegin/end declare target
syntax in C/C++ and device-specific ICV settings with environment variables are now supported. - Initial support for OpenMP 5.2 features has been added:
firstprivate
andallocate
clauses on thescope
construct; the OpenMP 5.2 syntax of thelinear
clause; new enum/constantsomp_initial_device
andomp_invalid_device
; and optionally omitting the map-type intarget enter/exit data
. Theenter
clause (as alias forto
) has been added to thedeclare target
directive. Also added have been theomp_in_explicit_task
routine and thedoacross
clause as alias fordepend
withsource
/sink
modifier. - The
_ALL
suffix to the device-scope environment variables added in Technical Report (TR11) is already handled. - For user defined allocators requesting high bandwidth or large capacity memspaces or interleaved partitioning, the memkind library is used, if available at run time.
- Reverse offload is now supported with AMD GCN and nvptx devices. Additionally, the
- AddressSanitizer defaults to
detect_stack_use_after_return=1
on GNU/Linux targets. For compatibility, it can be disabled withenv ASAN_OPTIONS=detect_stack_use_after_return=0
. - New debug info compression option value
-gz=zstd
has been added. - Link-time optimization improvements:
- LTO supports the newly added jobserver of GNU make jobserver that uses named pipes (
--jobserver-style=fifo
) by default. - If make's jobserver is active, parallel LTO WPA streaming communicates with it and thus avoids system overcommitting.
- LTO supports the newly added jobserver of GNU make jobserver that uses named pipes (
-Ofast
,-ffast-math
and-funsafe-math-optimizations
will no longer add startup code to alter the floating-point environment when producing a shared object with-shared
.- GCC can now emit its diagnostics using SARIF. This is a JSON-based format suited for capturing the results of static analysis tools (like GCC's -fanalyzer), but it can also be used to capture other GCC warnings and errors in a machine-readable format. Specifically, the -fdiagnostics-format= option has been extended to support these new values:
-fdiagnostics-format=sarif-stderr
-fdiagnostics-format=sarif-file
-fdiagnostics-format=json-stderr
, a synonym for the existing-fdiagnostics-format=json
-fdiagnostics-format=json-file
where thejson
-prefixed variants refer to GCC's own JSON diagnostic format.
- Support for profiling and test coverage in freestanding environments has been added, see alsoProfiling and Test Coverage in Freestanding Environments.
- New options
-fharden-compares
and-fharden-conditional-branches
to verify compares and conditional branches, to detect some power-deprivation hardware attacks, using reversed conditions.
New Languages and Language specific improvements
Ada
- Traceback support added in RTEMS for the PPC ELF and ARM architectures.
- Support for versions older than VxWorks 7 has been removed.
- General improvements to the contracts in the standard libraries.
- Addition of
GNAT.Binary_Search
. - Further additions and fixes for the Ada 2022 specification.
- The Pragma
SPARK_Mode=>Auto
is now accepted. Contract analysis has been further improved. - Documentation improvements.
C family
- New warnings:
- -Wxor-used-as-pow warns about uses of
^
, the exclusive or operator, where it appears the user meant exponentiation (PR90885)
- -Wxor-used-as-pow warns about uses of
- Three new function attributes for documenting
int
arguments that are file descriptors:- __attribute__((fd_arg(N)))
- __attribute__((fd_arg_read(N)))
- __attribute__((fd_arg_write(N)))
These are used by-fanalyzer to detect misuses of file descriptors.
- A new statement attribute for C++23 P1774R8 Portable assumptions support also in C or older C++:__attribute__((assume(EXPR)));
- GCC can now control when to treat the trailing array of a structure as a flexible array member for the purpose of accessing the elements of such an array. By default, all trailing arrays in aggregates are treated as flexible array members. Use the new command-line option-fstrict-flex-arrays to control which array members are treated as flexible arrays.
C
- Several C23 features have been implemented:
- N3042, Introduce the nullptr constant
- N2963, Enhanced Enumerations (fixed underlying types)
- N2975, Relax requirements for variadic parameter lists
- N3007, Type inference for object definitions (
auto
) - N3018, The
constexpr
specifier for object definitions - N3038, Introduce storage-class specifiers for compound literals
typeof
(previously supported as an extension) andtypeof_unqual
- New keywords
alignas
,alignof
,bool
,false
,static_assert
,thread_local
,true
- N2764, The
noreturn
attribute - Support for empty initializer braces
__STDC_VERSION_*_H__
header version macros- Removal of
ATOMIC_VAR_INIT
unreachable
macro in<stddef.h>
- Removal of trigraphs
- Removal of unprototyped functions
printf
andscanf
format checking with -Wformat for%wN
and%wfN
format length modifiers- N2836, Identifier Syntax using Unicode Standard Annex 31
- In addition to those C23 features, existing features adopted in C23 have been adjusted to follow C23 requirements and are not diagnosed with
-std=c2x -Wpedantic
. - New warnings:
- -Wenum-int-mismatch warns about mismatches between an enumerated type and an integer type (PR105131)
C++
- Excess precision support (which has been available in C since GCC 4.5) has been implemented for C++ as well. It is enabled by default in strict standard modes like
-std=c++17
, where it defaults to-fexcess-precision=standard
, while in GNU standard modes like-std=gnu++20
it defaults to-fexcess-precision=fast
. The option mainly affects IA-32/x86-64 using x87 math and in some cases on Motorola 68000, wherefloat
anddouble
expressions are evaluated inlong double
precision and S/390, System z, IBM z Systems wherefloat
expressions are evaluated indouble
precision. Also, on several architectures wherestd::float16_t
orstd::bfloat16_t
types are supported those are evaluated infloat
precision.-fexcess-precision=fast
restores previous behavior. - Several C++23 features have been implemented:
- P2324R1, Labels at the end of compound statements (PR103539)
- P2255R2, A type trait to detect reference binding to temporary (PR104477)
- P2327R1, De-deprecating volatile compound operations
- P2437R1, Support for
#warning
(PR106646) - P2290R3, Delimited escape sequences (PR106645)
- P2071R2, Named universal character escapes (PR106648)
- P2513R3,
char8_t
Compatibility and Portability Fix (PR106656) - P1169R4, static
operator()
(PR106651) - P2266R3, Simpler implicit move (PR101165)
- P2468R2, The Equality Operator You Are Looking For (PR106644)
- P2362R3, Remove non-encodable wide character literals and multicharacter wide character literals (PR106647)
- P2448R2, Relaxing some constexpr restrictions (PR106649)
- P1467R9, Extended floating-point types and standard names (PR106652)
- P1774R8, Portable assumptions (PR106654)
- P2295R6, Support for UTF-8 as a portable source file encoding (PR106655)
- P2589R1, static operator[] (PR107684)
- New warnings:
- -Wself-move warns when a value is moved to itself with
std::move
(PR81159) - -Wdangling-reference warns when a reference is bound to a temporary whose lifetime has ended (PR106393)
- -Wself-move warns when a value is moved to itself with
- The -Wpessimizing-move and -Wredundant-move warnings have been extended to warn in more contexts.
- The -nostdlib++ option has been added, to enable linking with
g++
without implicitly linking in the C++ standard library.
Runtime Library (libstdc++)
- Improved experimental support for C++20, including:
<format>
header andstd::format
.std::chrono::utc_clock
and other clocks, time zones, andstd::format
support in the<chrono>
header.
- Improved experimental support for C++23, including:
- Additions to the
<ranges>
header:views::zip
,views::zip_transform
,views::adjacent
,views::adjacent_transform
views::pairwise
,views::slide
,views::chunk
,views::chunk_by
,views::repeat
,views::chunk_by
,views::cartesian_product
,views::as_rvalue
,views::enumerate
,views::as_const
. - Additions to the
<algorithm>
header:ranges::contains
,ranges::contains_subrange
,ranges::iota
,ranges::find_last
,ranges::find_last_if
,ranges::find_last_if_not
,ranges::fold_left
,ranges::fold_left_first
,ranges::fold_right
,ranges::fold_right_last
,ranges::fold_left_with_iter
,ranges::fold_left_first_with_iter
. - Monadic operations for
std::expected
. - Constexpr
std::bitset
,std::to_chars
andstd::from_chars
. - Library support for extended floating-point types.
- Additions to the
- Support for the
<experimental/scope>
header from v3 of the Library Fundamentals Technical Specification. - Support for the
<experimental/synchronized_value>
header from v2 of the Concurrency Technical Specification. - Support for many previously unavailable features in freestanding mode, thanks to Arsen Arsenović. For example,
std::tuple
is now available for freestanding compilation. The freestanding subset contains all the components made freestanding byP1642, and libstdc++ adds more components such asstd::array
andstd::string_view
. Additionally, libstdc++ now respects the-ffreestanding
compiler option and so it is not necessary to build a separate freestanding installation of libstdc++. Compiling with-ffreestanding
restricts the available features to the freestanding subset, even if libstdc++ was built as a full, hosted implementation.
D
- Support for the D programming language has been updated to version 2.103.1 of the language and run-time library. Full changelog for this release and previous releases can be found on thedlang.org website.
- The following GCC attributes are now recognized and available from the
gcc.attributes
module with short-hand aliases for convenience:@attribute("no_sanitize", arguments)
or@no_sanitize(arguments)
.@attribute("register")
or@register
.@attribute("simd")
or@simd
.@attribute("simd_clones", mask)
or@simd_clones(mask)
.@attribute("visibility", arguments)
or@visibility(arguments)
.
- New aliases have been added to
gcc.attributes
for compatibility withldc.attributes
.- The
@hidden
attribute is an alias for@attribute("visibility", "hidden")
. - The
@noSanitize
attribute is an alias for@attribute("no_sanitize")
.
- The
- Vector operation intrinsics
prefetch
,loadUnaligned
,storeUnaligned
,shuffle
,shufflevector
,extractelement
,insertelement
,convertvector
, andblendvector
have been added to thegcc.simd
module. - New warnings:
- -Wbuiltin-declaration-mismatch= warns when a built-in function is declared with the wrong signature.
- -Wmismatched-special-enum warns when a special enum is declared with the wrong base type.
- New version identifier
D_Optimized
is now predefined when the-O
option, or any higher optimization level is used. - The predefinition of version
D_Exceptions
can now by controlled by the option-fexception
. - The predefinition of version
D_TypeInfo
can now by controlled by the option-frtti
. - The
-fdebug=
and-fversion=
compiler switches no longer accept an integer argument.
Fortran
- Finalization is now fully supported.
Go
- GCC 13, like GCC 12, provides a complete implementation of the Go 1.18 user packages.
- Although Go 1.18 includes support for generic programming, that support is not yet available in GCC.
Modula-2
- Support for the language Modula-2 has been added. This includes support for the ISO/IEC 10514-1, PIM2, PIM3, PIM4 dialects together with a complete set of ISO/IEC 10514-1 and PIM libraries.
- The
<* noreturn *>
attribute is supported with the-Wreturn-type
option.
New Targets and Target Specific Improvements
AArch64
- The AArch64 target now supports Decimal Floating-point in the BID format through the
libbid
library. - A number of new CPUs are supported through the
-mcpu
and-mtune
options (GCC identifiers in parentheses).- Ampere-1A (
ampere1a
). - Arm Cortex-A715 (
cortex-a715
). - Arm Cortex-X1C (
cortex-x1c
). - Arm Cortex-X3 (
cortex-x3
). - Arm Neoverse V2 (
neoverse-v2
).
- Ampere-1A (
- Support has been added for the
armv9.1-a, armv9.2-a
andarmv9.3-a
arguments to the-march=
option. - The
FEAT_LRCPC
feature is now supported by generating theLDAPR
instructions for C and C++ atomic loads with an acquire memory model. This is enabled when compiling with the+rcpc
extension to-march
or a CPU target that supports this feature. - The
FEAT_CSSC
feature from the 2022 Arm Architecture extensions is supported through the+cssc
extension option. When enabled, scalar operations like integer minimum, maximum, absolute value, count trailing zeroes (__builtin_ctz
), population count (__builtin_popcount
) can be implemented in a single instruction. - The
FEAT_LSE2
feature is now supported throughlibatomic
and provides lockless 16-byte atomics on systems that implement it.
AMD Radeon (GCN)
- Support for the Instinct MI200 series devices ( gfx90a) has been added.
- SIMD vectorization support has been improved; this and stack-handling changes require newlib 4.3.0 (or newer).
arm
- A number of new CPUs are supported through the
-mcpu
and-mtune
options (GCC identifiers in parentheses).- STAR-MC1 (
star-mc1
). - Arm Cortex-X1C (
cortex-x1c
). - Arm Cortex-M85 (
cortex-m85
).
- STAR-MC1 (
- Support has been added for the M-profile PACBTI extension that can help harden the generated code against return-oriented and jump-oriented attacks. It can be enabled through the
-mbranch-protection=
option.
AVR
- Support for the following devices has been added in v13.3:
- ATtiny102, ATtiny104, ATtiny424, ATtiny426, ATtiny427, ATtiny824, ATtiny826, ATtiny827, ATtiny1624, ATtiny1626, ATtiny1627, ATtiny3224, ATtiny3226, ATtiny3227, AVR32DD14, AVR32DD20, AVR32DD28, AVR32DD32, AVR32DU14, AVR32DU20, AVR32DU28, AVR32DU32, AVR32EA28, AVR32EA32, AVR32EA48, AVR64DD14, AVR64DD20, AVR64DD28, AVR64DD32, AVR64DU28, AVR64DU32, AVR64EA28, AVR64EA32, AVR64EA48, ATA5787, ATA5835, ATA5700M322.
- Support for the following devices has been added in v13.4:
- AVR32SD20, AVR32SD28, AVR32SD32, AVR64SD28, AVR64SD32, AVR64SD48.
IA-32/x86-64
- For both C and C++ the
__bf16
type is supported on x86 systems with SSE2 and above enabled. - Use this
__bf16
type for AVX512BF16 intrinsics instead of__bfloat16
which is typedef for short.__bf16
is now part of the x86 psABI. Users need to adjust their AVX512BF16-related source code when upgrading to GCC 13. - New ISA extension support for Intel AMX-COMPLEX was added. AMX-COMPLEX intrinsics are available via the
-mamx-complex
compiler switch. - New ISA extension support for Intel AMX-FP16 was added. AMX-FP16 intrinsics are available via the
-mamx-fp16
compiler switch. - New ISA extension support for Intel AVX-IFMA was added. AVX-IFMA intrinsics are available via the
-mavxifma
compiler switch. - New ISA extension support for Intel AVX-NE-CONVERT was added. AVX-NE-CONVERT intrinsics are available via the
-mavxneconvert
compiler switch. - New ISA extension support for Intel AVX-VNNI-INT8 was added. AVX-VNNI-INT8 intrinsics are available via the
-mavxvnniint8
compiler switch. - New ISA extension support for Intel CMPccXADD was added. CMPccXADD intrinsics are available via the
-mcmpccxadd
compiler switch. - New ISA extension support for Intel PREFETCHI was added. PREFETCHI intrinsics are available via the
-mprefetchi
compiler switch. - New ISA extension support for Intel RAO-INT was added. RAO-INT intrinsics are available via the
-mraoint
compiler switch. - GCC now supports the Intel CPU named Raptor Lake through
-march=raptorlake
. Raptor Lake is based on Alder Lake. - GCC now supports the Intel CPU named Meteor Lake through
-march=meteorlake
. Meteor Lake is based on Alder Lake. - GCC now supports the Intel CPU named Sierra Forest through
-march=sierraforest
. Based on ISA extensions enabled on Alder Lake, the switch further enables the AVX-IFMA, AVX-NE-CONVERT, AVX-VNNI-INT8, CMPccXADD, ENQCMD and UINTR ISA extensions. - GCC now supports the Intel CPU named Grand Ridge through
-march=grandridge
. Grand Ridge is based on Sierra Forest. - GCC now supports the Intel CPU named Emerald Rapids through
-march=emeraldrapids
. Emerald Rapids is based on Sapphire Rapids. - GCC now supports the Intel CPU named Granite Rapids through
-march=graniterapids
. Based on Sapphire Rapids, the switch further enables the AMX-FP16 and PREFETCHI ISA extensions. - GCC now supports the Intel CPU named Granite Rapids D through
-march=graniterapids-d
. Based on Granite Rapids, the switch further enables the AMX-COMPLEX ISA extensions. - GCC now supports AMD CPUs based on the
znver4
core via-march=znver4
. The switch makes GCC consider using 512-bit vectors when auto-vectorizing.
LoongArch
- New features
- The new command-line option
-mexplicit-relocs
decides whether to use the assembler relocation operator when dealing with symbolic addresses. It is enabled by default if a compatible assembler (binutils 2.40 or later) is present at GCC build time. - The new command-line option
-mdirect-extern-access
can be used to prevent accessing external symbols through GOT. - The new variable attribute model has been added.
- The new command-line option
- Built-in functions
- The
rint
andcopysign
mathematical builtins (and their float variants) are now implemented as inline LoongArch intrinsics. - The
lrint
,logb
,scalbln
,scalbn
andldexp
mathematical builtins (and their float variants) are now implemented as inline LoongArch intrinsics when using-fno-math-errno
. - The
lceil
andlfloor
mathematical builtins (and their float variants) are now implemented as inline LoongArch intrinsics when using-ffp-int-builtin-inexact
.
- The
- Subprojects Support
libvtv
now supports LoongArch.libitm
now supports LoongArch.- Address sanitizers other than HWASan and TSan are now supported on LoongArch.
NVPTX
- The default value for the -march option can be now changed when building GCC using the --with-arch= configure option. GCC's target libraries are then build both with
sm_30
and the specified target architecture. If not specified, GCC defaults tosm_30
.
RISC-V
- Support for vector intrinsics as specified in version 0.11 of the RISC-V vector intrinsic specification, thanks Ju-Zhe Zhong from RiVAI for contributing most of implementation.
- Support for the following standard extensions has been added:
- Zawrs
- Zbkb
- Zbkc
- Zbkx
- Zdinx
- Zfinx
- Zfh
- Zfhmin
- Zhinx
- Zhinxmin
- Zicbom
- Zicbop
- Zicboz
- Zknd
- Zkne
- Zksed
- Zksh
- Zmmul
- Support for the following vendor extensions has been added:
- XTheadBa
- XTheadBb
- XTheadBs
- XTheadCmo
- XTheadCondMov
- XTheadFMemIdx
- XTheadFmv
- XTheadInt
- XTheadMac
- XTheadMemIdx
- XTheadMemPair
- XTheadSync
- The following new CPUs are supported through the
-mcpu
option (GCC identifiers in parentheses).- T-Head's XuanTie C906 (
thead-c906
).
- T-Head's XuanTie C906 (
- Improves the multi-lib selection mechanism for the bare-metal toolchain (riscv*-elf*). GCC will now automatically select the best-fit multi-lib candidate instead of requiring all possible reuse rules to be listed at build time.
Operating Systems
Windows
- The GNU threads library used by the
win32
thread model has been reimplemented using direct Win32 API calls, except for the Objective-C specific subset. It requires Windows XP/Server 2003 or later. The new implementation also adds the support needed for the C++11 threads, using again direct Win32 API calls; this additional layer requires Windows Vista/Server 2008 or later. It is recommended to use a recent version of MinGW-W64 in conjunction with thewin32
thread model.
Improvements to Static Analyzer
- The analyzer has gained 20 new warnings:
- -Wanalyzer-allocation-size
- -Wanalyzer-deref-before-check
- -Wanalyzer-exposure-through-uninit-copy
- Seven new warnings relating to misuse of file descriptors:
* -Wanalyzer-fd-access-mode-mismatch
* -Wanalyzer-fd-double-close
* -Wanalyzer-fd-leak
* -Wanalyzer-fd-phase-mismatch (e.g. callingaccept
on a socket before callinglisten
on it)
* -Wanalyzer-fd-type-mismatch (e.g. using a stream socket operation on a datagram socket)
* -Wanalyzer-fd-use-after-close
* -Wanalyzer-fd-use-without-check
along with special-casing handling of the behavior of
open
,close
,creat
,dup
,dup2
,dup3
,pipe
,pipe2
,read
, andwrite
.- -Wanalyzer-imprecise-fp-arithmetic
- -Wanalyzer-infinite-recursion
- -Wanalyzer-jump-through-null
- -Wanalyzer-out-of-bounds
- -Wanalyzer-putenv-of-auto-var
- -Wanalyzer-tainted-assertion
- Four new warnings for misuses of
<stdarg.h>
:
* -Wanalyzer-va-list-leak for complaining about missingva_end
after ava_start
orva_copy
* -Wanalyzer-va-list-use-after-va-end for complaining aboutva_arg
orva_copy
used on ava_list
that's hadva_end
called on it
* -Wanalyzer-va-arg-type-mismatch for type-checking ofva_arg
usage in interprocedural execution paths against the types of the parameters that were actually passed to the variadic call
* -Wanalyzer-va-list-exhausted for complaining in interprocedural execution paths ifva_arg
is used too many times on ava_list
along with numerous other improvements.
Improvements for plugin authors
- GCC diagnostics can now beassociated with rules such as from coding standards documents, or specifications. Such rules have a code name and can have a URL, which GCC can print in text form or capture in itsSARIF output when emitting diagnostics.
Other significant improvements
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 13.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 13.2
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 13.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 13.3
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 13.3 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
Language Specific Changes
C++
- The
libstdc++exp.a
library now includes all the Filesystem TS symbols from thelibstdc++fs.a
library, and the experimental symbols for the C++23std::stacktrace
class from thelibstdc++_libbacktrace.a
library. This means that-lstdc++exp
is the only library needed for all experimental libstdc++ features.