Latest Updates

GCC 7.1 Released with Full C++17 Support

The latest GNU Compiler Collection major release, GCC 7.1, brings substantial new functionality, writes GCC maintainer Jakub Jelinek, including experimental support for the current C++17 draft, better diagnostics, and new optimizations.
As it is known, GCC stable releases start at x.1, while x.0 is reserved for release candidates, so GCC 7.1 is the first stable release of GCC 7.
As mentioned, the C++ front end in GCC 7.1 brings experimental support for the current C++17 draft, including features such as if constexpr, class template argument deduction, auto template parameters, and structured bindings. Both the -std=c++1z and -std=gnu++1z flags are supported. A list of all new features in the C++ front end is available in the C++ Status page. As InfoQ reported, the ISO C++ committee has recently completed its work on the definition of C++17, which is now only pending approval from the various national bodies of the organization.
GCC 7 also introduces an improved optimizer, with many new intra- and inter-procedural optimizations, such as:
  • Loop splitting (-fsplit-loops) for loops containing conditions that are always true on one side of the iteration and always false on the other.
  • Value range (-fipa-vrp) and bitwise constant propagation (-fipa-bit-cp), to propagate across the call graph knowledge about a variable belonging to a range, or about which bits in a variable are zero.
  • Code hoisting (-fcode-hoisting), aimed to improve the partial redundancy elimination pass by evaluating expressions that are executed on all paths that lead to the function exit as early as possible.
  • Out-of-scope address sanitization (-fsanitize-address-use-after-scope) to sanitize variables whose address is used outside of the scope where they are defined, e.g.:
    int main (int argc, char **argv) {
      char *ptr;
      {
          char my_char;
          ptr = &my_char;
      }
      *ptr = 123;  //-- the address of my_char is not valid here
      return *ptr;
    }
  • Arithmetic overflows on operations with generic vectors (-fsanitize=signed-integer-overflow).
On the diagnostics front, GCC 7.1 brings improved locations, location ranges, suggestions for misspelled identifiers, option names, fix-it hints and new warnings.
Finally, it is worth noting that a few of the changes included in GCC 7.1 will break C++ code that compiles just fine on previous versions. Among the changes that could cause issues are stricter template rules, changes in name mangling conventions for operators, and others.
You can find the complete list of changes in GCC 7.1 in the changelog and download the release from GNU FTP server.

No comments