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

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

https://gcc.gnu.org/g:800227516cf3d407ef17e7206b8bebe2d29f4dc1

commit r17-1467-g800227516cf3d407ef17e7206b8bebe2d29f4dc1
Author: Chung-Lin Tang <[email protected]>
Date:   Wed Jun 10 14:29:06 2026 +0000

    Fortran/OpenMP: Fix POINTER array mis-privatization [PR122910]

    This patch fixes a case where POINTER attribute arrays are deep copied
    when not supposed to. Namely, OpenMP states for the "firstprivate Clause":

     "If an original list item has the POINTER attribute, the new list
      items receive the same association status as the original list
      item, as if by pointer assignment."

    This creates a new langhook 'omp_array_data_privatize' to differentiate
    cases in certain places during omp-low.

            PR fortran/122910

    gcc/fortran/ChangeLog:

            * f95-lang.cc (LANG_HOOKS_OMP_ARRAY_DATA_PRIVATIZE): Define as
            gfc_omp_array_data_privatize.
            * trans-openmp.cc (gfc_omp_array_data_privatize): New function.
            * trans.h (gfc_omp_array_data_privatize): New declaration.

    gcc/ChangeLog:

            * langhooks-def.h (LANG_HOOKS_OMP_ARRAY_DATA_PRIVATIZE): Define.
            * langhooks.h (struct lang_hooks_for_decls): Define
            omp_array_data_privatize hook.
            * omp-low.cc (scan_sharing_clauses): Add new calls to
            lang_hooks.decls.omp_array_data_privatize,
            (lower_omp_target): Likewise.

    libgomp/ChangeLog:
            * testsuite/libgomp.fortran/pr122910.f90: New test.

    Reviewed-by: Tobias Burnus <[email protected]>

Reply via email to