https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122543

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <[email protected]>:

https://gcc.gnu.org/g:28d20a591ddf1618d75f2b8261ba85bf15a49876

commit r16-5008-g28d20a591ddf1618d75f2b8261ba85bf15a49876
Author: Tobias Burnus <[email protected]>
Date:   Mon Nov 3 18:30:07 2025 +0100

    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.

Reply via email to