GCC 10 series compilers arrive in major upgrade

Highlights of GCC 10 release include a multitude of C++ 20 features and C2X support

GCC 10 series compilers arrive in major upgrade

GCC (GNU Compiler Collection) 10.1, a major release of the platform, was published on May 7, 2020, with highlights including C++ 20 capabilities and C2X language support. C2X is the next major revision of the C language, due in 2022. 

Release notes for GCC 10 show that a multitude of C++ 20 features have been implemented including permitting inline-assembly in constexpr Functions and extending structured bindings. Also for C++ 20, GCC 10 permits conversions to arrays of unknown bound, allows trivial default initialization in constexpr contexts, adds the constinit keyword, and deprecates the volatile keyword.

For C2X, the upcoming revision of the ISO C standard, several features are supported with the syntax -std=c2x and -std+gnu2x. Among these are strftime format checking supporting the %OB and %Ob formats and UTF-8 character constants using the u8' ' syntax.

GCC, which has been around for more than 33 years, includes front ends and libraries for C, C++, Fortran, Ada, Go, and D. A bulletin has been posted on porting to GCC 10. Other new capabilities in GCC 10.1 include

  • Built-in functions have been added, including a has_builtin preprocessor operator that can be used to query support for built-in functions provided by GCC and other compilers that support it. 
  • Command-options have been added. These include -fallocation-dce, to remove unneeded pairs of new and delete operators, and -fanalyzer, to enable a new static analysis pass and associated warnings. The latter option should be regarded as being in the experimental phase.
  • Interprocedural optimization improvements were made. These include re-implementing the inter-procedural scalar replacements of aggregates (IPA-SRA) pass that was re-implemented to work at link-time. IPA-SRA now can also remove computing and returning unused return values.
  • Link-time optimization improvements include a new binary ito-dump. The program can dump various information about an LTO byte object file.
  • Profile-driven optimization improvements have been made, including improving profile maintenance during compilation and hot/cold partitioning.
  • For the C family, the access function and type attribute have been added to describe how a function accesses objects passed to it by pointer or reference, and to associate such arguments with integer arguments denoting object size. The attribute is used to enable the detection of invalid accesses by user-defined functions. There also are new warnings and enhancements to existing warnings. One warning, -Wzero-length-bounds, warns about access to elements of zero-length arrays that might overlap other members of the same object.
  • An ABI incompatibility between C++ 14 and C++ 17 was fixed. On some targets, a class with a zero-sized subobject would be passed incorrectly when compiled as C++ 17 or C++ 20.

Copyright © 2020 IDG Communications, Inc.