This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] improve C++ code by changing fold-const.c
On Thu, May 27, 2004 at 09:39:10AM -0600, Roger Sayle wrote:
> As you know fold already handles the case where t1 == t2, so I suspect
> a better place to tackle this problem is elsewhere.
Well, iirc fold *only* handles pointer equality of types, and
not the "sameness" of types as defined by types_compatible_p.
Fold should almost certainly be using the new definition of
equality.
> The pointer types (const int*), (int&) and (int*) really are all
> distinct types, that need to be preserved by the middle-end.
Yes, but you may be surprised to discover that (T*) and (T*)
are sometimes distinct types in terms of pointer equality.
Argue all you like about this front-end bug, but fixing them
is tricky at best. And so we invent types_compatible_p.
I'm not 100% sure what to do about Andrew's patches, but it's
sure that *something* needs to happen.
r~