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

--- Comment #3 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:9e2e40f4ed8f0797963a0166d2568d23c2d25024

commit r17-2448-g9e2e40f4ed8f0797963a0166d2568d23c2d25024
Author: Tobias Burnus <[email protected]>
Date:   Thu Jul 16 12:11:38 2026 +0200

    OpenMP: uses_allocators - fix Fortran memspace use + multiple clauses
[PR126279]

    The memspace modifier to uses_allocators was converted in Fortran not to an
    integer number but to an external variable - which failed then at link
time.

    Additionally, it turned out that - at least with host fallback - multiple
    uses_allocator clauses aren't supported as newer ones overrode previous
ones;
    shifting it by gomp_omp_allocator_data_size data helped.

    OpenMP requires 'a constant array, have constant values' for C/C++ and for
    Fortran a 'named constant of rank one'; it turned out that the FEs already
    generate, e.g.
       static struct omp_alloctrait_t traits[1] = {{.key=2, .value=1024}};
    which can be directly passed to the runtime library - no need to expand the
    initializer values into a new variable and then take the address of that
one.

    For C/C++, this might be new since commit r17-2414-g9e9e22587f7954
    that set calls 'mark_exp_read' to avoid an 'unused but set' warning for the
    traits variable [not checked] - but in any case it is now consistent.

            PR fortran/126279

    gcc/fortran/ChangeLog:

            * trans-openmp.cc (gfc_trans_omp_clauses): Convert memspace
constant
            to an integer not to an external variable.

    gcc/ChangeLog:

            * omp-low.cc (lower_omp_target): Avoid creating a second static
const
            variable for the trait array used by uses_allocators.

    libgomp/ChangeLog:

            * target.c (copy_firstprivate_data): After storing 
users_allocators'
            allocator, shift the offset by its storage size to avoid
overriding.
            * testsuite/libgomp.fortran/uses_allocators-1.f90: Use kind
c_size_t
            instead of kind 8 for 32bit compatibility.
            * testsuite/libgomp.fortran/uses_allocators-4.f90: Update expected
            tree dump.
            * testsuite/libgomp.fortran/uses_allocators-7.f90: Extend testcase
now
            that user-defined allocators are supported by uses_allocators.

Reply via email to