re PR fortran/28439 ([4.1 only] Multiple evaluations of arithmetic if condition)
authorSteven Bosscher <steven@gcc.gnu.org>
Sat, 22 Jul 2006 17:55:35 +0000 (17:55 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 22 Jul 2006 17:55:35 +0000 (17:55 +0000)
2006-07-22  Steven Bosscher  <steven@gcc.gnu.org>

PR fortran/28439
* trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition once.

From-SVN: r115677

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c

index 3f9f928d85232fd51e115d5c251f151b6127d1c4..ad63dd19bbbcf3134de6c979f9b89b94fcce79bb 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-22  Steven Bosscher  <steven@gcc.gnu.org> 
+
+    PR fortran/28439
+       * trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition once.
+
 2006-07-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/28390
index a12316688cb9b12739e1f0d4fca71d37d27204b2..97cb747ee54cb8eef52a12c1c217489b6ce92cb0 100644 (file)
@@ -663,6 +663,7 @@ gfc_trans_arithmetic_if (gfc_code * code)
 
   /* Pre-evaluate COND.  */
   gfc_conv_expr_val (&se, code->expr);
+  se.expr = gfc_evaluate_now (se.expr, &se.pre);
 
   /* Build something to compare with.  */
   zero = gfc_build_const (TREE_TYPE (se.expr), integer_zero_node);