]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/61184 (wrong code (that hangs) by LTO on x86_64-linux-gnu)
authorRichard Biener <rguenther@suse.de>
Mon, 19 May 2014 12:32:15 +0000 (12:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 19 May 2014 12:32:15 +0000 (12:32 +0000)
2014-05-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/61184
* tree-vrp.c (is_negative_overflow_infinity): Use
TREE_OVERFLOW_P and do that check first.
(is_positive_overflow_infinity): Likewise.
(is_overflow_infinity): Likewise.
(vrp_operand_equal_p): Properly treat operands with
differing overflow as not equal.

* c-c++-common/torture/pr61184.c: New testcase.

From-SVN: r210611

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/torture/pr61184.c [new file with mode: 0644]
gcc/tree-vrp.c

index 57dbd0faa692f9d3584a647079ca4a3b044e67ce..c69a30cff516fe0dad401dbafceca6cef79b47e9 100644 (file)
@@ -1,3 +1,13 @@
+2014-05-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61184
+       * tree-vrp.c (is_negative_overflow_infinity): Use
+       TREE_OVERFLOW_P and do that check first.
+       (is_positive_overflow_infinity): Likewise.
+       (is_overflow_infinity): Likewise.
+       (vrp_operand_equal_p): Properly treat operands with
+       differing overflow as not equal.
+
 2014-05-19  Bernd Schmidt  <bernds@codesourcery.com>
 
        * simplify-rtx.c (simplify_unary_operation_1): Use CONST_INT_P in
index 846ad6d446c600b5c665a3d10d95a612325d22a1..d731eb91da3a2258f9a629f6b9b09e4d7a540ec3 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61184
+       * c-c++-common/torture/pr61184.c: New testcase.
+
 2014-05-19  Christian Bruel  <christian.bruel@st.com>
 
        PR target/61195
diff --git a/gcc/testsuite/c-c++-common/torture/pr61184.c b/gcc/testsuite/c-c++-common/torture/pr61184.c
new file mode 100644 (file)
index 0000000..83117b9
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fno-strict-overflow" } */
+
+short a; 
+
+void
+foo (void)
+{
+  for (a = 0; a >= 0; a++)
+    ;
+}
+
+int
+main ()
+{
+  foo ();
+  return 0;
+}
index 633c329030f604c102fc5b5bb5908dce2d6b6bed..7f0489f3c255d59b76c863c6ffa9319a3e219b5d 100644 (file)
@@ -293,9 +293,8 @@ positive_overflow_infinity (tree type)
 static inline bool
 is_negative_overflow_infinity (const_tree val)
 {
-  return (needs_overflow_infinity (TREE_TYPE (val))
-         && CONSTANT_CLASS_P (val)
-         && TREE_OVERFLOW (val)
+  return (TREE_OVERFLOW_P (val)
+         && needs_overflow_infinity (TREE_TYPE (val))
          && vrp_val_is_min (val));
 }
 
@@ -304,9 +303,8 @@ is_negative_overflow_infinity (const_tree val)
 static inline bool
 is_positive_overflow_infinity (const_tree val)
 {
-  return (needs_overflow_infinity (TREE_TYPE (val))
-         && CONSTANT_CLASS_P (val)
-         && TREE_OVERFLOW (val)
+  return (TREE_OVERFLOW_P (val)
+         && needs_overflow_infinity (TREE_TYPE (val))
          && vrp_val_is_max (val));
 }
 
@@ -315,9 +313,8 @@ is_positive_overflow_infinity (const_tree val)
 static inline bool
 is_overflow_infinity (const_tree val)
 {
-  return (needs_overflow_infinity (TREE_TYPE (val))
-         && CONSTANT_CLASS_P (val)
-         && TREE_OVERFLOW (val)
+  return (TREE_OVERFLOW_P (val)
+         && needs_overflow_infinity (TREE_TYPE (val))
          && (vrp_val_is_min (val) || vrp_val_is_max (val)));
 }
 
@@ -791,9 +788,7 @@ vrp_operand_equal_p (const_tree val1, const_tree val2)
     return true;
   if (!val1 || !val2 || !operand_equal_p (val1, val2, 0))
     return false;
-  if (is_overflow_infinity (val1))
-    return is_overflow_infinity (val2);
-  return true;
+  return is_overflow_infinity (val1) == is_overflow_infinity (val2);
 }
 
 /* Return true, if the bitmaps B1 and B2 are equal.  */