Closed
Description
Issue description
wasmtime
with lightbeam backend panic due to an unreachable!
. This issue will make program calling lightbeam as 3rd party library to crash. Instead an error should be through to let the caller handle it properly.
Reproduction
wasmtime commit: 3558d41
Compilation with debug info:
$ RUSTFLAGS=-g cargo build --release --features lightbeam
Download & run testcase:
panic_internal_unreachable_code.zip
$ unzip panic_internal_unreachable_code.zip
$ ./target/release/wasmtime --lightbeam panic_internal_unreachable_code.wasm
thread 'main' panicked at 'internal error: entered unreachable code', crates/lightbeam/src/backend.rs:3559:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Related piece of code
lightbeam panics because of a calling to unreachable!
macro.
wasmtime/crates/lightbeam/src/backend.rs
Lines 3558 to 3560 in 3558d41
Fix proposal
After applying the pull request 672, wasmtime
will return:
$ ./target/release/wasmtime --lightbeam panic_internal_unreachable_code.wasm
Error: failed to process main module `panic_internal_unreachable_code.wasm`
Caused by:
0: WebAssembly failed to compile
1: Compilation error: Failed to translate function: Microwasm error: i32_extend_s unreachable code