https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127723
--- 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:8bb7a53a0df5c5c6eb41ae689cba5e1a7b814875 commit r17-5077-g8bb7a53a0df5c5c6eb41ae689cba5e1a7b814875 Author: Tobias Burnus <[email protected]> Date: Mon Oct 12 08:29:37 2026 +0200 OpenMP/Fortran: Handle simdlen's 'scaled' modifier; for > / >= checks, enforce const check [PR127723] Follow up to commit r17-4947-gfbcafeec06a661 by adding support for Fortran. Namely, the OpenMP simdlen clause to 'simd' and 'declare simd' gained the 'scaled' modifier that accepts a numeric type and an optional divisor expression: simdlen( [ scaled(type-name [, divisor_expr ] ) : ] length_expr) where divisor_expr and length_expr must be >= 1 and constant. In the module handling, there was a preexisting bug that for module-file reading: mio_omp_declare_simd_clauses wrote the keyword "simdlen" to the module file - but did not read it; its caller for 'declare simd' read it but the caller for the 'declare variant' context selector didn't, leading to a read error when 'simdlen' appeared in declare-variant 'match' clause. As resolve_positive_int_expr/resolve_nonnegative_int_expr only warned when the violated the condition - and didn't enforce the constantness, a boolean argument was added such that either an error is printed when not constant or violating the > / >= 0 condition - or non-constant values are accepteded - with (only) a warning when constant and violating the the > / >= 0 condition. (The later matches the current behavior.) Hence, all callers had to be updated, which lead to testcase updates as well (for OpenMP and OpenACC). PR middle-end/127723 gcc/fortran/ChangeLog: * gfortran.h (gfc_omp_clauses): Add simdlen_type and simdlen_divisor for simdlen. * module.cc (mio_omp_declare_simd_clauses): Handle scaled; consume "simdlen" token on reading. (mio_omp_declare_simd): Remove the latter. * openmp.cc (gfc_free_omp_clauses): Free simdlen_divisor. (gfc_match_omp_clauses): Parse 'scaled' modifier to 'simdlen'. (resolve_scalar_int_expr): Return boolean. (resolve_positive_int_expr, resolve_nonnegative_int_expr): Additional boolean WARN argument, if false, require constant argument and fail with an error. (resolve_oacc_loop_blocks): Update positive/nonnegative const argument checking. (resolve_omp_clauses): Likewise; handle simdlen_type/divisor. * trans-openmp.cc (gfc_trans_omp_clauses, gfc_split_omp_clauses): Handle simdlen clause's simdlen_type and simdlen_divisor. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/clauses-1.f90: Fix testcase: priority must be a constant expression. * gfortran.dg/gomp/masked-1.f90: Likewise. * gfortran.dg/gomp/target2.f90: Likewise. * gfortran.dg/gomp/taskloop-1.f90: Likewise. * gfortran.dg/gomp/taskloop-2.f90: Add diagnostic check for a non-const priority. * gfortran.dg/goacc/loop-2-kernels-tile.f95: Update dg-warn/error. * gfortran.dg/goacc/loop-2-parallel-tile.f95: Likewise. * gfortran.dg/goacc/loop-2-serial-tile.f95: Likewise. * gfortran.dg/goacc/tile-1.f90: Likewise. * gfortran.dg/gomp/atomic-18.f90: Likewise. * gfortran.dg/gomp/atomic-2.f90: Likewise. * gfortran.dg/gomp/pr67500.f90: Likewise. * gfortran.dg/gomp/pr77516.f90: Likewise. * gfortran.dg/gomp/tile-7.f90: Likewise. * gfortran.dg/gomp/simdlen-scaled-1.f90: New test. * gfortran.dg/gomp/simdlen-scaled-2.f90: New test. * gfortran.dg/gomp/simdlen-scaled-3.f90: New test. * gfortran.dg/gomp/simdlen-scaled-4.f90: New test. * gfortran.dg/gomp/simdlen-scaled-5-1.f90: New test. * gfortran.dg/gomp/simdlen-scaled-5-2.f90: New test. libgomp/ChangeLog: * testsuite/libgomp.fortran/nestedfn5.f90: Fix testcase: safelen must be constant.
