This page is a "brief" summary of some of the huge number of improvements in GCC 11. You may also want to check out our Porting to GCC 11 page and the full GCC documentation.
Note: GCC 11 has not been released yet, so this document is a work-in-progress.
-std=gnu++14. Note that C++17 changes to template template parameter matching can be disabled independently of other features with
-save-temps=*, and you expect any file other than the primary output file(s) to be created as a side effect, watch out for improvements and a few surprises. See the patch, particularly its textual description, for more details about the changes.
-gsplit-dwarfno longer enables debug info generation on its own but requires a separate
--enable-cheaders=c_stdis deprecated and will be removed in a future release. It should be possible to use
--enable-cheaders=c_global(the default) with no change in behaviour.
--param tsan-distinguish-volatileto optionally emit instrumentation distinguishing volatile accesses.
--param tsan-instrument-func-entry-exitto optionally control if function entries and exits should be instrumented.
In previous releases of GCC, the "column numbers" emitted in diagnostics were actually a count of bytes from the start of the source line. This could be problematic, both because of:
For example, the character π ("GREEK SMALL LETTER PI (U+03C0)") occupies one column, and its UTF-8 encoding requires two bytes; the character 🙂 ("SLIGHTLY SMILING FACE (U+1F642)") occupies two columns, and its UTF-8 encoding requires four bytes.
In GCC 11 the column numbers default to being column numbers, respecting multi-column characters. The old behavior can be restored using a new option -fdiagnostics-column-unit=byte. There is also a new option -fdiagnostics-column-origin=, allowing the pre-existing default of the left-hand column being column 1 to be overridden if desired (e.g. for 0-based columns). The output of -fdiagnostics-format=json has been extended to supply both byte counts and column numbers for all source locations.
Additionally, in previous releases of GCC, tab characters in the source would be emitted verbatim when quoting source code, but be prefixed with whitespace or line number information, leading to misalignments in the resulting output when compared with the actual source. Tab characters are now printed as an appropriate number of spaces, using the -ftabstop option (which defaults to 8 spaces per tab stop).
allocateclause support in C/C++. The
OMP_TARGET_OFFLOADenvironment variable and the active-levels routines are now supported. For C/C++, the
mapsupport has been extended. For Fortran, OpenMP 4.5 is now fully supported and OpenMP 5.0 support has been extended, including the following features which were before only available in C and C++:
device_type, memorder-clauses for
reductionclause extensions of OpenMP 5.0,
mapclause, and limited support for the
-Wsizeof-array-div, enabled by
-Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.
autoas a template-argument
reinterpret_casts in constexpr evaluation are now checked more completely (PR95307).
static_asserthas been improved: the compiler now shows the expression including its template arguments (if there were any), and can point to the failing clause if the condition comprised of any logical AND operators (PR97518).
-Wctad-maybe-unsupported, disabled by default, warns about performing class template argument deduction on a type with no deduction guides.
-Wrange-loop-construct, enabled by
-Wall, warns when a range-based for-loop is creating unnecessary and expensive copies.
-Wdeprecated-enum-enum-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands of enumeration types, as outlined in [depr.arith.conv.enum].
-Wdeprecated-enum-float-conversion, enabled by default in C++20, warns about deprecated arithmetic conversions on operands where one is of enumeration type and the other is of a floating-point type, as outlined in [depr.arith.conv.enum].
-Wvexing-parse, enabled by default, warns about the most vexing parse rule: the cases when a declaration looks like a variable definition, but the C++ language requires it to be interpreted as a function declaration.
-mamx-tile, -mamx-int8, -mamx-bf16compiler switches.
-march=sapphirerapids. The switch enables the MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, SERIALIZE, PTWRITE, WAITPKG, TSXLDTRK, AMT-TILE, AMX-INT8, AMX-BF16, and AVX-VNNI ISA extensions.
-march=alderlake. The switch enables the CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, KEYLOCKER, AVX-VNNI, and HRESET ISA extensions.
-misadefault has changed from
-m32compiler switch has been removed.
-msoft-stack-reserve-localformat has been fixed. Previously, it accepted
-msoft-stack-reserve-local<n>. It now accepts
-fexcess-precision=standard(e.g., implied by
-std=c99) on s390(x) targets can now be controlled at configure time with the flag
--enable-s390-excess-float-precision. When enabled, GCC will maintain previous behavior and evaluate float expressions in double precision, which aligns with the definition of
double. With the flag disabled, GCC will always evaluate float expressions in single precision. In native builds, GCC will by default match the definition of
float_tin the installed glibc.
freechecking within -fanalyzer has been generalized to also check
delete, adding a new -Wanalyzer-mismatching-deallocation warning. However, C++ is not yet properly supported by -fanalyzer (for example, exception-handling is unimplemented).
Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.