This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bad code from egcs-1.1b


I've finally tracked down the code-gen problems with EGCS-1.1b.
It seems that it's possible to have a piece of code that creates
an object, with appropriate error handling setup code, that does
not destroy the object or clean up the error handler on exit.

On the PowerPC (at least) this has very serious side effects.  In
particular, the error handler objects are on the stack which has
now been popped away.  When the next error handler create/cleanup
runs it accesses invalid stack locations and the program fails
miserably.

I've attached a very small C++ program along with the generated
assembly code.  The assembly has been hand edited with some "###(n)"
comments to help you associate the C++ code with the assembly.
I don't know of a way to write a test case that can properly test
this, sorry.

Details:

/opt/egcs/lib/gcc-lib/powerpc-unknown-linux-gnulibc1/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

g++ -O2 -Wall -fno-inline -S bug2.cpp


I'll try another configuration (Linux/x86) today to see if it has
similar problems.

bug2.s

bug2.cpp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]