Page MenuHomePhabricator

[flang] Fix crashes due to failure to find a subprogram

Authored by klausler on Jun 2 2021, 4:57 PM.



In error recovery situations, the mappings from source locations
to scopes were failing in a way that tripped some asserts.
Specifically, FindPureProcedureContaining() wasn't coping well
when starting at the global scope. (And since the global scope
no longer has a source range, clean up the Semantics constructor
to avoid confusion.)

Diff Detail

Event Timeline

klausler created this revision.Jun 2 2021, 4:57 PM
klausler requested review of this revision.Jun 2 2021, 4:57 PM
PeteSteinfeld accepted this revision.Jun 2 2021, 6:58 PM

All builds, tests, and looks good.

This revision is now accepted and ready to land.Jun 2 2021, 6:58 PM
awarzynski accepted this revision.Jun 3 2021, 12:34 AM

LGTM, thanks. Before merging, could you please fix the clang-tidy warning? No need to upload another version here.


As pointed out by clang-tidy, you can skip else here without changing the semantics:

klausler added inline comments.Jun 3 2021, 10:51 AM

We don't always follow that LLVM rule in the more functional style used in f18. This whole function is essentially one big expression that would be a single return statement if C++ could handle it.

This revision was landed with ongoing or failed builds.Jun 3 2021, 12:46 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2021, 12:46 PM