aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven Bosscher <stevenb@suse.de>2005-07-14 22:54:42 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2005-07-14 22:54:42 +0000
commit3c341936db4cd869659d61387381c32fea5f01ab (patch)
treeb55834910ba7dbd2bb2989f26bcb51ca80c754c8 /gcc
parente8f35d4dc7ee49c5570aefcb53931aa30b30e70b (diff)
downloadgcc-3c341936db4cd869659d61387381c32fea5f01ab.zip
gcc-3c341936db4cd869659d61387381c32fea5f01ab.tar.gz
gcc-3c341936db4cd869659d61387381c32fea5f01ab.tar.bz2
re PR tree-optimization/22230 (value range propagation error)
PR tree-optimization/22230 gcc/ * tree-vrp.c (extract_range_from_binary_expr): Fix logics thinko in the computation of the four cross productions for "range op range". testsuite/ * gcc.dg/tree-ssa/pr22230.c: New test. From-SVN: r102038
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr22230.c21
-rw-r--r--gcc/tree-vrp.c2
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1105727..2a13af2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-14 Steven Bosscher <stevenb@suse.de>
+
+ PR tree-optimization/22230
+ * tree-vrp.c (extract_range_from_binary_expr): Fix logics thinko in
+ the computation of the four cross productions for "range op range".
+
2005-07-14 Alexandre Oliva <aoliva@redhat.com>
Ulrich Weigand <uweigand@de.ibm.com>
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 334e96e..2e5eee9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-15 Steven Bosscher <stevenb@suse.de>
+
+ PR tree-optimization/22230
+ * gcc.dg/tree-ssa/pr22230.c: New test.
+
2005-07-14 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/g77/cpp6.f: New test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr22230.c b/gcc/testsuite/gcc.dg/tree-ssa/pr22230.c
new file mode 100644
index 0000000..4d65349
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr22230.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -ftree-vrp" } */
+
+/* PR tree-optimization/22230
+
+ The meet of the ranges in "i*i" was not computed correctly, leading
+ gcc to believe that a was equal to 0 after the loop. */
+
+extern void abort (void) __attribute__((noreturn));
+
+int main (void)
+{
+ long a, i;
+
+ for (i = 0; i < 5; i++)
+ a = i * i;
+ if (a != 16)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bcbc738..a42a21a 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1183,7 +1183,7 @@ extract_range_from_binary_expr (value_range_t *vr, tree expr)
? vrp_int_const_binop (code, vr0.max, vr1.min)
: NULL_TREE;
- val[3] = (vr0.min != vr1.min && vr0.max != vr1.max)
+ val[3] = (vr0.min != vr0.max && vr1.min != vr1.max)
? vrp_int_const_binop (code, vr0.max, vr1.max)
: NULL_TREE;