X-Git-Url: https://gcc.gnu.org/git/?a=blobdiff_plain;f=gcc%2Ffortran%2Ftrans-stmt.c;h=6670f543609d4069fbc75a0bedb729412f4ef58b;hb=a8e12e4d7509326a298a3ddd39fb0d2746811ff2;hp=55543182f8d32ec9e218a40633b76f22f4f46e2c;hpb=364667a1ca156f8b6b5fb682cbd423108d6f223c;p=gcc.git diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 55543182f8d3..6670f543609d 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -37,8 +37,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "trans-const.h" #include "arith.h" -int has_alternate_specifier; - typedef struct iter_info { tree var; @@ -206,6 +204,7 @@ tree gfc_trans_call (gfc_code * code) { gfc_se se; + int has_alternate_specifier; /* A CALL starts a new block because the actual arguments may have to be evaluated first. */ @@ -213,10 +212,10 @@ gfc_trans_call (gfc_code * code) gfc_start_block (&se.pre); gcc_assert (code->resolved_sym); - has_alternate_specifier = 0; /* Translate the call. */ - gfc_conv_function_call (&se, code->resolved_sym, code->ext.actual); + has_alternate_specifier + = gfc_conv_function_call (&se, code->resolved_sym, code->ext.actual); /* A subroutine without side-effect, by definition, does nothing! */ TREE_SIDE_EFFECTS (se.expr) = 1; @@ -1365,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;