forked from OSchip/llvm-project
[flang] Fix name resolution with directly recursive calls.
Original-commit: flang-compiler/f18@b8e8610430 Reviewed-on: https://github.com/flang-compiler/f18/pull/557 Tree-same-pre-rewrite: false
This commit is contained in:
parent
2ccba3837d
commit
caf9e8e624
|
@ -1573,7 +1573,6 @@ MaybeExpr ExpressionAnalyzer::Analyze(
|
|||
if (MaybeExpr funcRef{MakeFunctionRef(std::move(*callee))}) {
|
||||
return funcRef;
|
||||
}
|
||||
Say("Subroutine called as if it were a function"_err_en_US);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
|
@ -1584,9 +1584,12 @@ void ScopeHandler::PushScope(Scope &scope) {
|
|||
// Create a dummy symbol so we can't create another one with the same
|
||||
// name. It might already be there if we previously pushed the scope.
|
||||
if (!FindInScope(scope, symbol->name())) {
|
||||
auto &newSymbol{CopySymbol(symbol->name(), *symbol)};
|
||||
auto &newSymbol{MakeSymbol(symbol->name())};
|
||||
if (kind == Scope::Kind::Subprogram) {
|
||||
newSymbol.set_details(symbol->get<SubprogramDetails>());
|
||||
// Allow for recursive references. If this symbol is a function
|
||||
// without an explicit RESULT(), this new symbol will be discarded
|
||||
// and replaced with an object of the same name.
|
||||
newSymbol.set_details(HostAssocDetails{*symbol});
|
||||
} else {
|
||||
newSymbol.set_details(MiscDetails{MiscDetails::Kind::ScopeName});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue