This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix parsing and semantics for array element substring%KIND/%LEN
ClosedPublic

Authored by klausler on Jul 22 2022, 11:59 AM.

Details

Summary

A type-param-inquiry of %KIND or %LEN applies to a designator, and
so must also be allowed for a substring. F18 presently (mis)parses
instances of a type-param-inquiry as structure component references
and then fixes them in expression semantics when types are known and
we can distinguish them. But when the base of a type-param-inquiry is
a substring of an array element, as in "charArray(i)(j:k)%len",
parsing fails.

Adjust the grammar to parse these cases, and extend expression semantics
to process the new production.

Diff Detail

Event Timeline

klausler created this revision.Jul 22 2022, 11:59 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Jul 22 2022, 11:59 AM
PeteSteinfeld accepted this revision.Jul 22 2022, 4:00 PM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Jul 22 2022, 4:00 PM