PATCH: Fix a comment typo in gfc_trans_do

FX Coudert fxcoudert@gmail.com
Mon May 21 21:16:00 GMT 2007


Hi H. J.,

Can you try that patch? I strongly believe it might fix the  
regression. If you confirm that it fixes it, I'll commit quickly as  
obvious.

/me gives his "I'm so sorry" look

FX


Index: trans-stmt.c
===================================================================
--- trans-stmt.c        (revision 124910)
+++ trans-stmt.c        (working copy)
@@ -818,8 +818,8 @@ gfc_trans_simple_do (gfc_code * code, st
         body;
cycle_label:
         dovar += step
-       countm1--;
         if (countm1 ==0) goto exit_label;
+       countm1--;
       }
exit_label:
@@ -947,6 +947,10 @@ gfc_trans_do (gfc_code * code)
        gfc_add_expr_to_block (&body, tmp);
      }
+  /* Increment the loop variable.  */
+  tmp = build2 (PLUS_EXPR, type, dovar, step);
+  gfc_add_modify_expr (&body, dovar, tmp);
+
    /* End with the loop condition.  Loop until countm1 == 0.  */
    cond = fold_build2 (EQ_EXPR, boolean_type_node, countm1,
                       build_int_cst (utype, 0));
@@ -955,10 +959,6 @@ gfc_trans_do (gfc_code * code)
                      cond, tmp, build_empty_stmt ());
    gfc_add_expr_to_block (&body, tmp);
-  /* Increment the loop variable.  */
-  tmp = build2 (PLUS_EXPR, type, dovar, step);
-  gfc_add_modify_expr (&body, dovar, tmp);
-
    /* Decrement the loop count.  */
    tmp = build2 (MINUS_EXPR, utype, countm1, build_int_cst (utype, 1));
    gfc_add_modify_expr (&body, countm1, tmp);



More information about the Fortran mailing list