[gnu.g++.bug] several problems with g++ 1.27 on sparc

schmidt%crimee.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (10/05/88)

Hi,

  The following program causes several problems for g++ 1.27.

1. When compiled with the -gg and -O flags it gets a fatal signal.
2. When compiled ``normally,'' (i.e., would -gg) the resulting
   code gets a segmentation fault when executed.  However, it works
   fine with cfront 1.2.1.

Also, there seems to be a problem with the debugger (gdb+ 2.8) running
under the Sun OS 4.0.  Since ld++ doesn't recognize -Bstatic I am 
generally unable to debug g++ code under 4.0.  Is there a workaround
for this?

Here's the code:
----------------------------------------
#include <stream.h>

class foo {
public:
   char buf[100];

   foo() {
      strcpy(buf,"I am the default base");
   }
   virtual ~foo() {
      cout << buf << "\n";
   }
};

class bar : foo {
public:
   bar() {
      strcpy(foo::buf,"I am derived constructor");
   }
   ~bar() {
      cout << "I am the derived destructor!" << "\n";
   }
};

main() {
   foo foobar;
   bar Foobar;
}
----------------------------------------

thanks,

Doug