Optimization bug in egcs-1.1.2
YAKUSH S.E.
yakush@ipmnet.ru
Tue Mar 16 22:21:00 GMT 1999
/*
Hi, folks!
The following short program demonstrates optimization-related
bug in egcs-1.1.2 (built by applying egcs-1.1.1-1.1.2.diff patch
to egcs-1.1.1 distribution and configured on x86 with --enable-shared
--enable-haifa --enable-threads)
The program is distilled from a larger one by removing all
unrelated functionality. It compiles fine without optimisation
but ICEs with -O1 or higher
Regards
Sergey Yakush
Here are the details:
Orion 44% uname -a
Linux Orion 2.0.34 #11 Sat Jan 30 16:52:55 MSK 1999 i686 unknown
This performs well:
Orion 48% g++ -c -O0 crash.cpp
Orion 49%
But this crashes:
Orion 50% g++ -c -O1 -v crash.cpp
Reading specs from /usr/local/egcs-1.1.2/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
/usr/local/egcs-1.1.2/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__uni
x -D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -D__OPTIMIZE__ -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ crash.cpp /tmp/ccCRLqnx.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/egcs-1.1.2/include/g++
/usr/local/include
/usr/local/egcs-1.1.2/i686-pc-linux-gnu/include
/usr/local/egcs-1.1.2/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/include
/usr/include
End of search list.
/usr/local/egcs-1.1.2/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/cc1plus /tmp/ccCRLqnx.ii -quiet -dumpbase crash.cc -O1 -version -o /tmp/ccqQu1pU.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
crash.cpp: In function `void CRASH()':
crash.cpp:37: internal error--unrecognizable insn:
(insn 87 268 89 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
(mem:SI (reg:SI 45))) -1 (insn_list 268 (nil))
(expr_list:REG_DEAD (reg:SI 45)
(nil)))
../../egcs-1.1.2/gcc/toplev.c:1367: Internal compiler error in function fatal_insn
Orion 51%
Finally, here is the program:
Orion 51% cat crash.cpp
*/
// Exception object class
class XObject{};
//
//
class IOFILE {
public:
/// Constructor
IOFILE(char* file);
/// Data access
void ReadEntry(char* Entry, int* Value);
};
extern void Func(int);
void CRASH()
{
int intVal1;
int intVal2;
IOFILE IO("crash");
try{
// ...
try{
IO.ReadEntry("intVal1",&intVal1);
}
catch(XObject){
Func(intVal2);
}
// ...
}
catch(XObject){
// Ignore
}
//
IO.ReadEntry("INT",&intVal2);
}
More information about the Gcc-bugs
mailing list