[flang-commits] [clang] [flang] [flang] Add support for -finit-local-zero (PR #159788)

via flang-commits flang-commits at lists.llvm.org
Mon Aug 3 02:34:07 PDT 2026


================
@@ -1317,6 +1381,50 @@ static void instantiateLocal(Fortran::lower::AbstractConverter &converter,
       Fortran::lower::genUnpackArray(*converterPtr, loc, *varDef, *sym);
     });
   }
+
+  /// These options do not initialize:
+  ///   1) Any variable already initialized
+  ///   2) objects with the POINTER attribute
+  ///   3) allocatable arrays
+  ///   4) variables that appear in an EQUIVALENCE statement
+
+  auto isEligibleForImplicitAssignment = [&var, &converter]() -> bool {
+    if (!var.hasSymbol())
+      return false;
+
+    const Fortran::semantics::Symbol &sym = var.getSymbol();
+    if (!sym.GetType())
+      return false;
+    if (const auto *details =
+            sym.detailsIf<Fortran::semantics::ObjectEntityDetails>()) {
+      if (details->init())
+        return false;
+    }
----------------
NimishMishra wrote:

Thanks, I have changed this check

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


More information about the flang-commits mailing list