[flang-commits] [flang] [flang][semantics] fix crash involving equivalences (PR #168909)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Thu Nov 20 16:00:19 PST 2025


================
@@ -863,8 +863,18 @@ static bool ProcessScopes(const Scope &scope,
       if (std::find_if(associated.begin(), associated.end(), [](SymbolRef ref) {
             return IsInitialized(*ref);
           }) != associated.end()) {
-        result &=
-            CombineEquivalencedInitialization(associated, exprAnalyzer, inits);
+        if (std::find_if(associated.begin(), associated.end(),
+                [](SymbolRef ref) { return !ref->size(); }) !=
+            associated.end()) {
+          // If a symbol has a non-legacy initialization, it won't have a size,
----------------
akuhlens wrote:

Legacy Initialization happens during name resolution before this diff, It seems like symbols without legacy initialization don't get there sizes set until after name resolution. You are right about the zero size array, seems like we would need to make size optional to tell if it had been set or not since zero is a valid size.

https://github.com/llvm/llvm-project/pull/168909


More information about the flang-commits mailing list