[Bug middle-end/116107] [OpenMP] Array-section mapping with 'declare target' link accesses the wrong data
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 29 09:41:11 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116107
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:
https://gcc.gnu.org/g:14c47e7eb06e8b95913794f6059560fc2fa6de91
commit r15-2377-g14c47e7eb06e8b95913794f6059560fc2fa6de91
Author: Tobias Burnus <tburnus@baylibre.com>
Date: Mon Jul 29 11:40:38 2024 +0200
libgomp: Fix declare target link with offset array-section mapping
[PR116107]
Assume that 'int var[100]' is 'omp declare target link(var)'. When now
mapping an array section with offset such as 'map(to:var[20:10])',
the device-side link pointer has to store &<device-storage-data>[0] minus
the offset such that var[20] will access <device-storage-data>[0]. But
the offset calculation was missed such that the device-side 'var' pointed
to the first element of the mapped data - and var[20] points beyond at
some invalid memory.
PR middle-end/116107
libgomp/ChangeLog:
* target.c (gomp_map_vars_internal): Honor array mapping offsets
with declare-target 'link' variables.
* testsuite/libgomp.c-c++-common/target-link-2.c: New test.
More information about the Gcc-bugs
mailing list