[flang-commits] [flang] [flang] Fix shared library flang build (PR #108101)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Sep 10 15:00:38 PDT 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/108101

I broke the shared library builds a few minutes ago by introducing a cyclic dependency between two parts of the compiler.  Fix.

>From e7a1870cf2fb9b83949f512c04a2085ec0b844e5 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Tue, 10 Sep 2024 14:59:23 -0700
Subject: [PATCH] [flang] Fix shared library flang build

I broke the shared library builds a few minutes ago by introducing
a cyclic dependency between two parts of the compiler.  Fix.
---
 flang/lib/Evaluate/check-expression.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Evaluate/check-expression.cpp b/flang/lib/Evaluate/check-expression.cpp
index 8a90404db0456c..a1ede7d7553bf6 100644
--- a/flang/lib/Evaluate/check-expression.cpp
+++ b/flang/lib/Evaluate/check-expression.cpp
@@ -525,6 +525,11 @@ class CheckSpecificationExprHelper
 
   Result operator()(const semantics::Symbol &symbol) const {
     const auto &ultimate{symbol.GetUltimate()};
+    const auto *object{ultimate.detailsIf<semantics::ObjectEntityDetails>()};
+    bool isInitialized{semantics::IsSaved(ultimate) &&
+        !IsAllocatable(ultimate) && object &&
+        (ultimate.test(Symbol::Flag::InDataStmt) ||
+            object->init().has_value())};
     if (const auto *assoc{
             ultimate.detailsIf<semantics::AssocEntityDetails>()}) {
       return (*this)(assoc->expr());
@@ -554,8 +559,7 @@ class CheckSpecificationExprHelper
       }
     } else if (&symbol.owner() != &scope_ || &ultimate.owner() != &scope_) {
       return std::nullopt; // host association is in play
-    } else if (semantics::IsSaved(ultimate) &&
-        semantics::IsInitialized(ultimate) &&
+    } else if (isInitialized &&
         context_.languageFeatures().IsEnabled(
             common::LanguageFeature::SavedLocalInSpecExpr)) {
       if (!scope_.IsModuleFile() &&



More information about the flang-commits mailing list