Follow-up to my 'lastprivate(conditional:' patch for a left-over problem which I kind mostly missed. Checking the dump also shows that it now works as expected.
OK? Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Fortran: Fix for OpenMP's 'lastprivate(conditional:' gcc/fortran/ChangeLog: * trans-openmp.c (gfc_trans_omp_do): Fix 'lastprivate(conditional:'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/lastprivate-conditional-3.f90: Enable some previously disabled 'lastprivate(conditional:' dg-warnings. gcc/fortran/trans-openmp.c | 2 ++ gcc/testsuite/gfortran.dg/gomp/lastprivate-conditional-3.f90 | 12 ++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 98702b1aa22..7891a7e651b 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -4570,6 +4570,8 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock, { tree l = build_omp_clause (input_location, OMP_CLAUSE_LASTPRIVATE); + if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)) + OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (l) = 1; OMP_CLAUSE_DECL (l) = dovar_decl; OMP_CLAUSE_CHAIN (l) = omp_clauses; OMP_CLAUSE_LASTPRIVATE_STMT (l) = tmp; diff --git a/gcc/testsuite/gfortran.dg/gomp/lastprivate-conditional-3.f90 b/gcc/testsuite/gfortran.dg/gomp/lastprivate-conditional-3.f90 index 720fe9b64a8..932249c9225 100644 --- a/gcc/testsuite/gfortran.dg/gomp/lastprivate-conditional-3.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/lastprivate-conditional-3.f90 @@ -27,14 +27,12 @@ subroutine foo end do !$omp end parallel - ! Error in eqiv. C code: "conditional 'lastprivate' on loop iterator 'i' ignored" - !$omp parallel do lastprivate (conditional: i) + !$omp parallel do lastprivate (conditional: i) ! { dg-warning "conditional 'lastprivate' on loop iterator 'i' ignored" } do i = 1, 32 end do !$omp end parallel do - ! Error in eqiv. C code: "conditional 'lastprivate' on loop iterator 'i' ignored" - !$omp parallel do collapse (3) lastprivate (conditional: i) + !$omp parallel do collapse (3) lastprivate (conditional: i) ! { dg-warning "conditional 'lastprivate' on loop iterator 'i' ignored" } do i = 1, 32 do j = 1, 32 do k = 1, 32 @@ -43,8 +41,7 @@ subroutine foo end do !$omp end parallel do - ! Error in eqiv. C code: "conditional 'lastprivate' on loop iterator 'j' ignored" - !$omp parallel do collapse (3) lastprivate (conditional: j) + !$omp parallel do collapse (3) lastprivate (conditional: j) ! { dg-warning "conditional 'lastprivate' on loop iterator 'j' ignored" } do i = 1, 32 do j = 1, 32 do k = 1, 32 @@ -53,8 +50,7 @@ subroutine foo end do !$omp end parallel do - ! Error in eqiv. C code: "conditional 'lastprivate' on loop iterator 'k' ignored" - !$omp parallel do collapse (3) lastprivate (conditional: k) + !$omp parallel do collapse (3) lastprivate (conditional: k) ! { dg-warning "conditional 'lastprivate' on loop iterator 'k' ignored" } do i = 1, 32 do j = 1, 32 do k = 1, 32