This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Use actual type when copying an actual argument variable
ClosedPublic

Authored by jeanPerier on May 25 2023, 2:16 AM.

Details

Summary

The copy must made according to the actual type, not the dummy type. In
case the dummy is polymorphic, these types will be different and the
dynamic type of the copy passed in the call should be the one of the
actual.

There is no support for "class(t), value" yet (it is hitting a TODO in
CallInterface that is moot for HLFIR but has not been lifted for lack of
proper testing) so the bug was dormant, but D151271 created a situation
where a copy is needed with polymorphic dummies and exposed the bug.
This led to a compile time assert
"value.isScalar() && fir::isa_trivial(value.getType())" in "hlfir::genAssociateExpr".

Diff Detail

Event Timeline

jeanPerier created this revision.May 25 2023, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 2:16 AM
jeanPerier requested review of this revision.May 25 2023, 2:16 AM
vzakhari accepted this revision.May 25 2023, 8:15 AM

Thank you, Jean!

This revision is now accepted and ready to land.May 25 2023, 8:15 AM