[flang-commits] [flang] [flang] Don't evaluate initializers for arrays with invalid rank (PR #171163)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Tue Dec 16 16:59:14 PST 2025


================
@@ -10622,11 +10641,13 @@ class DeferredCheckVisitor {
 private:
   void Init(const parser::Name &name,
       const std::optional<parser::Initialization> &init) {
-    if (init) {
+    // Don't evaluate initializers for arrays with a rank greater than the
+    // maximum supported, to avoid running out of memory.
+    if (init && name.symbol && resolver_.CheckRank(*name.symbol)) {
       if (const auto *target{
               std::get_if<parser::InitialDataTarget>(&init->u)}) {
         resolver_.PointerInitialization(name, *target);
-      } else if (name.symbol) {
----------------
akuhlens wrote:

Nope, you are correct. I thought they were chained, not nested.

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


More information about the flang-commits mailing list