[Bug optimization/12301] corruption in exception path, exception in returned expression (g++ 3.3, 3.3.1 and 3.3.2 snapshot)
ehrhardt at mathematik dot uni-ulm dot de
gcc-bugzilla@gcc.gnu.org
Wed Sep 17 16:22:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12301
ehrhardt at mathematik dot uni-ulm dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-09-17 15:52:36
date| |
------- Additional Comments From ehrhardt at mathematik dot uni-ulm dot de 2003-09-17 15:52 -------
I can confirm the crash on sparc with recent 3.4. Apparently
the value of debug in function cast_helper is not preserved
accross the try block and the catch block tries to throw chunk.
Here's a reduced self contained testcase that crashes on sparc if
compiled with -O. Note that adding debug output sometimes makes the
bug go away.
// #include <iostream>
struct S{
char * c;
char data[100];
S () : c (data) {};
S (const S & s) {
c = data;
data[0] = s.c[0];
}
};
S real_cast ()
{
throw 3;
}
S cast_helper( S & debug )
{
// std::cerr << &debug << std::endl; /* AAA */
try {
return real_cast();
}
catch ( int e) {
// std::cerr << "HO " << &e << " "<< &debug << std::endl;
throw debug;
}
}
int main( )
{
S tmp;
try {
cast_helper ( tmp );
}
catch ( S & e ) { }
return 0;
}
More information about the Gcc-bugs
mailing list