[flang-commits] [flang] [flang][OpenMP] Fix standalone SIMD directive post-loop variable value (PR #196731)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Tue May 12 05:22:54 PDT 2026


mjklemm wrote:

@luporl Darn, I have not seen the other PRs.  It's a quick shot that merged from a discussion at the OpenMP FTF last week.  We have been looking at this example code:

```Fortran
implicit none
integer :: i, j, k
i = 100; j = 200; k = 300
!$omp do simd
  do i = 1, 10; end do
!$omp do
  do j = 1, 11; end do
!$omp simd
  do k = 1, 12; end do
  print *, i,j,k
  ! expected output: 100 200 13
end
```

The expected output of the example is `100 200 13`.  PR https://github.com/llvm/llvm-project/pull/194623 does not change the output at all, while PR https://github.com/llvm/llvm-project/pull/183800 changes the behavior of to print incorrect values `10 200 12`.  I will comment on the latter as part of a review with more details.


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


More information about the flang-commits mailing list