aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c12
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.fortran/target-enter-data-2.F9040
4 files changed, 59 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 75540e8..93badc2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-17 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/94635
+ * gimplify.c (gimplify_scan_omp_clauses): Turn MAP_TO_PSET to
+ MAP_DELETE.
+
2020-04-17 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64.c (aarch64_advsimd_ldp_stp_p): New function.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 8cdfae2..2f2c51b 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -8785,10 +8785,14 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
'exit data' - and in particular for 'delete:' - having an 'alloc:'
does not make sense. Likewise, for 'update' only transferring the
data itself is needed as the rest has been handled in previous
- directives. */
- if ((code == OMP_TARGET_EXIT_DATA || code == OMP_TARGET_UPDATE)
- && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
- || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET))
+ directives. However, for 'exit data', the array descriptor needs
+ to be delete; hence, we turn the MAP_TO_PSET into a MAP_DELETE. */
+ if (code == OMP_TARGET_EXIT_DATA
+ && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET)
+ OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_DELETE);
+ else if ((code == OMP_TARGET_EXIT_DATA || code == OMP_TARGET_UPDATE)
+ && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET))
remove = true;
if (remove)
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 8f351f6..ce71ac6 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-17 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/94635
+ * testsuite/libgomp.fortran/target-enter-data-2.F90: New.
+
2020-04-13 Thomas Schwinge <thomas@codesourcery.com>
PR libgomp/92843
diff --git a/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90 b/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90
new file mode 100644
index 0000000..320d8bf
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90
@@ -0,0 +1,40 @@
+! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } }
+!
+! PR middle-end/94635
+ implicit none
+ integer, parameter :: N = 20
+ integer, allocatable, dimension(:) :: my1DPtr
+ integer, dimension(N) :: my1DArr
+ integer :: i
+
+ allocate(my1DPtr(N))
+ my1DPtr = 43
+
+ !$omp target enter data map(alloc: my1DPtr)
+ !$omp target
+ my1DPtr = [(i , i = 1, N)]
+ !$omp end target
+
+ !$omp target map(from: my1DArr)
+ my1DArr = my1DPtr
+ !$omp end target
+ !$omp target exit data map(delete: my1DPtr)
+
+ if (any (my1DArr /= [(i, i = 1, N)])) stop 1
+#if MEM_SHARED
+ if (any (my1DArr /= my1DPtr)) stop 2
+#else
+ if (any (43 /= my1DPtr)) stop 3
+#endif
+
+ my1DPtr = [(2*N-i, i = 1, N)]
+ my1DArr = 42
+
+ !$omp target map(tofrom: my1DArr) map(tofrom: my1DPtr(:))
+ my1DArr = my1DPtr
+ my1DPtr = 20
+ !$omp end target
+
+ if (any (my1DArr /= [(2*N-i, i = 1, N)])) stop 4
+ if (any (20 /= my1DPtr)) stop 6
+end