aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 014f195..41cf6e1 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -287,7 +287,13 @@ compare_values (tree val1, tree val2)
return 0;
/* Do some limited symbolic comparisons. */
- if (!POINTER_TYPE_P (TREE_TYPE (val1)))
+ /* 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)))
{
/* We can determine some comparisons against +INF and -INF even
if the other value is an expression. */
@@ -400,7 +406,13 @@ compare_values (tree val1, tree val2)
if (!is_gimple_min_invariant (val1) || !is_gimple_min_invariant (val2))
return -2;
- if (!POINTER_TYPE_P (TREE_TYPE (val1)))
+ /* 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)))
return tree_int_cst_compare (val1, val2);
else
{