[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:10 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);
+    mlir::func::FuncOp sbaFunc =
+        fir::runtime::getRuntimeFunc<mkRTKey(AllocatableSetBaseAddr)>(loc,
+                                                                      builder);
+    llvm::SmallVector<mlir::Value> args2{fir::runtime::createArguments(
+        builder, loc, sbaFunc.getFunctionType(), op.getBox(), allocMem)};
+    fir::CallOp::create(builder, loc, sbaFunc, args2);
+    if (fir::isa_builtin_event_type(
----------------
bonachea wrote:

My 2 cents: I think default initialization of non-`EVENT_TYPE` coarray variables could be out of scope for this PR, and it would be fine to do whatever makes sense to signal this is not yet supported. 

If that feature can be added with minimal effort then great, but we need to avoid feature creep in order to reach a useful merge-able state.

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


More information about the flang-commits mailing list