Skip to content

Commit d452429

Browse files
authored
[flang] Fix shared library flang build (#108101)
I broke the shared library builds a few minutes ago by introducing a cyclic dependency between two parts of the compiler. Fix.
1 parent 2ddf21b commit d452429

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

flang/lib/Evaluate/check-expression.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,11 @@ class CheckSpecificationExprHelper
525525

526526
Result operator()(const semantics::Symbol &symbol) const {
527527
const auto &ultimate{symbol.GetUltimate()};
528+
const auto *object{ultimate.detailsIf<semantics::ObjectEntityDetails>()};
529+
bool isInitialized{semantics::IsSaved(ultimate) &&
530+
!IsAllocatable(ultimate) && object &&
531+
(ultimate.test(Symbol::Flag::InDataStmt) ||
532+
object->init().has_value())};
528533
if (const auto *assoc{
529534
ultimate.detailsIf<semantics::AssocEntityDetails>()}) {
530535
return (*this)(assoc->expr());
@@ -554,8 +559,7 @@ class CheckSpecificationExprHelper
554559
}
555560
} else if (&symbol.owner() != &scope_ || &ultimate.owner() != &scope_) {
556561
return std::nullopt; // host association is in play
557-
} else if (semantics::IsSaved(ultimate) &&
558-
semantics::IsInitialized(ultimate) &&
562+
} else if (isInitialized &&
559563
context_.languageFeatures().IsEnabled(
560564
common::LanguageFeature::SavedLocalInSpecExpr)) {
561565
if (!scope_.IsModuleFile() &&

0 commit comments

Comments
 (0)