This fixes the gimple verification ICEs in the Fortran testsuite.
We can easily make more types equivalent for alias-set computation.
This reduces the amout of differences we introduce for pointers
(following get_alias_set and useless_type_conversion_p).

Queued for testing.

Richard.

2014-01-07  Richard Biener  <rguent...@suse.de>

        PR lto/45586
        * lto.c (hash_canonical_type): Handle pointer type equivalence
        similar to useless_type_conversion_p.
        (gimple_canonical_types_compatible_p): Likewise.

Index: gcc/lto/lto.c
===================================================================
*** gcc/lto/lto.c       (revision 206385)
--- gcc/lto/lto.c       (working copy)
*************** hash_canonical_type (tree type)
*** 304,318 ****
    if (TREE_CODE (type) == COMPLEX_TYPE)
      v = iterative_hash_hashval_t (TYPE_UNSIGNED (type), v);
  
!   /* For pointer and reference types, fold in information about the type
!      pointed to but do not recurse to the pointed-to type.  */
    if (POINTER_TYPE_P (type))
!     {
!       v = iterative_hash_hashval_t (TYPE_REF_CAN_ALIAS_ALL (type), v);
!       v = iterative_hash_hashval_t (TYPE_ADDR_SPACE (TREE_TYPE (type)), v);
!       v = iterative_hash_hashval_t (TYPE_RESTRICT (type), v);
!       v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
!     }
  
    /* For integer types hash only the string flag.  */
    if (TREE_CODE (type) == INTEGER_TYPE)
--- 304,313 ----
    if (TREE_CODE (type) == COMPLEX_TYPE)
      v = iterative_hash_hashval_t (TYPE_UNSIGNED (type), v);
  
!   /* Treat pointer and reference types mostly opaque, like in
!      get_alias_set.  For sure do not recurse to the pointed-to type.  */
    if (POINTER_TYPE_P (type))
!     v = iterative_hash_hashval_t (TYPE_ADDR_SPACE (TREE_TYPE (type)), v);
  
    /* For integer types hash only the string flag.  */
    if (TREE_CODE (type) == INTEGER_TYPE)
*************** gimple_canonical_types_compatible_p (tre
*** 486,505 ****
         useless_type_conversion_p would do.  */
        if (POINTER_TYPE_P (t1))
        {
-         /* If the two pointers have different ref-all attributes,
-            they can't be the same type.  */
-         if (TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2))
-           return false;
- 
          if (TYPE_ADDR_SPACE (TREE_TYPE (t1))
              != TYPE_ADDR_SPACE (TREE_TYPE (t2)))
            return false;
- 
-         if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
-           return false;
- 
-         if (TREE_CODE (TREE_TYPE (t1)) != TREE_CODE (TREE_TYPE (t2)))
-           return false;
        }
  
        /* Tail-recurse to components.  */
--- 481,489 ----

Reply via email to