GCC 11.1 Is Released
GCC 11.1 has made
std=gnu++17 the default C++ language and DWARF 5 the default debugging format for targets that produce DWARF debugging information. There is also very experimental C++23 support, C2X enhancements and a whole lot more.
GCC compiling a simple "hello world" program.
The GNU Compiler Collection 11.1 release is not, as the version number would imply, a bug-fix release for GCC 11. There was no GCC 11.0, there never are any .0 GCC releases. GCC 11.1 is the first major release in the GCC 11 series.
The biggest change since GCC 10 is that
-std=gnu++17, instead of
-std=gnu++14, is now the default C++ language. That's just one of many changes to the GNU Compiler Collection's C++ compiler. This release adds several new C++20 features like array size deduction in new-expressions and pseudo-destructors end object lifetimes. The C++ Standards Support in GCC has an overview of what parts of the C++20 standard, published in 2020 as the name implies, are implemented in GCC 11.1.
GCC 11.1 introduces two new warnings that are enabled if C++20 is used:
-Wdeprecated-enum-float-conversion. First first warns about deprecated arithmetic conversions on operands of enumeration types, and the latter warns about deprecated arithmetic conversions on operands where one is of enumeration type and the other is of a floating-point type.
GCC 11.1 also adds some initial support for the upcoming C++23 standard. That standard is still a draft, so it is way too early to actually use any of the C++23 features.
The libstdc++ configure option
--enable-cheaders=c_std is now deprecated and scheduled for removal in a future release. Developers should use
GCC 11.1 introduces hardware-assisted AddressSanitizer support. It is currently only available for AArch64 targets. It works similar to the AddressSanitizer. The release notes note that:
" Hardware-assisted AddressSanitizer is not production-ready for user space, and is provided mainly for use compiling the Linux Kernel."
GCC 11.1 defaults to the DWARF 5 debugging format on targets with support for it (most except Darwin/macOS X, VxWorks and AIX). The advantage is a up to 25% reduction in the size the debugging information takes up. DWARF 5 has been supported since GDB 8.0, valgrind 3.17.0, elfutils 0.172 and dwz 0.14 GDB 10.2 was released just a few days ago, GDB 8 has been around since September 2017.
OpenMP is a open API for shared memory multiprocessing (CPU+GPU, or CPU+hardware accelerators) programs in C, C++ and Fortran. GCC 11.1 fully supports OpenMP 4.5 in the Fortran programming language, and several new features have been added that bring it closer to full OpenMP 5.0 support.
The list of new RISC-V features for in the GCC 11.1 release announcement is rather long. Support for
__builtin_thread_pointer, a new
shorten_memrefs optimization, big-endian support and an address sanitizer are the highlights.
GCC 11.1 has "initial support" for the Radeon Instinct MI100 Accelerator (gfx908). LLVM has supported it for quite a while, so it is about time GCC caught up. There are also new attributes, warnings and enhancements to the C family support, seven new ISA extensions for x86-64, support for the Intel Alderlake and Sapphire Rapids CPUs (
-march=alderlake) and quite a lot more.
We have barely scratched the surface and we highly recommend reading the rather long GCC 11 Release Series Changes, New Features, and Fixes page to learn more. You may also want to take a long hard look at Porting to GCC 11 if you have written programs that are typically compiled with GCC because there are some changes you may want to be aware of. You may, for example, need to explicitly declare
thread when you compile with GCC 11.1.