summaryrefslogtreecommitdiff
path: root/test/lit/validation/nn-locals-bad-call_ref.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/validation/nn-locals-bad-call_ref.wast')
-rw-r--r--test/lit/validation/nn-locals-bad-call_ref.wast31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lit/validation/nn-locals-bad-call_ref.wast b/test/lit/validation/nn-locals-bad-call_ref.wast
new file mode 100644
index 000000000..357409eef
--- /dev/null
+++ b/test/lit/validation/nn-locals-bad-call_ref.wast
@@ -0,0 +1,31 @@
+;; Test for validation of non-nullable locals
+
+;; RUN: not wasm-opt -all --enable-gc-nn-locals %s 2>&1 | filecheck %s
+
+;; CHECK: non-nullable local must not read null
+
+(module
+ (tag $tag (param i32))
+ (func $func
+ (local $0 (ref any))
+ (try
+ (do
+ (call_ref
+ (ref.func $func)
+ )
+ )
+ (catch $tag
+ (drop
+ (pop (i32))
+ )
+ ;; The path to here is from a possible exception thrown in the call_ref.
+ ;; This is a regression test for call_ref not being seen as possibly
+ ;; throwing. We should see a validation error here, as the local.get is
+ ;; of a null default, and it *is* reachable thanks to the call_ref.
+ (drop
+ (local.get $0)
+ )
+ )
+ )
+ )
+)