Skip to content

Commit 2fdf427

Browse files
committed
Add setjmp bait
1 parent 6ca3310 commit 2fdf427

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: test/legacy/exceptions/core/try_catch.wast

+17
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,20 @@
175175
(func (export "break-try-catch_all")
176176
(try (do (br 0)) (catch_all))
177177
)
178+
179+
(func $longjmp-bait (throw $e0))
180+
(func (export "setjmp-bait") (param $return-early i32) (result i32)
181+
(local $value i32)
182+
(try $try
183+
(do
184+
(br_if $try (local.get $return-early))
185+
(local.set $value (i32.const 1))
186+
(call $longjmp-bait)
187+
)
188+
(catch $e0)
189+
)
190+
(local.get $value)
191+
)
178192
)
179193

180194
(assert_return (invoke "empty-catch"))
@@ -222,6 +236,9 @@
222236
(assert_return (invoke "break-try-catch"))
223237
(assert_return (invoke "break-try-catch_all"))
224238

239+
(assert_return (invoke "setjmp-bait" (i32.const 1)) (i32.const 0))
240+
(assert_return (invoke "setjmp-bait" (i32.const 0)) (i32.const 1))
241+
225242
(module
226243
(func $imported-throw (import "test" "throw"))
227244
(tag $e0)

0 commit comments

Comments
 (0)