diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-02-15 11:17:40 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-02-15 11:18:31 +0100 |
commit | c7a9655be60cb4f224d1e5906bfe8ae227b5a3a0 (patch) | |
tree | 2352ef12c4be99d6147b9404b4abddfe9a3a3a76 /libgomp/target.c | |
parent | 3f71b82596e992eb6e53fe9bbd70a4b52bc908e8 (diff) | |
download | gcc-c7a9655be60cb4f224d1e5906bfe8ae227b5a3a0.zip gcc-c7a9655be60cb4f224d1e5906bfe8ae227b5a3a0.tar.gz gcc-c7a9655be60cb4f224d1e5906bfe8ae227b5a3a0.tar.bz2 |
libgomp: Fix 'target enter data' with always pointer
As GOMP_MAP_ALWAYS_POINTER operates on the previous map item, ensure that
with 'target enter data' both are passed together to gomp_map_vars_internal.
libgomp/ChangeLog:
* target.c (gomp_map_vars_internal): Add 'i > 0' before doing a
kind check.
(GOMP_target_enter_exit_data): If the next map item is
GOMP_MAP_ALWAYS_POINTER map it together with the current item.
* testsuite/libgomp.fortran/target-enter-data-3.f90: New test.
Diffstat (limited to 'libgomp/target.c')
-rw-r--r-- | libgomp/target.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libgomp/target.c b/libgomp/target.c index c1682ca..b4ea2c5 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -1480,8 +1480,9 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, gomp_mutex_unlock (&devicep->lock); gomp_fatal ("always pointer not mapped"); } - if ((get_kind (short_mapkind, kinds, i - 1) & typemask) - != GOMP_MAP_ALWAYS_POINTER) + if (i > 0 + && ((get_kind (short_mapkind, kinds, i - 1) & typemask) + != GOMP_MAP_ALWAYS_POINTER)) cur_node.tgt_offset = gomp_map_val (tgt, hostaddrs, i - 1); if (cur_node.tgt_offset) cur_node.tgt_offset -= sizes[i]; @@ -4085,7 +4086,10 @@ GOMP_target_enter_exit_data (int device, size_t mapnum, void **hostaddrs, GOMP_MAP_VARS_ENTER_DATA); i += j - i - 1; } - else if (i + 1 < mapnum && (kinds[i + 1] & 0xff) == GOMP_MAP_ATTACH) + else if (i + 1 < mapnum + && ((kinds[i + 1] & 0xff) == GOMP_MAP_ATTACH + || ((kinds[i + 1] & 0xff) == GOMP_MAP_ALWAYS_POINTER + && (kinds[i] & 0xff) != GOMP_MAP_ALWAYS_POINTER))) { /* An attach operation must be processed together with the mapped base-pointer list item. */ |