This is the mail archive of the gcc-prs@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]
Other format: [Raw text]

c++/6157: exceptions when cleaning up the stack



>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:


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