Discovered in #1242
Compiled Rust guest programs trap in the Miden VM with
assertion failed with error message: value does not fit in i32
whenever control flow reaches a Wasm br_table whose selector, interpreted as u32, is > 0x8000_0000. LLVM routinely produces such selectors on purpose: it normalizes a match/switch by subtracting the smallest case value with wrapping arithmetic and relies on br_table's unsigned out-of-range → default rule to catch everything else. A selector of 0 - 1 = 0xFFFFFFFF is therefore a perfectly legal "go to the default arm" value, and the compiler-inserted assert is wrong.
Discovered in #1242
Compiled Rust guest programs trap in the Miden VM with
whenever control flow reaches a Wasm
br_tablewhose selector, interpreted as u32, is> 0x8000_0000. LLVM routinely produces such selectors on purpose: it normalizes amatch/switch by subtracting the smallest case value with wrapping arithmetic and relies onbr_table's unsigned out-of-range → default rule to catch everything else. A selector of0 - 1 = 0xFFFFFFFFis therefore a perfectly legal "go to the default arm" value, and the compiler-inserted assert is wrong.