[flang-commits] [flang] [flang][OpenMP][Semantics] Don't allow reduction of derived type components (PR #125480)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Tue Feb 4 08:06:22 PST 2025


kkwli wrote:

> > > 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.
> > 
> > 
> > OpenMP 6.0 clarifies that array elements are allowed on the clause.
> > "The list items that appear in a reduction clause or an induction clause may include array sections and array elements." (247:3-4)
> 
> Thanks @kkwli. Would you know why derived type members are not allowed?

For the array elements, one can treat it as an array section with stride 1. 

For derived type components, the spec does not have the semantic of subobject privatization yet. For example, if some components of a derived type is privatized, are other components in the same derived type shared? What if the whole derived type is accessed? We haven't figured out the details yet. That is one of the reasons why subobjects are disallowed on most of the data-sharing attribute clauses.

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


More information about the flang-commits mailing list