[flang] Fix CHECK() calls on erroneous procedure declarations
authorPeter Steinfeld <psteinfeld@nvidia.com>
Thu, 25 Mar 2021 15:04:19 +0000 (08:04 -0700)
committerPeter Steinfeld <psteinfeld@nvidia.com>
Mon, 29 Mar 2021 17:12:35 +0000 (10:12 -0700)
commita7afc8a51471bdfd0c597f8e885dbddada7f590a
tree94f0ff1f955c3891cdd4a5c166ffd15a26d03653
parent54bacaf31127ee9d19e8df7ad7de5c94a4fc7c62
[flang] Fix CHECK() calls on erroneous procedure declarations

When writing tests for a previous problem, I ran across situations where the
compiler was failing calls to CHECK().  In these situations, the compiler had
inconsistent semantic information because the programs were erroneous.  This
inconsistent information was causing the calls to CHECK().

I fixed this by avoiding the code that ended up making the failed calls to
CHECK() and making sure that we were only avoiding these situations when the
associated symbols were erroneous.

I also added tests that would cause the calls to CHECK() without these changes.

Differential Revision: https://reviews.llvm.org/D99342
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/resolve18.f90