https://gcc.gnu.org/gcc-13/changes.html
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 our Porting to
GCC 13 page and the full 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* and m32c-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.
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 and unified_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, the inoutset modifier to the
depend clause, the nowait clause for the taskwait directive
and the omp_target_is_accessible, omp_target_memcpy_async,
omp_target_memcpy_rect_async and omp_get_mapped_ptr API
routines. The assume and assumes directives, the begin/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 and allocate clauses on the scope construct; the
OpenMP 5.2 syntax of the linear clause; new enum/constants
omp_initial_device and omp_invalid_device; and optionally
omitting the map-type in target enter/exit data. The enter
clause (as alias for to) has been added to the declare target
directive. Also added have been the omp_in_explicit_task
routine and the doacross clause as alias for depend with
source/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.
* AddressSanitizer defaults to detect_stack_use_after_return=1 on
GNU/Linux targets. For compatibility, it can be disabled with env
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.
* -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 the json-prefixed variants refer to GCC's own JSON
diagnostic format.
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)
* 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) and
typeof_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
+ Removal of trigraphs
+ Removal of unprototyped functions
+ printf and scanf 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, where float and double expressions are
evaluated in long double precision and S/390, System z, IBM z
Systems where float expressions are evaluated in double
precision. Also, on several architectures where std::float16_t or
std::bfloat16_t types are supported those are evaluated in float
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)
* 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:
+ header and std::format.
+ std::chrono::utc_clock and other clocks, time zones, and
std::format support in the header.
* Improved experimental support for C++23, including:
+ Additions to the 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 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 and std::from_chars.
+ Library support for extended floating-point types.
* Support for the header from v3 of the
Library Fundamentals Technical Specification.
* Support for the header from v2
of the Concurrency Technical Specification.
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).
* Support has been added for the armv9.1-a, armv9.2-a and armv9.3-a
arguments to the -march= option.
* The FEAT_LRCPC feature is now supported by generating the LDAPR
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 through libatomic 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).
* 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.
IA-32/x86-64
* For both C and C++ the __bf16 type is supported on x86 systems
with SSE2 and above enabled.
* Use real __bf16 type for AVX512BF16 intrinsics. Previously we use
__bfloat16 which is typedef of short. Now we introduced real
__bf16 type to x86 psABI. Users need to adjust their
AVX512BF16-related source code when upgrading GCC12 to GCC13.
* 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-VNNI-INT8 was added.
AVX-VNNI-INT8 intrinsics are available via the -mavxvnniint8
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 CMPccXADD was added.
CMPccXADD intrinsics are available via the -mcmpccxadd 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 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.
* New ISA extension support for Intel AMX-COMPLEX was added.
AMX-COMPLEX intrinsics are available via the -mamx-complex
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. The switch enables the AVX-IFMA, AVX-VNNI-INT8,
AVX-NE-CONVERT and CMPccXADD ISA extensions.
* GCC now supports the Intel CPU named Grand Ridge through -march=
grandridge. The switch enables the AVX-IFMA, AVX-VNNI-INT8,
AVX-NE-CONVERT, CMPccXADD and RAO-INT ISA extensions.
* 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. The switch enables the AMX-FP16, PREFETCHI
and 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.
* Built-in functions
+ The rint and copysign mathematical builtins (and their float
variants) are now implemented as inline LoongArch intrinsics.
+ The lrint, logb, scalbln, scalbn and ldexp mathematical
builtins (and their float variants) are now implemented as
inline LoongArch intrinsics when using -fno-math-errno.
+ The lceil and lfloor mathematical builtins (and their float
variants) are now implemented as inline LoongArch intrinsics
when using -ffp-int-builtin-inexact.
* 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 to sm_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).
* 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
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:
o -Wanalyzer-fd-access-mode-mismatch
o -Wanalyzer-fd-double-close
o -Wanalyzer-fd-leak
o -Wanalyzer-fd-phase-mismatch (e.g. calling accept on a
socket before calling listen on it)
o -Wanalyzer-fd-type-mismatch (e.g. using a stream socket
operation on a datagram socket)
o -Wanalyzer-fd-use-after-close
o -Wanalyzer-fd-use-without-check
along with special-casing handling of the behavior of open,
close, creat, dup, dup2, dup3, pipe, pipe2, read, and write.
+ -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 :
o -Wanalyzer-va-list-leak for complaining about missing
va_end after a va_start or va_copy
o -Wanalyzer-va-list-use-after-va-end for complaining about
va_arg or va_copy used on a va_list that's had va_end
called on it
o -Wanalyzer-va-arg-type-mismatch for type-checking of
va_arg usage in interprocedural execution paths against
the types of the parameters that were actually passed to
the variadic call
o -Wanalyzer-va-list-exhausted for complaining in
interprocedural execution paths if va_arg is used too
many times on a va_list
along with numerous other improvements.
Improvements for plugin authors
* GCC diagnostics can now be associated 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 its SARIF output when emitting diagnostics.
Other significant improvements
GCC 13.1
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).
For questions related to the use of GCC, please consult these web
pages and the GCC manuals. If that fails, the gcc-help@gcc.gnu.org
mailing list might help. Comments on these web pages and the
development of GCC are welcome on our developer list at
gcc@gcc.gnu.org. All of our lists have public archives.
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 2023-04-26.