summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/exceptions/unreachable.js
blob: f0091bc617dfb0a0da0074312954a34a6ca50c44 (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=--wasm-function-references --wasm-gc --wasm-compiler=optimizing; test-also=--wasm-function-references --wasm-gc --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/);
}