Skip to content

Commit b942c24

Browse files
authored
[flang] Don't crash on not-yet-implemented feature (#91368)
A procedure pointer can be initialized in a DATA statement, but semantics crashes if the initializer is the name of an intrinsic function. This patch fixes that crash so that compilation survives to the point where lowering admits that it doesn't yet support the feature. Addresses #91295.
1 parent c3d2af0 commit b942c24

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

flang/lib/Semantics/data-to-inits.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,13 @@ void ConstructInitializer(const Symbol &symbol,
903903
if (const auto *procDesignator{
904904
std::get_if<evaluate::ProcedureDesignator>(&expr->u)}) {
905905
CHECK(!procDesignator->GetComponent());
906-
mutableProc.set_init(DEREF(procDesignator->GetSymbol()));
906+
if (const auto *intrin{procDesignator->GetSpecificIntrinsic()}) {
907+
const Symbol *intrinSymbol{
908+
symbol.owner().FindSymbol(SourceName{intrin->name})};
909+
mutableProc.set_init(DEREF(intrinSymbol));
910+
} else {
911+
mutableProc.set_init(DEREF(procDesignator->GetSymbol()));
912+
}
907913
} else {
908914
CHECK(evaluate::IsNullProcedurePointer(*expr));
909915
mutableProc.set_init(nullptr);

0 commit comments

Comments
 (0)