[flang-commits] [flang] [Flang][OpenMP] Add declare simd to all subprogram entries (PR #215777)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Wed Aug 19 06:14:34 PDT 2026


================
@@ -0,0 +1,60 @@
+! DECLARE SIMD applies to all entries of a subprogram, not just to the main one.
----------------
skatrak wrote:

As implemented here, what happens in that case is that the `linear` operand to `omp.declare_simd` for the `e(y)` alternative entry points to a local stack allocation. That's indeed an invalid use of the clause, but it's not clear to me what's the expected behavior. Shouldn't that be disallowed in semantics? CC: @mjklemm.
```f90
subroutine s(x)
  implicit none
  !$omp declare_simd linear(x:1)
  integer :: x, y

  call foo(x, y)
  return

! x is not an argument here, but declare_simd applies
entry e(y)
  call foo(x, y)
  return
end subroutine
```

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


More information about the flang-commits mailing list