[gnu.g++.bug] More constructor/destructor madness!

schmidt%crimee.ics.uci.edu@orion.cf.uci.edu ("Douglas C. Schmidt") (10/12/88)

[ok, so there are probably better ways to take a study break ;-)]

Hi,

   The following program produces a fatal signal when compiled with
g++ 1.27 on Sparc WITHOUT -O (i.e., it compiles and executes fine with
-O).  Furthermore, if the first line is uncommented the compiler
works.

Doug

----------------------------------------
// int main ( void );
// uncomment this to remove bug.

int i = 0;

class Foo {
public:
   Foo ( void ) {
      main (); // simply pathological!
      printf("Yow\n");
   }
   ~Foo ( void ) {
      printf("Goodbye\n");
   }
};

static Foo Main;

int main ( void) {
   printf("Hello\n");
}
----------------------------------------

Diagnostics:

----------------------------------------
g++ version 1.27.0
 echo use .cc filename extension!
use .cc filename extension!
 /usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix test.C /tmp/cca19167.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca19167.cpp -quiet -dumpbase test.C -fchar-charconst -noreg -version -o /tmp/cca19167.s

At top level:
:54: warning: test.C:19: Segmentation violation
/usr/public/g++: Program c++ got fatal signal 11.