The latest release in the 4.0 release series is GCC 4.0.4.
-fno-var-tracking
.-fwritable-strings
option. Use named character arrays when you need a writable
string.-freduce-all-givs
and
-fmove-all-movables
have been discontinued. They
were used to circumvent a shortcoming in the heuristics of the
old loop optimization code with respect to common Fortran constructs.
The new (tree) loop optimizer works differently and doesn't need those
work-arounds.-fnew-ra
, has been discontinued.-I-
has been deprecated. -iquote
is meant
to replace the need for this option.-membedded-pic
and -mrnames
options have been removed.-mflat
has been removed.LC_CTYPE=C
in the environment to disable that
locale. Programs that parse diagnostics and expect plain
ASCII English-language messages should set
LC_ALL=C
. See Markus
Kuhn's explanation of Unicode quotation marks for more
information.specs
file is no longer installed on most
platforms. Most users will be totally unaffected. However,
if you are accustomed to editing the specs file yourself, you
will now have to use the -dumpspecs
option to
generate the specs file, and then edit the resulting file.sentinel
attribute has been added to GCC.
This function attribute allows GCC to warn when variadic
functions such as execl
are not NULL
terminated. See the GCC manual for a complete description of
its behavior.__attribute__((alias("target")))
it is now
an error if target
is not a symbol, defined in the
same translation unit. This also applies to aliases created by
#pragma weak alias=target
. This is because it's
meaningless to define an alias to an undefined symbol. On
Solaris, the native assembler would have caught this error,
but GNU as does not.-Wstrict-aliasing=2
option has been added. This
warning catches all unsafe cases, but it may also give a warning for
some cases that are safe.-fwritable-strings
option, which was
deprecated in 3.4, has been removed.#pragma pack()
semantics have been brought closer to
those used by other compilers. This also applies to C++.register
storage is invalid in C. GCC now issues an error instead of a
warning.extern struct s x[];
(where struct s
has not been defined) can be moved after the definition of
struct s
. Function parameters declared as
arrays of incomplete type can instead be declared as pointers.-O0
), the C++
front end is much faster than in any previous
versions of GCC. Independent testers have measured speed-ups up to
25% in real-world production code, compared to the 3.4 family (which
was already the fastest version to date). Upgrading from older
versions might show even bigger improvements.class __attribute__ ((visibility("hidden"))) Foo { int foo1(); void foo2(); };The syntax is deliberately similar to the
__declspec()
system used by Microsoft Windows based compilers, allowing
cross-platform projects to easily reuse their existing macro system for
denoting exports and imports. By explicitly marking internal classes
never used outside a binary as hidden, one can completely avoid PLT
indirection overheads during their usage by the compiler. You can find
out more about the advantages of this at
https://www.akkadia.org/drepper/dsohowto.pdf-fvisibility-inlines-hidden
option has been added
which marks all inlineable functions as having hidden ELF visibility,
thus removing their symbol and typeinfo from the exported symbol table
of the output ELF binary. Using this option can reduce the exported
symbol count of template-heavy code by up to 40% with no code change
at all, thus notably improving link and load times for the binary as
well as a reduction in size of up to 10%. Also, check the new
-fvisibility
option.-fno-threadsafe-statics
for a small savings in code
size.register
storage so this will
continue to compile with a warning. For example, assuming
that r0
is a machine register:
register int foo asm ("r0"); register int bar; &foo; // error, no longer accepted &bar; // OK, with a warning
void
*
could be overridden by a function returning
T *
. This is now deprecated and will be removed in
a future release.<?
and
>?
) and their compound forms
(<?=
) and >?=
) have been
deprecated and will be removed in a future version. Code
using these operators should be modified to use
std::min
and std::max
instead.template <typename T> struct A { class B {}; }; class C { template <typename T> friend class A<T>::B; };This complements the feature member functions of class templates as friends introduced in GCC 3.4.0.
class A; namespace N { class B { friend class A; // Refer to N::A which has not been declared yet // because name outside namespace N are not searched friend class ::A; // Refer to ::A }; }Hiding the friend name until declaration is still not implemented.
namespace N { class A; } class N::A { friend class B; // Refer to N::B in GCC 4.0.0 // but ::B in earlier versions of GCC };
istream
functions
for char
and wchar_t
.strings
, in particular
wrt single-char append
and getline
.iter_swap
- and therefore most of the mutating
algorithms - now makes an unqualified call to swap
when
the value_type
of the two iterators is the same.reference_wrapper
and
shared_ptr
.result_of
, mem_fn
,
bind
, function
.tuple
, array
,
unordered_set
, unordered_map
,
unordered_multiset
, unordered_multimap
.rmic
is now grmic
,rmiregistry
is now grmiregistry
,
andjar
is now fastjar
./usr/bin
that point to the preferred versions of these tools.
-findirect-dispatch
argument to the compiler
now works and generates code following a new "binary
compatibility" ABI. Code compiled this way follows the binary
compatibility rules of the Java Language Specification.
gnu.gcj.jit
family of system properties.
gcj-dbtool
program, and the
new gnu.gcj.precompiled.db.path
system property.
java.util.regex
, java.net.URI
,
javax.crypto
,
javax.crypto.interfaces
, javax.crypto.spec
,
javax.net
, javax.net.ssl
,
javax.security.auth
,
javax.security.auth.callback
,
javax.security.auth.login
,
javax.security.auth.x500
,
javax.security.sasl
,
org.ietf.jgss
,
javax.imageio
,
javax.imageio.event
,
javax.imageio.spi
,
javax.print
,
javax.print.attribute
,
javax.print.attribute.standard
,
javax.print.event
, and
javax.xml
Wide_Wide_Character
and Ada.Containers
.
--enable-languages=ada
at configuration time,
since the Ada front end is not currently activated by default. See
the Installing GCC
for details.
acos
, asin
, drem
,
exp10
, exp2
, expm1
,
fmod
, ilogb
, log10
,
log1p
, log2
, logb
and
tan
mathematical builtins (and their float and long
double variants) are now implemented as inline x87 intrinsics
when using -ffast-math
.ceil
, floor
, nearbyint
,
rint
and trunc
mathematical builtins
(and their float and long double variants) are now implemented as
inline x87 intrinsics when using -ffast-math
.fsincos
instruction is now used automatically
with -ffast-math
when calculating both the sin and cos
of the same argument.sqrt
are now inlined, resulting in significant performance improvements
on some codes.--with-divide=breaks
to configure
or at
runtime by passing -mdivide-breaks
to GCC.-mpaired-single
and can be accessed
using both the target-independent vector extensions and new
MIPS-specific built-in functions.-mips3d
and provides new MIPS-3D-specific
built-in functions.-mexplicit-relocs
option now supports static
n64 code (as is used, for example, in 64-bit linux kernels).
-mexplicit-relocs
should now be feature-complete
and is enabled by default when GCC is configured to use a
compatible assembler.-march=vr4130
while code for any ISA can be tuned
for the VR4130 using -mtune=vr4130
. There is also
a new -mvr4130-align
option that produces better
schedules at the cost of increased code size.-march=sb1
while code for any ISA can be optimized
for the SB-1 using -mtune=sb1
.-mfix-r4000
, -mfix-r4400
,
-mfix-vr4120
and -mfix-vr4130
respectively. The VR4120 and VR4130 workarounds need binutils
2.16 or above.lib/
,
n32 libraries go into lib32/
and n64 libraries
go into lib64/
.-msym32
option.
It can be used to optimize n64 code in which all symbols
are known to have 32-bit values.-mwarn-framesize
and
-mwarn-dynamicstack
trigger compile-time
warnings for single functions that require large or
dynamic stack frames.-mstack-size
and -mstack-guard
generate code that checks for stack overflow at run time.-mpacked-stack
generates code that reduces
the stack frame size of many functions by reusing unneeded
parts of the stack bias area.-msoft-float
option now ensures that generated
code never accesses floating point registers.s390x-ibm-tpf
target now fully supports C++,
including exceptions and threads.ADD LOGICAL WITH CARRY
and SUBTRACT
LOGICAL WITH BORROW
instructions are now used to
avoid conditional branches in certain cases.LEGITIMIZE_RELOAD_ADDRESS
feature to optimize address arithmetic required to access large
stack frames.MVC
, CLC
, ...).-mv8
, -msparclite
,
-mcypress
, -msupersparc
,
-mf930
and -mf934
have been removed.
They have been replaced with -mcpu=xxx
.-mvis
and provides new built-in functions
for VIS instructions on UltraSPARC processors.-mapp-regs
has been turned on by default on
Solaris too.Support for a number of older systems has been declared obsolete in GCC 4.0. 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:
Also, those for some individual systems have been obsoleted:
sparclite-*-coff
,
sparclite-*-elf
, sparc86x-*-elf
)sparc-*-openbsd*
)-fomit-frame-pointer
.-fvisibility
option has
been added which allows the default ELF visibility of all symbols to be
set per compilation and the new #pragma GCC visibility
preprocessor command allows the setting of default ELF visibility for a
region of code. Using -fvisibility=hidden
especially in
combination with the new -fvisibility-inlines-hidden
can
yield substantial improvements in output binary quality including
avoiding PLT indirection overheads, reduction of the exported symbol
count by up to 60% (with resultant improvements to link and load times),
better scope for the optimizer to improve code and up to a 20% reduction
in binary size. Using these options correctly yields a binary with a
similar symbol count to a Windows DLL.This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.0.1 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 4.0.2 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
Unfortunately, due to a release engineering failure, this release
has a regression on Solaris that will affect some C++ programs. We
suggest that Solaris users apply a patch
that corrects the problem. Users who do not wish to apply the patch
should explicitly link C++ programs with the -pthreads
option, even if they do not use threads. This problem has been
corrected in the current 4.0 branch sources and will not be present in
GCC 4.0.3.
Starting with this release, the function getcontext
is
recognized by the compiler as having the same semantics as the
setjmp
function. In particular, the compiler will ensure
that all registers are dead before calling such a function and will emit
a warning about the variables that may be clobbered after the second
return from the function.
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.0.4 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
The 4.0.4 release is provided for those that require a high degree of binary compatibility with previous 4.0.x releases. For most users, the GCC team recommends that version 4.1.1 or later be used instead."
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 2022-10-26.