From a8e12e4d7509326a298a3ddd39fb0d2746811ff2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Schl=C3=BCter?= Date: Mon, 13 Jun 2005 20:23:46 +0200 Subject: [PATCH 1/1] re PR fortran/22038 (Forall with mask broken) fortran/ 2005-06-13 Jakub Jelinek PR fortran/22038 * trans-stmt.c (gfc_trans_forall_loop): Only increment maskindex in the innermost loop. testsuite/ 2005-06-13 Tobias Schl"uter PR fortran/22038 * gfortran.dg/forall_1.f90: Un-XFAIL. From-SVN: r100887 --- gcc/fortran/ChangeLog | 8 +++++++- gcc/fortran/trans-stmt.c | 5 +++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/forall_1.f90 | 3 +-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4bd62d10febc..309aff1fe663 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2005-06-13 Jakub Jelinek + + PR fortran/22038 + * trans-stmt.c (gfc_trans_forall_loop): Only increment maskindex + in the innermost loop. + 2005-06-12 Richard Henderson * trans-array.c (gfc_conv_descriptor_data_get): Rename from @@ -18,7 +24,7 @@ * trans-array.h (gfc_conv_descriptor_data_get): Declare. (gfc_conv_descriptor_data_set, gfc_conv_descriptor_data_addr): Declare. -2005-06-11 Tobias Schl"uter +2005-06-12 Tobias Schl"uter * trans-expr.c (gfc_conv_variable): POINTER results don't need f2c calling conventions. Look at sym instead of sym->result. diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 46a69d461487..6670f543609d 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fb457e66516..a0c560f4a008 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-06-13 Tobias Schl"uter + + PR fortran/22038 + * gfortran.dg/forall_1.f90: Un-XFAIL. + 2005-06-13 Nathan Sidwell PR c++/21929 diff --git a/gcc/testsuite/gfortran.dg/forall_1.f90 b/gcc/testsuite/gfortran.dg/forall_1.f90 index e425c4cd4119..35fcfdd7fd2e 100644 --- a/gcc/testsuite/gfortran.dg/forall_1.f90 +++ b/gcc/testsuite/gfortran.dg/forall_1.f90 @@ -1,6 +1,5 @@ -! { dg-do run { xfail *-*-* } } +! { dg-do run } ! tests FORALL statements with a mask -! unfortunately, this is broken, PR 22038 dimension i2(15,10), i1(15) type a sequence -- 2.43.5