
-std=gnu11 instead of-std=gnu89.has_trivial_default_constructor,has_trivial_copy_constructor andhas_trivial_copy_assign have been deprecated and will be removed in a future version. The standard C++11 traitsis_trivially_default_constructible,is_trivially_copy_constructible andis_trivially_copy_assignable should be used instead.-fipa-icf) has been added. Compared to the identical code folding performed by the Gold linker this pass does not require function sections. It also performs merging before inlining, so inter-procedural optimizations are aware of the code re-use. On the other hand not all unifications performed by a linker are doable by GCC which must honor aliasing information. During link-time optimization of Firefox, this pass unifies about 31000 functions, that is 14% overall.-fno-semantic-interposition option can be used to improve code quality of shared libraries where interposition of exported symbols is not allowed.--param inline-insns-auto and--param inline-insns-single limits for hot calls.-fipa-reference with-fprofile-generate. This also solves a bottleneck seen when building Chromium with link-time optimization.-flto-odr-type-merging.Command-line optimization and target options are now streamed on a per-function basis and honored by the link-time optimizer. This change makes link-time optimization a more transparent replacement of per-file optimizations. It is now possible to build projects that require different optimization settings for different translation units (such as-ffast-math,-mavx, or-finline). Contrary to earlier GCC releases, the optimization and target options passed on the link command line are ignored.
Note that this applies only to those command-line options that can be passed tooptimize andtarget attributes. Command-line options affecting global code generation (such as-fpic), warnings (such as-Wodr), optimizations affecting the way static variables are optimized (such as-fcommon), debug output (such as-g), and--param parameters can be applied only to the whole link-time optimization unit. In these cases, it is recommended to consistently use the same options at both compile time and link time.
-fprofile-generate). SPEC2006 benchmarks on x86-64 improve by 4.7% with auto-FDO and by 7.3% with traditional feedback directed optimization.gcov-tool utility allows manipulating profiles.--param profile-func-internal-id).-flra-remat, implements control-flow sensitive global register rematerialization. Instead of spilling and restoring a register value, it is recalculated if it is profitable. The sub-pass improved SPEC2000 generated code by 1% and 0.5% correspondingly on ARM and x86-64.-fipa-ra-fsanitize=float-divide-by-zero: detect floating-point division by zero;-fsanitize=float-cast-overflow: check that the result of floating-point type to integer conversions do not overflow;-fsanitize=bounds: enable instrumentation of array bounds and detect out-of-bounds accesses;-fsanitize=alignment: enable alignment checking, detect various misaligned objects;-fsanitize=object-size: enable object size checking, detect various out-of-bounds accesses.-fsanitize=vptr: enable checking of C++ member function calls, member accesses and some conversions between pointers to base and derived classes, detect if the referenced object does not have the correct dynamic type.-fcheck-pointer-bounds. Memory accesses are instrumented with run-time checks of used pointers against their bounds to detect pointer bounds violations (overflows). The Pointer Bounds Checker is available on x86/x86-64 GNU/Linux targets with a new ISA extension Intel MPX support. See the Pointer Bounds CheckerWiki page for more details.-fdiagnostics-color= command-line option is nowconfigurable when building GCC using configuration option--with-diagnostics-color=. The possible values are:never,always,auto andauto-if-env. The new defaultauto uses color only when the standard error is a terminal. The default in GCC 4.9 wasauto-if-env, which is equivalent toauto if there is a non-emptyGCC_COLORS environment variable, andnever otherwise. As in GCC 4.9, an emptyGCC_COLORS variable in the environment will always disable colors, no matter what the default is or what command-line options are used.-Wswitch-bool has been added forthe C and C++ compilers, which warns whenever aswitchstatement has an index of boolean type.-Wlogical-not-parentheses hasbeen added for the C and C++ compilers, which warns about "logical not"used on the left hand side operand of a comparison.-Wsizeof-array-argument has beenadded for the C and C++ compilers, which warns when thesizeof operator is applied to a parameter that has beendeclared as an array in a function definition.-Wbool-compare has been addedfor the C and C++ compilers, which warns about boolean expressionscompared with an integer value different fromtrue/false.no_reorder prevents reordering of selected symbols against other such symbols or inline assembler. This enables to link-time optimize the Linux kernel without having to resort to-fno-toplevel-reorder that disables several optimizations.__has_include and__has_include_next, to test the availability of headers have been added.<optional> only if it is available:The header search paths for#ifdef __has_include# if __has_include(<optional>)# include <optional># define have_optional 1# elif __has_include(<experimental/optional>)# include <experimental/optional># define have_optional 1# define experimental_optional# else# define have_optional 0# endif#endif
__has_include and__has_include_next are equivalent to those of the standard directive#include and the extension#include_next respectively.__has_attribute, has been added.The equivalent built-in macro__has_cpp_attribute wasadded to C++ to supportFeature-testing recommendations for C++.The macro__has_attribute is added to all C-likelanguages as an extension:If an attribute exists, a nonzero constant integer is returned.For standardized C++ attributes a date is returned, otherwise theconstant returned is 1.Bothint#ifdef __has_attribute# if __has_attribute(__noinline__) __attribute__((__noinline__))# endif#endiffoo(int x);
__has_attribute and__has_cpp_attribute will add underscores to anattribute name if necessary to resolve the name.For C++11 and onwards the attribute may be scoped.__builtin_add_overflow,__builtin_sub_overflow and__builtin_mul_overflowand for compatibility with clang also other variants.These builtins have two integral arguments (which don't need to havethe same type), the arguments are extended to infinite precisionsigned type,+,- or*is performed on those, and the result is stored in an integervariable pointed to by the last argument. If the stored value isequal to the infinite precision result, the built-in functions returnfalse, otherwisetrue. The type ofthe integer variable that will hold the result can be different fromthe types of the first two arguments. The following snippetdemonstrates how this can be used in computing the size for thecalloc function:void *calloc (size_t x, size_t y){ size_t sz; if (__builtin_mul_overflow (x, y, &sz)) return NULL; void *ret = malloc (sz); if (ret) memset (res, 0, sz); return ret;}On e.g. i?86 or x86-64 the above will result in amulinstruction followed by a jump on overflow.-fextended-identifiers is now enabledby default for C++, and for C99 and later C versions. Variousbugs in the implementation of extended identifiers have beenfixed.-std=gnu11.-Wc90-c99-compat has been addedto warn about features not present in ISO C90, but present in ISOC99.-Wc99-c11-compat has been addedto warn about features not present in ISO C99, but present in ISOC11.-Wno-incompatible-pointer-types; warnings about implicitincompatible integer to pointer and pointer to integer conversions viaa new warning option-Wno-int-conversion; and warningsabout qualifiers on pointers being discarded via a new warning option-Wno-discarded-qualifiers.-pedantic). Instead, a new warning isemitted only if the const qualifier is lost. This can be controlled witha new warning option-Wno-discarded-array-qualifiers.-pg command-line option now only affects the current file in an LTO build.-Wnon-virtual-dtor doesn't warn anymore forfinal classes.typename in a template template parameter.template<template<typename>typename X> struct D; // OK
struct A { int i, j = i; };A a = { 42 }; // a.j is also 42constexpr.constexpr int f (int i){ int j = 0; for (; i > 0; --i) ++j; return j;}constexpr int i = f(42); // i is 42void operator delete (void *, std::size_t) noexcept;void operator delete[] (void *, std::size_t) noexcept;
-Wodr) detects mismatches in type definitions and virtual table contents during link-time optimization.-Wsuggest-final-types and-Wsuggest-final-methods help developers to annotate programs withfinal specifiers (or anonymous namespaces) to improve code generation. These warnings can be used at compile time, but they are more useful in combination with link-time optimization.-fabi-version=9and-fabi-compat-version=2. So various mangling bugs arefixed, but G++ will still emit aliases with the old, wrong mangling wherefeasible.-Wabi=2 will warn about differences between ABIversion 2 and the current setting.std::nullptr_t. Most code is likely to be unaffected, but-Wabi=8 will warn about a non-static data member with typestd::nullptr_t which changes position due to this change._GLIBCXX_USE_CXX11_ABI to0 before including any C++ standard library headers.std::string is enabled by default, using thesmall string optimization instead ofcopy-on-write reference counting.std::list is enabled by default, with an O(1)size() function;std::deque andstd::vector<bool> meet the allocator-aware container requirements;std::align andstd::aligned_union;std::is_trivially_copyable,std::is_trivially_constructible,std::is_trivially_assignable etc.;std::put_time,std::get_time,std::hexfloat andstd::defaultfloat;std::isblank;std::shared_ptr;std::notify_all_at_thread_exit() and functions for making futures ready at thread exit.hexfloat manipulator changes how thenum_put facet formats floating point types whenios_base::fixed|ios_base::scientific is set in a stream'sfmtflags. This change affects all language modes, even though the C++98 standard gave no special meaning to that combination of flags. To prevent the use of hexadecimal notation for floating point types usestr.unsetf(std::ios_base::floatfield) to clear the relevant bits instr.flags().std::is_final type trait;cbegin,cend,rbegin,rend,crbegin, andcrend for range access to containers, arrays and initializer lists.std::experimental::any;std::experimental::apply;std::experimental::sample;std::experimental::search and related searcher types;std::experimental::not_fn.logistic_distribution anduniform_on_sphere_distribution as extensions.std::unique_ptr.-Werror=line-truncation is now enabled by default. Note that comments exceeding the line length are not diagnosed. (For fixed-form source code, the same warning is available but turned off by default, such that excess characters are ignored.-ffree-line-length-n and-ffixed-line-length-n can be used to modify the default line lengths of 132 and 72 columns, respectively.)-Wtabs option is now more sensible: with-Wtabs the compiler warns if it encounters tabs and with-Wno-tabs this warning is turned off. Before,-Wno-tabs warned and-Wtabs disabled the warning. As before, this warning is also enabled by-Wall,-pedantic and thef95,f2003,f2008 andf2008ts options of-std=.-fdiagnostics-color controls when color is used in diagnostics. The default value of this option can beconfigured when building GCC. TheGCC_COLORS environment variable can be used to customize the colors or disable coloring completely. Sample diagnostics output:$ gfortran -fdiagnostics-color=always -Wuse-without-only test.f90test.f90:6:1: 0 continue1Error: Zero is not a valid statement label at (1)test.f90:9:6: USE foo1Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
-Wuse-without-only option has been added to warn when aUSE statement has noONLY qualifier and thus implicitly imports all public entities of the used module.READ andWRITE statements now work correctly in locale-aware programs. For more information and potential caveats, seeSection 5.3 Thread-safety of the runtime library in the manual.IEEE_FEATURES,IEEE_EXCEPTIONS andIEEE_ARITHMETIC) arenow supported.-fcoarray=lib except for allocatable/pointercomponents of derived-type coarrays. GCC currently only ships with asingle-image library (libcaf_single), butmulti-image support based on MPI and GASNet is provided by the librariesof theOpenCoarrays project.CO_MAX,CO_MIN,CO_SUM,CO_BROADCAST andCO_REDUCE has been added, including-fcoarray=lib support.-fcoarray=lib support.IMPLICIT NONE (external, type).ERROR STOP is now permitted in pure procedures.New in GCC 5 is the ability to build GCC as a shared library for embeddingin other processes (such as interpreters), suitable for Just-In-Timecompilation to machine code.
The shared library has aC APIand aC++ wrapper APIproviding some "syntactic sugar".There are also bindings available from 3rd parties forPython and forD.
For example, this library can be used by interpreters forcompilingfunctions from bytecode to machine code.
The library can also be used for ahead-of-time compilation, enablingGCC to be plugged into a pre-existing front end. An example of usingthis to build a compiler for an esoteric language we'll refer to as "brainf"can be seenhere.
libgccjit is licensed under the GPLv3 (or at your option, any later version)
It should be regarded as experimental at this time.
-fstack-usage option.-mcpu=cortex-a57 or-mtune=cortex-a57.-mfix-cortex-a53-835769 option. Alternatively it can be enabled by default by configuring GCC with the--enable-fix-cortex-a53-835769 option.-mcpu=cortex-a53,-mcpu=cortex-a57 or-mcpu=cortex-a57.cortex-a53 options. To enable these extensions add+crypto to the value of-mcpu or-march e.g.-mcpu=cortex-a53+crypto.cortex-a72) and initial support for its big.LITTLE combination with the ARM Cortex-A53 (cortex-a72.cortex-a53), Cavium ThunderX (thunderx), Applied Micro X-Gene 1 (xgene1), and Samsung Exynos M1 (exynos-m1). The GCC identifiers can be used as arguments to the-mcpu or-mtune options, for example:-mcpu=xgene1 or-mtune=cortex-a72.cortex-a53. Using-mcpu=cortex-a72 requires a version of GNU binutils that has support for the Cortex-A72.-mlra and-mno-lra have been removed. The AArch64 backend now uses the local register allocator (LRA) only.-masm-syntax-unified specifies whether inline assembly code is using unified syntax. By default the option is off which means non-unified syntax is used. However this is subject to change in future releases. Eventually the non-unified syntax will be deprecated.--with-cpu configure option with either of--with-tune or--with-arch.-mcpu=cortex-a57 or-mtune=cortex-a57.cortex-a17) and initial support for its big.LITTLE combination with the ARM Cortex-A7 (cortex-a17.cortex-a7), ARM Cortex-A72 (cortex-a72) and initial support for its big.LITTLE combination with the ARM Cortex-A53 (cortex-a72.cortex-a53), ARM Cortex-M7 (cortex-m7), Applied Micro X-Gene 1 (xgene1), and Samsung Exynos M1 (exynos-m1). The GCC identifiers can be used as arguments to the-mcpu or-mtune options, for example:-mcpu=xgene1 or-mtune=cortex-a72.cortex-a53. Using-mcpu=cortex-a72 requires a version of GNU binutils that has support for the Cortex-A72.-mwords-little-endian has been removed.-mapcs,-mapcs-frame,-mtpcs-frame and-mtpcs-leaf-frame which are only applicable to the old ABI have been deprecated.-mlra and-mno-lra have been removed. The ARM backend now uses the local register allocator (LRA) only.ATmega8. Specifying, say,-mmcu=atmega8 triggers the usage of the device-specificspec filespecs-atmega8 which is part of the installation and describes options for the sub-processes like compiler proper, assembler and linker. You can add support for a new device-mmcu=mydevice as follows:/someplace, create a new directorydevice-specs.device-specs folder, follow the comments in that file and then save it as/someplace/device-specs/specs-mydevice.-B /someplace -mmcu=mydevice to the compiler's command-line options. Notice that/someplace must specify an absolute path and thatmydevice must not start with "avr".libmydevice.a available, you can put it at/someplace, dito for a device-specific startup filecrtmydevice.o.--with-avrlibc=no and whether or not it is configured for RTEMS.-nodevicelib has been added. It prevents the compiler from linking against AVR-LibC's device-specific librarylibdevice.a.-mrmwLAC,LAS,LAT andXCH.-mn-flash=size-mskip-bug-mavx512vl, AVX-512 Byte and Word instructions:-mavx512bw, AVX-512 Dword and Qword instructions:-mavx512dq, AVX-512 FMA-52 instructions:-mavx512ifma and for AVX-512 Vector Bit ManipulationInstructions:-mavx512vbmi.-mmpx compiler switch. Intel MPX is a set of processor features which,with compiler, run-time library and OS support, brings increased robustness tosoftware by run-time checking pointer references against their bounds.In GCC Intel MPX is supported by Pointer Bounds Checker and libmpx run-timelibraries.-mrecord-mcount option for-pggenerates a Linux kernel style table of pointers tomcount or__fentry__ calls at the beginningof functions. The new-mnop-mcount option in additionalso generates nops in place of the__fentry__ ormcount call, so that a call per function can be laterpatched in. This can be used for low overhead tracing or hot codepatching.-malign-data option controls howGCC aligns variables.-malign-data=compat usesincreased alignment compatible with GCC 4.8 and earlier,-malign-data=abi uses alignment as specified bythe psABI, and-malign-data=cacheline uses increasedalignment to match the cache line size.-malign-data=compat is the default.-mskip-rax-setup option skips settingup the RAX register when SSE is disabled and there are no variablearguments passed in vector registers. This can be used tooptimize the Linux kernel.-mips32r3,-mips64r3,-mips32r5 and-mips64r5 to enable code-generation for these processors.-march=p5600 command-line option.-march=octeon3 command-line option.-mips32r6 and-mips64r6 command-line options.-mfp64 command-line option has changed. It is now used to enable the FP64A and FP64 ABI extensions.-mabi=32 -mfpxx can be used to enable this extension. MIPS II is the minimum processor required.-mabi=32 -mfp64 -mno-odd-spreg can be used to enable this extension. MIPS32R2 is the minimum processor required.-mabi=32 -mfp64 -modd-spreg can be used to enable this extension. MIPS32R2 is the minimum processor required.--with-fp-32=[32|xx|64] and--with(out)-odd-sp-reg-32. It is strongly recommended that all vendors begin to set o32 FPXX as the default ABI. This will be required to run the generated code on MIPSR5 cores in conjunction with future MIPS SIMD (MSA) code and MIPSR6 cores..set directive to override the global assembler options when compiling for soft-float targets.-mforce-fp-as-gp,-mforbid-fp-as-gp, and-mex9 have been removed since they are not yet available in the nds32 port of GNU binutils.-mcmodel=[small|medium|large] supports varied code models on code generation. The-mgp-direct option became meaningless and can be discarded.-mno-allow-string-insns can be used to disable the generation of theSCMPU,SMOVU,SMOVB,SMOVF,SUNTIL,SWHILE andRMPA instructions. An erratum released by Renesas shows that it is unsafe to use these instructions on addresses within the I/O space of the processor. The new option can be used when the programmer is concerned that the I/O space might be accessed. The default is still to enable these instructions.--isa= option to the assembler.GBR has been changed from call clobbered to call preserved. The old behavior can be reinstated by specifying the option-fcall-used-gbr.fpchg instruction has been added which will be utilized when switching between single and double precision FPU modes.__fpscr_values array for switching between single and double FPU precision modes on non-SH4A targets. Instead mode switching will now be performed by storing, modifying and reloading theFPSCR, so that otherFPSCR bits are preserved across mode switches. The__fpscr_values array that is defined in libgcc is still present for backwards compatibility, but it will not be referenced by compiler generated code anymore.__builtin_sh_get_fpscr and__builtin_sh_set_fpscr have been added. The__builtin_sh_set_fpscr function will mask the specified bits in such a way that theSZ,PR andFR mode bits will be preserved, while changing the other bits. These new functions do not reference the__fpscr_values array. The old functions__set_fpscr and__get_fpscr in libgcc which access the__fpscr_values array are still present for backwards compatibility, but their usage is highly discouraged.__atomic built-in functions.bt andbf. The old behavior can be reinstated (e.g. to work around a hardware bug in the original SH7055) by specifying the new option-mcbranch-force-delay-slot.arm*-*-freebsd* target triplets.gcc-ar,gcc-nm,gcc-ranlib wrappers now understand a-B option to set the compiler to use.-freport-bug is used, GCC automatically generates a developer-friendly reproducer whenever an internal compiler error is encountered.This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 5.2 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
monitorx andmwaitx has been added. This includes new intrinsicand built-in support. It is enabled through option-mmwaitx.The instructionsmonitorx andmwaitximplement the same functionality as the oldmonitorandmwait instructions. In additionmwaitxadds a configurable timer. The timer value is received as thirdargument and stored in register%ebx.-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 keywordvector 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 ofvector.)vecintrin.h header file needs to be included.This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 5.3 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
-march=skylake-avx512. The switch enables the following ISA extensions: AVX-512F, AVX512VL, AVX-512CD, AVX-512BW, AVX-512DQ.This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 5.4 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
This is thelistof problem reports (PRs) from GCC's bug tracking system that areknown to be fixed in the 5.5 release. This list might not becomplete (that is, it is possible that some PRs that have been fixedare not listed here).
Copyright (C)Free Software Foundation, Inc.Verbatim copying and distribution of this entire article ispermitted in any medium, provided this notice is preserved.
These pages aremaintained by the GCC team.Last modified 2022-10-26.