]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP/Fortran: Reject ALLOCATE on non-local static variables with trait:cgroup/pteam...
authorTobias Burnus <tburnus@baylibre.com>
Fri, 28 Nov 2025 10:44:41 +0000 (11:44 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Fri, 28 Nov 2025 10:44:41 +0000 (11:44 +0100)
commit67b143a07bac3df9542b3a474bb2ffe6160da22c
treed0ce19d9238e2f8019060f8963e444a72b5c42ee
parent0367efb112795290831bbc3eff181707fdfcc52c
OpenMP/Fortran: Reject ALLOCATE on non-local static variables with trait:cgroup/pteam/thread [PR122892]

OpenMP 6.0 clarified that static-storage objects may only specify the
omp_cgroup_mem_alloc, omp_pteam_mem_alloc, or omp_thread_mem_alloc allocator
inside a BLOCK or procedure. Let's check for this for Fortran.

PR c/122892

gcc/fortran/ChangeLog:

* openmp.cc (gfc_resolve_omp_allocate): Reject non-local
static variables with cgroup/pteam/thread allocators.
* parse.cc: Permit OMP ALLOCATE in BLOCK DATA.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/allocate-15.f90: Use another allocator as
omp_{cgroup,pteam}_mem_alloc is invalid for non-local static vars.
* gfortran.dg/gomp/allocate-7.f90: Likewise.
* gfortran.dg/gomp/allocate-static-3.f90: New test.
gcc/fortran/openmp.cc
gcc/fortran/parse.cc
gcc/testsuite/gfortran.dg/gomp/allocate-15.f90
gcc/testsuite/gfortran.dg/gomp/allocate-7.f90
gcc/testsuite/gfortran.dg/gomp/allocate-static-3.f90 [new file with mode: 0644]