🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug Report

#659
From: Ned Nowotny
Date: Fri, 01 Dec 1989 22:13
70 lines
2382 bytes
Two bugs in g++:

1.  If a derived class is accidently (and incorrectly, of course) declared
    more than once and the base class from which the multiply declared
    class is derived contains a virtual function, the compile will eventually
    dump core with a segmentation violation.  It appears that the combination
    of a virtual function in the base class with the multiple declaration is
    significant.  The following code still printed the correct error messages,
    but did not dump core when the "virtual" keyword was removed.

2.  Hardly worth noting:  g++ -v prints "gcc version ... (based on GCC ...)".
    It seems that "g++ version ... (based on GCC ...)" is intended.

Script started on Fri Dec  1 14:57:27 1989
$ cat /etc/motd ; mach ; arch
SunOS Release 4.0.3 (GENERIC) #2: Mon Apr 24 16:53:06 PDT 1989
sparc
sun4
$ /net/maverick/usr/local/gnu/bin/g++ -v
gcc version 1.36.1 (based on GCC 1.36)
$ cat test.c
/* test.c */

#include <stream.h>

class a
{
    public:
	a() { cout << "I think I will be an a.\n"; }
	virtual void Print();
};

class b : a
{
    public:
	b() { cout << "I think I will be a b.\n"; }
	void Print();
};

class b : a
{
    public:
	b() { cout << "I think I will be a b.\n"; }
	//void Print();
};

void a::Print()
{
    cout << "I think I am an a.\n";
}

void b::Print()
{
    cout << "I must be a b.\n";
}

$ g++ -c test.c
test.c:20: redeclaration of derivation chain of type `b'
test.c:24: redefinition of `struct b'
test.c:36: Segmentation violation
g++: Program cc1plus got fatal signal 11.
$ exit

script done on Fri Dec  1 14:58:37 1989


Ned Nowotny, MCC CAD Program, Box 200195, Austin, TX  78720  Ph: (512) 338-3715
ARPA: ned@mcc.com                   UUCP: ...!cs.utexas.edu!milano!cadillac!ned
-------------------------------------------------------------------------------
"We have ways to make you scream." - Intel advertisement in the June 1989 DDJ.
Technical Details
Message-ID: <8912012213.AA08842@pebbles.cad.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!mcc.com!ned%cadillac.cad.mcc.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!mcc.com!ned%cadillac.cad.mcc.com
From: ned%cadillac.cad.mcc.com@mcc.com (Ned Nowotny)
Newsgroups: gnu.g++.bug
Subject: Bug Report
Message-ID: <8912012213.AA08842@pebbles.cad.mcc.com>
Date: 1 Dec 89 22:13:54 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 70