[flang-commits] [flang] b942c24 - [flang] Don't crash on not-yet-implemented feature (#91368)

via flang-commits flang-commits at lists.llvm.org
Thu May 9 11:19:07 PDT 2024


Author: Peter Klausler
Date: 2024-05-09T11:19:03-07:00
New Revision: b942c24845a39e6161c8623b1efc4e2083d879e9

URL: https://github.com/llvm/llvm-project/commit/b942c24845a39e6161c8623b1efc4e2083d879e9
DIFF: https://github.com/llvm/llvm-project/commit/b942c24845a39e6161c8623b1efc4e2083d879e9.diff

LOG: [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 https://github.com/llvm/llvm-project/issues/91295.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/data-to-inits.cpp b/flang/lib/Semantics/data-to-inits.cpp
index 64050874bcde..605a9f10712e 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