[llvm] [WebAssembly] Add unreachable before catch destinations (PR #123915)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 15:15:24 PST 2025


dschuff wrote:

> This problem was not discovered when I was testing the new LLVM implementation with Emscripten test suite last year because binaryen masked this problem. This is invalid but Binaryen [accepts](https://github.com/WebAssembly/binaryen/blob/9795fc13fc18d5ff9e869a81a5599c1baedc7e06/src/wasm/wasm.cpp#L196-L203) it:
> 
> ```webassembly
> block i32
>   try_table (catch_all_ref 0)
>     ...
>   end_try_table
> end_block
> ```
> 

I think we should consider this a bug in Binaryen. When it parses Wasm input, it should reject invalid wasm unless there is some option enabled that relaxes the validation or accepts some input that isn't really wasm (e.g. if using the relooper).

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


More information about the llvm-commits mailing list