BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News New GCC 8.1 Supports Several Features of C++2a

New GCC 8.1 Supports Several Features of C++2a

This item in japanese

GCC 8.1 is the latest major release of the GNU Compiler Collection, bringing experimental support for some parts of the upcoming C++2a standard. Additionally, GCC 8.1 improves profile driven optimizations and brings Go support up to version 1.10.1.

While work on the upcoming C++ draft is still in its infancy, GCC C++ frontend provides two new flags, -std=c++2a and -std=gnu++2a, to enable several new C++ features that have already been pre-approved. Those include designated initializers, default member initializer for bit-fields, __VA_OPT__ for preprocessor comma elision, lambda [=, this] captures and simplified implicit lambda captures, and others. For a full list of C++2a features in GCC 8, check the C++ status page.

In addition to this, the C++ frontend emits now improved diagnostics that include improved location and location ranges, and a number of new fix-it hints. For example, the compiler is now able to provide a hint when you use a macro before defining it, when you attempt to access a private field of a class or struct, when an old-style cast can be replaced by a static_cast, const_cast, or reinterpret_cast, etc.

GCC 8.1 improves significantly profile driven optimizations, which are optimizations that use the results of profiling the performance of instrumented code to decide which parts of the code to optimize. For example, GCC now splits functions for the x86 target into hot and cold regions by default. Hot functions are optimized more aggressively, and placing them in the same region improves locality. On the same topic, GCC is now able to detect code that is not executed in a valid run of the program, such as when it triggers undefined behavior at some point.

Continuing the theme of optimizations, new loop optimizers have been added, such as -floop-unroll-and-jam, which performs outer loop unrolling and fusing of the inner loop copies; and -floop-interchange, which exchanges loops in a loop nest to improve data locality. Some existing optimizers have been improved, including -floop-nest-optimize and -ftree-loop-distribution. All of the these optimizations are enabled by default using the -O3 flag.

As mentioned, Go support has been improved, thanks to a complete implementation of Go 1.10.1, which is the latest official version of Go. Additionally, the garbage collector is now fully concurrent.

As a final note, GCC 8.1 also introduces support for the Armv8.4-A architecture, enabled by specifying the -march=armv8.4-a option, and the Scalable Vector Extension (SVE) is now supported as an optional extension to the Armv8.2-A architecture and newer.

GCC 8.1 contains many more interesting changes that can possibly appear here. Do not miss the official release notes to get full detail.

Rate this Article

Adoption
Style

BT