Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Keith Dorken
Fri, 10 Apr 1992 17:07
Infinite loop compiling attached sample.
Author: Keith Dorken
Date: Fri, 10 Apr 1992 17:07
Date: Fri, 10 Apr 1992 17:07
82 lines
2761 bytes
2761 bytes
The GNU 2.1 C++ compiler goes into an infinite loop, and will eventually fill
up my virtual memory (and sometimes kill the machine) on the following program.
It is compiled with
c++ -c -g -v bad.cc
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 -g bad.cc /usr/tmp/cca10268.i
GNU CPP version 2.1 (sparc)
bad.cc contains the line '#include "bad.h"', bad.h contents are at the end of this
message.
This is a fragment of code from a larger class definition; this code used to compile and run with G++ 1.39; I have reduced the code fragement to a small portion. The
problem is around the #ifdef BUG areas of the code fragment. If you remove the
#define BUG, the compiler doesn't loop.
bad.h contains:
#define BUG /* Remove this line to avoid problem. */
typedef struct
{
union
{
unsigned long blo;
unsigned short blos[2]; // for accessing both parts of long
};
unsigned char bhi;
} Bits;
extern Bits* U36_alloc(Bits*, const unsigned long );
extern Bits* U36_alloc_large(Bits*, const unsigned long, const unsigned long );
extern Bits* U36_copy(Bits*, const Bits*);
class Unsigned36
{
protected:
Bits* rep;
public:
Unsigned36();
Unsigned36(const Unsigned36&);
Unsigned36(unsigned long);
Unsigned36(unsigned long, unsigned long); // for those big constants
operator int();
#ifdef BUG
friend int operator == (const Unsigned36&, const Unsigned36&);
#endif
};
typedef Unsigned36 U36; // short form
int operator ! (const Unsigned36& x);
inline Unsigned36::Unsigned36() : rep(U36_alloc(0,0))
{
}
inline Unsigned36::Unsigned36(const Unsigned36& x) : rep(U36_copy(0, x.rep))
{
}
inline Unsigned36::Unsigned36( unsigned long value ) : rep(U36_alloc( 0, value ))
{
}
inline Unsigned36::Unsigned36( unsigned long high, unsigned long low ) : rep( U36_alloc_large(0, high, low))
{
}
inline unsigned int Unsigned36::operator int()
{
return (unsigned int) rep->blo;
}
#ifdef BUG
inline int operator ! ( Unsigned36& x )
{
return( x == 0 );
}
#endif
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads