Bad asm output on alpha with asni overloading
H.J. Lu
hjl@lucon.org
Mon Sep 15 10:03:00 GMT 1997
>
> >>>>> H J Lu <hjl@lucon.org> writes:
>
> > On alpha, ansi overloading generates bad/incorrect asm output for the
> > code enclosed here.
>
> I can't imagine that the problem is caused by a bug in the overloading
> code. It has nothing to do with code generation.
>
There are what I have found:
1. The current gcc/egcs snapshot -O generates bad/incorrect asm output
for the code enclosed here. By "bad", I mean unnecessary code. By
"incorrect", I mean the executable binary dumps core.
2. When -fno-ansi-overloading is used, everything is fine.
3. When a complex_double (const complex_double &) constructor is
defined, everything is fine.
4. When a dummy data member is added to complex_double, everything is
fine.
5. I cannot duplicate it in C.
It seems that under certain condition, g++ may generate an incorrect
default complex_double (const complex_double &) constructor. It happens
on alpha where long is 64 bits and TImode is used. As for code
generation, is that possible for g++ to generate an incorrect default
copy constructor. From what I have seen in g++, flag_ansi_overloading
does more than just the argument matching. It seems to affect the
default C++ function generation.
BTW, you don't need an alpha machine to see the bug. Just make a cross
cc1plus for alpha, you will see the bad/incorrect foo.cc.rtl.
--
H.J. Lu (hjl@gnu.ai.mit.edu)
----
class complex_double
{
public:
complex_double (double r = 0, double i = 0): re (r), im (i) { }
double re, im;
};
main()
{
complex_double one = 1.0;
if (one.re != 1.0 || one.im != 0.0)
abort ();
return 0;
}
More information about the Gcc
mailing list