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

--- Comment #6 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:2946b3a77880a9f0ba108e76d34a4b656bb4b1ca

commit r17-985-g2946b3a77880a9f0ba108e76d34a4b656bb4b1ca
Author: Tobias Burnus <[email protected]>
Date:   Fri May 29 16:51:18 2026 +0200

    OpenMP: Reject omp_{cgroup,pteam,thread}_mem_alloc for static vars in
ALLOCATE directive [PR122892]

    Using omp_{cgroup,pteam,thread}_mem_alloc for static variables was not
    very useful as currently worded in the spec; hence, OpenMP 6.1 will
    disallow it also for for local static variables, OpenMP 6.0 already
    disallowed for other static variables. Cf. OpenMP specification
    issue #4665.

    For Fortran, the check is modified while for C the check was completely
    missing. Both has been rectified by this commit. For C++, the allocate
    directive still has to be added.

            PR c/122892

    gcc/c/ChangeLog:

            * c-parser.cc (c_parser_omp_allocate): Reject
            omp_{cgroup,pteam,thread}_mem_alloc for static variables.

    gcc/fortran/ChangeLog:

            * openmp.cc (gfc_resolve_omp_allocate): Reject
            omp_{cgroup,pteam,thread}_mem_alloc also for local static
            variables.

    gcc/ChangeLog:

            * gimplify.cc (gimplify_scan_omp_clauses): Update for removed
            plural -S in GOMP_OMP_PREDEF_ALLOC_THREAD.

    include/ChangeLog:

            * gomp-constants.h (GOMP_OMP_PREDEF_ALLOC_THREADS): Rename to ...
            (GOMP_OMP_PREDEF_ALLOC_THREAD): ... this.
            (GOMP_OMP_PREDEF_ALLOC_CGROUP, GOMP_OMP_PREDEF_ALLOC_PTEAM): Define
            with the value of omp_{cgroup,pteam}_mem_alloc

    libgomp/ChangeLog:

            * allocator.c (_Static_assert): Add asserts for the values of
            GOMP_OMP_PREDEF_ALLOC_CGROUP and GOMP_OMP_PREDEF_ALLOC_PTEAM.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/gomp/allocate-static-3.f90: Modify to also
            disallow local static variables.
            * c-c++-common/gomp/allocate-20.c: New test.

Reply via email to