public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>, fortran <fortran@gcc.gnu.org>
Subject: [Patch] Fortran: Fix for OpenMP's 'lastprivate(conditional:'
Date: Tue, 4 Aug 2020 14:26:45 +0200	[thread overview]
Message-ID: <f3a7d91d-d1e5-a2fd-4b7d-52295b9a42ee@codesourcery.com> (raw)

[-- 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

             reply	other threads:[~2020-08-04 12:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 12:26 Tobias Burnus [this message]
2020-08-04 12:37 ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3a7d91d-d1e5-a2fd-4b7d-52295b9a42ee@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).