[flang-commits] [flang] [flang] Access host associated equivalences via global aggregate storage. (PR #67078)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 22 02:18:26 PDT 2023


jeanPerier wrote:

> Note that in the above example iarr4 symbol is global, while
jarr4 is not. Maybe this issue could have been fixed before
the lowering by uniformly marking all symbols from the equivalence
as globals, so comments are very welcome.

I really think this is a bug in `semantics::IsSaved()` (called by `lower::symbolIsGlobal()`).
The standard is clear that `jarr4` implicitly has the SAVE attribute.

- 8.4 point 3 -> iarr4 has implicit save attribute because of the initialization
- 8.10.1.2 point 2 -> _"If any data object in an equivalence-set has the SAVE attribute, all other objects in the equivalence-set have the SAVE attribute"_ so jarr4 implicitly has the SAVE attribute because jarr4 has implicitly has it.

I would much rather a fix there, even though I cannot think of any semantic check that is bugged because of the current behavior of semantics::IsSaved().

Maybe semantics::FindEquivalenceSet could be used in semantics::IsSaved to check if any of the other symbol are Saved (with care to avoid infinite recursion I guess :) ). If you go that way, which I would recommend, please ask Peter for review too.

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


More information about the flang-commits mailing list