This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Optimizer generates corrupted code.
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Optimizer generates corrupted code.
- From: Christoph Weidenbach <weidenb at mpi-sb dot mpg dot de>
- Date: Tue, 17 Aug 1999 12:27:01 +0200 (MET DST)
- CC: weidenb at mpi-sb dot mpg dot de
GCC version: gcc version 2.95 19990728 (release)
System Type: SunOS q 5.6 Generic_105181-14 sun4u sparc SUNW
I'm leading a theorem proving project called SPASS.
A particular version of the prover compiles without
problems with older versions of gcc (e.g., 2.8.1, 2.7.2.3)
using among others optimization option "-O2". The new gcc version
2.95 compiles SPASS with no warnings if "-O2" is not
used and generates a working binary.
Using "-O2" also generates no warnings
(the exact options are "-Wall -Wtraditional -Wshadow -ansi -pedantic -O2 -Winline")
but generates a corrupted binary,i.e., the
binary runs but internal initialization data seems
to be already corrupted resulting in unexpected behaviour.
My guess is that the reason for this bug are
functions in the source code of the form
void foo()
{
if (<Cond1>) {
<do something1>;
return;
}
...
if (<Condn>) {
<do somethingn>;
return;
}
}
where the <Condi> are disjunctions of function calls
that share (at least at some level) code fragments.
The same applies to the <do somethingi> statements and
also the different functions share parts.
There are at most 24 such statements in
one function.
I can make you the overall source code available
(600kb as gziped, uuencoded tar archive) but do
not see a possibility to trace this down to a
small, handy example.
best
Christoph