This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/6157: exceptions when cleaning up the stack
- From: mb at apissoft dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: Wed, 3 Apr 2002 17:38:15 +0200
- Subject: c++/6157: exceptions when cleaning up the stack
- Reply-to: mb at apissoft dot com
>Number: 6157
>Category: c++
>Synopsis: exceptions when cleaning up the stack
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 03 07:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Michael Becker
>Release: 3.0.3
>Organization:
Apis Software
>Environment:
System: Linux hercules.wesseling.apis.de 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: : (reconfigured) ./configure --enable-threads --enable-shared
>Description:
when an exception is thrown and the cleanup of the stack calls a destructor which also throws an exception i get a core
the same problem exists on Sun 2.7 gcc 2.95.3
>How-To-Repeat:
#include <stream.h>
class exc {
public:
exc() {
}
~exc() {
throw(333);
}
};
void sub()
{
exc ex;
cerr << "leaving sub" << endl;
throw("error");
}
int main()
{
try {
cerr << "calling sub ..." << endl;
sub();
}
catch (int err) {
cerr << "caught exception " << err << endl;
}
catch (const char * err) {
cerr << "caught exception " << err << endl;
}
catch (...) {
cerr << "caught unknown exception" << endl;
}
return 0;
}
>Fix:
don't use exceptions in destructors
>Release-Note:
>Audit-Trail:
>Unformatted: