From 689418b97e5eb6a221871a2439bca3e6283ac579 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 31 Mar 2020 20:38:38 +0200 Subject: =?UTF-8?q?libgomp=20=E2=80=93=20fix=20handling=20of=20'target=20e?= =?UTF-8?q?nter=20data'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * target.c (GOMP_target_enter_exit_data): Handle PSET/MAP_POINTER. * testsuite/libgomp.fortran/target-enter-data-1.f90: New. --- libgomp/target.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libgomp/target.c') 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); -- cgit v1.1