[flang-commits] [flang] [flang][OpenMP][Semantics] Don't allow reduction of derived type components (PR #125480)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Tue Feb 4 04:15:18 PST 2025
kiranchandramohan wrote:
> > How does it work for array elements? Isn't there a similar issue?
>
> It seems we just do reduction on the whole array, ignoring the indexing.
The following program seemed to work correctly with ifx.
I see that flang currently generates a combiner that does the reduction on the whole array but the final answer it computes is also correct.
```
program mn
integer :: i
integer :: arr(10)
arr = 0
!$omp parallel do reduction(+:arr(3))
do i=1,10
arr(3) = arr(3) + i
end do
!$omp end parallel do
print *, arr
end program
```
>
> > Does this exclude array elements also?
>
> I imagine it should do. gfortran and classic-flang don't allow it.
>
> So does this sound okay to you:
>
> 1. I change this patch to deny derived type components for all standard versions
> 2. I do a followup patch denying array indexing
I am not 100% sure about this since previous versions explicitly allowed array elements. It might be worth asking a question to the OpenMP committee.
https://github.com/llvm/llvm-project/pull/125480
More information about the flang-commits
mailing list