GCC 11 released: GNU Compiler Collection

GCC (GNU Compiler Collection) is a set of programming language compilers developed by GNU. It is a set of free software distributed under the GPL and LGPL licenses. It is also a key part of the GNU project and is a standard compiler for Unix-like and Mac OS X operating systems. GCC (especially the C compiler) is also often considered the de facto standard for cross-platform compilers.

GCC 8.3

GCC was formerly known as GNU C compiler because it can only deal with the original C language. Later, the ability to handle C++ was added and later became available for languages such as Fortran, Pascal, Objective-C, Java, and Ada.

GCC 11 was released.

Changelog

Caveats

  • The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14. Note that C++17 changes to template template parameter matching can be disabled independently of other features with -fno-new-ttp-matching.
  • When building GCC itself, the host compiler must now support C++11, rather than C++98. In particular bootstrapping GCC 11 using an older version of GCC requires a binary of GCC 4.8 or later, rather than of GCC 3.4 or later as was the case for bootstrapping GCC 10.
  • Naming and location of auxiliary and dump output files changed. If you compile multiple input files in a single command, if you enable Link Time Optimization, or if you use -dumpbase-dumpdir-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-dwarf no longer enables debug info generation on its own but requires a separate -g for this.
  • The libstdc++ configure option --enable-cheaders=c_std is 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.
  • The front end for compiling BRIG format of Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
  • Some short options of the gcov tool have been renamed: -i to -j and -j to -H.

General Improvements

  • ThreadSanitizer improvements to support alternative runtimes and environments. The Linux Kernel Concurrency Sanitizer (KCSAN) is now supported.
    • Add --param tsan-distinguish-volatile to optionally emit instrumentation distinguishing volatile accesses.
    • Add --param tsan-instrument-func-entry-exit to 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:
    • multibyte characters (requiring more than one byte to encode), and
    • multicolumn characters (requiring more than one column to display in a monospace font)

    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).

  • Introduce Hardware-assisted AddressSanitizer support. This sanitizer currently only works for the AArch64 target. It helps debug address problems similarly to AddressSanitizer but is based on partial hardware assistance and provides probabilistic protection to use less RAM at run time. Hardware-assisted AddressSanitizer is not production-ready for user space, and is provided mainly for use compiling the Linux Kernel.

    To use this sanitizer the command line arguments are:

    • -fsanitize=hwaddress to instrument userspace code.
    • -fsanitize=kernel-hwaddress to instrument kernel code.
  • For targets that produce DWARF debugging information GCC now defaults to DWARF version 5 (with the exception of VxWorks and Darwin/Mac OS X which default to version 2 and AIX which defaults to version 4). This can produce up to 25% more compact debug information compared to earlier versions.

    To take full advantage of DWARF version 5 GCC needs to be build against binutils version 2.35.2 or higher. When GCC is build against earlier versions of binutils GCC will still emit DWARF version 5 for most debuginfo data, but will generate version 4 debug line tables (even when explicitly given -gdwarf-5).

More

Download