[Mlir-commits] [mlir] [mlir][Parser] Fix use-after-free when parsing invalid reference to nested definition (PR #127778)

Will Dietz llvmlistbot at llvm.org
Wed Feb 19 11:19:50 PST 2025


================
@@ -499,8 +499,20 @@ ParseResult ForOp::parse(OpAsmParser &parser, OperationState &result) {
   else if (parser.parseType(type))
     return failure();
 
-  // Resolve input operands.
+  // Set block argument types, so that they are known when parsing the region.
   regionArgs.front().type = type;
+  for (auto [iterArg, type] :
+       llvm::zip(llvm::drop_begin(regionArgs), result.types))
----------------
dtzSiFive wrote:

```suggestion
       llvm::zip_equal(llvm::drop_begin(regionArgs), result.types))
```
?

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


More information about the Mlir-commits mailing list