[flang-commits] [flang] [llvm] [flang][MIF] Adding lowering for EVENT POST/WAIT statements (PR #210283)
via flang-commits
flang-commits at lists.llvm.org
Fri Oct 16 15:58:07 PDT 2026
================
@@ -297,7 +297,8 @@ struct TypeBuilderImpl {
if (Fortran::semantics::IsPointer(symbol))
return fir::wrapInClassOrBoxType(fir::PointerType::get(ty), isPolymorphic,
isAssumedType, symbol.Corank());
- if (Fortran::semantics::IsAllocatable(symbol))
+ if (Fortran::semantics::IsAllocatable(symbol) ||
+ Fortran::evaluate::IsCoarray(symbol))
----------------
MattPD wrote:
With this change, a NAMELIST group naming a nonallocatable coarray crashes lowering. For example:
```fortran
subroutine s()
integer, save :: t[*]
namelist /nl/ t
t = 7
write(*, nml=nl)
end subroutine
```
`flang -fcoarray -c` reports `error: cannot build a pointer to type: '!fir.box<!fir.heap<i32>, corank:1>'` and then fails an assertion. Before this PR, the subroutine compiled, and a call to it printed `&NL T= 7/`. A module coarray fails the same way, while an allocatable coarray works.
For a nonallocatable, nonpointer global object, `getNamelistGroup` in `IO.cpp` builds a `!fir.box<!fir.ptr<T>>` descriptor, and `T` is now itself a box. That branch already skips allocatables. Skipping coarrays there too only moves the crash to `fir::getAllocaBlock`. Could `getNamelistGroup` support this case, or raise a TODO?
https://github.com/llvm/llvm-project/pull/210283
More information about the flang-commits
mailing list