[flang-commits] [flang] [llvm] [flang][MIF] Adding lowering for EVENT POST/WAIT statements (PR #210283)
Dan Bonachea via flang-commits
flang-commits at lists.llvm.org
Wed Oct 7 13:47:07 PDT 2026
================
@@ -1190,9 +1305,21 @@ struct MIFAllocCoarrayOpConversion
builder, loc, ftype, op.getLcobounds(), op.getUcobounds(), sizeInBytes,
finalFunc, coarrayHandle, allocMem, stat, errmsgArg, errmsgAllocArg);
fir::CallOp callOp = fir::CallOp::create(builder, loc, funcOp, args);
-
storeCoarrayHandle(builder, loc, coarrayHandle, op.getUniqName().str());
+ // Set new base_addr for the coarray descriptor
+ mlir::Value addrRef =
+ fir::factory::genCPtrOrCFunptrAddr(builder, loc, allocMem, ptrTy);
+ allocMem = fir::LoadOp::create(builder, loc, addrRef);
----------------
bonachea wrote:
I agree that IF the `stat` argument was passed, then the compiler is responsible for checking the result is zero before proceeding with data initialization or storing the `allocated_memory` in a user data structure. If `stat` comes back non-zero those steps should be skipped, to allow for the possibility of user-driven error recovery.
However when the `stat` argument is absent (the overwhelmingly common case in most user codes I've seen), allocation failures initiate error termination and never return from `prif_allocate_coarray`.
IMHO non-trivial recovery from allocation failures is exceedingly rare in Fortran codes, so this should be considered low priority. Possibly we just enter an issue and ignore it for now.
https://github.com/llvm/llvm-project/pull/210283
More information about the flang-commits
mailing list