summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-06-01 22:47:02 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2007-06-01 22:47:02 +0000
commite07e405d7b1e06496a9a4819091205ee22ac7532 (patch)
tree103f55ccc2020c73fac60b1aac6912c7db6c30af
parent069a73f9a47f57f264b2b1efad950ec33c1b23aa (diff)
downloadgcc-e07e405d7b1e06496a9a4819091205ee22ac7532.tar.gz
tree-vrp.c (compare_name_with_value): Always set used_strict_overflow if we get a result from the variable itself.
./: * tree-vrp.c (compare_name_with_value): Always set used_strict_overflow if we get a result from the variable itself. testsuite/: * gcc.dg/Wstrict-overflow-17.c: New test. From-SVN: r125269
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-overflow-17.c20
-rw-r--r--gcc/tree-vrp.c4
4 files changed, 31 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ece60c7ae48..87d2444b48b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2007-06-01 Ian Lance Taylor <iant@google.com>
+ * tree-vrp.c (compare_name_with_value): Always set
+ used_strict_overflow if we get a result from the variable itself.
+
+2007-06-01 Ian Lance Taylor <iant@google.com>
+
PR rtl-optimization/31455
* lower-subreg.c (find_decomposable_subregs): Don't decompose
subregs which have a cast between modes which are not tieable.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9f011b00809..6d4256893a1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-06-01 Ian Lance Taylor <iant@google.com>
+
+ * gcc.dg/Wstrict-overflow-17.c: New test.
+
2007-06-01 Kazu Hirata <kazu@codesourcery.com>
* gcc.dg/builtin-return-1.c (g): New.
diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c b/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
new file mode 100644
index 00000000000..5625bc2a7f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
+
+/* This erroneously gave an overflow warning. */
+
+extern void bar (char);
+void
+foo (char *s)
+{
+ int len, i;
+
+ for (len = 1; len < 5000; ++len)
+ {
+ for (i = 0; i < len; ++i)
+ {
+ if (s[i] != '\0')
+ bar (s[i]);
+ }
+ }
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 80744d67968..e0a55a86eac 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4676,8 +4676,8 @@ compare_name_with_value (enum tree_code comp, tree var, tree val,
equiv_vr = get_vr_for_comparison (SSA_NAME_VERSION (var));
sop = false;
retval = compare_range_with_value (comp, &equiv_vr, val, &sop);
- if (sop)
- used_strict_overflow = 1;
+ if (retval)
+ used_strict_overflow = sop ? 1 : 0;
/* If the equiv set is empty we have done all work we need to do. */
if (e == NULL)