wabt icon indicating copy to clipboard operation
wabt copied to clipboard

Assertion fails in `return_call` test case when tracing is on

Open takikawa opened this issue 4 years ago • 0 comments

When running the example in #1761 with tracing on, you get a crash due to an assertion failure like the following

$ wabt/out/clang/Debug/wasm-interp out/test/interp/return-call-get-local/return-call-get-local.wasm -t --run-all-exports --enable-tail-call
>>> running export "f":
#0.    0: V:0  | i64.const 1
#0.   12: V:1  | br @24
#0.   24: V:1  | i32.const 3
#0.   32: V:2  | drop_keep $1 $1
#0.   44: V:1  | br @68
#0.   68: V:1  | i32.const 2
wasm-interp: ../../../src/interp/interp.cc:192: wabt::interp::ValueType wabt::interp::FuncDesc::GetLocalType(wabt::interp::Index) const: Assertion `iter != locals.end()' failed.
Aborted (core dumped)

This is because the value stack height is set for the wrong function when a return_call is done, because it re-uses the existing stack frame without adjusting any of its values. It's probably easiest to fix this after #1749 lands because it also adjusts how return_call is executed.

takikawa avatar Nov 17 '21 00:11 takikawa