public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <fortran@gcc.gnu.org>, Tobias Burnus <tobias@codesourcery.com>
Subject: [PATCH 2/7] [og10] openacc: Use class_pointer instead of pointer attribute for class types
Date: Wed, 24 Feb 2021 13:57:23 -0800	[thread overview]
Message-ID: <20210224215726.129681-3-julian@codesourcery.com> (raw)
In-Reply-To: <20210224215726.129681-1-julian@codesourcery.com>

Elsewhere in the Fortran front-end, the class_pointer attribute is
used for BT_CLASS entities instead of the pointer attribute. This patch
follows suit for OpenACC. I couldn't actually come up with a test case
where this makes a difference (i.e., where "class_pointer" and "pointer"
have different values at this point in the code), but this may nonetheless
fix a latent bug.

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
	for BT_CLASS.

(cherry picked from commit f743fe231663e32d52db987650d0ec3381a777af)
---
 gcc/fortran/ChangeLog.omp  | 7 +++++++
 gcc/fortran/trans-openmp.c | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 9e0cf7198acf..2dd82a70cb71 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,10 @@
+2021-02-24  Julian Brown  <julian@codesourcery.com>
+
+	Backport from mainline
+
+	* trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
+	for BT_CLASS.
+
 2021-02-24  Julian Brown  <julian@codesourcery.com>
 
 	Backport from mainline
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index e53f7ebb7d7f..d0e299b02142 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -2973,7 +2973,10 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		  if (lastcomp->u.c.component->ts.type == BT_DERIVED
 		      || lastcomp->u.c.component->ts.type == BT_CLASS)
 		    {
-		      if (sym_attr.pointer || (openacc && sym_attr.allocatable))
+		      bool pointer
+			= (lastcomp->u.c.component->ts.type == BT_CLASS
+			   ? sym_attr.class_pointer : sym_attr.pointer);
+		      if (pointer || (openacc && sym_attr.allocatable))
 			{
 			  tree data, size;
 
-- 
2.29.2


  parent reply	other threads:[~2021-02-24 21:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 21:57 [PATCH 0/7] [og10] openacc: Arrays/derived types/character type backports Julian Brown
2021-02-24 21:57 ` [PATCH 1/7] [og10] openacc: Dereference BT_CLASS data pointers but not BT_DERIVED pointers Julian Brown
2021-02-24 21:57 ` Julian Brown [this message]
2021-02-24 21:57 ` [PATCH 3/7] [og10] openacc: Character types and mixed arrays/derived type tests Julian Brown
2021-02-24 21:57 ` [PATCH 4/7] [og10] Fortran: OpenMP/OpenACC diagnose substring rejections better Julian Brown
2021-02-25 15:30 ` [OG10] backport an additional commit – was: [PATCH 0/7] [og10] openacc: Arrays/derived types/character type backports Tobias Burnus

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=20210224215726.129681-3-julian@codesourcery.com \
    --to=julian@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@codesourcery.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).