From: Steven Bosscher Date: Sat, 22 Jul 2006 17:55:35 +0000 (+0000) Subject: re PR fortran/28439 ([4.1 only] Multiple evaluations of arithmetic if condition) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ec1334b94435a794e486bd94ea20b4b171d8cb2;p=gcc.git re PR fortran/28439 ([4.1 only] Multiple evaluations of arithmetic if condition) 2006-07-22 Steven Bosscher PR fortran/28439 * trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition once. From-SVN: r115677 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3f9f928d852..ad63dd19bbb 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2006-07-22 Steven Bosscher + + PR fortran/28439 + * trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition once. + 2006-07-16 Jakub Jelinek PR fortran/28390 diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index a12316688cb..97cb747ee54 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -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);