[flang] Fix crashes due to failure to find a subprogram
authorpeter klausler <pklausler@nvidia.com>
Wed, 2 Jun 2021 23:54:42 +0000 (16:54 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 3 Jun 2021 19:45:43 +0000 (12:45 -0700)
commit1dff8637b11232a7e6e7994c2ed3526262564786
treeb0ea10b9059681a1745df3554ab5a0bc4f39a55b
parenta3fd40b955ecbb970883ea5f097fd919058432bd
[flang] Fix crashes due to failure to find a subprogram

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.)

Differential Revision: https://reviews.llvm.org/D103567
flang/include/flang/Semantics/semantics.h
flang/lib/Frontend/FrontendActions.cpp
flang/lib/Semantics/check-io.cpp
flang/lib/Semantics/scope.cpp
flang/lib/Semantics/tools.cpp
flang/tools/f18/f18.cpp