binaryen
binaryen copied to clipboard
Failed parse for 'attempted pop from empty stack / beyond block start boundary' on non-empty stack
I receive a parse error using wasm-opt v116.
The error reports the issue 'attempted pop from empty stack / beyond block start boundary', however the stack is non-empty.
The same input program passes wat2wasm and wasm-validate.
Example illustrating what goes wrong:
$ cat instrumented_input.wat
yields
(module
(func $a (result i32)
i32.const 0
i32.const 0
if (param i32) (result i32)
drop
i32.const 0
else
drop
i32.const 0
end))
however:
# Turn Wat into Wasm
$ wat2wasm instrumented_input.wat -o instrumented_input.wasm
# Validate
$ wasm-validate instrumented_input.wasm # No problem
# Attempt to use wasm-opt
$ wasm-opt --version
wasm-opt version 116
$ wasm-opt instrumented_input.wasm
[parse exception: attempted pop from empty stack / beyond block start boundary at 40 (at 0:40)]
Fatal: error parsing wasm (try --debug for more info)
if (param i32) (result i32)
Binaryen does not yet support input params to ifs (and other control flow structures).
Closing in favor of #6407.