[flang-commits] [flang] [flang][OpenMP] Fix the detection of static storage duration variables (PR #227871)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Mon Oct 5 08:50:55 PDT 2026


eugeneepshteyn wrote:

Please also check interaction of this change and `-fno-automatic`:
```fortran
! Compile with -fno-automatic (LanguageFeature::DefaultSave).  IsSaved()
! then treats every local of a non-RECURSIVE subprogram as saved; locals of
! a RECURSIVE subprogram are not.
subroutine nonrec()
  integer :: x
  x = 1
  !$omp task
  x = 12
  !$omp end task
  !$omp taskwait
  print *, 'nonrec x:', x
end subroutine

recursive subroutine rec()
  integer :: y
  y = 1
  !$omp task
  y = 12
  !$omp end task
  !$omp taskwait
  print *, 'rec y:', y
end subroutine

program main_noauto
  call nonrec()
  call rec()
end program
```

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


More information about the flang-commits mailing list