]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/27136 (Compile failure with -O -ffast-math)
authorRichard Guenther <rguenther@suse.de>
Tue, 9 May 2006 16:01:53 +0000 (16:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 9 May 2006 16:01:53 +0000 (16:01 +0000)
2006-05-09  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/27136
* tree-ssa-loop-niter.c (get_val_for): Correct function
comment, assert requirements.
(loop_niter_by_eval): Stop processing if the iterated
value did not simplify.

* gcc.dg/torture/pr27136.c: New testcase.

From-SVN: r113657

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr27136.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.c

index 0c5f5893ac26d2401b20aa51082846f8796b808b..be18f843ad61d8578fe467e2c276535a2c6baf91 100644 (file)
@@ -1,3 +1,11 @@
+2006-05-09  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/27136
+       * tree-ssa-loop-niter.c (get_val_for): Correct function
+       comment, assert requirements.
+       (loop_niter_by_eval): Stop processing if the iterated
+       value did not simplify.
+
 2006-05-03  Roger Sayle  <roger@eyesopen.com>
 
        PR c/25309
index 3644eff079b3646429695118009693c7f3e5b7fe..97da8e57a6361ee7832f283b036d510bb148b9be 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-09  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/27136
+       * gcc.dg/torture/pr27136.c: New testcase.
+
 2006-05-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * g++.dg/template/incomplete2.C: Fix error marker.
diff --git a/gcc/testsuite/gcc.dg/torture/pr27136.c b/gcc/testsuite/gcc.dg/torture/pr27136.c
new file mode 100644 (file)
index 0000000..32b7bf1
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-ffast-math" } */
+
+void foo()
+{
+  double x;
+
+  for (x = 2; x < 10; x *= x)
+    ;
+}
index 58a00e4c74e5da9126c14b6a36dec4715e02bf43..b994b5b1f384e1d00dfa11461f9d192038bb1ac3 100644 (file)
@@ -947,7 +947,7 @@ get_base_for (struct loop *loop, tree x)
 
 /* Given an expression X, then 
  
-   * if BASE is NULL_TREE, X must be a constant and we return X.
+   * if X is NULL_TREE, we return the constant BASE.
    * otherwise X is a SSA name, whose value in the considered loop is derived
      by a chain of operations with constant from a result of a phi node in
      the header of the loop.  Then we return value of X when the value of the
@@ -960,6 +960,8 @@ get_val_for (tree x, tree base)
   use_optype uses;
   use_operand_p op;
 
+  gcc_assert (is_gimple_min_invariant (base));
+
   if (!x)
     return base;
 
@@ -1057,7 +1059,11 @@ loop_niter_by_eval (struct loop *loop, edge exit)
        }
 
       for (j = 0; j < 2; j++)
-       val[j] = get_val_for (next[j], val[j]);
+       {
+         val[j] = get_val_for (next[j], val[j]);
+         if (!is_gimple_min_invariant (val[j]))
+           return chrec_dont_know;
+       }
     }
 
   return chrec_dont_know;