* [Patch] Fortran: Fix for OpenMP's 'lastprivate(conditional:'
@ 2020-08-04 12:26 Tobias Burnus
2020-08-04 12:37 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2020-08-04 12:26 UTC (permalink / raw)
To: gcc-patches, Jakub Jelinek, fortran
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
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
[-- Attachment #2: omp-lastpriv-fix.diff --]
[-- Type: text/x-patch, Size: 2949 bytes --]
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch] Fortran: Fix for OpenMP's 'lastprivate(conditional:'
2020-08-04 12:26 [Patch] Fortran: Fix for OpenMP's 'lastprivate(conditional:' Tobias Burnus
@ 2020-08-04 12:37 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2020-08-04 12:37 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc-patches, fortran
On Tue, Aug 04, 2020 at 02:26:45PM +0200, Tobias Burnus wrote:
> 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?
Ok, thanks.
Note, we'll need to remove the warning when we properly implement the OpenMP
5.1 zero iterations lastprivate conditional semantics, because then there is
a difference between conditional and non-conditional iterators that are
never written in the loop. Assuming it passes 2nd voting today.
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-04 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 12:26 [Patch] Fortran: Fix for OpenMP's 'lastprivate(conditional:' Tobias Burnus
2020-08-04 12:37 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).