(module
(func (export "trunc")
(drop
(i32.trunc_f64_s
(f64.const -2147483648.1)
)
)
)
)
(assert_trap (invoke "trunc") "integer overflow")
This behaves differently in different VMs: The spec interpreter, JavaScriptCore, wabt and binaryen trap (that is, the testcase passes as it throws an error when doing the truncation), while V8 and SpiderMonkey do not trap.
To run it: d8 aa.js -- aa.wasm etc., or run the above wast file in something that can run spec testcases.
test.zip