[flang] Fix scope in which undeclared symbols are created
authorpeter klausler <pklausler@nvidia.com>
Wed, 1 Sep 2021 21:03:15 +0000 (14:03 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 2 Sep 2021 21:16:19 +0000 (14:16 -0700)
commita4c5d00cd33b137d103c799032666dcc91ac3065
treea3e9063fb890789110a96efbdeb59929c4d94a97
parentf411be0d246ca8f37fd3e9fc3db35cbbd7119646
[flang] Fix scope in which undeclared symbols are created

Don't create new symbols in FORALL, implied DO, or other
construct scopes when an undeclared name appears; use the
innermost enclosing program unit's scope.  This clears up
a pending TODO in name resolution, and also exposes (& fixes)
an unnoticed name resolution problem in a module file test.

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