[flang] [llvm] [Flang] Adding lowering for the allocation and deallocation of coarrays (PR #182110)

Dan Bonachea via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 17 19:17:10 PDT 2026


================
@@ -2524,6 +2533,8 @@ void Fortran::lower::mapSymbolAttributes(
   }
 
   if (Fortran::evaluate::IsCoarray(sym)) {
+    if (sym.attrs().test(Fortran::semantics::Attr::SAVE))
+      TODO(loc, "Coarray with explicit SAVE attribute.");
----------------
bonachea wrote:

This test and message might not be quite right, for two reasons:

1. It's irrelevant whether the SAVE attribute is syntactically explicit (because the user typed it) or implicit (e.g. because the variable has an initializer, or it's a global variable like a module variable). All coarrays with either form of the SAVE attribute have the same lifetime behavior (no automatic deallocation at scope exit).
2. Only non-ALLOCATABLE SAVE coarrays require the "problematic" implicit allocation at program startup that I think we are trying to prohibit here. ALLOCATABLE SAVE coarrays are the easy case because they are always allocated explicitly.

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


More information about the llvm-commits mailing list