Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[interpreter] Fix crashes on try_table with parameters #321

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion interpreter/exec/eval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ let rec step (c : config) : config =
let n1 = Lib.List32.length ts1 in
let n2 = Lib.List32.length ts2 in
let args, vs' = take n1 vs e.at, drop n1 vs e.at in
vs', [Handler (n2, cs, (args, [Label (n2, [], ([], List.map plain es')) @@ e.at])) @@ e.at]
vs', [Handler (n2, cs, ([], [Label (n2, [], (args, List.map plain es')) @@ e.at])) @@ e.at]

| Drop, v :: vs' ->
vs', []
Expand Down
6 changes: 6 additions & 0 deletions test/core/try_table.wast
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@
)
)
)

(func (export "try-with-param")
(i32.const 0) (try_table (param i32) (drop))
)
)

(assert_return (invoke "simple-throw-catch" (i32.const 0)) (i32.const 23))
Expand Down Expand Up @@ -294,6 +298,8 @@
(assert_exception (invoke "return-call-in-try-catch"))
(assert_exception (invoke "return-call-indirect-in-try-catch"))

(assert_return (invoke "try-with-param"))

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