llvm / llvm/llvm-project

[Flang][OpenMP] OpenMP 5.0 relaxes restrictions on the nonmonotonic modifier in schedule clauses but Flang still rejects them

Open
#193,432 1 comment 0 reactions 0 assignees View on GitHub
flang:frontend flang:openmp
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Summary

In OpenMP 4.5, the `nonmonotonic` modifier can only be specified with `schedule(dynamic)` or `schedule(guided)`.This restriction appears to have been deleted in OpenMP 5.0. However, Flang does not reflect this change and continues to reject such usage, even when `-fopenmp-version=50` is specified.

### Reproducer

* test.f90

```fortran
program main
!$omp do schedule(nonmonotonic:static)
! $omp do schedule(nonmonotonic:auto)
! $omp do schedule(nonmonotonic:runtime)
do i=1,8
end do
!$omp end do

print *,'pass'
end
```

* commands

```console
$ flang --version
flang version 23.0.0git (https://github.com/llvm/llvm-project.git abc37e6aef740b0af087331e6db807b916f559f5)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/llvm/build/bin
Build config: +assertions
$ flang test.f90 -fopenmp -fopenmp-version=45 && ./a.out
warning: OpenMP support for version 45 in flang is still incomplete
error: Semantic errors in test.f90
test.f90:2:12: error: The NONMONOTONIC modifier can only be specified with SCHEDULE(DYNAMIC) or SCHEDULE(GUIDED)
!$omp do schedule(nonmonotonic:static)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$ flang test.f90 -fopenmp -fopenmp-version=50 && ./a.out
warning: OpenMP support for version 50 in flang is still incomplete
error: Semantic errors in test.f90
test.f90:2:12: error: The NONMONOTONIC modifier can only be specified with SCHEDULE(DYNAMIC) or SCHEDULE(GUIDED)
!$omp do schedule(nonmonotonic:static)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

## Other Compilers

* GFortran
```console
$ gfortran --version
GNU Fortran (GCC) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gfortran test.f90 -fopenmp && ./a.out
pass
```

* Intel Fortran
```console
$ ifx --version
ifx (IFX) 2025.3.2 20260112
Copyright (C) 1985-2026 Intel Corporation. All rights reserved.

$ ifx -O0 test.f90 -qopenmp && ./a.out
pass
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with test.f90 using Flang and compare the behavior under -fopenmp-version=45 and -fopenmp-version=50. Locate the semantic check for the NONMONOTONIC modifier and its existing OpenMP version handling; done means static, auto, and runtime are accepted in version 50 while the version 45 restriction remains enforced.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.