[flang-commits] [flang] [Flang][MIF] Allocation of NON-ALLOCATABLE SAVE coarray (PR #205847)
Dan Bonachea via flang-commits
flang-commits at lists.llvm.org
Sat Jul 4 20:36:43 PDT 2026
================
@@ -701,10 +701,15 @@ static void instantiateGlobal(Fortran::lower::AbstractConverter &converter,
mlir::StringAttr linkage = getLinkageAttribute(converter, var);
fir::GlobalOp global;
- if (Fortran::evaluate::IsCoarray(sym))
+ if (Fortran::evaluate::IsCoarray(sym)) {
if (hasFinalization(sym) || hasAllocatableDirectComponent(sym))
TODO(loc, "coarray: coarray with an allocatable direct component and/or "
"requiring finalization");
+ const auto *details =
+ sym.detailsIf<Fortran::semantics::ObjectEntityDetails>();
+ if (details && details->init())
+ TODO(loc, "coarray: default initialization.");
----------------
bonachea wrote:
In the Fortran standard the term "Default initialization" refers specifically to derived types and means something different from what I think we mean here.
The code `real, SAVE :: m[*] = 1.0` is explicit initialization, not default initialization.
I think what this message currently needs to say is that all forms of coarray initialization are unimplemented :
```suggestion
TODO(loc, "coarray: initialization");
```
We could alternatively say "explicit initialization", but I suspect it's probably _also_ the case that coarrays of derived type with default initialization also remain unimplemented. For example, the following statements in the specification section of a module or main program : `EVENT_TYPE :: e[*]` and `TEAM_TYPE :: t[*]` both use default initialization.
https://github.com/llvm/llvm-project/pull/205847
More information about the flang-commits
mailing list