Skip to content

Commit 9b6be0f

Browse files
committed
Add extra assert for fir.result op
1 parent 34f3171 commit 9b6be0f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flang/lib/Lower/OpenACC.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4188,8 +4188,11 @@ void Fortran::lower::attachDeclarePostDeallocAction(
41884188
std::stringstream fctName;
41894189
fctName << converter.mangleName(sym) << declarePostDeallocSuffix.str();
41904190
mlir::Operation *op = &builder.getInsertionBlock()->back();
4191-
if (mlir::isa<fir::ResultOp>(*op))
4191+
if (auto resOp = mlir::dyn_cast<fir::ResultOp>(*op)) {
4192+
assert(resOp.getOperands().size() == 0 &&
4193+
"expect only fir.result op with no operand");
41924194
op = op->getPrevNode();
4195+
}
41934196
assert(op && "expect operation to attach the post deallocation action");
41944197
if (op->hasAttr(mlir::acc::getDeclareActionAttrName())) {
41954198
auto attr = op->getAttrOfType<mlir::acc::DeclareActionAttr>(

0 commit comments

Comments
 (0)