This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix assert on character literal substrings as arguments
ClosedPublic

Authored by PeteSteinfeld on Aug 13 2020, 8:10 AM.

Details

Summary

Character literal substrings used as arguments were causing asserts. This
happened when the code was trying to get the DynamicType of the substring. We
were only recording the DynamicType of the Designator on which the substring
was based. For character literal substrings, the Designator was a character
literal, and we weren't handling getting its type.

I fixed this by changing the GetType() method for DynamicType to check to
see if we were getting the type of a Substring and calculating the type of
the substring by getting the number of bytes in an element of the string.

I also changed the test resolve49.f90 with some tests, one of which causes
the original crash.

Diff Detail

Event Timeline

PeteSteinfeld created this revision.Aug 13 2020, 8:10 AM
Herald added a project: Restricted Project. · View Herald Transcript
PeteSteinfeld requested review of this revision.Aug 13 2020, 8:10 AM
PeteSteinfeld added a project: Restricted Project.Aug 13 2020, 8:11 AM
klausler accepted this revision.Aug 13 2020, 8:51 AM

Thanks! Ship it.

This revision is now accepted and ready to land.Aug 13 2020, 8:51 AM