Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 7e2c27c

Browse files
authored
add a test case (#326)
some runtimes implement tag matching as the equality of tag indexes. (cf. bytecodealliance/wasm-micro-runtime#3109) i believe it's a wrong interpreteation of the spec. this test case ensures a failure on such implementations.
1 parent 24be425 commit 7e2c27c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/core/try_table.wast

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
(module
1111
(tag $imported-e0 (import "test" "e0"))
12+
(tag $imported-e0-alias (import "test" "e0"))
1213
(func $imported-throw (import "test" "throw"))
1314
(tag $e0)
1415
(tag $e1)
@@ -211,6 +212,16 @@
211212
(i32.const 2)
212213
)
213214

215+
(func (export "catch-imported-alias") (result i32)
216+
(block $h
217+
(try_table (result i32) (catch $imported-e0 $h)
218+
(throw $imported-e0-alias (i32.const 1))
219+
)
220+
(return)
221+
)
222+
(i32.const 2)
223+
)
224+
214225
(func (export "catchless-try") (param i32) (result i32)
215226
(block $h
216227
(try_table (result i32) (catch $e0 $h)
@@ -291,6 +302,7 @@
291302
(assert_return (invoke "catch-param-i32" (i32.const 5)) (i32.const 5))
292303

293304
(assert_return (invoke "catch-imported") (i32.const 2))
305+
(assert_return (invoke "catch-imported-alias") (i32.const 2))
294306

295307
(assert_return (invoke "catchless-try" (i32.const 0)) (i32.const 0))
296308
(assert_return (invoke "catchless-try" (i32.const 1)) (i32.const 1))

0 commit comments

Comments
 (0)