This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix bad dereference of NULLIFY pointer object
ClosedPublic

Authored by PeteSteinfeld on Mar 8 2021, 8:23 AM.

Details

Summary

When we have a subprogram that has been determined to contain errors, we do not
perform name resolution on its execution part. In this case, if the subprogram
contains a NULLIFY statement, the parser::Name of a pointer object in a NULLIFY
statement will not have had name resolution performed on it. Thus, its symbol
will not have been set. Later, however, we do semantic checking on the NULLIFY
statement. The code that did this assumed that the parser::Name of the
pointer object was non-null.

I fixed this by just removing the null pointer check for the "symbol" member of
the "parser::Name" of the pointer object when doing semantic checking for
NULLIFY statements. I also added a test that will make the compiler crash
without this change.

Diff Detail

Event Timeline

PeteSteinfeld requested review of this revision.Mar 8 2021, 8:23 AM
PeteSteinfeld created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2021, 8:23 AM
PeteSteinfeld added a project: Restricted Project.Mar 8 2021, 8:23 AM
tskeith accepted this revision.Mar 8 2021, 9:02 AM
This revision is now accepted and ready to land.Mar 8 2021, 9:02 AM