🔥 Explore this awesome post from Hacker News 📖
📂 **Category**:
✅ **What You’ll Learn**:
GCC 16 Release Series — Changes, New Features, and Fixes
– GNU Project
This page is a “brief” summary of some of the huge number of improvements
in GCC 16.
You may also want to check out our
Porting to GCC 16 page and the
full GCC documentation.
Caveats
int8_tetc. are nowsigned charon Solaris
for conformance with the C99 standard. However, this is an
incompatible change. See the
porting notes for more information.- The
-pthreadoption no longer
predefines_REENTRANTon Solaris.
See the porting notes for more
information. - The so-called “
json” format for
-fdiagnostics-format=
has been removed in this release.
Users seeking machine-readable diagnostics from GCC should use
SARIF.
- Link-Time Optimization now supports better handling of toplevel asm
statements with-flto-toplevel-asm-heuristics. - Speculative devirtualization now handles general indirect function
calls and supports speculating of more than one target. - The vectorizer is now more flexible in identifying in-loop parallelism
of reductions. - The vectorizer now supports vectorizing uncounted loops or loops for
which the number of iterations could not be determined. - The vectorizer now supports peeling for alignment for vector length
agnostic loops using masking. - The vectorizer now supports mutual peeling for alignment.
- The vectorizer now generates more efficient code for loops with early
breaks by eliminating the vector induction computations.
Documentation
- The documentation for
GCC Command Options and the
option index have been corrected to include many previously
missing options. - The documentation for
GCC-specific attributes has been modernized to put more emphasis
on the standard attribute syntax, which GCC accepts in all supported
dialects of C and C++. The material has also been reorganized to be
less repetitive, and there is a newindex for attributes.
- Documentation for parameters and option spec files has been moved
from the main GCC manual to theGCC internals manual.
These features are intended for use by GCC developers and those
who need to build custom GCC configurations.
OpenMP
See the
GNU Offloading and Multi-Processing Project (GOMP)
page for general information.
- The
memory allocation support has been enhanced: for allocators with the
pinnedtrait, includingompx_gnu_pinned_mem_alloc,
the CUDA
API (if available) is used; this improves the performance when accessing
this memory on Nvidia GPUs. The newly addedompx_gnu_managed_mem_allocallocator and the
ompx_gnu_managed_mem_space(both GNU
extensions) allocate device-accessible memory on the host. Such memory is
device accessible even when unified-shared memory is not supported and
might have different page-migration behavior than other memory on systems
even if all host memory is device accessible. - OpenMP 5.0: Limited support for
declare mapperhas been added
for C and C++, only. Theuses_allocatorsclause is now
supported, including the OpenMP 5.2 syntax changes and supporting
semicolons (OpenMP 6.0); for now, only predefined allocators are supported. - OpenMP 5.1: Initial support for the
iteratormodifier in map
clauses and thetarget updateconstruct has been added for C
and C++. - OpenMP 5.2: The
begin declare variantdirective for C
and C++ is now supported. - OpenMP 6.0: The
omp_target_memsetand
omp_target_memset_asyncAPI routines have been
added. Theno_openmp_constructsassumptions clause can now
be used. - OpenMP Technical Report 14 (TR14): The named
omp_default_device
constant has been added to denote the default-device number. - For OpenMP directives and clauses that have been deprecated in OpenMP 5.0,
5.1, or 5.2, a deprecation warning is shown, hinting at the to-be-used
syntax; the warning is on by default and can be silenced using
-Wno-deprecated-openmp. Additionally, a deprecation warning is
shown when using a deprecated named constant or API routine; this warning
can be silenced using-Wno-deprecated-declarations.
OpenACC
See the GCC OpenACC wiki page
for general information.
- The
acc_memcpy_deviceandacc_memcpy_device_async
API routines have been added for C, C++ and Fortran. - OpenACC 3.0: The
waitdirective now accepts the
ifclause. - OpenACC 3.3: The Fortran API routines
and
acc_attachnow augment their OpenACC 2.6 C/C++ counterparts.
acc_detach - OpenACC 3.4: In Fortran, named constants (
PARAMETER) used as
var in data clauses are now permitted by the specification and
GCC for better compatibility with existing code; however, with GCC,
specifying them in data clauses affects neither compile-time nor runtime
behavior.
Ada
GNAT Extensions
-
The Constructor [RFC]
and Destructor [RFC]
extensions add new construction/finalization mechanisms that differ
significantly from standard Ada. Those features are inspired by
object-oriented programming in other widely used languages (such as C++). - Implicit
with allows a stand-alone use clause in the context clause of a
compilation unit to imply an implicit with of the same library unit where
an equivalent with clause would be allowed. - Structural
Generic
instantiation [RFC]
allows reference to an implicit instance of a generic unit, that is
denoted directly by the unit’s name and actual parameters, rather than by
a separately declared name. -
The Extended_Access
aspect can be specified on a general access type declaration designating an
unconstrained array subtype. It changes the pointer representation and
allows easier interfacing with foreign languages when memory for the
designated object is not allocated by Ada. In particular, it allows the
creation
of access
to an array
slice [RFC].
Other
-
VAST (Verifier for the Ada Semantic Tree), enabled
with-gnatd_V(or-gnatd_Wfor verbose mode), can
be used to debug the compiler. It checks various properties of the produced
Ada Semantic Tree and reports detected violations. - The semantic analysis of Ada 2022’s Reduction Expressions has been
enhanced. - The Ada.Containers.Bounded_Indefinite_Holders unit has been added.
- Various loopholes in the implementation of accessibility rules have been
plugged. - Android support has been improved.
C++
- C++20 by default: GCC 16 changes the default language version
for C++ compilation from
-std=gnu++17
to
-std=gnu++20.
If your code relies on older versions of the C++ standard, you will need to
either add
-std=
to your build flags, or port your code; see the porting notes.
N.B. C++20 modules support is still experimental and must be enabled by
-fmodules. - Several C++26 features have been implemented:
- P2996R13, Reflection
(PR120775, enabled by
-std=c++26 -freflection) - P3394R4, Annotations for
Reflection - P3293R3, Splicing a base
class subobject - P3096R12, Function Parameter
Reflection - P3491R3,
define_static_⚡
(PR120783) - P3560R2, Error Handling in
Reflection - P1306R5, Expansion
statements (PR120776) - P2900R14, Contracts
(PR119061) - P2795R5, Erroneous behavior
for uninitialized reads (PR114457) - P1061R10, Structured bindings
can introduce a pack (PR117783) - P3068R5,
constexpr
exceptions (PR117785) - P3533R2,
constexpr
virtual inheritance (PR120777) - P1494R5, Partial program
correctness (PR119060) - P3618R0, Allow attaching main
to the global module (PR120773) - P2843R3, Preprocessing is
never undefined (PR120778) - P2686R4,
constexpr
structured bindings and references toconstexprvariables (PR117784, only partially,
structured bindings can beconstexprbut references to
constexprautomatic variables still not allowed)
- P2996R13, Reflection
- Several C++23 features have been implemented:
- Various C++ error messages (such as for problems involving templates)
now have a hierarchical structure. This nesting of messages is presented
using indentation and bullet points. The old behavior can be restored via
-fno-diagnostics-show-nesting
or
-fdiagnostics-plain-output.
- Improved experimental C++20 modules support:
-
New command line option
--compile-std-modulethat
conveniently builds theheader unit
and thestdandstd.compatmodules before
compiling any source files explicitly specified on the command line. -
Whenever the
header unit has been
built, GCC now transparently translates an#includeof
any importable standard library header into animportof
. - Many reported bugs have been fixed, thanks to Nathaniel Shead.
-
New command line option
-
Constraint failure diagnostics for standard library type traits such as
is_constructible_vandis_invocable_vare
improved to further elaborate why the trait isfalseinstead
of just reportingexpression is_foo_v<...> evaluated to false,
thanks to Nathaniel Shead.
Runtime Library (libstdc++)
-
For targets that support
128-bit
integers,std::is_integral<__int128>and similar
traits are always true. Previously this was only the case when compiling
with GNU dialects (-std=gnu++17,-std=gnu++14,
etc.) and not with strict dialects (-std=c++17, etc.) -
The proposal
P0952R2: A new specification forstd::generate_canonical
was implemented in all affected modes (since C++11), impacting the observed
output. The previous behavior can be restored by defining
_GLIBCXX_USE_OLD_GENERATE_CANONICAL. -
The
std::variantABI was updated to make it conforming
and consistent with C++20 and later modes. This impacts the layout
of classes which have astd::variantas the first member
and a base class of the same type as one of thevariant's
alternatives, if that type is an empty class and has a non-trivial
destructor:struct E ⚡; struct Affected : E 💬;
The previous behavior can be restored by defining
_GLIBCXX_USE_VARIANT_CXX17_OLD_ABI. This impacts only
C++17 mode. -
std::regexexecution has been rewritten to use a heap-based
stack instead of the system stack, avoiding stack overflows when matching
larger strings. - Improved support for C++20, including:
- The C++20 implementation is no longer experimental.
-
Working
std::chrono::current_zone()on Windows
(thanks to Björn Schäpers).
-
There are several changes to C++20 components which are incompatible with
the experimental C++20 support in previous releases. The following C++20
components have ABI changes in GCC 16:-
Atomic waiting/notifying functions in
and
semaphore types in.
Synchronization for. -
The representation of
std::formatargs and
std::formatterspecializations. -
The representation of the
std::partial_orderingtype in
. -
Semantics of
std::variantwithstd::jthread,
std::stop_token, andstd::stop_source
alternatives. -
Representation of some range adaptors in
.
This list is not necessarily complete. As C++20 support was experimental
before GCC 16, programs using C++20 components should assume that those
components are not compatible with older releases. -
Atomic waiting/notifying functions in
- Improved experimental support for C++23, including:
std::mdspan, thanks to Luc Grosheintz.-
ranges::starts_withandranges::ends_with. -
ranges::shift_leftandranges::shift_right. std::allocator_traits::allocate_at_least.
- Improved experimental support for C++26, including:
std::simd.std::inplace_vector.std::optional.-
std::copyable_functionandstd::function_ref. std::indirectandstd::polymorphic.-
std::owner_equalfor shared pointers, thanks to Paul Keir. header and contents.- New
std::stringstreamandstd::bitset
member functions acceptingstd::string_viewarguments,
thanks to Nathan Myers. -
Padded mdspan layouts, aligned accessor,
std::dims,
std::constant_wrapper, andstd::submdspan
thanks to Luc Grosheintz. std::philox_engine, thanks to 1nfocalypse.std::atomic_ref::address(), thanks to Yuao Ma.
Fortran
- Coarrays using native shared memory mulithreading on single node
machines and handling Fortran 2018’sTEAMfeature. - Fortran 2003: Parameterized Derived Types support is improved.
Handling of LEN parameters works but still requires a future
change of representation (see PR82649). - Fortran 2018: Support the extensions to the
IMPORT
statement, theREDUCEintrinsic and
the newGENERICstatement. - The Fortran 2023 additions to the trigonometric functions are now
supported (such as thesinpiintrinsic). - Fortran 2023: The
splitintrinsic subroutine is now
supported andc_f_pointernow accepts an optional
lower bound as a argument. - The
-fexternal-blas64option has been added to call
external BLAS routines with 64-bit integer arguments for
MATMUL. This option is only valid for
64-bit systems and when-ffrontend-optimizeis
in effect.
Modula-2
- Spelling hints have been implemented. Currently spelling hints
are issued when processing: import lists, module names and all
symbols within nested scopes. - A new implementation of wide set is used and this is
accompanied with a library moduleM2WIDESET.
This has changed the ABI and may lead to link-time
errors with object files generated with a previous GCC version. - A binary dictionary module
BinDicthas been
added to the base libraries. - The procedures
WriteandWriteLn
are available in the modules:ARRAYOFCHAR,
CFileSysOp,CHAR,
FileSysOp,Stringand
StringFileSysOp. - The
-fm2-pathname-root=option has been added to
improve access to external library modules.
Algol 68
- GCC now includes an experimental Algol 68 compiler, ga68. It aims to
implement the language described by the Revised Report, including all
errata approved by the Algol 68 Support subcommittee of IFIP WG2.1.
Some GNU extensions and a POSIX prelude are also implemented.More information about the language can be found
on the Algol 68 website.More information about the front end can be found
on the wiki.
IA-32/x86-64
- GCC now supports AMD CPUs based on the Zen6 core via
-march=znver6. This switch enables the
AVX512_BMM, AVX_NE_CONVERT, AVX_IFMA, AVX_VNNI_INT8 and
AVX512_FP16 ISA extensions on top of ISA extensions enabled
for Zen5. - Auto-vectorization will now try to use a masked vector epilog when
AVX512 support is enabled and tuning forznver4,
znver5orznver6, saving code size
and improving performance. - GCC now supports the Intel CPU named Wildcat Lake through
-march=wildcatlake.
Wildcat Lake is based on Panther Lake. - GCC now supports the Intel CPU named Nova Lake through
-march=novalake.
Based on ISA extensions enabled on Panther Lake, the switch in addition
enables the APX_F, AVX10.1, AVX10.2 and PREFETCHI ISA extensions. - Since GCC 16, AMX-TRANSPOSE and USER_MSR are not enabled through
the compiler switch-march=diamondrapidsany longer. CLDEMOTE
is not enabled through the compiler switches-march=alderlake,
-march=arrowlake,-march=arrowlake-s,
-march=gracemont,-march=lunarlake,
-march=meteorlake,-march=pantherlakeand
-march=raptorlakeany longer. KL and WIDEKL are not enabled
through the compiler switches-march=clearwaterforestand
-march=pantherlakeany longer. PREFETCHI is not enabled
through the compiler switch-march=pantherlakeany longer. -mavx10.1-256,-mavx10.1-512, and
-mevex512were removed together with the warning for the
behavior change on-mavx10.1.-mavx10.1has
enabled AVX10.1 intrinsics with 512-bit vector support since GCC 15.- Support for AMX-TRANSPOSE was removed in GCC 16. GCC will no longer accept
-mamx-transpose, - The new
--enable-x86-64-mfentryconfigure option
enables-mfentrywhich uses__fentry__,
instead ofmcountfor profiling on x86-64. This
option is enabled by default for glibc targets. --enable-tls=DIALECTis now supported to control the
default TLS dialect. The default remainsgnu.
The accepted values aregnuandgnu2(for
TLS descriptors).
AMD GPU (GCN)
- For offloading to AMD GPUs: The launch overhead of OpenMP target regions
and OpenACC compute regions has been drastically reduced. - Experimental support for AMD Instinct MI300 (
gfx942) devices
has been added, including the genericgfx9-4-genericand
mostly compatiblegfx950. - By default, the following multilibs are now built:
gfx908,
gfx90a,gfx9-generic,
gfx9-4-generic,gfx10-3-generic, and
gfx11-generic. Multilibs for specific devices are no longer
built by default if a generic arch exists. Note:- When compiling for a specific arch and the multilib only exists
for the associated generic arch, GCC’s error message suggests
the command-line option to do so. - Generic architectures require ROCm 6.4.0 or newer.
- The new default-built set of multilibs now requires the assembler
and linker of LLVM 20 or newer. - Consult GCC’s
AMD installation notes and
configuration notes for setting the multilibs to be build.
- When compiling for a specific arch and the multilib only exists
LoongArch
- Bit-precise integer types (
_BitInt (N)and
unsigned _BitInt (N)) are supported. - Added FunctionMulti-Versioning (FMV) support. The
target_clones
attribute can be used to generate multiple function versions for
different LoongArch CPU features
(e.g.,lsx,lasx), with automatic
runtime selection of the optimal version based on CPU capabilities. - Added support for the LoongArch32 architecture, including the
ilp32d(default),ilp32f,
andilp32sABIs.
This covers both the standard 32-bit version (LA32) and the
reduced 32-bit version (LA32R), enabling GCC to generate 32-bit target
code for a wider range of embedded applications.
(Note: This feature depends on corresponding Binutils and glibc support.)
S/390, System z, IBM z Systems
- Bit-precise integer types (
_BitInt (N)and
unsigned _BitInt (N)) are supported, now. - Floating-point type
_Float16is supported. All operations
are carried out in software or byfloatinstructions. - Global stack protector support has been added and exported via
-mstack-protector-guard=global. Option
-mstack-protector-guard-recordwas added, too. The primary
use is for the Linux kernel in order to support run-time patching of the
address loading of the canary. - Support for
-m31is deprecated and will be removed in a
future release.
Solaris
- GCC now supports the easy generation of Solaris CTF (Compact C Type
Format) with the-gsctfoption. More information can be
found in thectf(5)manual page.
Windows
- GCC now supports native TLS (Thread-Local Storage) on Windows. In order
to enable it,--enable-tlsmust be specified at configure
time and recent GNU binutils must be used (version 2.44 or later).
- GCC has gained a “publish/subscribe” framework, allowing for
loosely-coupled senders and receivers, with strongly-typed messages
passing between them. In this release the only topics for plugins
to subscribe to are:- events relating to optimization passes starting/stopping on particular
functions
- events relating to the static analyzer
- events relating to optimization passes starting/stopping on particular
- GCC diagnostic sinks can now have
extensionobjects
associated with them, with afinalizerhook. Plugins can
use this to capture additional information in SARIF output files.
- GCC’s diagnostic machinery has been substantially cleaned up in GCC 16.
This should not affect plugins that use just the
diagnostic-core.hheader, but maintainers of plugins making
more sophisticated uses of diagnostics may need to refer to the
porting guide.
- The analyzer is now usable on simple C++ examples, as it now handles
C++’s Named Return Value Optimization and has some initial support for
exceptions. However due to scaling issues it is not likely to be usable
on production C++ code in this release.
- With the added support for exception-handling,
-fanalyzer
assumes that a call to an external function not marked with attribute
nothrowcould throw an exception if-fexceptions
is enabled. GCC 16 adds a new option
-fanalyzer-assume-nothrow,
for disabling this assumption. This is intended as a workaround for
projects where the exception-handling generates large numbers of new
warnings, such as C code where-fexceptionsis used for
interoperability with C++ but where the C APIs in use are unlikely to
throw exceptions.
- The data structure used by
-fanalyzerfor representing
the user’s code has been rewritten in a way that makes it easier to
understand and debug, and slightly improves locations used when reporting
diagnostics. This comes at the cost of increasing the memory usage of
the analyzer.
- The data structure used by
-fanalyzerfor simulating the
contents of memory in the user’s program has been reimplemented. The new
implementation is faster and easier to maintain.
- The analyzer has started to make use of GCC’s
value_range
machinery, eliminating some false positives.
libgdiagnostics has gained 37 entrypoints:
- 5 new entrypoints for working with logical locations
- 2 new entrypoints for supporting command-line options and SARIF playback
- 12 new entrypoints for working with directed graphs:
- 17 new entrypoints for building up text for a diagnostic via a buffer:
diagnostic_manager_set_debug_physical_locations()
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 16.1 release. This list might not be
complete (that is, it is possible that some PRs that have been fixed
are not listed here).
⚡ **What’s your take?**
Share your thoughts in the comments below!
#️⃣ **#GCC #Release #Series #Features #Fixes #GNU #Project**
🕒 **Posted on**: 1777551130
🌟 **Want more?** Click here for more info! 🌟
