]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR debug/45419
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 2010 21:53:48 +0000 (21:53 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 2010 21:53:48 +0000 (21:53 +0000)
PR debug/45408
* tree-pretty-print.c (dump_generic_node): Disregard top-level
qualifiers in otherwise equal MEM_REF pointer types.
* fold-const.c (operand_equal_p): Compare pointer type of MEM_REFs.
* tree.c (iterative_hash_expr): Hash the pointer type of MEM_REFs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164031 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c
gcc/tree-pretty-print.c
gcc/tree.c

index c121a35e462c9d84d1390a57733798ef5f00b936..e02f98fbb610a7c22b186035dfbd0cce7f388170 100644 (file)
@@ -1,3 +1,12 @@
+2010-09-08  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/45419
+       PR debug/45408
+       * tree-pretty-print.c (dump_generic_node): Disregard top-level
+       qualifiers in otherwise equal MEM_REF pointer types.
+       * fold-const.c (operand_equal_p): Compare pointer type of MEM_REFs.
+       * tree.c (iterative_hash_expr): Hash the pointer type of MEM_REFs.
+
 2010-09-08  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
        PR target/44392
index baac13f756a84001a0fde2038f33fef8539d9414..c9417037a4bc41c87ce66d36fa3af479d7ab17d6 100644 (file)
@@ -2591,14 +2591,17 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
          return OP_SAME (0);
 
        case MEM_REF:
-         /* Require equal access sizes.  We can have incomplete types
-            for array references of variable-sized arrays from the
-            Fortran frontent though.  */
+         /* Require equal access sizes, and similar pointer types.
+            We can have incomplete types for array references of
+            variable-sized arrays from the Fortran frontent
+            though.  */
          return ((TYPE_SIZE (TREE_TYPE (arg0)) == TYPE_SIZE (TREE_TYPE (arg1))
                   || (TYPE_SIZE (TREE_TYPE (arg0))
                       && TYPE_SIZE (TREE_TYPE (arg1))
                       && operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)),
                                           TYPE_SIZE (TREE_TYPE (arg1)), flags)))
+                 && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg0, 1)))
+                     == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg1, 1))))
                  && OP_SAME (0) && OP_SAME (1));
 
        case ARRAY_REF:
index 44edbb071ddb0597e76f6c32353978f0a241af06..108a0d1893750f6945ada4debc0240d20e3c4173 100644 (file)
@@ -809,8 +809,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
                == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
            && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
                == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
-           && (TYPE_QUALS (TREE_TYPE (TREE_OPERAND (node, 0)))
-               == TYPE_QUALS (TREE_TYPE (TREE_OPERAND (node, 1))))
+           && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 0)))
+               == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1))))
            /* Same value types ignoring qualifiers.  */
            && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
                == TYPE_MAIN_VARIANT
@@ -829,9 +829,12 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
          }
        else
          {
+           tree ptype;
+
            pp_string (buffer, "MEM[");
            pp_string (buffer, "(");
-           dump_generic_node (buffer, TREE_TYPE (TREE_OPERAND (node, 1)),
+           ptype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1)));
+           dump_generic_node (buffer, ptype,
                               spc, flags | TDF_SLIM, false);
            pp_string (buffer, ")");
            dump_generic_node (buffer, TREE_OPERAND (node, 0),
@@ -1170,8 +1173,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
                      == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
                  && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
                      == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
-                 && (TYPE_QUALS (TREE_TYPE (TREE_OPERAND (op0, 0)))
-                     == TYPE_QUALS (TREE_TYPE (TREE_OPERAND (op0, 1))))
+                 && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (op0, 0)))
+                     == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (op0, 1))))
                  /* Same value types ignoring qualifiers.  */
                  && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
                      == TYPE_MAIN_VARIANT
index d696e96b56438ea128d99d99cee72c556676ed63..677e3bbf7e42a0d3ff5ad951f36933a9db7e0f94 100644 (file)
@@ -6768,6 +6768,21 @@ iterative_hash_expr (const_tree t, hashval_t val)
          }
        return val;
       }
+    case MEM_REF:
+      {
+       /* The type of the second operand is relevant, except for
+          its top-level qualifiers.  */
+       tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (t, 1)));
+
+       val = iterative_hash_object (TYPE_HASH (type), val);
+
+       /* We could use the standard hash computation from this point
+          on.  */
+       val = iterative_hash_object (code, val);
+       val = iterative_hash_expr (TREE_OPERAND (t, 1), val);
+       val = iterative_hash_expr (TREE_OPERAND (t, 0), val);
+       return val;
+      }
     case FUNCTION_DECL:
       /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
         Otherwise nodes that compare equal according to operand_equal_p might