[flang-commits] [flang] f348f30 - [flang] Fix GetHostProcedure() for main program
peter klausler via flang-commits
flang-commits at lists.llvm.org
Tue Sep 7 09:15:31 PDT 2021
Author: peter klausler
Date: 2021-09-07T09:15:23-07:00
New Revision: f348f30d6fe9898e1789657dda1e30d6243abd58
URL: https://github.com/llvm/llvm-project/commit/f348f30d6fe9898e1789657dda1e30d6243abd58
DIFF: https://github.com/llvm/llvm-project/commit/f348f30d6fe9898e1789657dda1e30d6243abd58.diff
LOG: [flang] Fix GetHostProcedure() for main program
It only worked for internal procedures of subprograms,
but must also allow for internal procedures of the
main program. This broke the use of host-associated
implicitly-typed symbols in specification expressions
of internal procedures.
Differential Revision: https://reviews.llvm.org/D109262
Added:
Modified:
flang/lib/Semantics/resolve-names.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index ba0a2da50cc42..56c890592e1d1 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -2038,7 +2038,14 @@ Scope &ScopeHandler::InclusiveScope() { return GetInclusiveScope(currScope()); }
Scope *ScopeHandler::GetHostProcedure() {
Scope &parent{InclusiveScope().parent()};
- return parent.kind() == Scope::Kind::Subprogram ? &parent : nullptr;
+ switch (parent.kind()) {
+ case Scope::Kind::Subprogram:
+ return &parent;
+ case Scope::Kind::MainProgram:
+ return &parent;
+ default:
+ return nullptr;
+ }
}
Scope &ScopeHandler::NonDerivedTypeScope() {
More information about the flang-commits
mailing list