tree-vrp.c (compare_values): Check that VAL1 and VAL2 are both pointers or both integers.
authorKazu Hirata <kazu@cs.umass.edu>
Sun, 17 Apr 2005 14:58:20 +0000 (14:58 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sun, 17 Apr 2005 14:58:20 +0000 (14:58 +0000)
* tree-vrp.c (compare_values): Check that VAL1 and VAL2 are
both pointers or both integers.

From-SVN: r98273

gcc/ChangeLog
gcc/tree-vrp.c

index 94dc52b65d78bb50f8d8a6aec8ce4713c1e781a1..8cf5ee382d869ede999bfd9124599d0a8a481639 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-17  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-vrp.c (compare_values): Check that VAL1 and VAL2 are
+       both pointers or both integers.
+
 2005-04-17  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/iris6.h (DRIVER_SELF_SPECS): Check -march as well as
index c1f910e5ce10beabe1e7d6a682fbf31b5fc3006c..3bb4a6b0cb02506eaa0a03703443827341c8708a 100644 (file)
@@ -286,14 +286,13 @@ compare_values (tree val1, tree val2)
   if (val1 == val2)
     return 0;
 
+  /* Below we rely on the fact that VAL1 and VAL2 are both pointers or
+     both integers.  */
+  gcc_assert (POINTER_TYPE_P (TREE_TYPE (val1))
+             == POINTER_TYPE_P (TREE_TYPE (val2)));
+
   /* Do some limited symbolic comparisons.  */
-  /* FIXME: The second check of POINTER_TYPE_P should not be necessary
-     because we should be comparing values of the same type here, but
-     for whatever reason, the front end throws us a type mismatched
-     comparison.  For now, work around the problem by checking both
-     types.  See PR 21021 and PR 21024.  */
-  if (!POINTER_TYPE_P (TREE_TYPE (val1))
-      && !POINTER_TYPE_P (TREE_TYPE (val2)))
+  if (!POINTER_TYPE_P (TREE_TYPE (val1)))
     {
       /* We can determine some comparisons against +INF and -INF even
         if the other value is an expression.  */
@@ -406,13 +405,7 @@ compare_values (tree val1, tree val2)
   if (!is_gimple_min_invariant (val1) || !is_gimple_min_invariant (val2))
     return -2;
 
-  /* FIXME: The second check of POINTER_TYPE_P should not be necessary
-     because we should be comparing values of the same type here, but
-     for whatever reason, the front end throws us a type mismatched
-     comparison.  For now, work around the problem by checking both
-     types.  See PR 21021 and PR 21024.  */
-  if (!POINTER_TYPE_P (TREE_TYPE (val1))
-      && !POINTER_TYPE_P (TREE_TYPE (val2)))
+  if (!POINTER_TYPE_P (TREE_TYPE (val1)))
     return tree_int_cst_compare (val1, val2);
   else
     {