]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/fortran/trans-stmt.c
re PR fortran/22038 (Forall with mask broken)
[gcc.git] / gcc / fortran / trans-stmt.c
index 46a69d461487f8a1c4ed2d26ba190841afef86f8..6670f543609d4069fbc75a0bedb729412f4ef58b 100644 (file)
@@ -1364,8 +1364,9 @@ gfc_trans_forall_loop (forall_info *forall_tmp, int nvar, tree body, int mask_fl
       tmp = build2 (PLUS_EXPR, TREE_TYPE (var), var, step);
       gfc_add_modify_expr (&block, var, tmp);
 
-      /* Advance to the next mask element.  */
-      if (mask_flag)
+      /* Advance to the next mask element.  Only do this for the
+        innermost loop.  */
+      if (n == 0 && mask_flag)
         {
           mask = forall_tmp->mask;
           maskindex = forall_tmp->maskindex;
This page took 0.028225 seconds and 5 git commands to generate.