Skip to content

br_table selector rejected at runtime — value does not fit in i32 #1243

Description

@greenhat

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions