🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

core dump in gcc 2.2.2

#24
From: sam
Date: Tue, 03 Nov 1992 02:59
732 lines
19501 bytes
The enclosed code causes gcc to dump core on a Sun4 running SunOS
4.1.1.

eucsun% gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/specs
gcc version 2.2.2

The gcc was retrieved from: interviews.stanford.edu:pub/contrib/g++/gcc.xtar.Z

and configured "./configure --target=sparc-sun-sunos4.1".
The installed binary is a "stage2" binary that passed the
stage3 validation tests.  To generate the core dump use

eucsun% gcc -c -x c++ x
gcc: Internal compiler error: program cc1plus got fatal signal 11

(the problem arises at the class constructor.)

If there's any workaround, I'd appreciate hearing about it--it's
keeping me from porting some code I want to put out for PD use.

	Sam

# 1 "Getty.c++"
# 1 "../port/termios.h" 1

extern "C" {

# 1 "/usr/include/termios.h" 1 3
# 1 "/usr/include/sys/stdtypes.h" 1 3

typedef	int		sigset_t;	 

typedef	unsigned int	speed_t;	 
typedef	unsigned long	tcflag_t;	 
typedef	unsigned char	cc_t;		 
typedef	int		pid_t;		 

typedef	unsigned short	mode_t;		 
typedef	short		nlink_t;	 

typedef	long		clock_t;	 
typedef	long		time_t;		 

typedef	int		size_t;		 
typedef int		ptrdiff_t;	 

typedef	unsigned short	wchar_t;	 

# 6 "/usr/include/termios.h" 2 3

# 1 "/usr/include/sys/ioccom.h" 1 3

# 7 "/usr/include/termios.h" 2 3

# 1 "/usr/include/sys/ttydev.h" 1 3

# 8 "/usr/include/termios.h" 2 3

# 1 "/usr/include/sys/ttycom.h" 1 3

struct winsize {
	unsigned short	ws_row;		 
	unsigned short	ws_col;		 
	unsigned short	ws_xpixel;	 
	unsigned short	ws_ypixel;	 
};

struct ttysize {
	int	ts_lines;	 
	int	ts_cols;	 
};

# 9 "/usr/include/termios.h" 2 3

struct	termios {
	tcflag_t	c_iflag;	 
	tcflag_t	c_oflag;	 
	tcflag_t	c_cflag;	 
	tcflag_t	c_lflag;	 
	char		c_line;		 
	cc_t		c_cc[17 ];	 
};

# 233 "/usr/include/termios.h" 3

# 5 "../port/termios.h" 2

speed_t	cfgetispeed(struct termios *);
speed_t	cfgetospeed(struct termios *);
int	cfsetispeed(const struct termios *, speed_t);
int	cfsetospeed(const struct termios *, speed_t);
int	tcdrain(int fildes);
int	tcflow(int fildes, int action);
int	tcflush(int fildes, int queue_selector);
int	tcgetattr(int fildes, struct termios *);
int	tcsendbreak(int fildes, int duration);
int	tcsetattr(int fildes, int optional_actions, const struct termios *);
}

# 25 "Getty.c++" 2

# 1 "/usr/local/lib/g++-include/osfcn.h" 1 3

# 1 "/usr/local/lib/g++-include/std.h" 1 3

# 1 "/usr/local/lib/g++-include/_G_config.h" 1 3

# 23 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/stddef.h" 1 3

extern "C" {

# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/include/stddef.h" 1 3

# 139 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/include/stddef.h" 3

# 7 "/usr/local/lib/g++-include/stddef.h" 2 3

}

# 24 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/stdlib.h" 1 3

extern "C" {

int       abs(int);

void volatile abort(void);

double    atof(const char*);
int       atoi(const char*);
long      atol(const char*);

int       atexit(auto void (*p) (void));
int       bsearch (const void *, const void *, size_t, 
                   size_t, auto int (*ptf)(const void*, const void*));
void*     calloc(size_t, size_t);
void      cfree(void*);

void volatile exit(int);

char*     fcvt(double, int, int*, int*);
void      free(void*);
char*     getenv(const char*);
int       getopt(int, char * const *, const char*);
int       getpw(int, char*);
char*     gcvt(double, int, char*);
char*     ecvt(double, int, int*, int*);
extern char**   environ;

long      labs(long);
void*     malloc(size_t);
size_t    malloc_usable_size(void*);
int       putenv(const char*);
extern char*    optarg;
extern int      opterr;
extern int      optind;
void      qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*));
int       rand(void);
void*     realloc(void*, size_t);
int       setkey(const char*);
int       srand(unsigned int);
double    strtod(const char*, char**);
long      strtol(const char*, char**, int);
unsigned long stroul(const char**, int);
int       system(const char*);

long      random(void);
void      srandom(int);
char*     setstate(char*);
char*     initstate(unsigned, char*, int);

double    drand48(void);
void      lcong48(short*);
long      jrand48(short*);
long      lrand48(void);
long      mrand48(void);
long      nrand48(short*);
short*    seed48(short*);
void      srand48(long);

char*     ctermid(char*);
char*     cuserid(char*);
char*     tempnam(const char*, const char*);
char*     tmpnam(char*);

}

# 25 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/string.h" 1 3

# 1 "/usr/local/lib/g++-include/memory.h" 1 3

# 43 "/usr/local/lib/g++-include/string.h" 2 3

# 26 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/unistd.h" 1 3

# 28 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/stdio.h" 1 3

#pragma interface

# 29 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/errno.h" 1 3

extern "C" {

# 1 "/usr/include/errno.h" 1 3

# 1 "/usr/include/sys/errno.h" 1 3

# 10 "/usr/include/errno.h" 2 3

extern int errno;

# 9 "/usr/local/lib/g++-include/errno.h" 2 3

extern char*    sys_errlist[];
extern int      sys_nerr;

extern int      errno;

void      perror(const char*);
char*     strerr(int);

}

# 30 "/usr/local/lib/g++-include/std.h" 2 3

# 1 "/usr/local/lib/g++-include/fcntl.h" 1 3

# 31 "/usr/local/lib/g++-include/std.h" 2 3

extern "C" {
int strcasecmp (...) ;
}

# 5 "/usr/local/lib/g++-include/osfcn.h" 2 3

# 1 "/usr/local/lib/g++-include/time.h" 1 3

# 6 "/usr/local/lib/g++-include/osfcn.h" 2 3

# 1 "/usr/local/lib/g++-include/sys/types.h" 1 3

extern "C"
{

# 1 "/usr/include/sys/types.h" 1 3

# 1 "/usr/include/sys/sysmacros.h" 1 3

# 19 "/usr/include/sys/types.h" 2 3

typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;
typedef	unsigned short	ushort;		 
typedef	unsigned int	uint;		 

typedef	struct  _physadr_t { int r[1]; } *physadr_t;
typedef	struct label_t {
	int	val[2];
} label_t;

typedef	struct	_quad_t { long val[2]; } quad_t;
typedef	long	daddr_t;
typedef	char *	caddr_t;
typedef	unsigned long	ino_t;
typedef	short	dev_t;
typedef	long	off_t;
typedef	unsigned short	uid_t;
typedef	unsigned short	gid_t;
typedef	long	key_t;
typedef	char *	addr_t;

typedef	long	fd_mask;

typedef	struct fd_set {
	fd_mask	fds_bits[(((256 )+(( (sizeof (fd_mask) * 8		)	)-1))/( (sizeof (fd_mask) * 8		)	)) ];
} fd_set;

extern int setjmp();
#pragma	unknown_control_flow(setjmp)
extern int on_fault();
#pragma	unknown_control_flow(on_fault)

# 15 "/usr/local/lib/g++-include/sys/types.h" 2 3

}

# 7 "/usr/local/lib/g++-include/osfcn.h" 2 3

# 1 "/usr/local/lib/g++-include/sys/socket.h" 1 3

# 9 "/usr/local/lib/g++-include/osfcn.h" 2 3

# 1 "/usr/local/lib/g++-include/sys/time.h" 1 3

# 11 "/usr/local/lib/g++-include/osfcn.h" 2 3

# 1 "/usr/local/lib/g++-include/sys/resource.h" 1 3

# 13 "/usr/local/lib/g++-include/osfcn.h" 2 3

# 26 "Getty.c++" 2

# 1 "/usr/local/lib/g++-include/signal.h" 1 3

# 27 "Getty.c++" 2

# 1 "/usr/local/lib/g++-include/ctype.h" 1 3

extern "C" {
# 1 "/usr/include/ctype.h" 1 3

extern	char	_ctype_[];

# 3 "/usr/local/lib/g++-include/ctype.h" 2 3

extern int toupper (...) ;

extern int tolower (...) ;

}
# 28 "Getty.c++" 2

# 1 "/usr/include/syslog.h" 1 3

	 

# 29 "Getty.c++" 2

# 1 "../port/paths.h" 1

# 30 "Getty.c++" 2

# 1 "/usr/local/lib/g++-include/sys/param.h" 1 3

extern "C"
{

# 1 "/usr/include/sys/param.h" 1 3

# 1 "/usr/include/machine/param.h" 1 3

# 126 "/usr/include/machine/param.h" 3

# 9 "/usr/include/sys/param.h" 2 3

# 1 "/usr/local/lib/g++-include/sys/signal.h" 1 3

# 36 "/usr/local/lib/g++-include/sys/signal.h" 3

# 72 "/usr/include/sys/param.h" 2 3

# 13 "/usr/local/lib/g++-include/sys/param.h" 2 3

}

# 31 "Getty.c++" 2

# 1 "Getty.h" 1

# 1 "../util/Str.h" 1

# 1 "../util/Obj.h" 1

# 1 "../util/Types.h" 1

# 1 "/usr/local/lib/g++-include/assert.h" 1 3

extern "C" {

# 1 "/usr/local/lib/g++-include/stdio.h" 1 3

# 174 "/usr/local/lib/g++-include/stdio.h" 3

# 8 "/usr/local/lib/g++-include/assert.h" 2 3

# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/include/assert.h" 1 3

# 19 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/include/assert.h" 3

extern "C" {
extern void __eprintf (const char *, const char *, unsigned, const char *);
}

# 50 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/include/assert.h" 3

# 9 "/usr/local/lib/g++-include/assert.h" 2 3

}

# 29 "../util/Types.h" 2

# 1 "/usr/local/lib/g++-include/stdio.h" 1 3

# 174 "/usr/local/lib/g++-include/stdio.h" 3

# 30 "../util/Types.h" 2

# 1 "/usr/local/lib/g++-include/new.h" 1 3

#pragma interface

# 1 "/usr/local/lib/g++-include/std.h" 1 3

# 37 "/usr/local/lib/g++-include/std.h" 3

# 8 "/usr/local/lib/g++-include/new.h" 2 3

typedef void (*new_handler_t)();
extern new_handler_t __new_handler;
extern "C" void default_new_handler();
extern "C" new_handler_t set_new_handler(new_handler_t);

static inline void *operator new(int  , void *place) { return place; }

inline void *operator new(int   size, void *ptr, int   new_len)
{
  return realloc(ptr, new_len * size);
}

# 31 "../util/Types.h" 2

typedef unsigned char fxBool;

extern "C" void _assert(const char*, const char*, int);

# 30 "../util/Obj.h" 2

class fxObj {
public:
    fxObj();
    virtual ~fxObj();

    void inc();
    void dec();
    u_long getReferenceCount();

    virtual const char* className() const;
    int compare(const fxObj *) const;
    virtual void subClassMustDefine(const char* method) const;
protected:
    u_long	referenceCount;
};

inline fxObj::fxObj()				{ referenceCount = 0; }
inline fxObj::~fxObj()				{ }
inline void fxObj::inc()			{ ++referenceCount; }
inline void fxObj::dec() {
    if (referenceCount>0); else _assert("Bogus object reference count","../util/Obj.h",55); ;
    if (0 >= --referenceCount) delete this;
}
inline u_long fxObj::getReferenceCount()	{ return referenceCount; }

# 29 "../util/Str.h" 2

class fxStr;

class fxTempStr {
public:
    fxTempStr(fxTempStr const &other);
    ~fxTempStr();

    friend fxTempStr operator|(fxStr const&, fxStr const&);
    friend fxTempStr operator|(fxStr const&, char const*);
    friend fxTempStr operator|(char const*, fxStr const&);

    friend fxTempStr& operator|(const fxTempStr&, fxStr const& b);
    friend fxTempStr& operator|(const fxTempStr&, char const* b);

    operator char*() const;
    operator int() const;
    operator float() const;
    operator double() const;

    u_int length() const;
protected:
    char	indata[100];		 
    char*	data;			 
    u_int	slength;		 

    friend class fxStr;

    fxTempStr(char const *, u_int, char const *, u_int);
    fxTempStr& concat(char const* b, u_int bl);
};

inline fxTempStr::operator char*() const	{ return data; }
inline fxTempStr::operator int() const		{ return atoi(data); }
inline fxTempStr::operator float() const	{ return float(atof(data)); }
inline fxTempStr::operator double() const	{ return double(atof(data)); }
inline u_int fxTempStr::length() const		{ return slength - 1; }

class fxStr {
    friend class fxTempStr;
public:
    fxStr(u_int l=0);
    fxStr(char const *s);
    fxStr(char const *s, u_int len);
    fxStr(fxStr const&);
    fxStr(int, char const* format);
    fxStr(float, char const* format);
    fxStr(double, char const* format);
    fxStr(const fxTempStr&);
    ~fxStr();

    u_long hash() const;

    operator char*() const
	{ return data; }
    operator int() const
	{ return atoi(data); }
    operator float() const
	{ return float(atof(data)); }
    operator double() const
	{ return double(atof(data)); }

    u_int length() const { return slength-1; }

    char& operator[](u_int i) const
    {   if (i<slength-1); else _assert("Invalid Str[] index","../util/Str.h",108); ;
	return data[i]; }

    void operator=(const fxTempStr& s);
    void operator=(fxStr const& s);
    void operator=(char const *s);

    friend fxBool operator==(fxStr const&, fxStr const&);
    friend fxBool operator==(fxStr const&, char const*);
    friend fxBool operator==(char const*, fxStr const&);

    friend fxBool operator!=(fxStr const&, fxStr const&);
    friend fxBool operator!=(fxStr const&, char const*);
    friend fxBool operator!=(char const*, fxStr const&);

    friend fxBool operator>=(fxStr const&, fxStr const&);
    friend fxBool operator>=(fxStr const&, char const*);
    friend fxBool operator>=(char const*, fxStr const&);

    friend fxBool operator<=(fxStr const&, fxStr const&);
    friend fxBool operator<=(fxStr const&, char const*);
    friend fxBool operator<=(char const*, fxStr const&);

    friend fxBool operator>(fxStr const&, fxStr const&);
    friend fxBool operator>(fxStr const&, char const*);
    friend fxBool operator>(char const*, fxStr const&);

    friend fxBool operator<(fxStr const&, fxStr const&);
    friend fxBool operator<(fxStr const&, char const*);
    friend fxBool operator<(char const*, fxStr const&);

    int compare(fxStr const *a) const { return ::compare(*this, *a); }
    friend int compare(fxStr const&, fxStr const&);
    friend int compare(fxStr const&, char const*);
    friend int compare(char const*, fxStr const&);

    friend fxTempStr& operator|(const fxTempStr&, fxStr const&);
    friend fxTempStr& operator|(const fxTempStr&, char const*);

    friend fxTempStr operator|(fxStr const&, fxStr const&);
    friend fxTempStr operator|(fxStr const&, char const*);
    friend fxTempStr operator|(char const*, fxStr const&);

    fxStr copy() const;
    fxStr extract(u_int start,u_int len) const;
    fxStr cut(u_int start,u_int len);
    fxStr head(u_int) const;
    fxStr tail(u_int) const;
    void lower();
    void raise();

    void remove(u_int posn,u_int len=1);

    void resize(u_int len, fxBool reallocate = ((fxBool)0) );
    void setMaxLength(u_int maxlen);

    void append(char a);
    void append(char const *s, u_int len=0);
    void append(const fxTempStr& s)
	{ append((char*)s, s.slength-1); }
    void append(fxStr const& s)
	{ append((char*)s, s.slength-1); }

    void insert(char a, u_int posn=0);
    void insert(char const *, u_int posn=0, u_int len=0);
    void insert(const fxTempStr& s, u_int posn=0)
	{ insert((char*)s, posn, s.slength-1); }
    void insert(fxStr const& s, u_int posn=0)
	{ insert((char*)s, posn, s.slength-1); }

    u_int next(u_int posn, char delimiter) const;
    u_int next(u_int posn, char const *delimiters, u_int len=0) const;
    u_int next(u_int posn, fxStr const& delimiters) const
	{ return next(posn, (char*)delimiters, delimiters.slength-1); }
			    
    u_int nextR(u_int posn, char delimiter) const;
    u_int nextR(u_int posn, char const*, u_int len=0) const;
    u_int nextR(u_int posn, fxStr const& delimiters) const
	{ return nextR(posn, (char*)delimiters, delimiters.slength-1); }
					  
    u_int skip(u_int posn, char a) const; 
    u_int skip(u_int posn, char const *, u_int len=0) const;
    u_int skip(u_int posn, fxStr const& delimiters) const
	{ return skip(posn, (char*)delimiters, delimiters.slength-1); }

    u_int skipR(u_int posn, char a) const;
    u_int skipR(u_int posn, char const *, u_int len=0) const;
    u_int skipR(u_int posn, fxStr const& delimiters) const
	{ return skipR(posn, (char*)delimiters, delimiters.slength-1); }

    fxStr token(u_int & posn, char delimiter) const;
    fxStr token(u_int & posn, char const * delimiters,
	u_int delimiters_len = 0) const;
    fxStr token(u_int & posn, fxStr const & delimiters) const
	{ return token(posn, delimiters.data, delimiters.slength-1); }

    fxStr tokenR(u_int & posn, char delimiter) const;
    fxStr tokenR(u_int & posn, char const * delimiters,
	u_int delimiters_len = 0) const;
    fxStr tokenR(u_int & posn, fxStr const & delimiters) const
	{ return tokenR(posn, delimiters.data, delimiters.slength-1); }

protected:

    u_int slength;

    char * data; 

    static char emptyString;
    void fxStr::resizeInternal(u_int);

    int findEndBuffer(const char *, u_int buflen) const;
    int findBuffer(const char *buf, u_int buflen) const;
    void bracketBuffer(const char *, u_int buflen, int &, int &) const;
};

# 32 "Getty.h" 2

const int GETTY_MAXIDLEN	= 16;	 
const int GETTY_MAXMESSAGE	= 512;	 
const int GETTY_MAXLINE		= 1024;	 
const int GETTY_MAXARGS		= 64;	 

struct termios;

class Getty {
private:
    enum GetStatus {
	GOODNAME,		 
	NONAME,			 
	BADSPEED,		 
	ABORT,			 
    };
    pid_t	pid;			 
    fxBool	nologin;		 
    u_int	timeout;		 
    char	user[GETTY_MAXLINE];	 
    fxStr	line;			 
    char*	hostname;		 

    GetStatus getLoginName(char* buf, termios& tio);
protected:
    typedef struct {
	char*	 name;
	u_int	value;
    } Token;
    static const Token imodes[];
    static const Token omodes[];
    static const Token cmodes[];
    static const Token lmodes[];

    virtual fxBool parseTermio(char*& cp, termios& tio);

    Getty(const char* line, u_int timeout = 60, fxBool nologin = ((fxBool)1) );

    virtual void setupState(const char* speed) = 0;
    virtual void setupSession(int modemFd, termios& tio) = 0;
    virtual void printGreetings() = 0;
    virtual void putPrompt() = 0;
    virtual void switchSpeed(termios& tio) = 0;
    virtual void execLogin(char** argv, termios& tio) = 0;

    virtual const char* getVariable(const char* name) = 0;

    virtual void error(const char* fmt, ...);
    virtual void fatal(const char* fmt, ...);

    void CheckIoctl(int cmd, const char* name, void* arg = 0);
    char backslash(const char* cp, int& len);
    char* getWord(char*& cp0, char& delim, const char* delimSet);
    void setupStream(struct _iobuf * fp, int fd, const char* sname);
    void printFile(const char* filename);
    void parseArgs(char* cp, char** args, int nargs);
public:
    virtual ~Getty();

    virtual void run(int fd, const char* speed);
    virtual fxBool wait(int& status, fxBool block = ((fxBool)0) ) = 0;
    virtual void hangup() = 0;

    pid_t getPID();
    void setPID(pid_t);

    const char* getLine();
    const char* getHostName();

    void setNologin(fxBool);
    void setTimeout(u_int);
};

# 33 "Getty.c++" 2

Getty::Getty(const char* l, u_int t, fxBool nl) : line(l)
{
a syntax error
    pid = 0;
    nologin = nl;
    timeout = t;
    hostname = 0 ;
}
Technical Details
Message-ID: <9211030259.AA18230@flake.asd.sgi.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!ira.uka.de!yale.edu!nigel.msen.com!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!flake.asd.SGi.COM!sam

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!ira.uka.de!yale.edu!nigel.msen.com!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!flake.asd.SGi.COM!sam
From: sam@flake.asd.SGi.COM
Subject: core dump in gcc 2.2.2
Message-ID: <9211030259.AA18230@flake.asd.sgi.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 3 Nov 1992 02:59:28 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 737