BT

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

| by Sergio De Simone Follow 21 Followers on May 07, 2018. Estimated reading time: 2 minutes |

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 Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT