Reporting Bugs | Managing Bugs (GNATS and the test-suite) | Frequently Reported Bugs in GCC 2.95
Our preferred way of receiving bugs is via our GNATS bug reporting system.
Before you report a bug, please check the list of well-known bugs and, if possible, try a newer development snapshot or CodeSourcery's Online Test Compilation. If you want to report a bug with egcs 1.x or versions of GCC before 2.95 we strongly recommend upgrading to the current release first.
After this summary, you'll find detailed bug reporting instructions, that explain how to obtain some of the information requested in this summary.
gcc -v
)gcc-lib
in the
output of gcc -v
-save-temps
to the complete
compilation command (see below)Please submit your bug report directly to our
GNATS bug database. If this is not possible,
please mail all information to
In general, all the information we need can be obtained by
collecting the command line below, as well as its output and the
preprocessed file it generates. gcc -v -save-temps all-your-options source-file Typically the preprocessed file (extension The only excuses to not send us the preprocessed sources are
(i) if you've found a bug in the preprocessor, or (ii) if you've
reduced the testcase to a small file that doesn't include any
other file. If you can't post the preprocessed sources because
they're proprietary code, then try to create a small file that
triggers the same problem. Since we're supposed to be able to re-create the assembly output
(extension Whether to use MIME attachments or Please avoid posting an archive (.tar, .shar or .zip); we generally
need just a single file to reproduce the bug (the .i/.ii preprocessed
file), and, by storing it in an archive, you're just making our
volunteers' jobs harder. Only when your bug report requires multiple
source files to be reproduced should you use an archive. In any case,
make sure the compiler version, error message, etc, are included in
the body of your bug report as plain text, even if needlessly
duplicated as part of an archive. The gcc lists have message size limits (200 kbytes) and bug reports
over those limits will currently be bounced. If your bug is larger
than that, please post it directly in GNATS. If you fail to supply enough information for a bug report to be
reproduced, someone will probably ask you to post additional
information (or just ignore your bug report, if they're in a bad day,
so try to get it right on the first posting :-). In this case, please
post the additional information to the bug reporting mailing list, not
just to the person who requested it, unless explicitly told so. If
possible, please include in this follow-up all the information you had
supplied in the incomplete bug report (including the preprocessor
output), so that the new bug report is self-contained. This section contains information mostly intended for GCC
contributors. If you find a bug, but you are not fixing it (yet): If you fix a bug for which there is already a GNATS entry: If you find a bug, and you are fixing it right then: The latest version of this document is always available at http://gcc.gnu.org/bugs.html.
Fortran bugs are documented in the G77 manual rather than explicitly
listed here. Please see "Known
Causes of Trouble with GNU Fortran" in the
G77 manual.
This is the list of bugs in g++ (aka GNU C++) that are reported very often,
but not yet
fixed. While it is certainly better to fix bugs instead of documenting
them, this document might save people the effort of writing a bug
report when the bug is already well-known.
How to report bugs tells you how to report a
bug.
There are many reasons why reported bugs don't get fixed. It might
be difficult to fix, or fixing it might break compatibility. Often,
reports get a low priority when there is a simple work-around. In
particular, bugs caused by invalid C++ code have a simple work-around,
fix the code. Now that there is an agreed ISO/ANSI standard
for C++, the compiler has a definitive document to adhere to. Earlier
versions might have accepted source code that is no longer
C++. This means that code which might have `worked' in a previous
version, is now rejected. You should update your code to be C++.
You should try to use the latest stable release of the GNU C++
compiler. This is currently 2.95. Many commonly reported bugs in earlier
releases are fixed in that version.
Since In the development branch of GCC, this bug was fixed on Feb 7, 2000.
The fix will appear in the next major release of GCC (after 2.95). Standard C++ extends this notion and aligns it with GCC 2.95 rejects this code. It treats
Another example is the parse error for the Many of the standard library features are not implemented in GCC
2.95. Others, such as iostreams, are supported, but not in a
compliant way (e.g. SGI's implementation of the STL is included, but it is in the
global namespace, not in Work is underway to complete a new C++
library which will provide all the functionality in a compliant
way.
Although allowed by the standard, GCC 2.95 will report an
'invalid exception specifications' error if you
declare a function pointer with an exception specification.
Detailed bug reporting instructions
.i
for C or
.ii
for C++) will be large, so please compress the
resulting file with one of the popular compression programs such as
bzip2, gzip, zip or compress (in
decreasing order of preference). Use maximum compression
(-9
) if available. Please include the compressed
preprocessor output in your bug report, even if the source code is
freely available elsewhere; it makes the job of our volunteer testers
much easier..s
), you usually should not include
it in the bug report, although you may want to post parts of it to
point out assembly code you consider to be wrong.uuencode
is up to
you. In any case, make sure the compiler command line, version and
error output are in plain text, so that we don't have to decode the
bug report in order to tell who should take care of it. A meaningful
subject indicating language and platform also helps.Managing Bugs (GNATS and the test-suite)
Frequently Reported Bugs in GCC 2.95
Fortran
C++
G++ allows to access private types
GCC 2.95 incorrectly accepts code like
struct X{
private:
struct Y{};
};
X::Y z;
Y
is a private member of X
, the
definition of z
should be rejected, but isn't. This
applies to structs, classes and types in general; for other members of
classes (functions and data), access control is implemented.export not implemented
As of GCC 2.95, the export
keyword is not implemented.
This feature, when implemented, will permit moving
definitions of templates out of header files; exported
templates can be instantiated without a visible definition.
Using declarations in classes do not work
The Annotated Reference Manual (ARM) defines an access declaration for
cases like
struct X{
protected:
int i;
};
class Y: private X{
public:
X::i;
};
void f()
{
Y y;
y.i=4;
}
Even though X::i
is protected, it is redeclared public in
Y
.
using
declarations available in namespaces. In Standard C++, the following
code is also valid:
struct X{
protected:
int i(bool);
};
class Y: private X{
public:
int i(int);
using X::i;
};
void f()
{
Y y;
y.i(true);
}
A using
declaration not only redeclares access, it also permits
merging functions from the base class into the derived class, which is
convenient for overloading. In Standard C++, the ARM-style notation is
equivalent to using
declarations.
using
declarations in
the same way as ARM-style access declarations.
Parse errors for "simple" code
Up to and including GCC 2.95, the compiler will give "parse error" for
seemingly simple code, such as
struct A{
A();
A(int);
void func();
};
struct B{
B(A);
B(A,A);
void func();
};
void foo(){
B b(A(),A(1)); //Variable b, initialized with two temporaries
B(A(2)).func(); //B temporary, initialized with A temporary
}
The problem is that GCC starts to parse the declaration of
b
as a function b
returning B
,
taking a function returning A
as an argument. When it
sees the 1, it is too late. The work-around in these cases is to add
additional parentheses around the expressions that are mistaken as
declarations:
(B(A(2))).func();
Sometimes, even that is not enough; to show the compiler that this
should be really an expression, a comma operator with a dummy argument
can be used:
B b((0,A()),A(1));
return
statement in
struct A{};
struct B{
A a;
A f1(bool);
};
A B::f1(bool b)
{
if (b)
return (A());
return a;
}
The problem is that the compiler interprets A()
as a
function (taking no arguments, returning A
), and
(A()
) as a cast - with a missing expression, hence the
parse error. The work-around is to omit the parentheses:
if (b)
return A();
This problem occurs in a number of variants; in throw
statements, people also frequently put the object in parentheses. The
exact error also somewhat varies with the compiler version. The
work-arounds proposed do not change the semantics of the program at
all; they make them perhaps less readable.
C++ Library not compliant
In Standard C++, the programmer can use a considerable run-time
library, including the STL (Standard Template Library), iostreams
for single-byte and wide characters, localization features, and
others.
ostream
is not
basic_ostream<char>
, and not
declared in std::
).
std::
.
Exception specifiers on function pointers
void (*fptr)() throw();