summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/bug1776358.js
blob: d5522b689fcb6a4310faa4b3f7cd0397355eaffc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let func = wasmEvalText(`(module
    (func
        (param f64) (param f64) (param f64) (param f64) (param f64)
        (param f64) (param f64) (param f64) (param f64)
    )
    (func
        (param i32)
        (result i32)
        ;; Call in a dead branch.
        (if (i32.const 0) (then
          (call 0
            (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0)
            (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0)
          )
        ))
        ;; Division to trigger a trap.
        (i32.div_s (local.get 0) (local.get 0))
    )
    (export "" (func 1))
)`).exports[""];
assertEq(func(7), 1);
let ex;
try {
    func(0);
} catch (e) {
    ex = e;
}
assertEq(ex instanceof WebAssembly.RuntimeError, true);