[flang-commits] [clang] [flang] [llvm] [flang] Add -finit-local= to initialize automatic variables (PR #216164)
via flang-commits
flang-commits at lists.llvm.org
Thu Sep 3 19:18:01 PDT 2026
================
@@ -0,0 +1,92 @@
+! Pinned negative tests for -finit-local= exclusions.
+!
+! Each case uses %flang_fc1 -emit-hlfir -finit-local=0xAA and asserts that
+! no synthesized initialization store appears for the excluded variable.
+!
+! Exclusions verified here:
+! 1. Function result variable
+! 2. Main-program local (implicit SAVE per Fortran 2018 8.5.16p4)
+! 3. Runtime-sized automatic array (unknown extent at compile time)
+! 4. CHARACTER array (pending memset infrastructure, PR #159788)
+! 5. Derived type with POINTER component (IsAllocatableOrPointer on component)
+! 6. host,device CUDA local (allocated via cuf.alloc, not fir.alloca)
+! -- see finit-local-cuda.cuf for the CUDA cases
+! 7. PowerPC vector locals (direct or as a derived-type component)
+! -- see finit-local-ppc-vector-llvm.f90 for the vector cases
+
+! RUN: %flang_fc1 -emit-hlfir -finit-local=0xAA %s -o - | FileCheck %s
----------------
MattPD wrote:
Confirmed. The exclusion checks now fail when the behavior they pin changes, negative directives included.
https://github.com/llvm/llvm-project/pull/216164
More information about the flang-commits
mailing list