BUG REPORT: snaphot-980302

Sai-Lai Lo S.Lo@orl.co.uk
Mon Mar 23 12:23:00 GMT 1998


Platform: i586-pc-linux-gnu
Snapshot: 980302 

egcs-snaphot-980302 generates wrong code for the following test program:

#include <iostream.h>

class B {
public:
  B(int v) : pd_v(v) {}
private:
  int pd_v;
  B();
};

class D {
public:
  D() { cerr << "ctor D" << endl; }
  ~D() { cerr << "dtor D" << endl; }
};

void f() 
{
_again:
  D tmpvar;
  try {
    B ex(1);
    throw ex;
  }
  catch (...) {
    cerr << "I'm here" << endl;
    throw;
  }
  goto _again;
}

int
main(int argc, char** argv)
{
  try {
    f();
  }
  catch (const B& ex) {
    cerr << "Got B exception" << endl;
  }
  return 0;
}

When executed, dtor D is called repeatedly within f() and the program never
gets out of it. The tricky bit is the _again: label and the goto _again in
f() *and* an autovariable with a dtor. 

egcs-1.0{.1,.2} compiles the code correctly. I believe snapshots
980{1,2,3}* all have the same problem.

I encounter this bug when I try the compiler with omniORB-2.5.0 and its
testsuite. 

Any patch to fix the bug is much appreciated.

By the way, I'm eagerly await a stable release that supports thread-safe
exception handling.


Sai-Lai Lo

-- 
Dr. Sai-Lai Lo                          |       Research Scientist
                                        |
E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
                                        |       24a Trumpington Street
Tel:            +44 223 343000          |       Cambridge CB2 1QA
Fax:            +44 223 313542          |       ENGLAND



More information about the Gcc-bugs mailing list