On 23.06.2015 17:49, Richard Sandiford wrote:
> This patch replaces various string hashers with a single copy
> in hash-traits.h.

(snip)

> Index: gcc/config/alpha/alpha.c
> ===================================================================
> --- gcc/config/alpha/alpha.c  2015-06-23 15:48:30.751788389 +0100
> +++ gcc/config/alpha/alpha.c  2015-06-23 15:48:30.747788453 +0100
> @@ -4808,13 +4808,7 @@ alpha_multipass_dfa_lookahead (void)
>  
>  struct GTY(()) alpha_links;
>  
> -struct string_traits : default_hashmap_traits
> -{
> -  static bool equal_keys (const char *const &a, const char *const &b)
> -  {
> -    return strcmp (a, b) == 0;
> -  }
> -};
> +typedef simple_hashmap_traits <nofree_string_hash> string_traits;
>  

I remember that when we briefly discussed unification of string traits,
a looked through GCC code and this one seemed weird to me: it does not
reimplement the hash function. I.e. the pointer value is used as hash. I
wonder, is it intentional or not? This could actually work if strings
are interned (but in that case there is no need to compare them, because
comparing pointers would be enough).

-- 
Regards,
    Mikhail Maltsev

Reply via email to