aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr24142.c19
-rw-r--r--gcc/tree-vrp.c10
4 files changed, 37 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e712977..e27296f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-02 Diego Novillo <dnovillo@redhat.com>
+
+ PR 24142
+ * tree-vrp.c (vrp_meet): Fix call to range_includes_zero_p in
+ case of anti-ranges.
+
2005-10-02 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18851
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d90b90b..98bfad4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-10-02 Diego Novillo <dnovillo@redhat.com>
+
+ PR 24142
+ * gcc.c-torture/execute/pr24142.c: New test.
+
2005-10-01 Diego Novillo <dnovillo@redhat.com>
PR 24141
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24142.c b/gcc/testsuite/gcc.c-torture/execute/pr24142.c
new file mode 100644
index 0000000..eed3e8b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr24142.c
@@ -0,0 +1,19 @@
+void abort (void);
+
+int f (int a, int b)
+{
+ if (a == 1)
+ a = 0;
+ if (b == 0)
+ a = 1;
+ if (a != 0)
+ return 0;
+ return 1;
+}
+
+int main (void)
+{
+ if (f (1, 1) != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index de7a931..7d7e0c9 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3454,11 +3454,15 @@ vrp_meet (value_range_t *vr0, value_range_t *vr1)
no_meet:
/* The two range VR0 and VR1 do not meet. Before giving up and
setting the result to VARYING, see if we can at least derive a
- useful anti-range. */
+ useful anti-range. FIXME, all this nonsense about distinguishing
+ anti-ranges from ranges is necessary because of the odd
+ semantics of range_includes_zero_p and friends. */
if (!symbolic_range_p (vr0)
- && !range_includes_zero_p (vr0)
+ && ((vr0->type == VR_RANGE && !range_includes_zero_p (vr0))
+ || (vr0->type == VR_ANTI_RANGE && range_includes_zero_p (vr0)))
&& !symbolic_range_p (vr1)
- && !range_includes_zero_p (vr1))
+ && ((vr1->type == VR_RANGE && !range_includes_zero_p (vr1))
+ || (vr1->type == VR_ANTI_RANGE && range_includes_zero_p (vr1))))
{
set_value_range_to_nonnull (vr0, TREE_TYPE (vr0->min));