Article View: gnu.gcc.bug
Article #396GCC (C++) 2.01 - additional info
From: Keith Dorken
Date: Tue, 14 Apr 1992 17:21
Date: Tue, 14 Apr 1992 17:21
51 lines
1970 bytes
1970 bytes
The bug in GCC that causes the compiler to go into an infinite loop during parsing
has been isolated even further in the following (smaller!) sample code.
You can eliminate any one section of the code surrounded by BUG, BUG1 or BUG2,
and the parsing problem goes away. Any known fixes would be appreciated..
This is the .h header file. To reproduce, put everything below "SAMPLE" into a
bug.h file, create a bug.cc file with '#include "bug.h"' in it, and compile with
c++ -c bug.cc
This problem is for the compiler identified by
Reading specs from /n/server/usr/local/languages/gnu-compilers/lib/gcc-lib/sun4os4/2.1/specs
gcc version 2.1
/n/server/usr/local/languages/gnu-compilers/lib/gcc-lib/sun4os4/2.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix junk.cc /usr/tmp/cca13962.i
GNU CPP version 2.1 (sparc)
---------- SAMPLE ----------
#define BUG // remove either BUG
#define BUG1 // or BUG1
#define BUG2 // or BUG2 and the parsing problem goes away.
class Unsigned36
{
protected:
char* rep;
public:
Unsigned36();
#ifdef BUG2
Unsigned36(int);
#endif
operator int();
#ifdef BUG
friend
#endif
int operator == (const Unsigned36&, const Unsigned36&);
};
int operator ! (const Unsigned36& x);
inline Unsigned36::Unsigned36() : rep( (char *)0 )
{
}
inline unsigned int Unsigned36::operator int()
{
return ( rep[0] );
}
inline int operator ! ( Unsigned36& x )
{
#ifdef BUG1
return( x == 0 );
#endif
}
Technical Details
Message-ID:
<9204141721.AA13968@sabre.Thinkage.On.CA>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!thinkage.on.CA!keithShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!thinkage.on.CA!keith From: keith@thinkage.on.CA (Keith Dorken) Subject: GCC (C++) 2.01 - additional info Message-ID: <9204141721.AA13968@sabre.Thinkage.On.CA> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 14 Apr 1992 17:21:55 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 63