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
- From: Jeffrey A Law <law at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Richard Henderson <rth at redhat dot com>, Andrew Pinski <pinskia at physics dot uc dot edu>, Mark Mitchell <mark at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 May 2004 16:57:44 -0600
- Subject: Re: [PATCH] improve C++ code by changing fold-const.c
- Organization: Red Hat, Inc
- References: <Pine.LNX.4.44.0405281113020.24913-100000@www.eyesopen.com>
- Reply-to: law at redhat dot com
On Fri, 2004-05-28 at 11:32, Roger Sayle wrote:
> The miscommunication appears to be that you believe that pointer
> equality should be sufficient for ANY front-end. My argument is
> that this shouldn't be a language hook, because Java, fortran,
> pascal, treelang and GCC's other front-end would benefit from a
> generic middle-end "types_compatible_p". In fact, there's very little
> language specific about the C types_compatible_lang hook, other than it
> only discards qualifications at the outer level (probably a bug).
>
> I was thinking about something like:
Well, you have to be really really careful with pointer types,
particularly pointers to functions, void * and char *. But it
is also important to recognize that a pointer to X is the same as
a reference to an X.
I also suspect it's important that we allow languages to specify that
two types are compatible. It may in fact be important that we allow
the languages to explicitly state that two types that appear
compatible are in fact not compatible for some reason. Basically I'm
not comfortable with type equivalence/compatibility being language
neutral for trees.
Another note, I found it quite valuable to first walk down the pointer
types ignoring TYPE_MAIN_VARIANT until we got to something that was
not a pointer.