summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/exceptions/unreachable.js
blob: 2dc2c8b3b17aebc63565b18505496179f4db1503 (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
29
30
31
32
33
// |jit-test| test-also=--setpref=wasm_gc=true --wasm-compiler=optimizing; test-also=--setpref=wasm_gc=true --wasm-compiler=baseline;

wasmFailValidateText(`(module
	(tag)
	(tag)
	(func (export "test")
		try
			throw 0
		catch 0
			unreachable
		catch 1
			i32.add
		end
	)
)`, /popping/);

if (wasmGcEnabled()) {
	wasmFailValidateText(`(module
		(tag)
		(tag)
		(func (export "test") (param (ref extern))
			(local $nonNullable (ref extern))
			try
				throw 0
			catch 0
				(local.set $nonNullable (local.get 0))
			catch 1
				(local.get $nonNullable)
				drop
			end
		)
	)`, /unset local/);
}