🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Fri, 30 Sep 1988 22:17
G++ 1.27 gets fatal signal with typedefs on the sparc
#1465
Author: "Douglas C. Schmidt"
Date: Fri, 30 Sep 1988 22:17
70 lines
2360 bytes
Hi,

  G++ 1.27 gets a segmentation violation for the following file.  This file compiles
and executes correctly with AT&T CC 1.2, producing an output of 

foo101

I think g++ is having problems with typedefs and classes.

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

/**********************************************************************/

typedef class Machine {

private:
   char   *Machine_Name;
   double  Clock_Speed;
   BOOLEAN Float_Chip;
   
public:

   Machine(char *Name,double Clock_Speed,BOOLEAN FPC): 
      Machine_Name(Name),Clock_Speed(Clock_Speed),Float_Chip(FPC) {
   }
   
   char *Name(void) {
      return(Machine_Name);
   }

   double Return_Clock_Speed(void) {
      return(Clock_Speed);
   }
   
   BOOLEAN Has_Float_Chip(void) {
      return(Float_Chip);
   }

   virtual char *CPU_Type() {
      return("No default");
   }

} MACHINE, *MACHINE_PTR;

main(int,char *argv[]) {
   MACHINE_PTR Foo = new MACHINE("foo",10.0,TRUE);
   cout << Foo->Name() << Foo->Return_Clock_Speed() << Foo->Has_Float_Chip() << "\n";
}
----------------------------------------

Here's the diagnostic:

Script started on Fri Sep 30 15:13:35 1988
[~/c++ ] [/cd/ua/schmidt/c++] 
..: g++ -v bug.C  
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 bug.C /tmp/cca02014.cpp 
GNU CPP version 1.27.0 
 /usr/public/lib/g++/gcc-c++ /tmp/cca02014.cpp -quiet -dumpbase bug.C -fchar-charconst -noreg -version -o /tmp/cca02014.s 
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28. 
 
bug.C:37: Segmentation violation 
/usr/public/g++: Program c++ got fatal signal 11. 

script done on Fri Sep 30 15:16:31 1988
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