blob: 3c035508722c3f7680a3271ee8a764ebc3bcf28b [file] [edit]
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.
;; RUN: wasm-opt %s -all --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s
(module
(tag $e-i32 (param i32))
;; CHECK: [fuzz-exec] export throw
;; CHECK-NEXT: [exception thrown: e-i32 1]
(func $throw (export "throw")
(throw $e-i32 (i32.const 1))
)
;; CHECK: [fuzz-exec] export try-catch
(func $try-catch (export "try-catch")
(try
(do
(throw $e-i32 (i32.const 2))
)
(catch $e-i32
(drop (pop i32))
)
)
)
;; CHECK: [fuzz-exec] export catchless-try
;; CHECK-NEXT: [exception thrown: e-i32 3]
(func $catchless-try (export "catchless-try")
(try
(do
(throw $e-i32 (i32.const 3))
)
)
)
;; CHECK: [fuzz-exec] export try-delegate
;; CHECK-NEXT: [exception thrown: e-i32 4]
(func $try-delegate (export "try-delegate")
(try $l0
(do
(try
(do
(throw $e-i32 (i32.const 4))
)
(delegate $l0)
)
)
)
)
;; CHECK: [fuzz-exec] export try-delegate-caller-through-try_table
;; CHECK-NEXT: [exception thrown: e-i32 5]
(func $try-delegate-caller-through-try_table (export "try-delegate-caller-through-try_table")
;; Delegation to the caller should bypass an intermediate try_table.
(block $catch
(try_table (catch_all $catch)
(try
(do
(throw $e-i32 (i32.const 5))
)
(delegate 1)
)
)
)
)
;; CHECK: [fuzz-exec] export try-delegate-try-through-try_table
;; CHECK-NEXT: [fuzz-exec] note result: try-delegate-try-through-try_table => 6
(func $try-delegate-try-through-try_table (export "try-delegate-try-through-try_table") (result i32)
;; Delegation to an outer try should also bypass an intermediate try_table.
(try $l0 (result i32)
(do
(block $catch
(try_table (catch_all $catch)
(try
(do
(throw $e-i32 (i32.const 6))
)
(delegate $l0)
)
)
)
(i32.const 0)
)
(catch $e-i32
(pop i32)
)
)
)
)
;; CHECK: [fuzz-exec] export throw
;; CHECK-NEXT: [exception thrown: e-i32 1]
;; CHECK: [fuzz-exec] export try-catch
;; CHECK: [fuzz-exec] export catchless-try
;; CHECK-NEXT: [exception thrown: e-i32 3]
;; CHECK: [fuzz-exec] export try-delegate
;; CHECK-NEXT: [exception thrown: e-i32 4]
;; CHECK: [fuzz-exec] export try-delegate-caller-through-try_table
;; CHECK-NEXT: [exception thrown: e-i32 5]
;; CHECK: [fuzz-exec] export try-delegate-try-through-try_table
;; CHECK-NEXT: [fuzz-exec] note result: try-delegate-try-through-try_table => 6
;; CHECK-NEXT: [fuzz-exec] comparing catchless-try
;; CHECK-NEXT: [fuzz-exec] comparing throw
;; CHECK-NEXT: [fuzz-exec] comparing try-catch
;; CHECK-NEXT: [fuzz-exec] comparing try-delegate
;; CHECK-NEXT: [fuzz-exec] comparing try-delegate-caller-through-try_table
;; CHECK-NEXT: [fuzz-exec] comparing try-delegate-try-through-try_table