summaryrefslogtreecommitdiff
path: root/test/parse
diff options
context:
space:
mode:
authorAsumu Takikawa <asumu@igalia.com>2021-06-29 13:53:26 -0700
committerGitHub <noreply@github.com>2021-06-29 13:53:26 -0700
commit6448318d5577b12c4bb1cec081ea0b48012ed3f4 (patch)
tree3d581ab4f7e82d775e4e78426ec5f28e28133fd6 /test/parse
parentb97dd591fad3e4b7d382d409247007cf65fc2baf (diff)
downloadwabt-6448318d5577b12c4bb1cec081ea0b48012ed3f4.tar.gz
wabt-6448318d5577b12c4bb1cec081ea0b48012ed3f4.tar.bz2
wabt-6448318d5577b12c4bb1cec081ea0b48012ed3f4.zip
Fix resolution of delegate labels (#1675)
This the label resolution code. Example from the spec (https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md): ``` try $l1 try call $foo delegate $l1 ;; (= delegate 0) catch ... catch_all ... end ``` The label `$l1` should resolve to `0` in the delegate target, which is 1 less than how typical block constructs work. The current code mis-resolves this to `1`. It should also error in cases like the following: ``` try $l1 nop delegate $l1 ``` Because it's not possible to represent the label `$l1` in the binary format, as a `try-delegate` cannot target itself.
Diffstat (limited to 'test/parse')
-rw-r--r--test/parse/bad-delegate-label.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parse/bad-delegate-label.txt b/test/parse/bad-delegate-label.txt
new file mode 100644
index 00000000..bff8f05c
--- /dev/null
+++ b/test/parse/bad-delegate-label.txt
@@ -0,0 +1,15 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-exceptions
+;;; ERROR: 1
+(module
+ (func
+ try $t
+ nop
+ delegate $t
+ )
+)
+(;; STDERR ;;;
+out/test/parse/bad-delegate-label.txt:8:14: error: undefined label variable "$t"
+ delegate $t
+ ^^
+;;; STDERR ;;)