[flang-commits] [flang] [flang][OpenMP] Fix construct privatization in default clause (PR #72510)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Wed Mar 13 13:05:10 PDT 2024


luporl wrote:

I have been using this patch (rebased on top of main) without issues for some time.
But today I have noticed a strange behavior with a test program, which I reduced to the following:

```f90
!$omp parallel do default(private) firstprivate(y)
  do i = 1, 10
    y = 1
    !$omp parallel default(private)
      y = 2
    !$omp end parallel
  end do
!$omp end parallel do
end
```

This program hits an assert:
`Assertion failed: (success && "Privatization failed due to existing binding"), function cloneSymbol, file DataSharingProcessor.cpp, line 74.`

The problem is that the inner parallel directive is inside a Fortran construct (`do`), which causes its symbols to not be collected as `symbolsInNestedRegions`. This results in `defaultPrivatize` trying to privatize `y` twice.

A possible solution could be to visit nested evaluations recursively and, in each one, collect the symbols from the first OpenMP construct (if any).

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


More information about the flang-commits mailing list