[Mlir-commits] [mlir] [mlir][scf] Fix crash in ForOp verifier when body block has no arguments (PR #183946)

Mehdi Amini llvmlistbot at llvm.org
Sun Mar 1 02:32:31 PST 2026


================
@@ -835,3 +835,23 @@ func.func @invalid_reference(%a: index) {
   }
   return
 }
+
+// -----
+
+// Regression test for https://github.com/llvm/llvm-project/issues/159737
+// A nested scf.for whose outer body block has no arguments used to crash in
+// getRegionIterArgs() via verifyLoopLikeOpInterface instead of producing a
+// proper diagnostic.
+func.func @for_missing_induction_var(%arg0: index, %arg1: index) {
+  %c1 = arith.constant 1 : index
+  %c2 = arith.constant 2 : index
+  // expected-error at +1 {{expected body to have at least 1 argument(s) for the induction variable, but got 0}}
+  "scf.for"(%arg0, %arg1, %c1) ({
----------------
joker-eph wrote:

Well spotted :)

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


More information about the Mlir-commits mailing list