🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

gcc internal compiler error

#34
From: Alan Shepherd
Date: Tue, 03 Nov 1992 15:20
106 lines
2247 bytes
The code below causes cc1plus to die on a signal 11.  I think it is to
do with multiple inheritence and virtual functions.  If the line which
reads "virtual int doChannel()=0;" is commented out of the Channel
class definition, then everything compiles fine, otherwise gcc says:

gcc -c test.C
gcc: Internal compiler error: program cc1plus got fatal signal 11

gcc -v gives:
Reading specs from /usr/local/lib/gcc-lib/sun4/2.3.1/specs
gcc version 2.3.1

(it also failed with gcc-2.2.2, but I didn't track it as far since I
thought gcc-2.3.1 might fix it)

Here's the code:

// test.C

#ifndef TRUE 
#define TRUE 1
#define FALSE 0
#endif

enum Boolean {
    Ok = TRUE,
    NotOk = FALSE, 
};

class Object
{
    int x;
    Boolean state;

protected:

    virtual void    	State(Boolean b)	{ state = b; }

public:

    Object();
    virtual ~Object();
};


class DirectoryUser : public Object 
{
    int a;

public:

    DirectoryUser();
};


class PPDirectoryUser : public DirectoryUser
{
    int foo;

public:

    PPDirectoryUser();
    ~PPDirectoryUser();
};

class Channel : public PPDirectoryUser
{
    int c;

public:

    Channel();
    virtual ~Channel();

    // if the next line is commented out, compilation is ok.
    virtual int doChannel()=0;

};

class ArchiveUser : public Object
{
    int c;

public:

    Channel();
};

class ArchiveStore: public ArchiveUser, public Channel {
    int d;

public:

    ArchiveStore();

    int doChannel();

};

Thanks for your help.


---------
Alan Shepherd, X-Tel Services Ltd., University Park, Nottingham NG7 2RD.
Email: a.shepherd@xtel.co.uk, Phone: +44 (0) 602 514591 (Fax:790278)
X.400: C=GB;ADMD= ;PRMD=X-Tel Services;O=X-Tel;S=Shepherd;G=Alan
Technical Details
Message-ID: <1326.720804036@xtel.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!xtel.co.uk!a.shepherd

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!xtel.co.uk!a.shepherd
From: a.shepherd@xtel.co.uk (Alan Shepherd)
Subject: gcc internal compiler error
Message-ID: <1326.720804036@xtel.co.uk>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 3 Nov 1992 15:20:36 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 108