-fshared-data
option.
This option has had no effect in any GCC 4 release; the targets
to which the option used to apply had been removed before GCC 4.0.New command-line options specify the possible relationships among
parameters and between parameters and global data. For example,
-fargument-noalias-anything
specifies that arguments
do not alias any other storage.
Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself.
-fstrict-overflow
and
-Wstrict-overflow
have been added.
-fstrict-overflow
tells the compiler that it may
assume that the program follows the strict signed overflow
semantics permitted for the language: for C and C++ this means
that the compiler may assume that signed overflow does not occur.
For example, a loop like
for (i = 1; i > 0; i *= 2)is presumably intended to continue looping until
i
overflows. With -fstrict-overflow
, the compiler may
assume that signed overflow will not occur, and transform this
into an infinite loop. -fstrict-overflow
is turned
on by default at -O2
, and may be disabled via
-fno-strict-overflow
. The
-Wstrict-overflow
option may be used to warn about
cases where the compiler assumes that signed overflow will not
occur. It takes five different levels:
-Wstrict-overflow=1
to 5
. See the
documentation for details. -Wstrict-overflow=1
is enabled by -Wall
.-fno-toplevel-reorder
directs GCC to emit top-level functions, variables, and
asm
statements in the same order that they appear in
the input file. This is intended to support existing code which
relies on a particular ordering (for example, code which uses
top-level asm
statements to switch sections). For
new code, it is generally better to use function and variable
attributes. The -fno-toplevel-reorder
option may be
used for most cases which currently use
-fno-unit-at-a-time
. The
-fno-unit-at-a-time
option will be removed in some
future version of GCC. If you know of a case which requires
-fno-unit-at-a-time
which is not fixed by
-fno-toplevel-reorder
, please open a bug report.redefine_extname
will now
macro expand its tokens for compatibility with
SunPRO.-std=c99
or
-std=gnu99
will direct GCC to handle inline
functions as specified in the C99 standard. In preparation
for this, GCC 4.2 will warn about any use of non-static inline
functions in gnu99 or c99 mode. This new warning may be
disabled with the new gnu_inline
function
attribute or the new -fgnu89-inline
command-line
option. Also, GCC 4.2 and later will define one of the
preprocessor macros __GNUC_GNU_INLINE__
or
__GNUC_STDC_INLINE__
to indicate the semantics of
inline functions in the current compilation.-Waddress
has been
added to warn about suspicious uses of memory addresses as,
for example, using the address of a function in a conditional
expression, and comparisons against the memory address of a
string literal. This warning is enabled by
-Wall
.C++ visibility handling has been overhauled.
Restricted visiblity is propagated from classes to members, from functions to local statics, and from templates and template arguments to instantiations, unless the latter has explicitly declared visibility.
The visibility attribute for a class must come between the class-key and the name, not after the closing brace.
Attributes are now allowed for enums and elaborated-type-specifiers that only declare a type.
Members of the anonymous namespace are now local to a particular translation unit, along with any other declarations which use them, though they are still treated as having external linkage for language semantics.
template <template <typename> class C> void f(C<double>) {} template <typename T, typename U = int> struct S {}; template void f(S<double>);is no longer accepted by G++. The reason this code is not accepted is that
S
is a template with two parameters;
therefore, it cannot be bound to C
which has only
one parameter.
<?
, >?
, <?=
,
and >?=
operators,
deprecated in previous GCC releases, have been removed.
-fconst-strings
, deprecated in
previous GCC releases, has been removed.
enable-__cxa_atexit
is now enabled by
default for more targets. Enabling this variable is necessary in order for
static destructors to be executed in the correct order, but it depends upon
the presence of a non-standard C library in the target library in order to
work. The variable is now enabled for more targets which are known to have
suitable C libraries.
-Wextra
will produce warnings for if
statements
with a semicolon as the only body, to catch code like:
if (a); return 1; return 0;To suppress the warning in valid cases, use
{ }
instead.
-fstrict-aliasing -Wstrict-aliasing
is in effect.
shared_ptr
was contributed as part of Phillip
Jordan's Google Summer of Code project on lock-free
containers.
namespace std
to
namespace__gnu_cxx
. Affected interfaces are the
functions __exchange_and_add
,
__atomic_add
, and the objects __mutex
,
__recursive_mutex
, and
__scoped_lock
. --enable-symvers=gnu-versioned-namespace
during configuration.
basic_tree
, tree
, trie
),
lists (list_update
), and both collision-chaining and
probing hash-based containers (basic_hash_table
,
cc_hash_table
, gp_hash_table
). More details
per the documentation.
namespace std
and namespace __gnu_cxx
in order to resolve some long
standing corner cases involving name lookup. Debug
functionality from the policy-based data structures was
consolidated and enabled with the single macro,
_GLIBCXX_DEBUG
. See PR 26142 for more
information.__conditional_type
, __numeric_traits
,
__add_unsigned
, __removed_unsigned
,
__enable_if
. namespace __gnu_cxx::typelist
.__gnu_cxx::throw_allocator
, for
testing exception-safety.-fvisibility
to be used.__gnu_internal
implementation-private
details to anonymous namespaces whenever possible.
-frecord-marker=8
option can be used.-static-libgcj
has been
added for targets that use a linker compatible with GNU Binutils.
As its name implies, this causes libgcj to be linked statically.
In some cases this causes the resulting executable to start
faster and use less memory than if the shared version of libgcj
were used. However caution should be used as it can also cause
essential parts of the library to be omitted. Some of these issues are
discussed in:
https://gcc.gnu.org/wiki/Statically_linking_libgcj
fastjar
is no longer bundled with GCC. To build
libgcj, you will need either InfoZIP (both zip
and unzip
) or an external jar
program.
In the former case, the GCC build will install a jar
shell script that is based on InfoZIP and provides the same
functionality as fastjar
.-mtune=generic
can now be used to generate code running
well on common x86 chips. This includes AMD Athlon,
AMD Opteron, Intel Pentium-M, Intel Pentium 4 and Intel Core 2.-mtune=native
and -march=native
will produce
code optimized for the host architecture as detected using the
cpuid
instruction.-fstackrealign
and
and __attribute__ ((force_align_arg_pointer))
to realign the stack at runtime. This allows functions compiled
with a vector-aligned stack to be invoked from legacy objects
that keep only word-alignment.--with-cpu
at configure time.A make pdf
target has been added to the
top-level makefile, enabling automated production of PDF
documentation files. (Front-ends external to GCC should modify
their Make-lang.in
file to add a lang.pdf:
target.)
All the components of the compiler are now bootstrapped by default. This improves the resilience to bugs in the system compiler or binary compatibility problems, as well as providing better testing of GCC 4.2 itself. In addition, if you build the compiler from a combined tree, the assembler, linker, etc. will also be bootstrapped (i.e. built with themselves).
You can disable this behavior, and go back to
the pre-GCC 4.2 set up, by configuring GCC with
--disable-bootstrap
.
The rules that configure
follows to find target tools
resemble more closely the locations that the built compiler
will search. In addition, you can use the new configure option
--with-target-tools
to specify where to find the
target tools used during the build, without affecting what the
built compiler will use.
This can be especially useful when building packages of
GCC. For example, you may want to build GCC with
GNU as
or ld
, even if the resulting compiler
to work with the native assembler and linker. To do so, you
can use --with-target-tools
to point to the native
tools.
Make-lang.in
file to replace double-colon rules (e.g.
dvi::
) with normal rules (like lang.dvi:
).
Front-end makefile hooks do not use double-colon rules anymore.gas
,
binutils
, etc. in the build tree, and create
links to the tools from there. This does not work any more
when the compiler is bootstrapped. The new configure option
--with-target-tools
provides a better way to achieve
the same effect, and works for all native and cross settings.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 2025-01-31.