This page is a brief summary of some of the huge number of improvements in GCC 6. For more information, see the Porting to GCC 6 page and the full GCC documentation.
-std=gnu++14
instead of
-std=gnu++98
.Support for a number of older systems and recently unmaintained or untested target ports of GCC has been declared obsolete in GCC 6. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
The following ports for individual systems on particular architectures have been obsoleted:
std::pair
objects, for more details see
PR 87822.
The bug causes a layout change for pairs where the first member is also
a pair, e.g. std::pair<std::pair<X, Y>, Z>
.
The GCC 6 release series is closed so the bug in GCC 6.5 will not be fixed
upstream, but there is a patch in the bug report to allow it to be fixed
by anybody packaging GCC 6.5 or installing it themselves.-fsanitize=bounds-strict
, which enables strict checking
of array bounds. In particular, it enables
-fsanitize=bounds
as well as instrumentation of
flexible array member-like arrays.-fno-strict-aliasing
to work correctly.weakref
and
alias
attributes. This allows accessing
both a variable and its alias in one translation unit which is common
with link-time optimization.this
pointer
in C++ member functions is non-null. This eliminates
common null pointer checks
but also breaks some non-conforming code-bases (such as Qt-5, Chromium,
KDevelop). As a temporary work-around
-fno-delete-null-pointer-checks
can be used. Wrong
code can be identified by using -fsanitize=undefined
.warning
and error
attributes are now
correctly preserved by declaration linking and thus
-D_FORTIFY_SOURCE=2
is now supported with
-flto
.Type merging was fixed to handle C and Fortran interoperability rules as defined by the Fortran 2008 language standard.
As an exception, CHARACTER(KIND=C_CHAR)
is not inter-operable
with char
in all cases because it is an array while
char
is scalar.
INTEGER(KIND=C_SIGNED_CHAR)
should be used instead.
In general, this inter-operability cannot be implemented, for
example on targets where the argument passing convention for
arrays differs from scalars.
-Wodr-type-mismatch
.-flto=n
)
was significantly improved by decreasing the size of streamed
data when partitioning programs. The size of streamed
IL while compiling Firefox 46.0 was reduced by 66%.The linker plugin was extended to pass information about the
type of binary produced to the GCC back end. (That can also be
controlled manually by -flinker-output
.)
This makes it possible to
properly configure the code generator and support incremental
linking. Incremental linking of LTO objects by gcc -r
is now supported for plugin-enabled setups.
There are two ways to perform incremental linking:
ld -r
will result in an object file
with all sections from individual object files mechanically merged.
This delays the actual link-time optimization to the final
linking step and thus permits whole program optimization.
Linking the final binary
with such object files is however slower.gcc -r
will lead to link-time
optimization and emit the final binary into the object file.
Linking such an object file is fast but avoids any benefits
from whole program optimization.gcc -r
.-fopenacc
combined with -O2
or
higher.device_type
clause is not supported.
The bind
and nohost
clauses are not
supported. The host_data
directive is not supported in
Fortran.acc_on_device
function has a
compile-time constant argument, the function call evaluates to a
compile-time constant value only for C and C++ but not for
Fortran.enum { newval, oldval __attribute__ ((deprecated ("too old"))) };
In addition, there is now initial support for precise diagnostic locations within strings:test.cc: In function 'int test(int, int, foo, int, int)': test.cc:5:16: error: no match for 'operator*' (operand types are 'int' and 'foo') return p + q * r * s + t; ~~^~~
format-strings.c:3:14: warning: field width specifier '*' expects a matching 'int' argument [-Wformat=] printf("%*d"); ^
fixits.c: In function 'bad_deref': fixits.c:11:13: error: 'ptr' is a pointer; did you mean to use '->'? return ptr.x; ^ ->
spellcheck-fields.cc:52:13: error: 'struct s' has no member named 'colour'; did you mean 'color'? return ptr->colour; ^~~~~~
-Wshift-negative-value
warns about left shifting a
negative value.-Wshift-overflow
warns about left shift overflows.
This warning is enabled by default.
-Wshift-overflow=2
also warns about left-shifting 1 into
the sign bit.-Wtautological-compare
warns if a self-comparison
always evaluates to true or false. This warning is enabled by
-Wall
.-Wnull-dereference
warns if the compiler detects paths
that trigger erroneous or undefined behavior due to dereferencing a
null pointer. This option is only active when
-fdelete-null-pointer-checks
is active, which is enabled
by optimizations in most targets. The precision of the warnings
depends on the optimization options used.-Wduplicated-cond
warns about duplicated conditions
in an if-else-if chain.-Wmisleading-indentation
warns about places where the
indentation of the code gives a misleading idea of the block
structure of the code to a human reader. For example, given
CVE-2014-1266:
This warning is enabled bysslKeyExchange.c: In function 'SSLVerifySignedServerKeyExchange': sslKeyExchange.c:629:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) ^~ sslKeyExchange.c:631:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' goto fail; ^~~~
-Wall
.test.c:3:1: error: version control conflict marker in file <<<<<<< HEAD ^~~~~~~
-Woverride-init-side-effects
.scalar_storage_order
applying to
structures and unions has been introduced. It specifies the storage
order (aka endianness) in memory of scalar fields in structures
or unions.-std=gnu++14
.-fconcepts
.-flifetime-dse
is more
aggressive in dead-store elimination in situations where
a memory store to a location precedes a constructor to that
memory location.u8
character literals,
extended static_assert
, and nested namespace definitions.-fgnu-tm
. std::uncaught_exceptions
function (this is also
available for -std=gnu++NN
modes); try_emplace
and
insert_or_assign
for unique_key maps;std::size
,
std::empty
, and std::data
for
accessing containers and arrays;std::invoke
;std::shared_mutex
;std::void_t
and std::bool_constant
metaprogramming utilities. shared_ptr
, thanks to Fan You._GLIBCXX_ASSERTIONS
. The subset of checks enabled by
the new macro have less run-time overhead than the full
_GLIBCXX_DEBUG
checks and don't affect the library
ABI, so can be enabled per-translation unit.
std::locale
support for DragonFly and FreeBSD,
thanks to John Marino and Andreas Tobler.
SUBMODULE
support.EVENT_TYPE
, EVENT_POST
,
EVENT_WAIT
, and EVENT_QUERY
support.MATMUL
intrinsic is now inlined for straightforward
cases if front-end optimization is active. The maximum size for
inlining can be set to n
with the
-finline-matmul-limit=n
option and turned off
with -finline-matmul-limit=0
.-Wconversion-extra
option will warn about
REAL
constants which have excess precision for
their kind.-Winteger-division
option has been added, which
warns about divisions of integer constants which are truncated.
This option is included in -Wall
by default.-march=native
,
-mcpu=native
and -mtune=native
are now
available on native AArch64 GNU/Linux systems. Specifying
these options causes GCC to auto-detect the host CPU and
choose the optimal setting for that system.
-fpic
is now supported when generating
code for the small code model (-mcmodel=small
). The size of
the global offset table (GOT) is limited to 28KiB under the LP64
SysV ABI, and 15KiB under the ILP32 SysV ABI.
-mtls-size=
is now supported. It can be used to
specify the bit size of TLS offsets, allowing GCC to generate
better TLS instruction sequences.
-fno-plt
is now fully functional.
-march=armv8.1-a
option. Additionally, the
+lse
option extension can be used in a similar fashion
to other option extensions.
The Large System Extensions introduce new instructions that are used
in the implementation of atomic operations.
__fp16
is now
supported in the C and C++ languages.
-mcpu=cortex-a35
and -mtune=cortex-a35
options as well as the equivalent target attributes and pragmas.
-mcpu=qdf24xx
and -mtune=qdf24xx
options as well as the equivalent target attributes and pragmas.
-mcpu=cortex-a57
or -mtune=cortex-a57
.
-mcpu=cortex-a53
or -mtune=cortex-a53
.
-mcpu=exynos-m1
or -mtune=exynos-m1
.
-mpc-relative-literal-loads
generates per-function literal pools, limiting the maximum
size of functions to 1MiB.
-mbig-endian
.
-mcpu
and -mtune
values that are
deprecated are:
arm2, arm250, arm3, arm6, arm60, arm600, arm610, arm620, arm7,
arm7d, arm7di, arm70, arm700, arm700i, arm710, arm720, arm710c,
arm7100, arm7500, arm7500fe, arm7m, arm7dm, arm7dmi, arm8, arm810,
strongarm, strongarm110, strongarm1100, strongarm1110, fa526,
fa626
. The value
arm7tdmi
is still supported.
The values of -march
that are deprecated are:
armv2,armv2a,armv3,armv3m,armv4
.
cortex-a32
), ARM Cortex-A35 (cortex-a35
) and
ARM Cortex-R8 (cortex-r8
).
The GCC identifiers can be used
as arguments to the -mcpu
or -mtune
options,
for example: -mcpu=cortex-a32
or
-mtune=cortex-a35
.
GCC can now generate HSAIL (Heterogeneous System Architecture
Intermediate Language) for simple OpenMP device constructs if
configured with --enable-offload-targets=hsa
. A new
libgomp plugin then runs the HSA GPU kernels implementing these
constructs on HSA capable GPUs via a standard HSA run time.
If the HSA compilation back end determines it cannot output HSAIL
for a particular input, it gives a warning by default. These
warnings can be suppressed with -Wno-hsa
. To give a few
examples, the HSA back end does not implement compilation of code
using function pointers, automatic allocation of variable sized
arrays, functions with variadic arguments as well as a number of
other less common programming constructs.
When compilation for HSA is enabled, the compiler attempts to compile composite OpenMP constructs
#pragma omp target teams distribute parallel for
into parallel HSA GPU kernels.
-march=skylake-avx512
. The switch enables the following
ISA extensions: AVX-512F, AVX512VL, AVX-512CD, AVX-512BW, AVX-512DQ.
monitorx
and
mwaitx
has been added. This includes new intrinsic
and built-in support. It is enabled through option -mmwaitx
.
The instructions monitorx
and mwaitx
implement the same functionality as the old monitor
and mwait
instructions. In addition, mwaitx
adds a configurable timer. The timer value is received as third
argument and stored in register %ebx
.
-mstackrealign
or
__attribute__ ((force_align_arg_pointer))
. This allows
functions compiled with a vector-aligned stack to be invoked from
objects that keep only word-alignment.
__seg_fs
, __seg_gs
,
and __seg_tls
. These can be used to access data via the
%fs
and %gs
segments without having to
resort to inline assembly.
Please refer to the
documentation for usage instructions.
-march=znver1
and -mtune=znver1
options.
Support for the MeP (mep-elf) architecture has been deprecated and will be removed in a future GCC release.
The MSP430 compiler now has the ability to automatically distribute code and data between low memory (addresses below 64K) and high memory. This only applies to parts that actually have both memory regions and only if the linker script for the part has been specifically set up to support this feature.
A new attribute of either
can be applied to both functions
and data, and this tells the compiler to place the object into low memory
if there is room and into high memory otherwise. Two other new attributes
- lower
and upper
- can be used to explicitly
state that an object should be placed in the specified memory region. If
there is not enough left in that region the compilation will fail.
Two new command-line options - -mcode-region=[lower|upper|either]
and -mdata-region=[lower|upper|either]
- can be used to tell
the compiler what to do with objects that do not have one of these new
attributes.
-mfloat128
. The IEEE 128-bit
floating-point support requires the use of the VSX instruction
set. IEEE 128-bit floating-point values are passed and returned
as a single vector value. The software emulator for IEEE 128-bit
floating-point support is only built on PowerPC GNU/Linux systems
where the default CPU is at least power7. On future ISA 3.0
systems (POWER 9 and later), you will be able to use the
-mfloat128-hardware
option to use the ISA 3.0 instructions
that support IEEE 128-bit floating-point. An additional type
(__ibm128) has been added to refer to the IBM extended double
type that normally implements long double
. This will allow
for a future transition to implementing long double
with IEEE
128-bit floating-point.New constraints have been added to support IEEE 128-bit floating-point and ISA 3.0 instructions:
wb: Altivec register if -mpower9-dform is enabled.
we: VSX register if -mpower9-vector is enabled for 64-bit code generation.
wo: VSX register if -mpower9-vector is enabled.
wp: Reserved for future use if long double is implemented with IEEE 128-bit floating-point instead of IBM extended double.
wq: VSX register if -mfloat128 is enabled.
wF: Memory operand suitable for POWER9 fusion load/store.
wG: Memory operand suitable for TOC fusion memory references.
wL: Integer constant identifying the element number mfvsrld accesses within a vector.
__builtin_cpu_is()
and
__builtin_cpu_supports()
, allowing for very fast access to
AT_PLATFORM, AT_HWCAP, and AT_HWCAP2 values. This requires
use of glibc 2.23 or later.#ifdef __TM_FENCE__
to determine whether their "old" compiler treats the builtins
as barriers.--with-advance-toolchain=at
was added for PowerPC 64-bit GNU/Linux systems to use the header files, library
files, and the dynamic linker from a specific Advance Toolchain release
instead of the default versions that are provided by the GNU/Linux
distribution. In general, this option is intended for the developers of
GCC, and it is not intended for general use.The "q", "S", "T", and "t" asm-constraints have been removed.
The "b", "B", "m", "M", and "W" format modifiers have been removed.
-march=z13
option, the compiler will generate
code making use of the new instructions and registers introduced
with the vector extension facility. The -mtune=z13
option enables z13 specific instruction scheduling without
making use of new instructions.-march=z13
reduces the default
alignment of vector types bigger than 8 bytes to 8. This is an
ABI change and care must be taken when linking modules compiled
with different arch levels which interchange variables
containing vector type values. For newly compiled code the GNU
linker will emit a warning.-mzvector
option enables a C/C++ language
extension. This extension provides a new
keyword vector
which can be used to define vector
type variables. (Note: This is not available when
enforcing strict standard compliance
e.g. with -std=c99
. Either enable GNU extensions
with e.g. -std=gnu99
or use
__vector
instead of vector
.)vecintrin.h
header file needs to be included.-march=native
,
and -mtune=native
are now available on native IBM
z Systems. Specifying these options causes GCC to
auto-detect the host CPU and choose the
optimal setting for that system. If GCC is unable to detect
the host CPU these options have no effect.-fsplit-stack
is now supported as part of the IBM
z Systems port. This feature requires a recent gold linker to
be used.g5
and g6
-march=/-mtune=
CPU level switches has been deprecated
and will be removed in a future GCC release. -m31
from now on defaults to -march=z900
if not
specified otherwise. -march=native
on a g5/g6
machine will default to -march=z900
.-mfdpic
target option and --enable-fdpic
configure option.double
or a 8-byte vector in the second
half is passed to a subprogram in slot #15, for example as 16th parameter
if the first 15 ones have at most 8 bytes. The double
or
vector was wrongly passed in floating-point register %d32
in lieu of on the stack as per the SPARC calling conventions.-mmusl
option in case musl is not the default libc. GCC
defaults to musl libc if it is built with a target triplet matching the
*-linux-musl*
pattern.once
function are directly defined via <pthread.h>.
Self-contained condition variables are provided via newlib
<sys/lock.h>. The RTEMS thread model also supports C++11
threads.libgomp
. It is possible to
configure thread pools for each scheduler instance via the environment
variable GOMP_RTEMS_THREAD_POOLS
.crt1.o
,
crti.o
, crtn.o
), which GCC now prefers over
its own ones.libvtv
has been ported to Solaris 11 and up.-mstackrealign
is now automatically activated
in 32-bit mode whenever the use of SSE instructions is requested.gcc
and g++
driver programs will now
provide suggestions for misspelled command-line options.
$ gcc -static-libfortran test.f95
gcc: error: unrecognized command line option '-static-libfortran'; did you mean '-static-libgfortran'?
--enable-default-pie
configure option enables
generation of PIE by default.This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 6.2 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
--with-cpu-32
and --with-cpu-64
configure options has been added on bi-architecture platforms.This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 6.3 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 6.4 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 6.5 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
These pages are maintained by the GCC team. Last modified 2023-02-20.