[gnu.g++.bug] program gives fatal signal on sparc

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

Hi,

   The following program gets a fatal signal running g++ 1.27 on
the Sun 4:

----------------------------------------
class Base {
private:
   char *Str;
public:  
   Base(void) {
      Str = "I am the Base";
   } 

   void Assign(char *S) {
      Str = new char[strlen(S) + 1];
      strcpy(Str,S);
   }
};

class Derived : Base {
public:
   Derived(char *S): () {
      Base::Assign(S);
   }
};

main() {
   Base Vector[100];

   for (int i = 0; i < 100; i++) {
      Vector[i] = odd(i) ? : Derived("I am derived");
   }
}
----------------------------------------

Here is the diagnostic:

----------------------------------------
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/cca18659.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca18659.cpp -quiet -dumpbase test.C -fchar-charconst -noreg -version -o /tmp/cca18659.s

test.C:28: Segmentation violation
/usr/public/g++: Program c++ got fatal signal 11.