From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Thomas Schwinge <thomas@codesourcery.com>, <fortran@gcc.gnu.org>,
Jakub Jelinek <jakub@redhat.com>,
Tobias Burnus <tobias@codesourcery.com>,
"Moore, Catherine" <Catherine_Moore@mentor.com>
Subject: [PATCH 1/9] [OpenACC] Fortran derived-type mapping fix
Date: Tue, 16 Jun 2020 15:38:31 -0700 [thread overview]
Message-ID: <54822b42a9e8e1d04d447ba5276ed6c7510e51d7.1592343756.git.julian@codesourcery.com> (raw)
In-Reply-To: <cover.1592343756.git.julian@codesourcery.com>
This is a slightly-updated version of the patch sent here, with some of
Thomas's suggestions incorporated:
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547407.html
I'm still assuming this is approved, but including for completeness.
Julian
ChangeLog
gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Use 'inner' not 'decl' for
derived type members which themselves have derived types.
gcc/testsuite/
* gfortran.dg/goacc/mapping-tests-3.f90: New test.
* gfortran.dg/goacc/mapping-tests-4.f90: New test.
---
gcc/fortran/trans-openmp.c | 4 ++--
.../gfortran.dg/goacc/mapping-tests-3.f90 | 15 +++++++++++++++
.../gfortran.dg/goacc/mapping-tests-4.f90 | 17 +++++++++++++++++
3 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90
create mode 100644 gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 7e2f6256c43..02c40fdc660 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -2774,9 +2774,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
}
else
{
- OMP_CLAUSE_DECL (node) = decl;
+ OMP_CLAUSE_DECL (node) = inner;
OMP_CLAUSE_SIZE (node)
- = TYPE_SIZE_UNIT (TREE_TYPE (decl));
+ = TYPE_SIZE_UNIT (TREE_TYPE (inner));
}
}
else if (lastcomp->next
diff --git a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90
new file mode 100644
index 00000000000..890ca781967
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90
@@ -0,0 +1,15 @@
+! { dg-additional-options "-fdump-tree-gimple" }
+
+subroutine foo
+ type one
+ integer i, j
+ end type
+ type two
+ type(one) A, B
+ end type
+
+ type(two) x
+
+ !$acc enter data copyin(x%A)
+! { dg-final { scan-tree-dump-times "omp target oacc_enter_exit_data map\\(struct:x \\\[len: 1\\\]\\) map\\(to:x.a \\\[len: \[0-9\]+\\\]\\)" 1 "gimple" } }
+end
diff --git a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90 b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90
new file mode 100644
index 00000000000..17cc4841d4e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90
@@ -0,0 +1,17 @@
+subroutine foo
+ type one
+ integer i, j
+ end type
+ type two
+ type(one) A, B
+ end type
+
+ type(two) x
+
+! This is accepted at present, although it represents a probably-unintentional
+! overlapping subcopy.
+ !$acc enter data copyin(x%A, x%A%i)
+! But this raises an error.
+ !$acc enter data copyin(x%A, x%A%i, x%A%i)
+! { dg-error ".x.a.i. appears more than once in map clauses" "" { target *-*-* } .-1 }
+end
--
2.23.0
next prev parent reply other threads:[~2020-06-16 22:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 22:38 [PATCH 0/9] [OpenACC] Refcounting and manual deep copy improvements Julian Brown
2020-06-16 22:38 ` Julian Brown [this message]
2020-06-16 22:38 ` [PATCH 2/9] [OpenACC] GOMP_MAP_ATTACH handling in find_group_last Julian Brown
2020-06-30 12:42 ` Thomas Schwinge
2020-06-16 22:38 ` [PATCH 3/9] [OpenACC] Adjust dynamic reference count semantics Julian Brown
2020-06-30 13:51 ` Thomas Schwinge
2020-07-03 15:41 ` Thomas Schwinge
2020-07-10 12:08 ` Julian Brown
2020-06-16 22:38 ` [PATCH 4/9] [OpenACC] Don't pass kind array via pointer to goacc_enter_datum Julian Brown
2020-06-16 22:39 ` [PATCH 5/9] [OpenACC] Fix incompatible copyout for acc_map_data (PR92843) Julian Brown
2020-06-16 22:39 ` [PATCH 6/9] [OpenACC] Set bias to zero for explicit attach/detach clauses in C and C++ Julian Brown
2020-06-25 11:36 ` Thomas Schwinge
2020-07-09 21:06 ` Thomas Schwinge
2020-07-09 21:32 ` Julian Brown
2020-06-16 22:39 ` [PATCH 7/9] [OpenACC] Do not strip GOMP_MAP_TO_PSET/GOMP_MAP_POINTER for enter/exit data directives Julian Brown
2020-07-06 16:19 ` Thomas Schwinge
2020-06-16 22:39 ` [PATCH 8/9] [OpenACC] Fix standalone attach for Fortran assumed-shape array pointers Julian Brown
2020-07-14 11:43 ` Thomas Schwinge
2020-07-15 10:28 ` Thomas Schwinge
2020-07-17 11:16 ` Thomas Schwinge
2020-07-27 14:33 ` Julian Brown
2020-07-30 9:53 ` Thomas Schwinge
2020-07-30 20:15 ` Julian Brown
2020-06-16 22:39 ` [PATCH 9/9] [OpenACC] Don't detach for no-op exit data with zero dynamic refcount Julian Brown
2020-07-24 14:18 ` Thomas Schwinge
2020-07-24 22:53 ` Julian Brown
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=54822b42a9e8e1d04d447ba5276ed6c7510e51d7.1592343756.git.julian@codesourcery.com \
--to=julian@codesourcery.com \
--cc=Catherine_Moore@mentor.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=thomas@codesourcery.com \
--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).