The final release in the 3.4 release series is GCC 3.4.6. The series is now closed.
GCC 3.4 has many improvements in the C++ front end. Before reporting a bug, please make sure it's really GCC, and not your code, that is broken.
-nostdinc
the preprocessor used to ignore
both standard include paths and include paths
contained in environment variables. It was neither documented
nor intended that environment variable paths be ignored, so
this has been corrected.-fvolatile
,
-fvolatile-global
and -fvolatile-static
.
It is unlikely that they worked correctly in any 3.x release.<varargs.h>
. Use
<stdarg.h>
instead.accum
. This register
has been removed.--enable-threads=pthreads
has
been removed; use --enable-threads=posix
instead,
which should have the same effect.-finline-insns
,
--param max-inline-insns-single
and --param max-inline-insns-auto
need to be
reconsidered.--param max-inline-slope
and --param min-inline-insns
have been removed; they are not needed for the new bottom-up inlining
heuristics.asm
statements are emitted may have changed. Code
relying on some particular ordering needs to be updated. The
majority of such top-level asm statements can be replaced by section
attributes.asm
statement refers to the variable/function directly. In that
case either the variable/function shall be listed in asm statement
operand or in the case of top-level asm statements the attribute
used
shall be used to force function/variable to be
always output and considered as a possibly used by unknown code.
For variables the attribute is accepted only by GCC 3.4 and newer,
while for earlier versions it is sufficient to use
unused
to silence warnings about the variables not being
referenced.
To keep code portable across different GCC versions, you can use
appropriate preprocessor conditionals.
asm
statements calling functions directly. Again
the attribute used
shall be used to prevent this
behavior.-fno-unit-at-a-time
can be used,
but this scheme may not be supported by future releases of GCC.
.bss
section on some operating systems.
Versions of GNU Emacs up to (and including) 21.3 will not work
correctly when using this optimization; you can use
-fno-zero-initialized-in-bss
to disable it.--enable-threads=posix
(the default on most targets that support pthreads) then
_REENTRANT
will be defined unconditionally by
some libstdc++ headers. C++ code which relies on that macro to
detect whether multi-threaded code is being compiled might
change in meaning, possibly resulting in linker errors for
single-threaded programs.
Affected users of Boost should
compile single-threaded code with -DBOOST_DISABLE_THREADS
.
See Bugzilla for
more
information.
fork()
calls and parallel
runs of profiled programs.gcov
coverage tool has been improved.make profiledbootstrap
available to build a faster
compiler.
Experiments made on i386 hardware showed an 11% speedup on
-O0
and a 7.5% speedup on -O2
compilation of a
large C++
testcase.
-fprofile-values
-fvpt
aims to optimize some code sequences by exploiting knowledge about
value ranges or other properties of the operands. At the moment a
conversion of expensive divisions into cheaper operations has been
implemented.-fprofile-generate
and -fprofile-use
command-line options to simplify the use of profile feedback.-funit-at-a-time
(and implied by
-O2
). In this scheme a whole file is parsed first and
optimized later. The following basic inter-procedural optimizations
are implemented:
--param
inline-unit-growth
).--param large-function-insns
and --param large-function-growth
.-funroll-loops
,
-fpeel-loops
and -funswitch-loops
flags,
respectively).
The old loop unroller still can be enabled by
-fold-unroll-loops
and may produce better code in some
cases, especially when the webizer optimization pass is not
run.
-fweb
(and implied
by -O3
) improves the quality of register allocation, CSE,
first scheduling pass and some other optimization passes by avoiding
re-use of pseudo registers with non-overlapping live ranges. The pass
almost always improves code quality but does make debugging difficult
and thus is not enabled by default by -O2
The pass is especially effective as cleanup after code duplication passes, such as the loop unroller or the tracer.
-fsched2-use-superblocks
and
-fsched2-use-traces
, respectively.GNAT.Sockets
,
GNAT.OS_Lib
, GNAT.Debug_Pools
, ... GNAT.xxxx
packages (e.g. GNAT.Strings
,
GNAT.Exception_Action
) -gnatS
switch replacing gnatpsta
#import
and
#pragma once
.
These two directives have therefore been un-deprecated.int i; (char) i = 5;
or this:
char *p; ((int *) p)++;
is no longer accepted for C++ and will not be accepted for C and Objective-C in a future version.
int a, b, c; (a ? b : c) = 2;
will not be accepted for C and Objective-C in a future version.
int a, b; (a, b) = 2;
will not be accepted for C and Objective-C in a future version. A possible non-intrusive workaround is the following:
(*(a, &b)) = 2;
__builtin_popcount
for counting bits, finding the highest and lowest bit in a
word, and parity have been added.-fwritable-strings
option has been deprecated
and will be removed.-finput-charset
command
line option. In the future we will add support for inline encoding
markers.typename
and
template
keywords to disambiguate dependent names,
as required by the C++ standard.
struct K { typedef int mytype_t; }; template <class T1> struct A { template <class T2> struct B { void callme(void); }; template <int N> void bar(void) { // Use 'typename' to tell the parser that T1::mytype_t names // a type. This is needed because the name is dependent (in // this case, on template parameter T1). typename T1::mytype_t x; x = 0; } }; template <class T> void template_func(void) { // Use 'template' to prefix member templates within // dependent types (a has type A<T>, which depends on // the template parameter T). A<T> a; a.template bar<0>(); // Use 'template' to tell the parser that B is a nested // template class (dependent on template parameter T), and // 'typename' because the whole A<T>::B<int> is // the name of a type (again, dependent). typename A<T>::template B<int> b; b.callme(); } void non_template_func(void) { // Outside of any template class or function, no names can be // dependent, so the use of the keyword 'typename' and 'template' // is not needed (and actually forbidden). A<K> a; a.bar<0>(); A<K>::B<float> b; b.callme(); }
template <typename T> struct B { int m; int n; int f (); int g (); }; int n; int g (); template <typename T> struct C : B<T> { void h () { m = 0; // error f (); // error n = 0; // ::n is modified g (); // ::g is called } };
You must make the names dependent, e.g. by prefixing them
with this->
. Here is the corrected definition
of C<T>::h
,
template <typename T> void C<T>::h () { this->m = 0; this->f (); this->n = 0 this->g (); }
As an alternative solution (unfortunately not backwards
compatible with GCC 3.3), you may use using
declarations instead of this->
:
template <typename T> struct C : B<T> { using B<T>::m; using B<T>::f; using B<T>::n; using B<T>::g; void h () { m = 0; f (); n = 0; g (); } };
void foo(int); template <int> struct A { static void bar(void){ foo('a'); } }; void foo(char); int main() { A<0>::bar(); // Calls foo(int), used to call foo(char). }
class
or struct
before the template-id:
template <int N> class A {}; template A<0>; // error, not accepted anymore template class A<0>; // OK
namespace N {}; // Invalid semicolon. void f() {}; // Invalid semicolon.
X x(1) __attribute__((...));is no longer accepted. Instead, use:
X x __attribute__((...)) (1);
template <template <class> class TT> class X {}; template <class T> class Y { X<Y> x; // Invalid, Y is always a type template parameter. };
The valid code for the above example is
X< ::Y> x; // Valid.
(Notice the space between <
and :
to
prevent GCC to interpret this as a digraph for
[
.)
template <typename T> class C { friend void f<> (C&); };
is rejected. You must first declare f
as a
template,
template <typename T> void f(T);
private
class members,
for example. See the ISO C++ Standard Committee's defect
report #209 for details.template <typename T> struct A { void f(); }; class C { template <typename T> friend void A<T>::f(); };
template <>
to introduce template
specializations, as required by the standard. For example,
template <typename T> struct S; struct S<int> { };
is rejected. You must write,
template <> struct S<int> {};
struct S { int h(); void f(int i = g()); int g(int i = h()); };
This behavior is not mandated by the standard. Now G++ issues
an error about this code. To avoid the error, you must move
the declaration of g
before the declaration of
f
. The default arguments for g
must
be visible at the point where it is called.
__cxa_vec_new2
and
__cxa_vec_new3
were changed to return
NULL
when the allocator argument returns
NULL
. These changes are incorporated into the
libstdc++ runtime library.class A; typedef A B; class C { friend class B; // error, no typedef name here friend B; // error, friend always needs class/struct/enum friend class A; // OK }; template <int> class Q {}; typedef Q<0> R; template class R; // error, no typedef name here template class Q<0>; // OK
int* a = new (int)[10]; // error, not accepted anymore int* a = new int[10]; // OK
class A { public: A(); private: A(const A&); // private copy ctor }; A makeA(void); void foo(const A&); void bar(void) { foo(A()); // error, copy ctor is not accessible foo(makeA()); // error, copy ctor is not accessible A a1; foo(a1); // OK, a1 is a lvalue }
This might be surprising at first sight, especially since most popular compilers do not correctly implement this rule (further details).
class A { public: void pub_func(); protected: void prot_func(); private: void priv_func(); }; class B : public A { public: void foo() { &A::pub_func; // OK, pub_func is accessible through A &A::prot_func; // error, cannot access prot_func through A &A::priv_func; // error, cannot access priv_func through A &B::pub_func; // OK, pub_func is accessible through B &B::prot_func; // OK, can access prot_func through B (within B) &B::priv_func; // error, cannot access priv_func through B } };
streambuf
, filebuf
, separate
synched with C Standard I/O streambuf
.filebuf
work
(UTF-8, Unicode).wchar_t
specializations on Mac OS 10.3.x,
FreeBSD 5.x, Solaris 2.7 and above, AIX 5.x, Irix 6.5.__cxa_demangle
with support for C++ style
allocators.@try
... @catch
...
@finally
, @throw
) and synchronization
(@synchronized
) support. These are accessible via
the -fobjc-exceptions
switch; as of this writing,
they may only be used in conjunction with -fnext-runtime
on Mac OS X 10.3 and later. See Options Controlling Objective-C Dialect for more
information.@encode
logic. The C99 _Bool
and C++ bool
type may now be encoded as
'B
'. In addition, the back-end/codegen dependencies
have been removed.-fzero-link
) and
"Fix-and-Continue" (-freplace-objc-classes
) debugging
modes, currently available on Mac OS X 10.3 and later. See Options Controlling Objective-C Dialect for more
information.-fno-nil-receivers
) on the assumption that message receivers are never
nil
. This is currently available on Mac OS X 10.3 and
later. See Options Controlling Objective-C Dialect for more
information.gcjlib
URL type; this
lets URLClassLoader
load code from shared
libraries.gij
.java.nio
have been implemented.
Direct and indirect buffers work, as do fundamental file and
socket operations.java.awt
has been improved, though it is still
not ready for general use.Runtime.exec()
handling and support for accented
characters in filenames.__builtin_alpha_zap
to
allow utilizing the more obscure instructions of the CPU.arm-elf
configuration has been converted to use
the new code.-mcpu=iwmmxt
command
line switch.arm-wince-pe
. This is
similar to the arm-pe
target, but it defaults to using the
APCS32 ABI.-mcpu=ep9312
command line switch. Note however that
the multilibs to support this chip are currently disabled in
gcc/config/arm/t-arm-elf
, so if you want to enable their
production you will have to uncomment the entries in that
file.long long
has been added.saveall
attribute has been added.-march=k8
and -mcpu=k8
.-m128bit-long-double
is now less buggy.__float128
support in 64-bit compilation.-mcpu
has been renamed to -mtune
.-mtune=itanium2
) is enabled by default now. To
generate code tuned for Itanium 1 the option
-mtune=itanium1
should be used.m68k-uclinux
target, based on former work done
by Paul Dale (SnapGear Inc.). Code generation for the
ColdFire
processors family has been enhanced and extended
to support the MCF 53xx and MCF 54xx cores, integrating
former work done by Peter Barada (Motorola).-march
compiler option
and should work with any MIPS I (mips-*
) or MIPS III
(mips64-*
) configuration.-march=mips32r2
.-mfix-sb1
, to work around
certain SB-1 errata.--with-arch
, which specifies the default
value of the -march
option.--with-tune
, which specifies the default
value of the -mtune
option.--with-abi
, which specifies the default ABI.--with-float=soft
, which tells GCC to
use software floating point by default.--with-float=hard
, which tells GCC to
use hardware floating point by default.mips64-linux-gnu
and
mips64el-linux-gnu
.mips-rtems
and mipsel-rtems
.*-elf
configurations,
mipsisa32r2-elf
and mipsisa32r2el-elf
.-mabicalls
code. This behavior is controlled by
-mexplicit-relocs
and can have several performance
benefits. For example:
$28
.$gp
can be removed from
functions that don't need it.-mxgot
, allows the GOT to be bigger
than 64k. This option is equivalent to the assembler's
-xgot
option and should be used instead of
-Wa,-xgot
.powerpc-apple-darwin7.0.0
and up.
powerpc-apple-darwin7.0.0
you need to install dlcompat.
long double
.double
, with special rules for a struct
starting with a double
, can be chosen with
-malign-power
. This change may result in
incompatibility between code compiled with GCC 3.3 and GCC 3.4.-mabi=altivec
is now the default rather than
-mabi=no-altivec
.long double
.-mesa
/-mzarch
allows to specify
whether to generate code running in ESA/390 mode or in
z/Architecture mode (this is applicable to 31-bit code
only).-march
allows to specify a minimum processor
architecture level (g5
, g6
,
z900
, or z990
).-mtune
allows to specify which processor to tune
for.--with-mode
, which specifies whether to
default to assuming ESA/390 or z/Architecture mode.--with-arch
, which specifies the default
value of the -march
option.--with-tune
, which specifies the default
value of the -mtune
option.-march=z990
or -mtune=z990
. This
includes instruction scheduling tuned for the superscalar instruction
pipeline of the z990 processor as well as support for all new
instructions provided by the long-displacement facility.-march=z900
and
-mzarch
respectively.z900
and z990
processors now uses the DFA pipeline hazard recognizer.-mbackchain
option.s390x-ibm-tpf
. This
configuration is supported as cross-compilation target only.MULTIPLY AND ADD
and
MULTIPLY AND SUBTRACT
instructions to
significantly speed up many floating-point applications.ADD LOGICAL WITH CARRY
and
SUBTRACT LOGICAL WITH BORROW
instructions to
speed up long long
arithmetic.SEARCH STRING
instruction to
implement strlen()
.-mflat
is deprecated.-m2e
command line
switch, or at configure time by specifying sh2e as the machine
part of the target triple.va_list
type has changed.
A va_list
value created by va_start
from a
previous release cannot be used with va_arg
from this
release, or vice versa.ABS
instruction is now optional;ADDX*
and SUBX*
instructions are
now optional;CONST16
instruction can be used to
synthesize constants instead of loading them from constant pools.xtensa-config.h
header file when building GCC. Additionally, the
-mno-serialize-volatile
option is no longer supported.Support for a number of older systems has been declared obsolete in GCC 3.4. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
All configurations of the following processor architectures have been declared obsolete:
d30v-*
dsp16xx-*
i960
Also, some individual systems have been obsoleted:
-mapcs-26
).i370-*
. (The other port,
s390-*
, is actively maintained and
supported.)i?86-moss-msdos
and
i?86-*-moss*
i?86-ncr-sysv4*
i?86-*-freebsd*aout*
and i?86-*-freebsd2*
i?86-linux*aout*
i?86-linux*libc1*
i?86-*-interix
i?86-mach*
i?86-*-udk*
i?86-*-sysv[123]*
i386-*-vsta
m68k-hp-hpux*
and
m68000-hp-hpux*
m68k-*-*-netbsd*
except
m68k-*-*-netbsdelf*
m68k-*-sysv4*
vax-*-*
(This is generic VAX only;
we have not obsoleted any VAX triples for specific operating
systems.)make
command. The top level has been autoconfiscated.--enable-maintainer-mode
or --enable-generated-files-in-srcdir
.-W
warning option has been renamed to
-Wextra
, which is more easily understood. The older
spelling will be retained for backwards compatibility.A vast number of bugs have been fixed in 3.4.0, too many to publish a complete list here. Follow this link to query the Bugzilla database for the list of over 900 bugs fixed in 3.4.0. This is the list of all bugs marked as resolved and fixed in 3.4.0 that are not flagged as 3.4 regressions.
This section lists the problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 3.4.1 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
--program-suffix
and --program-prefix
save_call_clobbered_regs
, in caller_save.c
gcc.c-torture/compile/930621-1.c
cp/parser.c
char*
is expected in a throw statementrtl_verify_flow_info_1
instantiate_template
-fforce-mem
to exhaust all memoryresolve_overloaded_unification
extract_insn
, in recog.c
tsubst_copy
, in cp/pt.c
lookup.c
do_SUBST
, in combine.c
-funroll-loops
--pedantic-errors
behaves differently from --pedantic
with C-compiler on GNU/Linuxconst
reference is incorrectly matched in a "const
T" partial specializationwcin.rdbuf()->in_avail()
return value too highenc_filebuf
doesn't workconst_cast
returns lvalue but should be rvaluenum_put::do_put()
undesired float/double behavior__gnu_cxx::stdio_sync_filebuf
should expose internal FILE*
offsetof
to get offsets of array elements in g++ 3.4.0-O0
#pragma redefine_extname
std::string
slow)enum
type is miscompiled-lsupc++
still links against libstdc++const
member__attribute__
unused in first parameter of constructor gives errorsizeof
on incomplete type diagnosticbitset<>::_Find_next
failsoperator &
and template definitionsint
with showposenum yn
' fails (confict with undeclared builtin)__gnu_debug::bitset
-1
)-oldstyle_liblookup
as -o ldstyle_liblookup
-O2
gcc.c
-torture/execute/20030408-1.c
execution, -O2
reload_cse_simplify_operands
, in postreload.c
-march=mips1 -G0
-mno-split-addresses
-mno-explicit-relocs
__divdf3
when -O1
gcc.dg/altivec-5.c
-pthread
option is used.-maltivec
affects vector return with -mabi=no-altivec
-m32
function
.c:4804, assign_parms, when -mpowerpc64
& half-word operation-maltivec
-mabi=no-altivec
results in mis-aligned lvx and stvx-march
=nocona from mainline-mms-bitfields
support on GCC 3.4 is not conformant to MS layout-mtune=pentium4 -O2
with sjlj EH breaks stack probe worker on windows32 targets-m5200
produces erroneous SImode set of short varaible on stack-mhitachi
option in SHv3/testsuite/abi_check.c
c-O2
-fPIC
-doc
: Allocators.3 manpage is emptyThis section lists the problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 3.4.2 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
-v3
/testsuitemkheaders.c
onfcp/parser.c
loc_descriptor_from_tree
, in dwarf2out.c
c_expand_expr
, in c-common.c
write_unscoped_name
(template/namespace)delete_insn
, in cfgrtl.c
__cxa_throw
finish_member_declaration
, in cp/semantics.c
build_ptrmemfunc
tsubst
, in cp/pt.c
finish_class_member_access_expr
, in cp/typeck.c
cp_parser_class_specifier
due to redefinitiondependent_template_p
, in cp/pt.c
-remap
causes memory corruption-O2
enum
of the same precisionif(0)
substatement failslocale::global()
and locale::locale()
ostringstream
in gcc 3.4.x very slow for big data__gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char> >::file()
offsetof
fails with constant member__attribute__((constructor))
broken in C++std::map::insert
ios_base::sync_with_stdio
accept()
leaks file descriptorsdwarf2out_frame_debug_expr
, in dwarf2out.c
final_scan_insn
, in final.c
)-mips1
-O0
)-O2
: strength-reduced iteration variable ends up off by 1config/ia64/ia64.c
(-mtune=merced
)config/ia64/ia64.c
(-mtune=itanium
)-mtune=merced
asm_noperands
result-fprofile-use
-O1
-fno-exceptions
issue)-m64
doesn't imply -mcpu=v9
anymorememcpy
-msdata=use
-O0
long long
" I/OThis is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 3.4.3 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
loc_descriptor_from_tree
, in dwarf2out.c
using
directive-O2
grokdeclarator
, in cp/decl.c
cp_tree_equal
-ftrapv
aborts on 0 * (-1)
#ident
stopped working-O2
-fwritable-strings
doesn't workostringstream::tellp()
filebuf::sgetn
is slowstd::basic_iostream
is instantiated when used, even though instantiations are already contained in libstdc++/ext/demangle.h
appears broken_S_leaf
incorrectly qualified with _RopeRep::
in ropeimpl.h
-Wall
-lstdc
++ to linker when all command line arguments are librariesenum
value in template-O2
ICE for MMX testcasestatistics/lag1.c
L_foo$stub
already defined.-maix64
<cmath>
calls acosf()
, ceilf()
, and other functions missing from system librarieslibgcc_s.sl
-mips1
vfprintf.c
-fdata-sections
triggers ICE__USE_INIT_FINI__
-O2
-fPIC
_Complex
function argumentsDW_AT_location
debug info is emitted for formal arguments to a function that uses "register" qualifierslibgcc_s.so.1
not found by 64-bit testsuiteThis is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 3.4.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 3.4.5 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
math.h
struct Foo { }
redefinition((unsigned char)(unsigned long long)((a?a:1)&(a*b)))?0:1)
find_function_data
, in function.c
long
long
using
keywordcp_convert_to_pointer
, in cp/cvt.c
typedef
in
template declaration not rejectedconst_cast
for undeclared variableint ::i;
acceptedtypename
not
allowed with non-dependent qualified nameoperator()
in templateuses_template_parms
, in cp/pt.c
g++.dg/warn/conversion-function-1.C
filebuf::xsgetn
vs pipesoperator new
ext/hash_map
char_traits
requirements/1.cc test bad mathinvert_truthvalue
, in fold-const.c
typename
outside templatefoo(<type error>)
'&#`label_decl'
not supported by
dump_expr#<expression error>
verify_local_live_at_start
-Os
real_const_1.f
and real_const_2.f90
uchar
to 255-O
operand_subword_force
-fpic/-fPIC
on i686-pc-linux-gnu
verify_local_live_at_start
reload_cse_simplify_operands
, in postreload.c
change_address_1
, in emit-rtl.c
const __attribute__((altivec(vector__)))
doesn't work in
arraysreload_cse_simplify_operands
TARGET_C99_FUNCTIONS
is wrongly definedCALL_V4_CLEAR_FP_ARGS
flag not properly setfloatdisf2_internal2
broken-mminimal-toc
miscompilation of __thread
varsHUGE_VAL
in math_c99
V2DF
-O1 -fschedule-insns2 -fsched2-use-traces
reg-stack.c
's swap_rtx_condition
-fpeephole2
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 3.4.6 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).