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

OpenMP/Fortran: Support 'simdlen' scaled modifier and enforce const checks

Adds support for the 'scaled' modifier in Fortran's OpenMP 'simdlen' clause and enforces constant expressions for relevant length modifiers.

This commit extends OpenMP support in Fortran to include the ‘scaled’ modifier for the simdlen clause in simd and declare simd directives. The ‘scaled’ modifier allows specifying a numeric type and an optional divisor expression. The change also enforces that divisor_expr and length_expr must be constant and greater than or equal to 1. Additionally, it fixes a bug in module file handling where simdlen was not consistently read, and refines expression resolution functions to better enforce constantness requirements.

In Details

This patch introduces support for the simdlen( [ scaled(type-name [, divisor_expr]) : ] length_expr) syntax in Fortran OpenMP. It modifies gfortran.h to include new fields for simdlen_type and simdlen_divisor. In module.cc, mio_omp_declare_simd_clauses is updated to correctly read the simdlen token from module files, fixing an issue where it was previously written but not consumed. The resolve_positive_int_expr and resolve_nonnegative_int_expr functions in openmp.cc are enhanced with a WARN argument to enforce constantness, ensuring that simdlen values are compile-time…

For Context
OpenMP
A standardized API for shared-memory parallel programming, allowing developers to easily express parallelism in C, C++, and Fortran.
simdlen clause
An OpenMP clause that specifies the desired length of SIMD (Single Instruction, Multiple Data) vectors for a construct like 'simd' or 'declare simd'.
scaled modifier
A new modifier for the simdlen clause that allows a numeric type and an optional divisor to be specified, influencing the effective SIMD length.
Fortran
A high-level programming language commonly used in scientific and engineering computations, known for its performance and array-handling capabilities.
declare simd
An OpenMP directive that allows a function to be considered for automatic vectorization, even if it's not explicitly marked with 'simd'.
constant expression
An expression whose value can be determined at compile time, rather than at runtime.
module file
In Fortran, a file that stores compiled information about modules, allowing them to be used across different compilation units without recompilation of the module itself.
Filed Under: openmpfortransimdoptimization