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

GCC 7 Release Series

Changes, New Features, and Fixes

This page is a brief summary of some of the huge number of improvements in GCC 7. For more information, see thePorting to GCC 7 page and thefull GCC documentation.

Caveats

General Optimizer Improvements

 ptr = &my_char;  

}

*ptr = 123;
return *ptr;
}

==28882==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffb8dba990 at pc 0x0000004006d5 bp 0x7fffb8dba960 sp 0x7fffb8dba958
WRITE of size 1 at 0x7fffb8dba990 thread T0
#0 0x4006d4 in main /tmp/use-after-scope-1.c:10
#1 0x7f9c71943290 in __libc_start_main (/lib64/libc.so.6+0x20290)
#2 0x400739 in _start (/tmp/a.out+0x400739)

Address 0x7fffb8dba990 is located in stack of thread T0 at offset 32 in frame
#0 0x40067f in main /tmp/use-after-scope-1.c:3

This frame has 1 object(s):
[32, 33) 'my_char' <== Memory access at offset 32 is inside this variable

The option is enabled by default with -fsanitize=address and disabled by default with -fsanitize=kernel-address. Compared to the LLVM compiler, where the option already exists, the implementation in the GCC compiler has some improvements and advantages:

New Languages and Language specific improvements

OpenACC support in C, C++, and Fortran continues to be maintained and improved. See the OpenACC and Offloading wiki pages for further information.

Ada

BRIG (HSAIL)

Support for processing BRIG 1.0 files was added in this release. BRIG is a binary format for HSAIL (Heterogeneous System Architecture Intermediate Language). The BRIG front end can be used for implementing HSAIL "finalizers" (compilation of HSAIL to a native ISA) for GCC-supported targets. An implementation of an HSAIL runtime library, libhsail-rt is also included.

C family

GCC 7 greatly expands the scope of these suggestions. Firstly, it adds fix-it hints to such suggestions:

spellcheck-fields.cc:52:13: error: 'struct s' has no member named 'colour'; did you mean 'color'?
return ptr->colour;
^~~~~~
color
The suggestions now cover many other things, such as misspelled function names:
spellcheck-identifiers.c:11:3: warning: implicit declaration of function 'gtk_widget_showall'; did you mean 'gtk_widget_show_all'? [-Wimplicit-function-declaration]
gtk_widget_showall (w);
^~~~~~~~~~~~~~~~~~
gtk_widget_show_all
misspelled macro names and enum values:
spellcheck-identifiers.cc:85:11: error: 'MAX_ITEM' undeclared here (not in a function); did you mean 'MAX_ITEMS'?
int array[MAX_ITEM];
^~~~~~~~
MAX_ITEMS
misspelled type names:
spellcheck-typenames.c:7:14: error: unknown type name 'singed'; did you mean 'signed'?
void test (singed char e);
^~~~~~
signed
and, in the C front end, named initializers:
test.c:7:20: error: 'struct s' has no member named 'colour'; did you mean 'color'?
struct s test = { .colour = 3 };
^~~~~~
color

^~~~~
endif

                     %d
 r += count.nr;  

}
return r;
}
-Wshadow=compatible-local will warn for the parameter being shadowed with the same type:
warn-test.c:8:12: warning: declaration of 'count' shadows a parameter [-Wshadow=compatible-local]
for (int count = 0; count > 0; count--)
^~~~~
warn-test.c:5:42: note: shadowed declaration is here
container_count (struct container c, int count)
^~~~~
-Wshadow=local will warn for the above and for the shadowed declaration with incompatible type:
warn-test.c:10:24: warning: declaration of 'count' shadows a previous local [-Wshadow=local]
struct container count = c;
^~~~~
warn-test.c:8:12: note: shadowed declaration is here
for (int count = 0; count > 0; count--)
^~~~~
-Wshadow=global will warn for all of the above and the shadowing of the global declaration:
warn-test.c:5:42: warning: declaration of 'count' shadows a global declaration [-Wshadow]
container_count (struct container c, int count)
^~~~~
warn-test.c:1:23: note: shadowed declaration is here
enum operation { add, count };
^~~~~

C

C++

      ;

Runtime Library (libstdc++)

Fortran

Go

Java (GCJ)

The GCC Java front end and associated libjava runtime library have been removed from GCC.

libgccjit

The libgccjit API gained support for marking calls as requiring tail-call optimization via a new entry point:gcc_jit_rvalue_set_bool_require_tail_call.

libgccjit performs numerous checks at the API boundary, but if these succeed, it previously ignored errors and other diagnostics emitted within the core of GCC, and treated the compile of a gcc_jit_context as having succeeded. As of GCC 7 it now ensures that if any diagnostics are emitted, they are visible from the libgccjit API, and that the the context is flagged as having failed.

New Targets and Target Specific Improvements

AArch64

ARC

ARM

AVR

IA-32/x86-64

NVPTX

PowerPC / PowerPC64 / RS6000

S/390, System z, IBM z Systems, IBM Z

RISC-V

RX

Basic support for atomic built-in function has been added. It is currently implemented by flipping interrupts off and on as needed.

SH

SPARC

Operating Systems

AIX

Fuchsia

RTEMS

Other significant improvements

  .globl  test  
  .type   test, @@function  

test:
.LFB0:
.cfi_startproc

example.c:4: int total = 0;

  xorl    %eax, %eax      # <retval>  

example.c:6: for (i = 0; i < n; i++)

  xorl    %edx, %edx      # i  

.L2:

example.c:6: for (i = 0; i < n; i++)

  cmpl    %edi, %edx      # n, i  
  jge     .L5     #,  

example.c:7: total += i * i;

  movl    %edx, %ecx      # i, tmp92  
  imull   %edx, %ecx      # i, tmp92  

example.c:6: for (i = 0; i < n; i++)

  incl    %edx    # i  

example.c:7: total += i * i;

  addl    %ecx, %eax      # tmp92, <retval>  
  jmp     .L2     #  

.L5:

example.c:10: }

  ret  
  .cfi_endproc

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 7.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 7.2

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 7.2 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

SPARC

Operating Systems

RTEMS

GCC 7.3

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 7.3 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

SPARC

Operating Systems

RTEMS

GCC 7.4

This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 7.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 7.5

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