This is an archive of the discontinued LLVM Phabricator instance.

[flang] Don't emit spurious error for polymorphic actual argument in PURE
ClosedPublic

Authored by klausler on Nov 30 2022, 2:39 PM.

Details

Summary

Definability checking is unconditionally flagging the use of a polymorphic
variable as an actual argument for a procedure reference in a PURE subprogram
unless the corresponding dummy is INTENT(IN). This isn't necessary, since
an INTENT(OUT) polymorphic dummy is already caught as an error in the definition
of the callee, which must also be PURE; and an INTENT(IN OUT) or intent-free
dummy is allowed to be passed a polymorphic actual in a PURE context, with
any attempt to deallocate it being caught in the callee.

So add a flag to the definability checker to disable the "polymorphic
definition in PURE context" check when using it to check actual arguments.

Diff Detail

Event Timeline

klausler created this revision.Nov 30 2022, 2:39 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Nov 30 2022, 2:39 PM
PeteSteinfeld accepted this revision.Dec 1 2022, 9:13 AM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Dec 1 2022, 9:13 AM