GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/fortran/openmp

OpenMP/Fortran: Restore non-const expr for 'priority' clause

Fortran OpenMP 'priority' clause now accepts non-constant expressions again, reverting a change that conformed to a later standard.

This commit partially reverts a change that required the ‘priority’ clause in Fortran OpenMP directives to use a constant expression. The ‘priority’ clause now accepts non-constant expressions again, aligning with behavior in OpenMP versions prior to 5.2, which is considered a syntax conversion bug.

In Details

The resolve_omp_clauses function in openmp.cc is modified to permit non-constant expressions for the 'priority' clause. This partially reverts r17-5077-g8bb7a53a0df5c5, addressing OpenMP Issue 5176, which mandated constant expressions for 'priority' since OpenMP 5.2, whereas earlier versions (since 4.5) allowed non-constant ones. Tests masked-1.f90 and taskloop-1.f90 are reverted, and taskloop-2.f90 is updated.

For Context
OpenMP
An API for shared-memory parallel programming, primarily used in C, C++, and Fortran. It uses directives to specify parallel regions and work-sharing constructs.
priority clause
An OpenMP clause that can be used with directives like 'task' or 'taskloop' to suggest a relative execution priority for tasks.
constant expression
An expression that can be evaluated to a constant value at compile time.
Filed Under: fortranopenmpcompiler