This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix bogus message on index-names in the presence of associated entities
ClosedPublic

Authored by PeteSteinfeld on Dec 9 2020, 1:54 PM.

Details

Summary

The semantic analysis of index-names of FORALL statements looks up symbols with
the same name as the index-name. This is needed to exclude symbols that are
not objects. But if the symbol found is host-, use-, or construct-associated
with another entity, the check fails.

I fixed this by getting the root symbol of the symbol found and doing the check
on the root symbol. This required creating a non-const version of
"GetAssociationRoot()".

Diff Detail

Event Timeline

PeteSteinfeld created this revision.Dec 9 2020, 1:54 PM
PeteSteinfeld requested review of this revision.Dec 9 2020, 1:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2020, 1:54 PM
PeteSteinfeld added a project: Restricted Project.Dec 9 2020, 1:55 PM
klausler accepted this revision.Dec 9 2020, 2:11 PM
klausler added inline comments.
flang/lib/Evaluate/tools.cpp
944

The body of this overridden function should be next to the original, no?

Consider using const_cast on a reference type rather than a created pointer.

This revision is now accepted and ready to land.Dec 9 2020, 2:11 PM
This revision was landed with ongoing or failed builds.Dec 10 2020, 7:36 AM
This revision was automatically updated to reflect the committed changes.
PeteSteinfeld added inline comments.Dec 10 2020, 7:37 AM
flang/lib/Evaluate/tools.cpp
944

Thanks, Peter. I'll make these changes.