aboutsummaryrefslogtreecommitdiff
path: root/libgomp/target.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-03-31 20:38:38 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-03-31 20:38:38 +0200
commit689418b97e5eb6a221871a2439bca3e6283ac579 (patch)
tree8d4189f370ad62a895722d42beafed401d6472e7 /libgomp/target.c
parent331c438d5a67204bc143d1b0febd51740b2ea32c (diff)
downloadgcc-689418b97e5eb6a221871a2439bca3e6283ac579.zip
gcc-689418b97e5eb6a221871a2439bca3e6283ac579.tar.gz
gcc-689418b97e5eb6a221871a2439bca3e6283ac579.tar.bz2
libgomp – fix handling of 'target enter data'
* target.c (GOMP_target_enter_exit_data): Handle PSET/MAP_POINTER. * testsuite/libgomp.fortran/target-enter-data-1.f90: New.
Diffstat (limited to 'libgomp/target.c')
-rw-r--r--libgomp/target.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libgomp/target.c b/libgomp/target.c
index c99dd51..3642547 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -2480,7 +2480,9 @@ GOMP_target_enter_exit_data (int device, size_t mapnum, void **hostaddrs,
}
}
- size_t i;
+ /* The variables are mapped separately such that they can be released
+ independently. */
+ size_t i, j;
if ((flags & GOMP_TARGET_FLAG_EXIT_DATA) == 0)
for (i = 0; i < mapnum; i++)
if ((kinds[i] & 0xff) == GOMP_MAP_STRUCT)
@@ -2489,6 +2491,15 @@ GOMP_target_enter_exit_data (int device, size_t mapnum, void **hostaddrs,
&kinds[i], true, GOMP_MAP_VARS_ENTER_DATA);
i += sizes[i];
}
+ else if ((kinds[i] & 0xff) == GOMP_MAP_TO_PSET)
+ {
+ for (j = i + 1; j < mapnum; j++)
+ if (!GOMP_MAP_POINTER_P (get_kind (true, kinds, j) & 0xff))
+ break;
+ gomp_map_vars (devicep, j-i, &hostaddrs[i], NULL, &sizes[i],
+ &kinds[i], true, GOMP_MAP_VARS_ENTER_DATA);
+ i += j - i - 1;
+ }
else
gomp_map_vars (devicep, 1, &hostaddrs[i], NULL, &sizes[i], &kinds[i],
true, GOMP_MAP_VARS_ENTER_DATA);