WebAssembly / WebAssembly/binaryen
wasm-opt --flatten fails with exceptions or GC
Open
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
When running wasm-opt on the following WASM file demo.wasm.zip, using -O4 or --flatten, the following exception is raised (tested in v124 and v125):
unexpected expr type
UNREACHABLE executed at /nix/var/nix/builds/nix-29457-2897100894/source/src/passes/Flatten.cpp:231
My complete command is
"wasm-opt" \
"--enable-sign-ext" "--disable-threads" "--enable-mutable-globals" \
"--enable-nontrapping-float-to-int" "--enable-simd" "--enable-bulk-memory" \
"--enable-exception-handling" "--disable-tail-call" "--enable-reference-types" \
"--enable-multivalue" "--disable-gc" "--disable-memory64" \
"--disable-relaxed-simd" "--disable-extended-const" "--disable-strings" \
"--disable-multimemory" "--strip-debug" "-O0" "--flatten" \
"-o" "demo.opt.wasm" "demo.wasm"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with demo.wasm and the provided wasm-opt command, then inspect Flatten.cpp around line 231. Compare behavior with exception-handling and GC-related inputs or flags. Done means wasm-opt completes without the unexpected expr type or UNREACHABLE failure on the supplied file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100