diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a06adad06cae..7cc52812c117 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-11-19 James A. Morrison + + * tree-vrp.c (compare_ranges): Return false for EQ_EXPR if VR0 is less + than VR1 or vice-versa. + 2005-11-19 Hans-Peter Nilsson PR middle-end/24912 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89fdbeb9cb9b..edc8723f0204 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-11-19 James A. Morrison + + * gcc.dg/tree-ssa/vrp22.c: New test. + 2005-11-19 Hans-Peter Nilsson PR middle-end/24912 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp22.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp22.c new file mode 100644 index 000000000000..1bb312a9f286 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp22.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vrp -fdump-tree-vrp" } */ + +extern void link_error (); + +void test02(unsigned int a, unsigned int b) +{ + unsigned int x = 0x80000000; + if (a > x) + if (b < x) + if (a == b) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "link_error" 0 "vrp" } } */ +/* { dg-final { cleanup-tree-dump "vrp" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index f88b23e1aeb5..af632e6f6e2d 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1878,6 +1878,10 @@ compare_ranges (enum tree_code comp, value_range_t *vr0, value_range_t *vr1) else if (cmp_min != -2 && cmp_max != -2) return boolean_false_node; } + /* If [V0_MIN, V1_MAX] < [V1_MIN, V1_MAX] then V0 != V1. */ + else if (compare_values (vr0->min, vr1->max) == 1 + || compare_values (vr1->min, vr0->max) == 1) + return boolean_false_node; return NULL_TREE; }