This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH]: make cp_tree_equal unequivocal
Mark Mitchell wrote:
Wow, this is very exciting -- lots of cruft going away.
How did you get away with assuming comp_target_types never sees an
ARRAY_TYPE? What about something like "int (*p)[5]"?
Yes, it took me ages to satisfy myself that was safe. comp_target_types
looks like this
if (is_pointer(t) && count > 0)
{
...
if (is_array (TREE_TYPE (t))
return something else
}
if (is_an_array) {/*unreachable*/}
Then it was a small matter of proving that all entry points into the
(recursive) comp_target_types call graph had count > 0, and never had
an array.
Also, I think this patch is a little too aggressive in cp_tree_equal:
! case COMPONENT_REF:
! if (TREE_OPERAND (t1, 1) != TREE_OPERAND (t2, 1))
! return false;
I think we should continue to recur on that operand; I'm pretty sure we
have COMPONENT_REFs and/or SCOPE_REFs with TEMPLATE_ID_EXPRs as the
field, and better safe than sorry...
I agree, but I have not changed that behaviour. I refactored
if (OP1(t1) == OP1(t2)) recurse
return false;
to
if (OP1(t1) != OP1(t2))
return false
recurse
which is similar to the formatting on other cases. I will try and see if
I can find a test case where that first test should use cp_tree_equal, rather
than ==
Thanks; this cleanup will make some of that code a lot simpler...
you bet!
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk