This is an archive of the discontinued LLVM Phabricator instance.

[flang] Ensure name resolution visits "=>NULL()" in entity-decl
ClosedPublic

Authored by klausler on Jul 13 2022, 11:44 AM.

Details

Summary

Most modern Fortran programs declare procedure pointers with a
procedure-declaration-stmt, but it's also possible to declare one
with a type-declaration-stmt with a POINTER attribute. In this
case, e.g. "real, external, pointer :: p => null()" the initializer
is required to be a null-init. The parse tree traversal in name
resolution would visit the null-init if the symbol were an object
pointer only, leading to a crash in the case of a procedure pointer.

That explanation of the bug is longer than the fix. In short,
ensure that a null-init in an entity-decl is visited for both
species of pointers.

Diff Detail

Event Timeline

klausler created this revision.Jul 13 2022, 11:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 11:44 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Jul 13 2022, 11:44 AM
PeteSteinfeld accepted this revision.Jul 13 2022, 1:07 PM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Jul 13 2022, 1:07 PM