]> git.ipfire.org Git - people/ms/gcc.git/commit
libgomp: Fix reverse offload issues
authorTobias Burnus <tobias@codesourcery.com>
Fri, 3 Feb 2023 10:46:38 +0000 (11:46 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Fri, 3 Feb 2023 10:46:38 +0000 (11:46 +0100)
commit07cea1a91b417731fd1b63f4a68377aaaecc7cbe
tree13310725ec71a0dea57334ae1b21895bf90d3f0a
parent62cb8efd2ee7fc412d62a426785679dbd50228e4
libgomp: Fix reverse offload issues

If there is nothing to map, skip the mapping and avoid attempting to
copy 0 bytes from addrs, sizes and kinds.

Additionally, it could happen that a non-allocated address was deallocated,
such as a pointer set, leading to a free for the actual data.

libgomp/
* target.c (gomp_target_rev): Handle mapnum == 0 and avoid
freeing not allocated memory.
* testsuite/libgomp.fortran/reverse-offload-6.f90: New test.

(cherry picked from commit 0b1ce70a813b98ef2893779d14ad6c90c5d06a71)
libgomp/ChangeLog.omp
libgomp/target.c
libgomp/testsuite/libgomp.fortran/reverse-offload-6.f90 [new file with mode: 0644]