"Internal compiler error" while overloading new/delete on egcs 1.0.2
Gary Holt
holt@lnc.usc.edu
Thu Apr 2 02:13:00 GMT 1998
With egcs-1.0.2 on a linux machine (pentium II, debian linux 1.3.1), I
get the following internal compiler error:
% uname -a
Linux kelp 2.0.30 #2 Wed Mar 4 02:06:04 PST 1998 i686 unknown
% ls /lib/libc.so* # We're still running with libc5.
/lib/libc.so.5@ /lib/libc.so.5.4.33*
% g++ -v
Reading specs from /usr/local/packages/egcs-1.0.2/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
% g++ junk2.cxx
junk2.cxx: In method `LMN::LMN()':
junk2.cxx:54: Internal compiler error.
junk2.cxx:54: Please submit a full bug report to `egcs-bugs@cygnus.com'.
EGCS was configured with nothing but the default options except that I
installed it in a different directory using "--prefix=/dir". No
modifications were made.
I've simplified the file down to a few lines which reliably reproduce
the problem on our machines (at the end of this message). What I was
trying to do will be completely obscure from the code, but trust me, it
actually made sense until I stripped it down to file a bug report. I'm
not actually sure if overloading the delete operator like this is
legal--I just followed an example from Stroustrup's book (p. 576, 3rd
edition, 4th printing) to see whether it would work--but the compiler
shouldn't generate an internal error, anyway.
--
Gary Holt (213)-740-3397
holt@lnc.usc.edu http://lnc.usc.edu/~holt/
Here's the file junk2.cxx:
------------------------------------------------------------------------
typedef unsigned int size_t;
inline void *
operator new(size_t alloc_sz, const char *fname, unsigned lineno)
{
}
inline void *
operator new[](size_t alloc_sz, const char *fname, unsigned lineno)
{
}
inline void
operator delete(void *ptr, const char *fname, unsigned lineno) throw()
{
}
inline void
operator delete[](void *ptr, const char *fname, unsigned lineno) throw()
{
}
class DEF {
public:
DEF( DEF *parent=0, const char *name=0 );
};
class ABC
{
public:
enum stuff { ID0, ID1 };
ABC( stuff, DEF *parent=0, const char *name=0 );
};
class GHI : public DEF
{
};
class LMNFrame;
class LMN : public DEF
{
friend class LMNFrame;
public:
public:
LMN();
private:
LMNFrame *draw_area;
ABC *scroll_h;
};
class LMNFrame : public GHI {
};
LMN::LMN()
{
draw_area = new ("abc", 69) LMNFrame;
scroll_h = new ("def", 71) ABC(ABC::ID0, this);
}
More information about the Gcc-bugs
mailing list