🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: g++ 2.1 SEGV/infinite loop

#259
From: Mike Stump
Date: Tue, 14 Apr 1992 17:02
87 lines
3585 bytes
This problem should not appear in the next version of gcc.

> Newsgroups: gnu.g++.bug
> From: marab@warwick.ac.uk (Mr I D Redfern)
> Message-Id: <xmmhb98s@csv.warwick.ac.uk>
> Organization: Computing Services, Warwick University, UK
> Date: Sat, 11 Apr 1992 18:56:03 GMT
> To: bug-g++@prep.ai.mit.edu

> The following code produces an error message at the line `return s;' followed
> by a fatal signal 11 (Segmentation fault) on a Sun4 running SunOS 4.1.2 during
> compilation under g++ 2.1. While cutting it down, I discovered that it can
> also cause an infinite loop. Cfront 3.0 compiles it without complaint.


> ---Start
> // test.cc		(This is -*- C++ -*-)

> //#define INF_LOOP
> //#define SEGV

> class state;

> class automaton
> {
> public:
>     state new_state();
> };

> class state
> {
>     automaton& my_aut;
>     int state_num;
>     state(const automaton& a, int i);
> public:
>     state(const state& s);

> #ifndef INF_LOOP
>     ~state();
> #endif
> #if defined(SEGV) || defined(INF_LOOP)
>     operator int() const { return state_num; }
> #endif
>     friend automaton;
> };

> // Make a new state
> state automaton::new_state()
> {
>     state s(*this, 0);
>     return s;
> }
> // End.
> ----End

> clover% g++ -v -c -DSEGV test.cc
> Reading specs from /usr/local/lib/gnu/gcc-lib/sun4/2.1/specs
> gcc version 2.1
>  /usr/local/lib/gnu/gcc-lib/sun4/2.1/cpp -lang-c++ -v -DSEGV -I/usr/local/lib/g++-include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix test.cc /usr/tmp/cca16553.i
> GNU CPP version 2.1 (sparc)
>  /usr/local/lib/gnu/gcc-lib/sun4/2.1/cc1plus /usr/tmp/cca16553.i -quiet -dumpbase test.cc -version -o /usr/tmp/cca16553.s
> GNU C++ version 2.1 (sparc) compiled by GNU C version 2.1.
> test.cc: In method `class state automaton::new_state ()':
> test.cc:35: bad argument 0 for function `state::state (const class state&)' (type was int )
> test.cc:35: in conversion to type `state'
> /usr/local/bin/gcc: Internal compiler error: program cc1plus got fatal signal 11


> clover% g++ -v -c -DINF_LOOP test.cc
> Reading specs from /usr/local/lib/gnu/gcc-lib/sun4/2.1/specs
> gcc version 2.1
>  /usr/local/lib/gnu/gcc-lib/sun4/2.1/cpp -lang-c++ -v -DINF_LOOP -I/usr/local/lib/g++-include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix test.cc /usr/tmp/cca16560.i
> GNU CPP version 2.1 (sparc)
>  /usr/local/lib/gnu/gcc-lib/sun4/2.1/cc1plus /usr/tmp/cca16560.i -quiet -dumpbase test.cc -version -o /usr/tmp/cca16560.s
> GNU C++ version 2.1 (sparc) compiled by GNU C version 2.1.
> test.cc: In method `class state automaton::new_state ()':
> test.cc:35: bad argument 0 for function `state::state (const class state&)' (type was int )
> test.cc:35: in conversion to type `state'
> test.cc:35: bad argument 0 for function `state::state (const class state&)' (type was int )
> test.cc:35: in conversion to type `state'

> ... and repeats


> If you need any more information, please let me know.
> Thanks,
> Ian Redfern (marab@dcs.warwick.ac.uk)
Technical Details
Message-ID: <9204141702.AA08359@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Subject: Re:  g++ 2.1 SEGV/infinite loop
Message-ID: <9204141702.AA08359@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 14 Apr 1992 17:02:55 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 90