🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1492

More constructor/destructor madness!

#1492
From: "Douglas C. Schmidt"
Date: Tue, 11 Oct 1988 19:52
49 lines
1677 bytes
[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.
Technical Details
Message-ID: <8810111253.aa26713@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!orion.cf.uci.edu!schmidt%crimee.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!orion.cf.uci.edu!schmidt%crimee.ics.uci.edu
From: schmidt%crimee.ics.uci.edu@orion.cf.uci.edu ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: More constructor/destructor madness!
Message-ID: <8810111253.aa26713@PARIS.ICS.UCI.EDU>
Date: 11 Oct 88 19:52:49 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 49