File: nn-locals-bad-call_ref.wast

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (32 lines) | stat: -rw-r--r-- 780 bytes parent folder | download
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
;; Test for validation of non-nullable locals

;; RUN: not wasm-opt -all %s 2>&1 | filecheck %s

;; CHECK: non-nullable local's sets must dominate gets

(module
  (tag $tag (param i32))
  (type $void (func))
  (func $func
    (local $0 (ref any))
    (try
      (do
        (call_ref $void
          (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)
        )
      )
    )
  )
)