This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/28439] Multiple evaluations of arithmetic if condition



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]