🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Mon, 03 Oct 1988 21:29
program gives fatal signal on sparc
#1470
Author: "Douglas C. Schmidt"
Date: Mon, 03 Oct 1988 21:29
49 lines
1579 bytes
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads