This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Committed] Tweak fold_builtin_unordered_cmp API
Hi Rogerm
> My belief/expectation is that the there shouldn't be a difference and
> the few places that use TREE_TYPE (exp) can safely be replaced with
> TREE_TYPE (TREE_TYPE (fndecl)). We could probably add an assert to
> fold_builtin to confirm this, but I'd be more concerned that using
> pointer equality to test for equal types would trigger false positives.
> As Mark puts it, using pointer equality to compare types is almost
> always wrong.
>
> At the moment, builtins.c randomly mixes these types on the assumption
> they're the same. Being different should indicate a latent bug elsewhere.
Thanks! I'll start with easy ones that allow mechanical replacements
like fold_builtin_logarithm.
I was just going to say that I would probably go through bootstrap and
regtesting to verify that those two types are indeed identical, but
then how would I compare two types if pointer comparison is likely to
give false positives? Is ther a convenient function? (I grepped
certain keywords in GCC, but I didn't find anything that's close to
our purpose.)
Kazu Hirata