This is an archive of the discontinued LLVM Phabricator instance.

[Flang] Don't crash when BOZ literals are on the rhs of an assignment
ClosedPublic

Authored by PeteSteinfeld on Feb 22 2023, 10:53 AM.

Details

Summary

For BOZ literals, the rhsType will be empty. Check for that before
trying to access its value.

Diff Detail

Event Timeline

PeteSteinfeld created this revision.Feb 22 2023, 10:53 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 22 2023, 10:53 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
PeteSteinfeld requested review of this revision.Feb 22 2023, 10:53 AM
clementval added inline comments.Feb 22 2023, 12:45 PM
flang/lib/Lower/Bridge.cpp
2878–2879

Thanks for the fix Pete. Can we combine this in a single if?

Combining two "if"s into a single one as per @clementval's suggestion.

PeteSteinfeld marked an inline comment as done.Feb 22 2023, 1:31 PM
clementval added inline comments.Feb 22 2023, 1:35 PM
flang/lib/Lower/Bridge.cpp
2864–2865

The rhsType check should only apply to the rhsType->IsPolymorphic() || rhsType->IsUnlimitedPolymorphic() part. If lhsType is polymorphic but the rhsType is typeless, we still want to lower to the assign runtime function.

Responding to more guidance from @clementval.

PeteSteinfeld marked an inline comment as done.Feb 22 2023, 1:46 PM
PeteSteinfeld added inline comments.
flang/lib/Lower/Bridge.cpp
2864–2865

Thanks, @clementval!

This revision is now accepted and ready to land.Feb 22 2023, 1:50 PM
This revision was automatically updated to reflect the committed changes.
PeteSteinfeld marked an inline comment as done.