The bytecode reader could enter an infinite loop when parsing deeply nested attributes containing type references. The deferred worklist stored only indices without distinguishing between attributes and types, causing type indexes to be misinterpreted as attributes. This patch changes the deferred worklist to store pairs of (index, kind) to track whether each deferred entry is a type or attribute. The worklist processing logic is updated to resolve the correct entry type.
15 lines
475 B
MLIR
15 lines
475 B
MLIR
// RUN: mlir-opt %s --verify-roundtrip --split-input-file
|
|
|
|
func.func @deeply_nested_attribute() -> i32 {
|
|
%0 = "test.constant"() {value = [[[[[[[[[[[[1]]]]]]]]]]]]} : () -> i32
|
|
return %0 : i32
|
|
}
|
|
|
|
// -----
|
|
// Make sure bytecode reader doesn't get stuck in an infinite loop when
|
|
// parsing a specific deeply nested attribute structure.
|
|
func.func @deeply_nested_infinite_loop() -> i32 {
|
|
%0 = "test.constant"() {value = [[[[[[1 : i64]]]]]]} : () -> i32
|
|
return %0 : i32
|
|
}
|