]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgomp.fortran/omp_target_memset.f90 - Avoid implicit mapping by an uninit size...
authorTobias Burnus <tburnus@baylibre.com>
Mon, 3 Nov 2025 17:30:07 +0000 (18:30 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Mon, 3 Nov 2025 17:30:07 +0000 (18:30 +0100)
commit28d20a591ddf1618d75f2b8261ba85bf15a49876
tree47077c2b6bc3c5406ca55c1a90b407aa277dab3b
parent237a83da197adf6d0a70d715812182df77fa5bf7
libgomp.fortran/omp_target_memset.f90 - Avoid implicit mapping by an uninit size [PR122543]

In OpenMP, pointers are implicitly mapped - which means for Fortran that
their pointer target is also mapped. However, for uninitialized memory,
this means that some random pointee with some random amount of memory is
copied - in the good case, size == 0, but if not, odd things can happen.

Solution: Use 'fptr => null()' before the target mapping or - as done here -
declare the pointer inside the region.

libgomp/ChangeLog:

PR libgomp/122543
* testsuite/libgomp.fortran/omp_target_memset.f90: Move fptr inside
the target to avoid implicit mapping of its uninit pointee.
* testsuite/libgomp.fortran/omp_target_memset-2.f90: Likewise.
libgomp/testsuite/libgomp.fortran/omp_target_memset-2.f90
libgomp/testsuite/libgomp.fortran/omp_target_memset.f90