From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12630 invoked by alias); 19 Jul 2006 23:08:20 -0000 Received: (qmail 12587 invoked by uid 48); 19 Jul 2006 23:08:13 -0000 Date: Wed, 19 Jul 2006 23:08:00 -0000 Message-ID: <20060719230813.12586.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/28439] Multiple evaluations of arithmetic if condition In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "steven at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-07/txt/msg01546.txt.bz2 List-Id: ------- Comment #4 from steven at gcc dot gnu dot org 2006-07-19 23:08 ------- Andrew, you're wrong. :-P My gfortran skills are not what they used to be, but I believe this is the fix: Index: trans-stmt.c =================================================================== --- trans-stmt.c (revision 115467) +++ trans-stmt.c (working copy) @@ -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); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28439