🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

compiler segv's

#699
From: Dave Newton
Date: Fri, 08 Dec 1989 23:28
36 lines
1539 bytes
The following code was compiled on a SUN3. 
Changing "B(char* Name): (Name) {}" to  "B(char* Name): A(Name) {}"
seems to work.

#include <stream.h>

class A {
public:
  A() {}
  A(char* n) {name=n;}
  virtual char* Name() {return name;}
  char* name;
};

class B: public virtual A {
public:
  B(char* Name): (Name) {}
};

main() {
  B b("dave");
  cout << b.Name() << "\n";
}


g++-1.36.2 -g -O  -v -o testvbug1 testvbug1.cc
g++ version 1.36.2- (based on GCC 1.36)
 /usr/local/gnu/1.36.2/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 testvbug1.cc /usr/tmp/cca18915.cpp
GNU CPP version 1.36
 /usr/local/gnu/1.36.2/lib/gcc-cc1plus /usr/tmp/cca18915.cpp -quiet -dumpbase testvbug1.cc -g -O -version -o /usr/tmp/cca18915.s
GNU C++ version 1.36.2- (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
testvbug1.cc: In function int main ():
testvbug1.cc:17: Segmentation violation
g++-1.36.2: Program cc1plus got fatal signal 11.
Technical Details
Message-ID: <8912082328.AA18918@suntrek.cad.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!MCC.COM!newton%cadillac.cad.mcc.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!MCC.COM!newton%cadillac.cad.mcc.com
From: newton%cadillac.cad.mcc.com@MCC.COM (Dave Newton)
Newsgroups: gnu.g++.bug
Subject: compiler segv's
Message-ID: <8912082328.AA18918@suntrek.cad.mcc.com>
Date: 8 Dec 89 23:28:24 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 36