This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
EH unwind bug
- To: egcs-bugs at cygnus dot com
- Subject: EH unwind bug
- From: Thomas Weise <tom at zaphod dot wh9 dot tu-dresden dot de>
- Date: Tue, 25 Nov 1997 17:14:21 +0000
- CC: egcs at cygnus dot com
egcs-2.90.18, i486-pc-linux-gnulibc1, libc-5.4.39
After latest EH fixes I've finally managed to provide a testcase for the
EH bug I've already reported. Building and runnings attached program
gives following:
tom@hermes:/home/tom > g++ -v
Reading specs from
/usr/local/lib/gcc-lib/i486-pc-linux-gnulibc1/egcs-2.90.18/specs
gcc version egcs-2.90.18 971122 (gcc2-970802 experimental)
tom@hermes:/home/tom > g++ bug.cc
tom@hermes:/home/tom > a.out
stackObj::~stackObj()
stackObj::~stackObj()
IOT trap/Abort
This is, the local object's destructor is executed twice, before the
exception raiser's destructor and again after raising the exception.
I hope it comes in time and can be fixed before release.
Tom.
--
Thomas Weise, http://www.inf.tu-dresden.de/~tw4
Dresden University of Technology, Department of Computer Science
#include <iostream.h>
class myExc
{
};
class myExcRaiser
{
public:
~myExcRaiser();
};
class stackObj
{
public:
~stackObj() { cout << "stackObj::~stackObj()" << endl; };
};
myExcRaiser::~myExcRaiser()
{
throw myExc();
}
int test()
{
myExcRaiser rais;
stackObj obj;
return 0;
}
int main()
{
try {
test();
}
catch (myExc &)
{
//cout << "caught myExc as expected\n";
}
cout << "SUCCESS" << endl;
return 0;
}