OSDN Git Service

./:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Jun 2007 22:47:02 +0000 (22:47 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Jun 2007 22:47:02 +0000 (22:47 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125269 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wstrict-overflow-17.c [new file with mode: 0644]
gcc/tree-vrp.c

index ece60c7..87d2444 100644 (file)
@@ -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.
index 9f011b0..6d42568 100644 (file)
@@ -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 (file)
index 0000000..5625bc2
--- /dev/null
@@ -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]);
+       }
+    }
+}
index 80744d6..e0a55a8 100644 (file)
@@ -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)