Skip to content

[flang] Maybe fix an odd crash on AIX & SPARC #108271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions flang/lib/Semantics/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2667,9 +2667,12 @@ const Symbol *ExpressionAnalyzer::ResolveForward(const Symbol &symbol) {
// procedure. Resolve its names now so that its interface
// is known.
const semantics::Scope &scope{symbol.owner()};
// Save the name, since "symbol" may vanish.
std::string name{symbol.name().ToString()};
semantics::ResolveSpecificationParts(context_, symbol);
const Symbol *resolved{nullptr};
if (auto iter{scope.find(symbol.name())}; iter != scope.cend()) {
if (auto iter{scope.find(parser::CharBlock{name})};
iter != scope.cend()) {
resolved = &*iter->second;
}
if (!resolved || resolved->has<semantics::SubprogramNameDetails>()) {
Expand All @@ -2678,8 +2681,10 @@ const Symbol *ExpressionAnalyzer::ResolveForward(const Symbol &symbol) {
// specification part; but recursive function calls are not
// allowed in specification parts (10.1.11 para 5).
Say("The module function '%s' may not be referenced recursively in a specification expression"_err_en_US,
symbol.name());
context_.SetError(symbol);
name);
if (resolved) {
context_.SetError(*resolved);
}
}
return resolved;
} else if (inStmtFunctionDefinition_) {
Expand Down
Loading