Path: utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%crimee.ics.uci.edu From: schmidt%crimee.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") Newsgroups: gnu.g++.bug Subject: program gets fatal signal on sparc Message-ID: <8810042037.aa01122@PARIS.ICS.UCI.EDU> Date: 5 Oct 88 03:37:17 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 54 Hi, The following short program gets a segmentation fault on the sparc for g++ 1.27: ---------------------------------------- #include const int Max_Buf = 1000; class foo { private: int j; int k; static int *Head, *Ptr; public: foo(int i) { j = k = i; } int Return(void) { return(j * k); } void * operator new(long Size) { if (!Head) { Ptr = Head = (int *) new int(Size * Max_Buf); } cout << Size << "\n"; } }; main() { foo Bar(1); foo *Bard = new foo(2); cout << "Bar.Return() = " << Bar.Return() << "\n"; cout << "Bard.->Return() = " << Bard->Return() << "\n"; } ---------------------------------------- Here's 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 new.C /tmp/cca24719.cpp GNU CPP version 1.27.0 /usr/public/lib/g++/gcc-c++ /tmp/cca24719.cpp -quiet -dumpbase new.C -fchar-charconst -noreg -version -o /tmp/cca24719.s In function void *foo::operator new (long int): new.C:20: Segmentation violation /usr/public/g++: Program c++ got fatal signal 11. ---------------------------------------- Doug