[flang-commits] [flang] [openacc][flang] Avoid attaching declare post-actions to acc.terminator (PR #188157)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Tue Mar 24 09:46:09 PDT 2026


================
@@ -4505,9 +4508,11 @@ void Fortran::lower::attachDeclarePostDeallocAction(
   std::stringstream fctName;
   fctName << converter.mangleName(sym) << declarePostDeallocSuffix.str();
   mlir::Operation *op = &builder.getInsertionBlock()->back();
-  if (auto resOp = mlir::dyn_cast<fir::ResultOp>(*op)) {
-    assert(resOp.getOperands().size() == 0 &&
-           "expect only fir.result op with no operand");
+  if (op && op->hasTrait<mlir::OpTrait::IsTerminator>()) {
+    if (op->getNumOperands() != 0) {
+      fir::emitFatalError(op->getLoc(),
+                          "expect only terminator op with no operand");
+    }
----------------
clementval wrote:

no braces

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


More information about the flang-commits mailing list