This page is a "brief" summary of some of the huge number of improvements in GCC 14. You may also want to check out our Porting to GCC 14 page and the full GCC documentation.
-Wflex-array-member-not-at-end
to
identify all such cases in the source code and modify them.
-fcf-protection=[full|branch|return|none|check]
is refactored, to override -fcf-protection
,
-fcf-protection=none
needs to be added and then
with -fcf-protection=xxx
.
ia64*-*-
target ports which have been
unmaintained for quite a while has been declared obsolete in GCC 14.
The next release of GCC will have their sources permanently removed.
nios2*-*-
target ports has also been
declared obsolete in GCC 14, and the sources will also be removed
in the next release of GCC.
-fanalyzer
is still only suitable for analyzing C code.
In particular, using it on C++ is unlikely to give meaningful output.
-lm
and/or
-lgfortran
to the offload-device linker using the -foffload-options=
flag.
--enable-host-pie
, to build the
compiler executables as PIE; and --enable-host-bind-now
,
to link the compiler executables with -Wl,-z,now
in order
to enable additional hardening.
-fhardened
,
an umbrella option that enables a set of hardening flags.
The options it enables can be displayed using the
--help=hardened
option.
-fharden-control-flow-redundancy
,
to verify, at the end of functions, that the visited basic blocks
correspond to a legitimate execution path, so as to detect and
prevent attacks that transfer control into the middle of
functions.
hardbool
,
for C and Ada. Hardened
booleans take user-specified representations for true
and false
, presumably with higher hamming distance
than standard booleans, and get verified at every use, detecting
memory corruption and some malicious attacks.
strub
to control stack scrubbing
properties of functions and variables. The stack frame used by
functions marked with the attribute gets zeroed-out upon returning
or exception escaping. Scalar variables marked with the attribute
cause functions contaning or accessing them to get stack scrubbing
enabled implicitly.
-finline-stringops
,
to force inline
expansion of memcmp
, memcpy
,
memmove
and memset
, even when that is
not an optimization, to avoid relying on library
implementations.
null_terminated_string_arg(PARAM_IDX)
for indicating parameters that are expected to be null-terminated
strings.
int z[100], y[100], x[100]; int foo (int n) { int res = 0; for (int i = 0; i < n; i++) { y[i] = x[i] * 2; res += x[i] + y[i]; if (x[i] > 5) break; if (z[i] > 5) break; } return res; }can now be vectorized on a number of targets. In this first version any input data sources must either have a statically known size at compile time or the vectorizer must be able to determine based on auxillary information that the accesses are aligned.
requires
directive's unified_address
requirement is now fulfilled by both AMD GCN and nvptx devices.
AMD GCN and nvptx devices now support low-latency allocators as
detailed in the manual. Initial support for pinned-memory
allocators has been added and, on Linux,
libnuma is now used
for allocators requesting the nearest-partition trait (both is described
in the memory allocation section of the manual).
allocate
directive is now
supported for stack variables in C and Fortran, including the OpenMP 5.1
align
modifier. In C and C++ the map
clause now
accepts lvalue expressions. For Fortran, OpenMP allocators can now be
used for allocatables and pointers using the allocate
directive and its OpenMP 5.2 replacement, the allocators
directive; files using this allocator and all files that might directly
or indirectly (intrinisic assignment, intent(out)
, ...)
de- or reallocate such-allocated variables must be compiled with the
-fopenmp-allocators
option.
present
as map-type modifier and in
defaultmap
. The indirect
clause is now
supported. The performance of copying strided data from or to nvptx
and AMD GPU devices using the OpenMP 5.1 routine
omp_target_memcpy_rect
has been improved.
OMP_TARGET_OFFLOAD=mandatory
handling has
been updated for the clarifications and changes of the 5.2 specification.
For Fortran, the list of directives permitted in Fortran pure procedures
was extended. Additionally, the spec change has been implemented for
default implicit mapping of C/C++ pointers pointing to unmapped storage.
The destroy
clause now optionally accepts the depend object
as argument.
decl
attribute is now
supported in C++ 11 and the directive
, sequence
and decl
attributes are now supported in C 23.
self
clause was added to be used on
compute constructs and the default
clause for data
constructs. Additionally, the readonly
modifier is now
handled in the copyin
clause and cache
directive.openacc
module or the
openacc_lib.h
header file:
acc_malloc
, acc_free
,
acc_map_data
, acc_unmap_data
,
acc_deviceptr
, acc_hostptr
,
acc_memcpy_to_device
,
acc_memcpy_to_device_async
,
acc_memcpy_from_device
, and
acc_memcpy_from_device_async
.
Local_Restrictions
,
which specifies that a particular subprogram does not violate one or more
local restrictions, nor can it call a subprogram that is not subject to
the same requirements.User_Aspect_Definition
and User_Aspect
,
which provide a mechanism for avoiding textual duplication if some set of
aspect specifications is needed in multiple places.Always_Terminates
,
which provides a condition for a subprogram to necessarily complete
(either return normally or raise an exception).Ghost_Predicate
,
which introduces a subtype predicate that can reference Ghost entities.
Exceptional_Cases
,
which lists exceptions that might be propagated by the subprogram with
side effects in the context of its precondition and associates them with a
specific postcondition.
Side_Effects
,
which indicates that a function should be handled like a procedure with
respect to parameter modes, Global contract, exceptional contract and
termination: it may have output parameters, write global variables, raise
exceptions and not terminate.LoongArch
architecture.-gnatyz
-gnateH
to force reverse Bit_Order threshold to 64.__has_feature
and
__has_extension
have been implemented in GCC. These
are available from C, C++, and Objective-C(++).
This is primarily intended to aid the portability of code written
against Clang.
_BitInt (N)
and unsigned _BitInt (N)
): integer types with
a specified number of bits. These are only supported on
IA-32, x86-64 and AArch64 (little-endian) at present.<stdckdint.h>
header for checked
integer arithmetic.-std=c23
, -std=gnu23
and -Wc11-c23-compat
. These are equivalent to the
previous options -std=c2x
, -std=gnu2x
and -Wc11-c2x-compat
, which are deprecated but remain
supported.#pragma GCC novector
to
indicate to the vectorizer not to vectorize the loop annotated with the
pragma.void*
(PR110344)
static_assert
messages
(PR110348)
const T&
conversion operatorstuple_size
requirements for structured binding[[fallthrough]]
attribute and iteration statementsconstinit
and optimized dynamic initializationrequired from here
"),
rather than just print filename and line/column numbers.
__type_pack_element
to speed up traits
such as std::tuple_element
(PR100157)goto
can cross the initialization of a trivially initialized
object with a non-trivial destructor
(DR 2256)-Wdangling-reference
false positives have been reduced. The
warning does not warn about std::span
-like classes; there is
also a new attribute gnu::no_dangling
to suppress the
warning. See
the manual
for more info.-Wnrvo
warning, to warn if the named return value
optimization is not performed although it is allowed by
[class.copy.elision]. See
the manual
for more info.std::initializer_list
has been made
static, allowing combining multiple equivalent initializer-lists
(git)
-Welaborated-enum-base
warning, to warn if an additional
enum-base is used in an elaborated-type-specifier#include
hints for missing headers
(PR110164)-Wmissing-field-initializers
is no longer emitted for
empty classes
(PR110064)static
/thread_local
structured bindings at function/block scope
(PR111069)hot
and cold
can be applied to
classes as well. See
the manual
for more info.decltype
fixes:
PR79620,
PR79378,
PR83167,
PR96917-fdiagnostics-all-candidates
to note all
candidates during overload resolution failure-Walloc-size
and -Wcalloc-transposed-args
warnings are enabled for C++ as well-Wtemplate-id-cdtor
warning instead#pragma GCC novector
to
indicate to the vectorizer not to vectorize the loop annotated with the
pragma.-fdeps-format=
, -fdeps-file=
, and
-fdeps-target=
flags may be used to generate dependency
information. In GCC 14 p1689r5
is the only valid argument
for -fdeps-format=
.libstdc++exp.a
library now includes all the Filesystem TS
symbols from the libstdc++fs.a
library.
The experimental symbols for the C++23 std::stacktrace
class
are also in libstdc++exp.a
, replacing the
libstdc++_libbacktrace.a
library that GCC 13 provides.
This means that -lstdc++exp
is the only library needed for
all experimental libstdc++ features.
std::chrono::parse
.std::format
.std::ranges::to
function for converting
ranges to containers.
std::generator
view for getting results from
coroutines.
<stacktrace>
header is supported by default.
std::print
and std::println
(requires linking with -lstdc++exp
on Windows).
std::thread::id
and
std::stacktrace
.
std::out_ptr
and
std::inout_ptr
.
filebuf
, fstream
, etc.std::to_string
now uses std::format
.std::format
.std::runtime_format
function to allow using
non-literal format strings with std::format
.<charconv>
functions.std::text_encoding
class for identifying character
sets (requires linking with -lstdc++exp
for some member
functions).
std::to_string
and
std::to_wstring
.
std::numeric_limits<_Float32>
and
std::numeric_limits<_Float64>
are now defined
for all standard modes, not only for C++23.
float
and
long double
to <cmath>
.
std::setfill
manipulator with
std::istream
is deprecated.
-std=f2023
option, which
has been added in preparation of support of Fortran 2023. This option
increases the line-length limit for source in free-form to 10000, and
statements may have up to 1 million characters.
-save-temps
option, preprocessed files
with the .fii
extension will be generated from
free-form source files such as .F90
and
.fi
from fixed-form files such as .F
.
-M
,
-MD
, -MF
,
-MMD
, -MP
, -MQ
and
-MT
have been implemented in the compiler.
-Wcase-enum
and -Wuninit-variable-checking=
options have
been implemented to provide compile time warnings against
missing case clauses and uninitialized variables respectively.
gcc_jit_type_get_restrict
for adding restrict
to types
(LIBGCCJIT_ABI_25
).
LIBGCCJIT_ABI_26
):
gcc_jit_context_new_sizeof
for accessing the size of a type
(LIBGCCJIT_ABI_27
).
-mcpu
and
-mtune
options (GCC identifiers in parentheses).
ampere1b
).cortex-a520
).cortex-a720
).cortex-x4
).cobalt-100
).generic
,
generic-armv8-a
and generic-armv9-a
are added
as arguments to -mcpu=
and -mtune=
to optimize
code generation aimed at a good blend of CPUs of a particular architecture
version. These tunings are also used as the default optimization targets
when compiling with the -march=armv8-a
or
-march=armv9-a
options and their point releases e.g.
-march=armv8.2-a
or -march=armv9.3-a
.+sme
and +sme2
extensions to
-march=
. In particular, this includes support for the Beta state
of the
SME ACLE in the form of a new intrinsics arm_sme.h
intrinsics header and a number of new keyword attributes to manage use
of the new Streaming SVE state. For more information please refer to the
ACLE documentation.FEAT_LSE2
.FEAT_LRCPC3
is added through ACLE intrinsics in
arm_neon.h
header and enabled through the +rcpc3
extension to -march=
.-mearly-ra=
that takes the arguments all, strided, none
.
-mearly-ra=all
is enabled by default at optimization levels
-O2
and above.-mearly-ldp-fusion
and
-mlate-ldp-fusion
.arm_acle.h
header, including the
Memory prefetch intrinsics and the
Special register intrinsics.
This also includes intrinsics for the extension to 128-bit system
registers, enabled through the +d128
extension to
-march=
.+dotprod
, +fp16
,
+fp16fml
, +i8mm
, +sha3
and
+sm4
extensions to -march=
no longer require
-march=armv8.2-a
or higher to be specified. Likewise, the
intrinsics enabled by +memtag
no longer require
-march=armv8.5-a
.arm_neon_sve_bridge.h
header.
-mtp=
is now supported for changing the TPIDR
register used for TLS accesses. For more details please refer to the
documentation.gfx90c
(GCN5),
gfx1030
, gfx1036
(RDNA2), gfx1100
and gfx1103
(RDNA3) devices has been added. LLVM 15+
(assembler and linker) is required
to support GFX11
.
gfx900
(Vega).--with-arch=fiji
.
cortex-m52
argument to the -mcpu
and -mtune
options.
__flmap
.
As an alternative, the byte address of the block can be specified
by the symbol __RODATA_FLASH_START__
which takes
precedence over __flmap
.
For example, linking with
-Wl,--defsym,__RODATA_FLASH_START__=32k
chooses the second 32 KiB block.NVMCTRL_CTRLB.FLMAP
.NVMCTRL_CTRLB.FLMAP
must be initialized accordingly
by hand, or AVR-LibC v2.2 that implements #931
can be used. The latter initializes NVMCTRL_CTRLB.FLMAP
in the startup code and according to the value
of __flmap
or
__RODATA_FLASH_START__
.__flmap_lock
to a non-zero value will set bit
NVMCTRL_CTRLB.FLMAPLOCK
. This will protect
NVMCTRL_CTRLB.FLMAP
from any further changes —
which would be Undefined Behaviour in C/C++. If you prefer to define
the symbol in a C/C++ file, an asm
statement
can be used:__asm (".global __flmap_lock" "\n\t" "__flmap_lock = 1");
__do_flmap_init
and the linker will not pull in
that code from libmcu.a
any more.-mrodata-in-ram
can be used.
This is required on devices where the hardware revision is
affected by a silicon bug concerning the FLMAP
functionality.
.rodata
,
whereas it is part of .text
when located in RAM.avrxmega2_flmap
and
avrxmega4_flmap
. The sole purpose of these emulations
is to provide adjusted default linker description files.
Apart from that, these emulations behave exactly the same like
avrxmega2
resp. avrxmega4
.-mavrxmega2_flmap
or -mavrxmega2
depending on -m[no-]rodata-in-ram
; and similar
for -mavrxmega4[_flmap]
.-m[no-]rodata-in-ram
has been added.
The default is to locate read-only data in program memory for devices that
support it, e.g. for AVR64* and AVR128* devices as explained above,
and for devices from the
avrxmega3
and
avrtiny families.
__AVR_RODATA_IN_RAM__
is supported
on all devices. It's defined to 0
or 1
.
-mfuse-add=level
where level
may be 0, 1 or 2.
"w"
has been changed.
It now constrains the registers R24…R31 as is the case for all
the other devices.
-m[no-]evex512
was added.
The compiler switch enables/disables 512-bit vector.
It will be default on if AVX512F is enabled.
-mapxf
compiler switch.
-mapx-inline-asm-use-gpr32
and user should ensure the
instruction supports EGPR.
-mavx10.1
or
-mavx10.1-256
compiler switch with 256-bit vector size
support. 512-bit vector size support for AVX10.1 intrinsics are
available via the -mavx10.1-512
compiler switch.
-mavxvnniint16
compiler switch.
-msha512
compiler switch.
-msm3
compiler switch.
-msm4
compiler switch.
-muser_msr
compiler switch.
-march=clearwaterforest
.
Based on Sierra Forest, the switch further enables the AVX-VNNI-INT16,
PREFETCHI, SHA512, SM3, SM4 and USER_MSR ISA extensions.
-march=arrowlake
.
Based on Alder Lake, the switch further enables the AVX-IFMA,
AVX-NE-CONVERT, AVX-VNNI-INT8 and CMPccXADD ISA extensions.
-march=arrowlake-s
.
Based on Arrow Lake, the switch further enables the AVX-VNNI-INT16, SHA512,
SM3 and SM4 ISA extensions.
-march=lunarlake
.
Lunar Lake is based on Arrow Lake S.
-march=pantherlake
.
Based on Arrow Lake S, the switch further enables the PREFETCHI ISA
extensions.
-mavx5124fmaps
, -mavx5124vnniw
,
-mavx512er
, -mavx512pf
,
-mprefetchwt1
, -march=knl
,
-march=knm
, -mtune=knl
or -mtune=knm
compiler switches. Support will be removed in GCC 15.
-fsanitize=hwaddress
will enable -mlam=u57
by default.
-march=znver5
. In addition to the ISA extensions
enabled on a znver4 core, this switch further enables the
AVX512VP2INTERSECT, AVXVNNI, MOVDIR64B, MOVDIRI, and PREFETCHI ISA
extensions.
-funsigned-bitfields
.
-march
parameters has been added:
la64v1.0
la64v1.1
la664
-march=la64v1.0
as the only
compiler option to describe the target ISA when building binaries for
distribution. For more information on LoongArch ISA versions, see
Toolchain Conventions of the LoongArch™ Architecture.
-mtune
parameters has been added:
generic
la664
frecipe.{s/d}
and
frsqrte.{s/d}
instructions and the intrinsics.
div.w[u]
and mod.w[u]
instructions with inputs not sign-extended.
am{swap/add}[_db].{b/h}
instructions.
amcas[_db].{b/h/w/d}
instructions.
__loongarch_arch
: Target ISA preset as specified by
-march=
. For example, compiling with
-march=la64v1.0
, the value of __loongarch_arch
is "la64v1.0"
.
__loongarch_tune
: Processor model as specified by
-mtune
or its default value.
__loongarch_{simd,sx,asx}
: These macros are not defined,
or defined as 1.
__loongarch_simd_width
: The maximum SIMD bit-width
enabled by the compiler. (128 for lsx, and 256 for lasx).
__loongarch_frecipe
: It's defined to 1 or undefined.
__loongarch_div32
: It's defined to 1 or undefined.__loongarch_lam_bh
: It's defined to 1 or undefined.__loongarch_lamcas
: It's defined to 1 or undefined.__loongarch_ld_seq_sa
: It's defined to 1 or undefined.
__loongarch_version_major
:
The minimally required LoongArch ISA version (major) to run the
compiled program, defined to 1 or undefined (iff no such version is
known to the compiler).
__loongarch_version_minor
:
The minimally required LoongArch ISA version (minor) to run the
compiled program, defined to 0 1 or undefined (iff
__loongarch_version_major
is undefined).
__FLOAT128_TYPE
: It's defined to 1.-free
by default at -O2
or higher.-fsched-pressure
by default at -O1
or
higher.
extreme
code model using macro instructions
(under -mno-explicit-relocs).call36
.-mtls-dialect=desc
. The default behavior can be
configured with --with-tls=[trad|desc]
.-mrvv-max-lmul=
option has been introduced for
performance tuning of the loop vectorizer. The default value is
-mrvv-max-lmul=m1
, which limits the maximum LMUL to 1.
The -mrvv-max-lmul=dynamic
setting can dynamically select
the maximum LMUL value based on register pressure.-mcmodel=large
,
thanks to Kuan-Lin Chen from
Andes Technology.target
attribute, which allows users to compile
a function with specific extensions.-march=
option no longer requires the architecture string
to be in canonical order, with only a few constraints remaining: the
architecture string must start with rv[32|64][i|g|e]
, and
must use an underscore as the separator after a multi-letter extension.
-march=help
option has been introduced to dump all
supported extensions.-mrvv-vector-bits=zvl
option and the riscv_rvv_vector_bits
attribute, which
specify a fixed length for scalable vector types. This option is
optimized for specific vector core implementations; however, the code
generated with this option is NOT portable between the core with
different VLEN,
thanks to Pan Li from Intel.
-mtls-dialect=desc
option. The default behavior can be
configured with --with-tls=[trad|desc]
.-mtls-dialect=desc
and the default behavior can be configure
by --with-tls=[trad|desc], and this feature require glibc 2.40,
thanks to Tatsuyuki Ishi from
Blue Whale Systems
-mcpu
option (GCC identifiers in parentheses).
sifive-x280
).sifive-p450
).sifive-p670
).-mtune
option (GCC identifiers in parentheses).
generic-ooo
).sifive-p400-series
).sifive-p600-series
).xiangshan-nanhu
).-Wanalyzer-infinite-loop
warns about paths through the code which appear to lead to an infinite loop.
-Wanalyzer-overlapping-buffers
warns for paths through the code in which overlapping buffers are passed to an API for which the behavior on such buffers is undefined.
-Wanalyzer-undefined-behavior-strtok
warns for paths through the code in which a call is made to
strtok
with undefined behavior.
-fanalyzer-checker=taint
(along with
-fanalyzer
).
This is now enabled by default when
-fanalyzer
is selected, thus also enabling the 6 taint-based warnings:
null_terminated_string_arg(PARAM_IDX)
attribute,
functions that use the
format
attribute,
and to the library functions
error
(parameter 3),
error_at_line
(parameter 5),
putenv
,
strchr
(parameter 1), and
strcpy
(parameter 2).
alloc_size
allowing
-fanalyzer
to emit
-Wanalyzer-allocation-size
,
-Wanalyzer-out-of-bounds
,
and
-Wanalyzer-tainted-allocation-size
on execution paths involving allocations using such functions.
fopen
,
strcat
,
strncpy
, and
strstr
.
The analyzer will also more precisely model the behavior of
memcpy
,
memmove
,
strcpy
,
strdup
,
strlen
,
and of various atomic
built-in functions.
-Wanalyzer-out-of-bounds
has been extended so that, where possible, it will emit a text-based
diagram visualizing the spatial relationship between
Such "text art" diagrams can be controlled (or suppressed) via a new
-fdiagnostics-text-art-charset=
option.
For example, given the out-of-bounds write in strcat
in:
void test (void) { char buf[10]; strcpy (buf, "hello"); strcat (buf, " world!"); }it emits:
┌────┬────┬────┬────┬────┐┌─────┬─────┬─────┐ │[0] │[1] │[2] │[3] │[4] ││ [5] │ [6] │ [7] │ ├────┼────┼────┼────┼────┤├─────┼─────┼─────┤ │' ' │'w' │'o' │'r' │'l' ││ 'd' │ '!' │ NUL │ ├────┴────┴────┴────┴────┴┴─────┴─────┴─────┤ │ string literal (type: 'char[8]') │ └───────────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ v v v v v v v v ┌─────┬────────────────────┬────┬──────────────┬────┐┌─────────────────┐ │ [0] │ ... │[5] │ ... │[9] ││ │ ├─────┼────┬────┬────┬────┬┼────┼──────────────┴────┘│ │ │ 'h' │'e' │'l' │'l' │'o' ││NUL │ │after valid range│ ├─────┴────┴────┴────┴────┴┴────┴───────────────────┐│ │ │ 'buf' (type: 'char[10]') ││ │ └───────────────────────────────────────────────────┘└─────────────────┘ ├─────────────────────────┬─────────────────────────┤├────────┬────────┤ │ │ ╭─────────┴────────╮ ╭─────────┴─────────╮ │capacity: 10 bytes│ │overflow of 3 bytes│ ╰──────────────────╯ ╰───────────────────╯showing that the overflow occurs partway through the second string fragment.
-fdiagnostics-format=
now adds indentation and newlines to reflect the logical JSON structure of the data. The previous compact behavior can be restored via the new option
-fno-diagnostics-json-formatting
.
This also applies to the older output format named "json".
-ftime-report
,
and a SARIF output format is requested via
-fdiagnostics-format=
,
then the timing and memory usage data is now written in JSON form into
the SARIF output, rather than as plain text to stderr.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 14.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 2024-05-07.