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

[legacy] Add setjmp bait #332

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/legacy/exceptions/core/try_catch.wast
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@
(func (export "break-try-catch_all")
(try (do (br 0)) (catch_all))
)

(func $longjmp-bait (throw $e0))
(func (export "setjmp-bait") (param $return-early i32) (result i32)
(local $value i32)
(try $try
(do
(br_if $try (local.get $return-early))
(local.set $value (i32.const 1))
(call $longjmp-bait)
)
(catch $e0)
)
(local.get $value)
)
)

(assert_return (invoke "empty-catch"))
Expand Down Expand Up @@ -222,6 +236,9 @@
(assert_return (invoke "break-try-catch"))
(assert_return (invoke "break-try-catch_all"))

(assert_return (invoke "setjmp-bait" (i32.const 1)) (i32.const 0))
(assert_return (invoke "setjmp-bait" (i32.const 0)) (i32.const 1))

(module
(func $imported-throw (import "test" "throw"))
(tag $e0)
Expand Down
Loading