[flang-commits] [flang] [flang] Don't crash on not-yet-implemented feature (PR #91368)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu May 9 11:08:05 PDT 2024
https://github.com/klausler updated https://github.com/llvm/llvm-project/pull/91368
>From f5040250e216944b572054015cbf6f5e66cad6ae Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Tue, 7 May 2024 11:04:32 -0700
Subject: [PATCH] [flang] Don't crash on not-yet-implemented feature
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.
Fixes https://github.com/llvm/llvm-project/issues/91295.
---
flang/lib/Semantics/data-to-inits.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/flang/lib/Semantics/data-to-inits.cpp b/flang/lib/Semantics/data-to-inits.cpp
index 64050874bcdec..605a9f10712e7 100644
--- a/flang/lib/Semantics/data-to-inits.cpp
+++ b/flang/lib/Semantics/data-to-inits.cpp
@@ -903,7 +903,13 @@ void ConstructInitializer(const Symbol &symbol,
if (const auto *procDesignator{
std::get_if<evaluate::ProcedureDesignator>(&expr->u)}) {
CHECK(!procDesignator->GetComponent());
- mutableProc.set_init(DEREF(procDesignator->GetSymbol()));
+ if (const auto *intrin{procDesignator->GetSpecificIntrinsic()}) {
+ const Symbol *intrinSymbol{
+ symbol.owner().FindSymbol(SourceName{intrin->name})};
+ mutableProc.set_init(DEREF(intrinSymbol));
+ } else {
+ mutableProc.set_init(DEREF(procDesignator->GetSymbol()));
+ }
} else {
CHECK(evaluate::IsNullProcedurePointer(*expr));
mutableProc.set_init(nullptr);
More information about the flang-commits
mailing list