The -fconserve-space
flag has been
deprecated. The flag had no effect for most targets: only
targets without a global .bss
section and without
support for switchable sections. Furthermore, the flag only
had an effect for G++, where it could result in wrong semantics
(please refer to the GCC manual for further details).
The flag will be removed in GCC 4.8
Support for a number of older systems and recently unmaintained or untested target ports of GCC has been declared obsolete in GCC 4.7. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
All GCC ports for the following processor architectures have been declared obsolete:
picochip-*
)The following ports for individual systems on particular architectures have been obsoleted:
-munaligned-access
is active by default, which for
some source codes generates code that accesses memory on unaligned
addresses. This will require the kernel of those systems to enable
such accesses (controlled by CP15 register c1
, refer
to ARM documentation). Alternatively or for compatibility with
kernels where unaligned accesses are not supported, all code has
to be compiled with -mno-unaligned-access
.
Linux/ARM in official releases has automatically and
unconditionally supported unaligned accesses as emitted by GCC due
to this option being active, since Linux version 2.6.28.The obsolete ports with alternatives are:
Note, however, that these alternatives are not binary compatible with their legacy counterparts (although some can support running legacy applications).
The obsolete ports that currently lack a modern alternative are:
--enable-threads=solaris
configure option and
the -threads
compiler option don't work any longer./usr/ucbinclude
and
/usr/ucblib
. It has been removed from Solaris 11, and was
only intended as a migration aid from SunOS 4 to SunOS 5. The
-compat-bsd
compiler option is not recognized any
longer.-mwords-little-endian
option has
been deprecated. It will be removed in a future release."l"
constraint in MIPS16 asm
statements.std::list
changing its size and altering the definitions of
some member functions, and std::pair
's move constructor was
non-trivial which altered the calling convention for functions with
std::pair
arguments or return types. The ABI incompatibilities
have been fixed for GCC version 4.7.2 but as a result C++11 code compiled
with GCC 4.7.0 or 4.7.1 may be incompatible with C++11 code compiled with
different GCC versions and with C++98/C++03 code compiled with any version.
--param case-values-threshold=n
was added to allow users to control the cutoff between doing switch statements
as a series of if statements and using a jump table.
ld -r
is now supported with LTO.void foo(int a) { if (a > 10) ... huge code ... } void bar (void) { foo (0); }The call of
foo
will be inlined into bar
even when
optimizing for code size. Constructs based on __builtin_constant_p
are now understood by the inliner and code size estimates are evaluated a lot
more realistically.alias
attribute) has been re-engineered. Aliases no
longer pose optimization barriers and calls to an alias can be inlined
and otherwise optimized.void foo(bool flag) { if (flag) ... do something ... else ... do something else ... } void bar (void) { foo (false); foo (true); foo (false); foo (true); foo (false); foo (true); }GCC will now produce two copies of
foo
. One with flag
being
true
, while other with flag
being
false
. This leads to performance improvements previously
possible only by inlining all calls. Cloning causes a lot less code size
growth.strlen
, strchr
, strcpy
,
strcat
, stpcpy
and their
_FORTIFY_SOURCE
counterparts into faster alternatives.
This pass is enabled by default at -O2
or above, unless
optimizing for size, and can be disabled by the
-fno-optimize-strlen
option. The pass can e.g. optimize
char *bar (const char *a) { size_t l = strlen (a) + 2; char *p = malloc (l); if (p == NULL) return p; strcpy (p, a); strcat (p, "/"); return p; }into:
char *bar (const char *a) { size_t tmp = strlen (a); char *p = malloc (tmp + 2); if (p == NULL) return p; memcpy (p, a, tmp); memcpy (p + tmp, "/", 2); return p; }or for hosted compilations where
stpcpy
is available in the
runtime and headers provide its prototype, e.g.
void foo (char *a, const char *b, const char *c, const char *d) { strcpy (a, b); strcat (a, c); strcat (a, d); }can be optimized into:
void foo (char *a, const char *b, const char *c, const char *d) { strcpy (stpcpy (stpcpy (a, b), c), d); }
-feliminate-unused-debug-types
has been re-enabled by default, as it is for the other languages,
leading to a reduction in debug info size of 12.5% and more for
relevant cases, as well as to a small compilation speedup.__builtin_assume_aligned
, has been added,
through which the compiler can be hinted about pointer alignment
and can use it to improve generated code.
Experimental support for transactional memory has been added.
It includes support in the compiler, as well as a supporting
runtime library called libitm
. To compile code
with transactional memory constructs, use
the -fgnu-tm
option.
Support is currently available for Alpha, ARM, PowerPC, SH, SPARC, and 32-bit/64-bit x86 platforms.
For more details on transactional memory see the GCC WiKi.
Support for atomic operations specifying the C++11/C11 memory model
has been added. These new __atomic
routines replace the
existing __sync
built-in routines.
Atomic support is also available for memory blocks. Lock-free instructions will be used if a memory block is the same size and alignment as a supported integer type. Atomic operations which do not have lock-free support are left as function calls. A set of library functions is available on the GCC atomic wiki in the "External Atomics Library" section.
For more details on the memory models and features, see the atomic wiki.
typedef int v4si __attribute__ ((vector_size (16))); v4si res, a = {1,2,3,4}; int x; res = 2 + a; /* means {2,2,2,2} + a */ res = a - x; /* means a - {x,x,x,x} */
-std=c11
and -std=gnu11
, in
addition to the previous -std=c1x
and -std=gnu1x
.
-std=gnu11
, now supported
with -std=c11
), and the predefined
macros __STDC_UTF_16__
and __STDC_UTF_32__
._Noreturn
and <stdnoreturn.h>
)._Alignas
, _Alignof
,
max_align_t
, <stdalign.h>
).__builtin_complex
is
provided to support C library implementation of
the CMPLX
family of macros.-std=c++11
,
-std=gnu++11
, and -Wc++11-compat
options,
which are equivalent to -std=c++0x
,
-std=gnu++0x
, and -Wc++0x-compat
,
respectively.template<class W> class Q { static const int I = 2; public: friend W; }; struct B { int ar[Q<B>::I]; };
struct B { virtual void f() const final; virtual void f(int); }; struct D : B { void f() const; // error: D::f attempts to override final B::f void f(long) override; // error: doesn't override anything void f(int) override; // ok }; struct E final { }; struct F: E { }; // error: deriving from final class
struct A { int i = 42; } a; // initializes a.i to 42
// Not actually a good approximation. :) constexpr long double operator"" _degrees (long double d) { return d * 0.0175; } long double pi = 180.0_degrees;
template <class T> using Ptr = T*; Ptr<int> ip; // decltype(ip) is int*
struct A { A(int); A(): A(42) { } // delegate to the A(int) constructor };
class POD { int a; int b; }; std::atomic<POD> my_atomic_POD;
__cplusplus
to the
correct value, 199711L
for C++98/03,
and 201103L
for C++11.
-fpermissive
compiler flag will
allow the code to compile with a warning.
template <class T> void f() { g(T()); } // error, g(int) not found by argument-dependent lookup void g(int) { } // fix by moving this declaration before the declaration of f template <class T> struct A: T { // error, B::g(B) not found by argument-dependent lookup void f() { g(T()); } // fix by using this->g or A::g }; struct B { void g(B); }; int main() { f<int>(); A<B>().f(); }
Here,const int &f(const int &i) { return i; } .... const int &x = f(1); const int &y = f(2);
x
refers to the temporary allocated to hold the
1
argument, which only lives until the end of the
initialization; it immediately becomes a dangling reference. So the
next statement re-uses the stack slot to hold the 2
argument, and users of x
get that value instead.
Note that this should not cause any change of behavior for temporaries of types with non-trivial destructors, as they are already destroyed at end of full-expression; the change is that now the storage is released as well.
-Wdelete-non-virtual-dtor
has been added to warn when delete
is used to destroy
an instance of a class which has virtual functions and non-virtual
destructor. It is unsafe to delete an instance of a derived class
through a pointer to a base class if the base class does not have a
virtual destructor. This warning is enabled by -Wall
.
-Wzero-as-null-pointer-constant
has been added to warn when a literal '0' is used as null pointer
constant. It can be useful to facilitate the conversion to
nullptr
in C++11.
noexcept
in most of the library;pointer_traits
, allocator_traits
and scoped_allocator_adaptor
; tuple
; vector
meets the allocator-aware container requirements; monotonic_clock
with steady_clock
; --enable-clocale=newlib
configure option. <unistd.h>
.-fstack-arrays
has been added, which causes
all local arrays to be put on stack memory. For some
programs this will improve the performance significantly. If your
program uses very large local arrays, it is possible that you will
have to extend your runtime limits for stack memory.-Ofast
flag now also implies -fno-protect-parens
and -fstack-arrays
.-ffrontend-optimize
option and deselected by
the -fno-frontend-optimize
option.-Wfunction-elimination
warns about that.-faggressive-function-elimination
option
allows the removal of duplicate function calls even for impure
functions.-Wreal-q-constant
has been added, which
warns if floating-point literals have been specified using
q
(such as 1.0q0
); the q
marker is now supported as a vendor extension to denote quad precision
(REAL(16)
or, if not available, REAL(10)
).
Consider using a kind parameter (such as in 1.0_qp
)
instead, which can be obtained via SELECTED_REAL_KIND
.GFORTRAN_USE_STDERR
environment variable has
been removed. GNU Fortran now always prints error messages to
standard error. If you wish to redirect standard error, please
consult the manual for your OS, shell, batch environment etc.
as appropriate.-fdump-core
option and
GFORTRAN_ERROR_DUMPCORE
environment variable have
been removed. When encountering a serious error, gfortran will
now always abort the program. Whether a core dump is generated
depends on the user environment settings; see the ulimit -c
setting for POSIX shells, limit coredumpsize
for C shells,
and the WER user-mode dumps settings on Windows.-fbacktrace
option is now enabled by default.
When encountering a fatal error, gfortran will attempt to
print a backtrace to standard error before aborting. It can be
disabled with -fno-backtrace
. Note: On POSIX targets
with the addr2line
utility from GNU binutils, GNU
Fortran can print a backtrace with function name, file name,
line number information in addition to the addresses; otherwise
only the addresses are printed.class
) arrays are now supported.DO CONCURRENT
construct has been
added, which allows the user to specify that individual loop
iterations have no interdependencies.-std=f2008ts
permits programs that are expected
to conform to the Fortran 2008 standard and the draft Technical
Specification (TS) 29113 on Further Interoperability of Fortran
with C.OPTIONAL
attribute is now allowed
for dummy arguments of BIND(C)
procedures.RANK
intrinsic has been added.ASYNCHRONOUS
attribute
in GCC is compatible with the candidate draft of TS 29113
(since GCC 4.6).-mcpu=cortex-a7
.-mvectorize-with-neon-double
was added to
allow users to change the vector size to 64 bits.__flash
, __flash1
, …,
__flash5
and __memx
has been added.
These address spaces locate read-only data in
flash memory and allow reading from flash memory by means of ordinary
C code, i.e. without the need of (inline) assembler code:
const __flash int values[] = { 42, 31 }; int add_values (const __flash int *p, int i) { return values[i] + *p; }
--with-avrlibc=yes
in order to arrange for better
integration of AVR-Libc.
This configure option is supported in avr-gcc 4.7.2 and newer and will
only take effect in non-RTEMS configurations. If avr-gcc is configured
for RTEMS, the option will be ignored which is the same as
specifying --with-avrlibc=no
.
See PR54461 for more technical
details.__int24
and __uint24
.-maccumulate-args
,
-mbranch-cost=cost
and -mstrict-X
were added to allow better fine-tuning of code optimization.-fdata-sections
now also takes affect
on the section names of variables with the progmem
attribute.%i
to print a RAM address as I/O
address has been added:
The offset between an I/O address and the RAM address for that I/O location is device-specific. This offset is taken into account when printing a RAM address with the#include <avr/io.h> /* Port Definitions from AVR-LibC */ void set_portb (uint8_t value) { asm volatile ("out %0, %i1" :: "r" (value), "n" (&PORTB) : "memory"); }
%i
modifier so that the
address is suitable to be used as operand in an I/O command.
The address must be a constant integer known at compile time."R"
to represent integers
in the range −6 … 5 has been removed
without replacement.__builtin_ffs*
, __builtin_clz*
, etc.switch
instructionsEIND
and indirect jumps on devices with
more than 128 KiB of program memory.RAMPD
, RAMPX
,
RAMPY
and RAMPZ
special function registers.OS_main
and OS_task
.-mavx2
.-mbmi2
.__builtin_clz*
using the lzcnt
instruction is available via -mlzcnt
.-mfma
.-mfsgsbase
command-line option is available that makes GCC
generate new segment register read/write instructions through dedicated built-ins.rdrnd
instruction is available via -mrdrnd
.-mf16c
.-march=core-avx-i
.-march=core-avx2
.-march=bdver2
and -mtune=bdver2
options.-mx32
option.-mms-bitfields
option
by default.__thiscall
calling
convention for C++ class-member functions.--with-threads=posix
for Windows mingw targets.-march=octeon+
and -march=octeon2
respectively. Both options require GNU binutils 2.22 or later.-mfix-24k
.
These workarounds require GNU binutils 2.20 or later.mips-linux-gnu
can now build n32 and n64 multilibs. The result is effectively
a 64-bit GNU/Linux toolchain that generates 32-bit code by default.
Use the configure-time option --enable-targets=all
to select these extra multilibs.-fno-delayed-branch
now also stops the
assembler from automatically filling delay slots.-mno-pointers-to-nested-functions
was
added to allow AIX 32-bit/64-bit and GNU/Linux 64-bit PowerPC users to
specify that the compiler should not load up the chain register
(r11
) before calling a function through a pointer.
If you use this option, you cannot call nested functions through a
pointer, or call other languages that might use the static chain.msave-toc-indirect
was added to allow AIX
32-bit/64-bit and GNU/Linux 64-bit PowerPC users control whether we
save the TOC in the prologue for indirect calls or generate the save
inline. This can speed up some programs that call through a function
pointer a lot, but it can slow down other functions that only call
through a function pointer in exceptional cases.#pragma GCC target
or
__attribute__ ((__target__ ("target")))
code sequences. In addition, the target macros are updated.
However, due to the way the -save-temps
switch is
implemented, you won't see the effect of these additional macros
being defined in preprocessor output.-msoft-atomic
has been added. When it is
specified, GCC will generate GNU/Linux-compatible gUSA atomic sequences
for the new __atomic
routines.-ml
with -m2a*
will now result in a compiler
error.-mbranch-cost
option has been fixed.tst #imm,R0
instruction.-mflat
has been reinstated. When it is
specified, the compiler will generate code for a single register
window model. This is essentially a new implementation and the
corresponding debugger support has been added to GDB 7.4.-mtune=native
and
-mcpu=native
has been added on selected native platforms
(GNU/Linux and Solaris).visintrin.h
has been added.alignaddr
is now
supported.const
, which
should increase the compiler's ability to optimize VIS
operations.%gsr
register
and how it behaves as an input for various VIS instructions.fzero
, the compiler can now generate
fone
instructions in order to set all of the bits
of a floating-point register to 1
.bmask
,
bshuffle
, and non-condition-code
setting edge instructions have been added. Their availability
is controlled by the new -mvis2
and
-mno-vis2
options. They are enabled by default
on UltraSPARC-III and later CPUs.-grecord-gcc-switches
) was added that
appends compiler command-line options that might affect code
generation to the DW_AT_producer
attribute string in the
DWARF debugging information.
-gstrict-dwarf
command-line option.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.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).
The Go frontend in the 4.7.1 release fully supports the Go 1 language standard.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.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).
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 2012-09-20.