[llvm-branch-commits] [flang] [flang][OpenMP] Remember decision of allowing past/future clause (PR #227419)

Abid Qadeer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 30 03:10:04 PDT 2026


abidh wrote:

One thing I noted with this stack applied:

```
subroutine compound(a, n)
  integer :: n, i
  real :: a(n)
  !$omp do simd if(.true.)
  do i = 1, n
    a(i) = a(i) + 1.0
  end do
  !$omp end do simd
end subroutine
```
Before PR stack
```
error: Semantic errors in future-clause.f90
future-clause.f90:14:17: error: IF clause is not allowed on DO SIMD directive in OpenMP v4.5, try -fopenmp-version=50
```

With the PR stack applied, there is a warning and then an error.
```
future-clause.f90:14:17: warning: IF clause is not allowed on DO SIMD directive in OpenMP v4.5, try -fopenmp-version=50 [-Wopenmp-kartoffel]
error: loc("future-clause.f90":14:9): OpenMP construct decomposition failed: a clause on 'do simd' cannot be applied to any of its leaf constructs
LLVM ERROR: aborting
```

Also notice the following case

```
subroutine leaf(a, n)
  integer :: n, i
  real :: a(n)
  !$omp simd if(.true.)
  do i = 1, n
    a(i) = a(i) + 1.0
  end do
  !$omp end simd
end subroutine

subroutine compound(a, n)
  integer :: n, i
  real :: a(n)
  !$omp do simd if(.true.)
  do i = 1, n
    a(i) = a(i) + 1.0
  end do
  !$omp end do simd
end subroutine
```
Before the PRs

```
error: Semantic errors in future-clause-masked.f90
future-clause-masked.f90:7:14: error: IF clause is not allowed on SIMD directive in OpenMP v4.5, try -fopenmp-version=50
future-clause-masked.f90:17:17: error: IF clause is not allowed on DO SIMD directive in OpenMP v4.5, try -fopenmp-version=50
```

With PR stack, the error is gone. If I comment out first simd then error comes back. So an alone simd can mask the error somehow.

```
future-clause-masked.f90:7:14: warning: IF clause is not allowed on SIMD directive in OpenMP v4.5, try -fopenmp-version=50 [-Wopenmp-kartoffel]
future-clause-masked.f90:17:17: warning: IF clause is not allowed on DO SIMD directive in OpenMP v4.5, try -fopenmp-version=50 [-Wopenmp-kartoffel]
```


https://github.com/llvm/llvm-project/pull/227419


More information about the llvm-branch-commits mailing list