Path: utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!rutgers!labrea!mcnc!rti!xyzzy!bert!coleman From: coleman@bert.dg.com (Kim Coleman) Newsgroups: gnu.g++.bug Subject: g++ 1.34.0 bug with -g Summary: SEGV with OOPS header Keywords: OOPS, debugging, friends Message-ID: <4240@xyzzy.UUCP> Date: 17 Mar 89 22:49:51 GMT References: <4238@xyzzy.UUCP> Sender: usenet@xyzzy.UUCP Reply-To: coleman@bert.dg.com (Kim Coleman) Distribution: gnu Organization: Data General Corporation, Research Triangle Park, NC. Lines: 38 The following program was once String.h out of our versio of OOPS. It causes g++ V1.34.0 to get a segmentation violation when compiled with -g. I'm using g++ configured for SUN3. Compilation trace follows program // // This class declaration will cause a segmentation violation in g++ 1.34 // IF compiled with the -g option. The problem goes away if is // not overloaded, if one of the overloads is not a friend, if the friend'ly // overload isn't inlined, or if you don't compile with -g. Once upon a // time, this was String.h out of the OOPs library, and was an // operator of SubString. // class SubString { char* sp; // substring pointer unsigned sl; // substring length public: SubString(); // can't take this out void problem(const char* cs); // this must be inlined and // must overload above func // must also be a friend friend void problem(const int& i) {} }; g++ version 1.34.0 /pdd/pde2/gnu/test/usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Dmc68020 String.cc /tmp/cca03222.cpp GNU CPP version 1.34 /pdd/pde2/gnu/test/usr/local/lib/gcc-c++ /tmp/cca03222.cpp -quiet -dumpbase main.cc -noreg -version -G -o /tmp/cca03222.s GNU C++ version 1.34.0 (68k, MIT syntax) compiled by GNU C version 1.34. In function void problem (const int &): String.cc:19: Segmentation violation Program c++ got fatal signal 11 ---------------------------------------- Kim Coleman {the world}!mcnc!rti!dg-rtp!coleman Data General, Research Triangle Park, NC