This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix call to CHECK() on overriding an erroneous type-bound procedure
ClosedPublic

Authored by PeteSteinfeld on Mar 10 2021, 8:11 AM.

Details

Summary

You can define a base type with a type-bound procedure which is erroneously
missing a NOPASS attribute and then define another type that extends the base
type and overrides the erroneous procedure. In this case, when we perform
semantic checking on the overriding procedure, we verify the "pass index" of
the overriding procedure. The attempt to get the procedure's pass index fails
a call to CHECK().

I fixed this by calling SetError() on the symbol of the overridden procedure in
the base type. Then, I check HasError() before executing the code that invokes
the failing call to CHECK(). I also added a test that will cause the compiler
to fail the call to CHECK() without this change.

Diff Detail

Event Timeline

PeteSteinfeld requested review of this revision.Mar 10 2021, 8:11 AM
PeteSteinfeld created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2021, 8:11 AM
PeteSteinfeld added a project: Restricted Project.Mar 10 2021, 8:11 AM
tskeith accepted this revision.Mar 10 2021, 9:05 AM
This revision is now accepted and ready to land.Mar 10 2021, 9:05 AM
This revision was landed with ongoing or failed builds.Mar 10 2021, 9:38 AM
This revision was automatically updated to reflect the committed changes.