GCC 8 Release Series — Changes, New Features, and Fixes

GCC 8 Release Series

Changes, New Features, and Fixes

This page is a "brief" summary of some of the huge number of improvements in GCC 8. You may also want to check out ourPorting to GCC 8 page and thefull GCC documentation.

Caveats

General Improvements

   -:    0:Graph:ins.gcno  
   -:    0:Data:ins.gcda  
   -:    0:Runs:1  
   -:    0:Programs:1  
   -:    1:template<class T>  
   -:    2:class Foo  
   -:    3:{  
   -:    4: public:  
   2:    5:   Foo(): b (1000) {}  

Foo::Foo():
1: 5: Foo(): b (1000) {}

Foo::Foo():
1: 5: Foo(): b (1000) {}

   2:    6:   void inc () { b++; }  

Foo::inc():
1: 6: void inc () { b++; }

Foo::inc():
1: 6: void inc () { b++; }

   -:    7:  
   -:    8:  private:  
   -:    9:   int b;  
   -:   10:};  
   -:   11:  
   1:   12:int main(int argc, char **argv)  
   -:   13:{  
   1:   14:  Foo<int> a;  
   1:   15:  Foo<char> b;  
   -:   16:  
   1:   17:  a.inc ();  
   1:   18:  b.inc ();  
   1:   19:}  

return 0;
}

==17465==ERROR: AddressSanitizer: invalid-pointer-pair: 0x604000000010 0x604000000050
#0 0x40070f in main /tmp/pointer-compare.c:7
#1 0x7ffff6a72a86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
#2 0x400629 in _start (/tmp/a.out+0x400629)

0x604000000010 is located 0 bytes inside of 42-byte region [0x604000000010,0x60400000003a)
allocated by thread T0 here:
#0 0x7ffff6efb390 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:86
#1 0x4006ea in main /tmp/pointer-compare.c:5
#2 0x7ffff6a72a86 in __libc_start_main (/lib64/libc.so.6+0x21a86)

0x604000000050 is located 0 bytes inside of 42-byte region [0x604000000050,0x60400000007a)
allocated by thread T0 here:
#0 0x7ffff6efb390 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:86
#1 0x4006f8 in main /tmp/pointer-compare.c:6
#2 0x7ffff6a72a86 in __libc_start_main (/lib64/libc.so.6+0x21a86)

SUMMARY: AddressSanitizer: invalid-pointer-pair /tmp/pointer-compare.c:7 in main

New Languages and Language specific improvements

Ada

BRIG (HSAIL)

In this release cycle, the focus for the BRIGFE was on stabilization and performance improvements. Also a couple of completely new features were added.

C family

arg-type-mismatch.cc:1:40: note: initializing argument 2 of 'int callee(int, const char*, float)'
extern int callee(int one, const char *two, float three);
~~~~~~~~~~~~^~~

incomplete.c:3:10: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
incomplete.c:1:1:
+#include <stddef.h>
const char *test(void)
incomplete.c:3:10:
return NULL;
^~~~
incomplete.c:3:10: note: each undeclared identifier is reported only once for each function it appears in
$ gcc incomplete.cc
incomplete.cc:1:6: error: 'string' in namespace 'std' does not name a type
std::string s("hello world");
^~~~~~
incomplete.cc:1:1: note: 'std::string' is defined in header ''; did you forget to '#include '?
+#include
std::string s("hello world");
^~~

}
~

unclosed.c:11:6: note: to match this '('
if (logging_enabled && check_range ()
^
or highlighting it directly if it's on the same line:
$ gcc unclosed-2.c
unclosed-2.c: In function 'test':
unclosed-2.c:8:45: error: expected ')' before '{' token
if (temperature < MIN || temperature > MAX {
~ ^~
)
They will also emit fix-it hints.

C

C++

accessor.cc:7:10: note: declared private here
double m_ratio;
^~~~~~~
accessor.cc:12:12: note: field 'double foo::m_ratio' can be accessed via 'double foo::get_ratio() const'
if (ptr->m_ratio >= 0.5)
^~~~~~~
get_ratio()

ordering.cc:2:30: error: 'OVERRIDE' does not name a type
virtual void clone() const OVERRIDE { }
^~~~~~~~
ordering.cc:2:30: note: the macro 'OVERRIDE' had not yet been defined
In file included from ordering.cc:5:
c++11-compat.h:2: note: it was later defined here
#define OVERRIDE override

In file included from extern-c.cc:1:
unclosed.h:1:1: note: 'extern "C"' linkage started here
extern "C" {
^~~~~~~~~~
extern-c.cc:3:39: error: expected '}' at end of input
template void test (void);
^
In file included from extern-c.cc:1:
unclosed.h:1:12: note: to match this '{'
extern "C" {
^

templates.cc:10:8: error: could not convert 'map<int, double>()' from 'map<[...],double>' to 'map<[...],int>'
fn_2(map<int, double>());
^~~~~~~~~~~~~~~~~~
Those [...] elided parameters can be seen using-fno-elide-type:
$ gcc templates.cc -fno-elide-type
templates.cc: In function 'void test()':
templates.cc:9:8: error: could not convert 'vector()' from 'vector' to 'vector'
fn_1(vector ());
^~~~~~~~~~~~~~~~~
templates.cc:10:8: error: could not convert 'map<int, double>()' from 'map<int,double>' to 'map<int,int>'
fn_2(map<int, double>());
^~~~~~~~~~~~~~~~~~
The C++ compiler has also gained an option-fdiagnostics-show-template-tree which visualizes such mismatching templates in a hierarchical form:
$ gcc templates-2.cc -fdiagnostics-show-template-tree
templates-2.cc: In function 'void test()':
templates-2.cc:9:8: error: could not convert 'vector()' from 'vector' to 'vector'
vector<
[double != int]>
fn_1(vector ());
^~~~~~~~~~~~~~~~~
templates-2.cc:10:8: error: could not convert 'map<map<int, vector >, vector >()' from 'map<map<[...],vector>,vector>' to 'map<map<[...],vector>,vector>'
map<
map<
[...],
vector<
[double != float]>>,
vector<
[double != float]>>
fn_2(map<map<int, vector>, vector> ());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
which again works with -fno-elide-type:
$ gcc templates-2.cc -fdiagnostics-show-template-tree -fno-elide-type
templates-2.cc: In function 'void test()':
templates-2.cc:9:8: error: could not convert 'vector()' from 'vector' to 'vector'
vector<
[double != int]>
fn_1(vector ());
^~~~~~~~~~~~~~~~~
templates-2.cc:10:8: error: could not convert 'map<map<int, vector >, vector >()' from 'map<map<int,vector>,vector>' to 'map<map<int,vector>,vector>'
map<
map<
int,
vector<
[double != float]>>,
vector<
[double != float]>>
fn_2(map<map<int, vector>, vector> ());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Runtime Library (libstdc++)

Fortran

Go

libgccjit

The libgccjit API gained four new entry points:

The C code generated bygcc_jit_context_dump_reproducer_to_fileis now easier-to-read.

New Targets and Target Specific Improvements

AArch64

ARC

ARM

AVR

IA-32/x86-64

NDS32

Nios II

PA-RISC

PowerPC / PowerPC64 / RS6000

Tile

Operating Systems

Windows

Improvements for plugin authors

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 8.1 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).

GCC 8.2

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 8.2 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).

General Improvements

Language Specific Changes

C++

GCC 8.2 fixed a bug introduced in GCC 8.1 affecting passing or returning of classes with a deleted copy constructor and defaulted trivial move constructor (bug c++/86094). GCC 8.2 introduces -fabi-version=13 and makes it the default, ABI incompatibilities between GCC 8.1 and 8.2 can be reported with-Wabi=12. See C++ changes for more details.

Target Specific Changes

IA-32/x86-64

GCC 8.3

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 8.3 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).

Windows

GCC 8.4

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 8.4 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).

GCC 8.5

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 8.5 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).

Target Specific Changes

AArch64