Skip to content

Commit ba5c994

Browse files
committed
push else operands only for IfReachability::Both
Otherwise a Wasm `if` acts similar to a Wasm `block` since it is known upfront that operands are not required to be input twice.
1 parent b5b452d commit ba5c994

File tree

1 file changed

+3
-1
lines changed
  • crates/wasmi/src/engine/translator/func2/stack

1 file changed

+3
-1
lines changed

crates/wasmi/src/engine/translator/func2/stack/control.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ impl ControlStack {
127127
label,
128128
reachability,
129129
}));
130-
self.else_operands.push(else_operands);
130+
if matches!(reachability, IfReachability::Both { .. }) {
131+
self.else_operands.push(else_operands);
132+
}
131133
}
132134

133135
/// Pushes a new Wasm `else` onto the [`ControlStack`].

0 commit comments

Comments
 (0)