GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
openmp

OpenMP: Disallow omp_mem_alloc for static variables in ALLOCATE directive.

The OpenMP ALLOCATE directive can no longer be used with omp_mem_alloc allocators for static variables, aligning with OpenMP 6.1.

The OpenMP specification is evolving to disallow the use of omp_{cgroup,pteam,thread}_mem_alloc allocators for static variables in the ALLOCATE directive. This commit enforces this restriction in GCC for both Fortran and C, rejecting such usage during compilation. This change aligns GCC’s behavior with the upcoming OpenMP 6.1 specification and the existing restrictions in OpenMP 6.0.

In Details

This change modifies c-parser.cc and openmp.cc to reject omp_{cgroup,pteam,thread}_mem_alloc for static variables in the OpenMP ALLOCATE directive. The change aligns with OpenMP specification issue #4665 and the upcoming OpenMP 6.1 standard. The constant GOMP_OMP_PREDEF_ALLOC_THREADS was renamed to GOMP_OMP_PREDEF_ALLOC_THREAD in gomp-constants.h, and related updates were made in gimplify.cc and allocator.c.

For Context

OpenMP (Open Multi-Processing) is an API that supports multi-platform shared-memory multiprocessing programming in C, C++, and Fortran. It allows developers to easily parallelize code, enabling programs to run faster on multi-core processors. The ALLOCATE directive in OpenMP lets programmers specify custom memory allocators for variables. This commit restricts the use of certain OpenMP memory allocators with static variables to comply with evolving OpenMP standards, ensuring more predictable and maintainable parallel code.

Filed Under: openmpfortrancmemory allocationstandards