Skip to content

compiler: properly handle non-word-sized CmmSwitch scrutinees in the wasm NCG

Currently, the wasm NCG has an implicit assumption: all CmmSwitch scrutinees are 32-bit integers. This is not always true; #22864 (closed) is one counter-example with a 64-bit scrutinee. This patch fixes the logic by explicitly converting the scrutinee to a word that can be used as a br_table operand. Fixes #22871 (closed). Also includes a regression test.

Merge request reports