This page is a "brief" summary of some of the huge number of improvements in GCC 8. You may also want to check out our Porting to GCC 8 page and the full GCC documentation.
-gcoff no longer
does anything.malloc attribute,
and the corresponding warning option Wsuggest-attribute=malloc emits a
diagnostic for a function, which can be annotated with malloc attribute.cold attribute.
Newly the noreturn attribute does not imply all effects of
cold to differentiate between exit (which
is noreturn) and abort (which is in addition
not executed in valid runs).-freorder-blocks-and-partition, a pass splitting function
bodies into hot and cold regions, is now enabled by default at -O2
and higher for x86 and x86-64.-fcf-protection=[full|branch|return|none] is
introduced to perform code instrumentation to increase program security by
checking that target addresses of control-flow transfer instructions (such as
indirect function call, function return, indirect jump) are valid. Currently
the instrumentation is supported on x86 GNU/Linux targets only. See the user
guide for further information about the option syntax and section "New Targets
and Target Specific Improvements" for IA-32/x86-64 for more details.
-floop-nest-optimize has been overhauled. It's still
considered experimental and may not result in any runtime improvements.
-floop-unroll-and-jam performs outer loop unrolling
and fusing of the inner loop copies. -floop-interchange
exchanges loops in a loop nest to improve data locality. Both passes
are enabled by default at -O3 and above.
-fstack-clash-protection causes the
compiler to insert probes whenever stack space is allocated
statically or dynamically to reliably detect stack overflows and
thus mitigate the attack vector that relies on jumping over
a stack guard page as provided by the operating system.
In this release cycle, the focus for the BRIGFE was on stabilization and performance improvements. Also a couple of completely new features were added.
-Wmultistatement-macros warns about unsafe macros
expanding to multiple statements used as a body of a clause such
as if, else, while,
switch, or for.-fno-strict-overflow is now mapped to
-fwrapv -fwrapv-pointer and signed integer overflow
is now undefined by default at all optimization levels. Using
-fsanitize=signed-integer-overflow is now the preferred
way to audit code, -Wstrict-overflow is deprecated.-fc-prototypes to write C prototypes for
BIND(C) procedures and variables.
-fmax-stack-var-size is honored if given together with
-Ofast, -fstack-arrays is no longer set in that
case.
-fdefault-real-16 and -fdefault-real-10
to control the default kind of REAL variables.
-Wdo-subscript,
enabled by -Wextra, warns about this even if the compiler can
not prove that the code will be executed.
FORALL and DO
CONCURRENT statements with multiple indices. This behavior be
controlled with the new flag -ffrontend-loop-interchange,
which is enabled with optimization by default.
The -Wfrontend-loop-interchange option warns about such
occurrences.
-std=legacy option can be
used to still compile such code.
RECL= argument to OPEN
and INQUIRE statements now allows 64-bit
integers, making records larger than 2GiB possible.
GFORTRAN_DEFAULT_RECL environment variable no
longer has any effect. The record length for preconnected units is
now larger than any practical limit, same as for sequential access
units opened without an explicit RECL= specifier.
HUGE(0) elements are
now possible on 64-bit targets. Note that this changes the
procedure call ABI for all procedures with character arguments on
64-bit targets, as the type of the hidden character length
argument has changed. The hidden character length argument is now
of type INTEGER(C_SIZE_T).
-march=armv8.4-a option.
+dotprod architecture extension. E.g. -march=armv8.2-a+dotprod.
+crypto extension has now been split into two extensions for finer grained control:
+aes which contains the Armv8-A AES crytographic instructions.+sha2 which contains the Armv8-A SHA2 and SHA1 cryptographic instructions.+crypto will now enable these two extensions.
+fp16fml architectural extension on Armv8.2-A and Armv8.3-A. On Armv8.4-A
the instructions can be enabled by specifying +fp16.
+sha3 New SHA3 and SHA2 instructions from Armv8.4-A. This implies +sha2.+sm4 New SM3 and SM4 instructions from Armv8.4-A.+sve architecture
extension (for example, -march=armv8.2-a+sve).
By default, the generated code works with all vector lengths,
but it can be made specific to N-bit vectors using
-msve-vector-bits=N.
cortex-a75).cortex-a55).cortex-a75.cortex-a55).-mcpu or -mtune options,
for example: -mcpu=cortex-a75 or
-mtune=cortex-a75 or as arguments to the equivalent target
attributes and pragmas.
-mfpu option now takes a new option setting of
-mfpu=auto. When set to this the floating-point and SIMD
settings are derived from the settings of the -mcpu
or -march options. The internal CPU configurations have been
updated with information about the permitted floating-point configurations
supported. See the user guide for further information about the extended
option syntax for controlling architectural extensions via the
-march option. -mfpu=auto is now the default
setting unless the compiler has been configured with an explicit
--with-fpu option.
-march and -mcpu options now accept optional
extensions to the architecture or CPU option, allowing the user to enable
or disable any such extensions supported by that architecture or CPU
such as (but not limited to) floating-point and AdvancedSIMD.
For example: the option
-mcpu=cortex-a53+nofp will generate code for the Cortex-A53
processor with no floating-point support.
This, in combination with the new -mfpu=auto option,
provides a straightforward way of specifying a valid build target through
a single -mcpu or -march option.
The -mtune option accepts the same arguments as
-mcpu but only the CPU name has an effect on tuning.
The architecture extensions do not have any effect.
For details of what extensions a particular architecture or CPU option
supports please refer to the
documentation.
-mstructure-size-boundary option has been deprecated and will be
removed in a future release.
-mbe32 can be used to force the linker to produce
legacy BE32 format images. There is no change of behavior for
Armv6-M and other Armv7 or later targets: these already defaulted
to BE8 format. This change brings GCC into alignment with other
compilers for the ARM architecture.
-march=armv8-r option.
-march=armv8.3-a option.
-march=armv8.4-a option.
+dotprod architecture extension. E.g. -march=armv8.2-a+dotprod.
#pragma GCC target ("arch=..."), #pragma GCC target ("+extension"),
__attribute__((target("arch=..."))) or __attribute__((target("+extension"))).
+fp16fml architectural extension on Armv8.2-A and Armv8.3-A. On Armv8.4-A
the instructions can be enabled by specifying +fp16.
cortex-a75).cortex-a55).cortex-a75.cortex-a55).cortex-r52).-mcpu or -mtune options,
for example: -mcpu=cortex-a75 or
-mtune=cortex-r52 or as arguments to the equivalent target
attributes and pragmas.
ATtiny212, ATtiny214, ATtiny412, ATtiny414, ATtiny416, ATtiny417, ATtiny814, ATtiny816, ATtiny817, ATtiny1614, ATtiny1616, ATtiny1617, ATtiny3214, ATtiny3216, ATtiny3217The new devices are listed under
-mmcu=avrxmega3.
PROGMEM and __flash
are not needed any more (as opposed to other AVR families for which
read-only data will be located in RAM except special, non-standard
features are used to locate and access such data). This requires
that the compiler is used with Binutils 2.29 or newer so that
read-only data will be
located in flash memory.-mshort-calls is supported.
This option is used internally for multilib selection of the
avrxmega3 variants. It is
not an optimization option. Do not set it by hand.__gcc_isr which is supported
and resolved by the GNU assembler.
__gcc_isr pseudo-instruction will be resolved by
the assembler, inline assembly is transparent to the process.
This means that when inline assembly uses an instruction like
INC that clobbers the condition code,
then the assembler will detect this and generate an appropriate
ISR prologue / epilogue chunk to save / restore SREG as needed.-mno-gas-isr-prologues
disables the generation of the __gcc_isr pseudo
instruction. Any non-naked ISR will save and restore SREG,
tmp_reg and zero_reg, no matter
whether the respective register is clobbered or used.-O0 and -Og. It is explicitly
enabled by means of option -mgas-isr-prologues.no_gccisr. It can be used
to disable __gcc_isr pseudo instruction generation
for individual ISRs.main;
the effect is the same as if attribute OS_task was
specified for main. This optimization can be switched
off by the new command-line option -mno-main-is-OS_task.
naked function attribute.znver1 and Intel Core based CPUs.-march=cannonlake. The switch enables the AVX512VBMI,
AVX512IFMA and SHA ISA extensions.-march=icelake. The switch enables the AVX512VNNI, GFNI, VAES,
AVX512VBMI2, VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ ISA
extensions.-mibt, -mshstk,
-mcet options. One of these options has to accompany the
-fcf-protection option to enable code instrumentation for
control-flow protection.
-mext-perf, -mext-perf2, and
-mext-string have been added for performance extension instructions.
-mgprel-sec= and
-mr0rel-sec= have been added.
powerpcspe
port. See the separate entry for that new port.
-mpaired, powerpc*-*-linux*paired*)
is deprecated and will be removed in a future release.
-mxilinx-fpu,
powerpc-xilinx-eabi*)
is deprecated and will be removed in a future release.
-maltivec=be) is deprecated and will be removed in a
future release.
--enable-mingw-wildcard or
--disable-mingw-wildcard to force a specific behavior for
GCC itself with regards to supporting the wildcard character. Prior
versions of GCC would follow the configuration of the MinGW runtime.
This behavior can still be obtained by not using the above options or by
using --enable-mingw-wildcard=platform.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 2018-03-20.