[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
Mon Feb 3 09:59:43 PST 2025


kiranchandramohan wrote:

> @kiranchandramohan I have added the TODO in lowering, but from the lowering error I wonder if we should really consider a derived type component as `definable`.
> 
> That wording is in all versions of the standard (IIRC). I previously assumed that it wasn't relevant here because `CheckReductionObjects()` already unconditionally calls `CheckDefinableObjects()`.
> 
> The error in lowering is because that object cannot be looked up in the symbol table because a component of a derived type isn't a symbol with a definition. I think `instance%component` is an expression and so is not definable.
> 

How does it work for array elements? Isn't there a similar issue?

> The wording in the Fortran standard is in section 3.47 of f2023. It says a definable object is capable of definition and permitted to become defined. Both of those conditions seem to require it to be a data object (3.42):
> 
> > constant, variable, or subobject of a constant
> 
> I think a derived type member is not constant and not a variable (if it were a variable we would be able to look it up in the symbol table).

Does this exclude array elements also?



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


More information about the flang-commits mailing list