Skip to content

Commit 3b01b4b

Browse files
Cherry-pick (by hand, just the fix itself, as a result of difficulties merging
in the test case): commit 31bac3e Merge: 93c1993 34d9931 Author: Nick Fitzgerald <[email protected]> Date: Wed Nov 25 13:09:05 2020 -0800 Merge pull request bytecodealliance#2450 from bytecodealliance/cfallin/fix-wasm-reachable Fix Wasm translator bug: end of toplevel frame is branched-to only for fallthrough returns.
1 parent 3bbadf8 commit 3b01b4b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cranelift/wasm/src/code_translator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,9 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
514514
Operator::Return => {
515515
let (return_count, br_destination) = {
516516
let frame = &mut state.control_stack[0];
517-
frame.set_branched_to_exit();
517+
if environ.return_mode() == ReturnMode::FallthroughReturn {
518+
frame.set_branched_to_exit();
519+
}
518520
let return_count = frame.num_return_values();
519521
(return_count, frame.br_destination())
520522
};

0 commit comments

Comments
 (0)