m68k-*-*bsd `Internal compiler error' mostly tracked down
Marc Espie
espie@quatramaran.ens.fr
Thu Feb 26 14:09:00 GMT 1998
I've got much more complete information regarding my bug.
As already stated, it seems to affect only the m68k-*-*bsd based systems.
The turn point is a patch to g++:
Thu Dec 18 14:43:19 1997 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.def: Add AGGR_INIT_EXPR.
* error.c, tree.c, typeck.c: Replace uses of NEW_EXPR with
AGGR_INIT_EXPR where appropriate.
* expr.c (cplus_expand_expr): Likewise. Simplify.
* decl2.c (finish_file): Remove call to register_exception_table.
where the decl2.c part is unrelated to the other patch.
Before that point in time, libstdc++ compiles correctly. After that point,
g++ turns up belly-up while compiling the complex numbers support.
Stripped of all bells and whistles, here is the code:
---------------------------------------------
typedef float f;
#pragma implementation "fcomplex"
template <class _FLT> class complex;
template <class _FLT> complex<_FLT>&
__doapl (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT>
class complex
{
public:
complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { }
complex& operator += (const complex&);
_FLT real () const { return re; }
_FLT imag () const { return im; }
private:
_FLT re, im;
friend complex& __doapl<> (complex *, const complex&);
};
class complex<float>;
template <class _FLT>
inline complex<_FLT>&
__doapl (complex<_FLT>* ths, const complex<_FLT>& r)
{
ths->re += r.re;
ths->im += r.im;
return *ths;
}
template <class _FLT>
inline complex<_FLT>&
complex<_FLT>::operator += (const complex<_FLT>& r)
{
return __doapl (this, r);
}
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
template <class _FLT> inline complex<_FLT>
operator + (const complex<_FLT>& x, _FLT y)
{
return complex<_FLT> (x.real() + y, x.imag());
}
#pragma interface "fcomplex"
class complex<float>
{
public:
complex (float r = 0, float i = 0): re (r), im (i) { }
complex& operator+= (const complex& r) { return __doapl (this, r); }
float real () const { return re; }
float imag () const { return im; }
private:
float re, im;
friend complex& __doapl<> (complex *, const complex&);
friend inline complex operator + (const complex& x, float y)
{ return operator+<> (x, y); }
};
----------------------------------------
cc1plus dies with `Internal compiler error 364' on the final method
(complex operator + (const complex& x, float y);
I guess I'm probably going to have to delve into gdb and cc1plus code to
understand what's going wrong... unless somebody else with better knowledge
of g++ and the right configuration can help me.
I could sure use some explanations, especially regarding what this Dec 18 patch
does (Jason Merrill ?)
More information about the Gcc-bugs
mailing list