[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
Thu Oct 8 20:59:42 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:

> We've coincidentally just https://github.com/BerkeleyLab/caffeine/issues/380 where prif_allocate_coarray is not correctly defining stat=0 on success.

Caffeine bug I mentioned above is now fixed in [Caffeine patch release 0.8.4](https://github.com/BerkeleyLab/caffeine/releases).

However I still think we should defer this change to a future PR, and taht future PR should _also_ deploy the clever workaround suggested by @MattPD , to avoid introducing a tight version coupling dependency on Caffeine:
> Zero-initializing that temporary and loading it after the call would also work around https://github.com/BerkeleyLab/caffeine/issues/380.

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


More information about the flang-commits mailing list