[flang-commits] [flang] [flang][OpenMP] Make lastprivate work with reallocated variables (PR #106559)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Thu Sep 5 07:54:37 PDT 2024
luporl wrote:
It seems the standard indeed allows an allocatable variable to be unallocated in a firstprivate clause:
> If the original list item that does not have the POINTER attribute has the allocation status of unallocated, the new list items will have the same status.
(OMP 5.2 - 5.4.4 firstprivate Clause - https://www.openmp.org/spec-html/5.2/openmpsu38.html)
I have modified `copyVarHLFIR` to emit the `if` in this case.
The `if` is not needed with copyprivate:
> Any list item with the ALLOCATABLE attribute must have the allocation status of allocated when the intrinsic assignment is performed.
(OMP 5.2 - 5.7.2 copyprivate Clause - https://www.openmp.org/spec-html/5.2/openmpsu59.html)
https://github.com/llvm/llvm-project/pull/106559
More information about the flang-commits
mailing list