summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/bug1776358.js
blob: b2cf178bf2aa0579df6c9b4df34a919be2aa0241 (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 (get_local 0) (get_local 0))
    )
    (export "" (func 1))
)`).exports[""];
assertEq(func(7), 1);
let ex;
try {
    func(0);
} catch (e) {
    ex = e;
}
assertEq(ex instanceof WebAssembly.RuntimeError, true);