Skip to content
Permalink
Browse files
fixed wrong stack adjustment for ensure clauses; fix #3175
  • Loading branch information
matz committed Nov 6, 2016
1 parent 0b8d8dd commit 6c299aae67e2e0f13a470b855298bc1efb43387a
Showing 2 changed files with 7 additions and 1 deletion.
@@ -1513,6 +1513,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
/* A B return R(A) (B=normal,in-block return/break) */
if (mrb->exc) {
mrb_callinfo *ci;
mrb_value *stk;
int eidx;

L_RAISE:
@@ -1524,6 +1525,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
if (ci->ridx == 0) goto L_STOP;
goto L_RESCUE;
}
stk = mrb->c->stack;
while (ci[0].ridx == ci[-1].ridx) {
cipop(mrb);
ci = mrb->c->ci;
@@ -1533,6 +1535,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
MRB_THROW(prev_jmp);
}
if (ci == mrb->c->cibase) {
mrb->c->stack = stk;
while (eidx > 0) {
ecall(mrb, --eidx);
}
@@ -338,10 +338,13 @@ def b
begin
1 * "b"
ensure
@e = self.z
@e = self.zz
end
end

def zz
true
end
def z
true
end

0 comments on commit 6c299aa

Please sign in to comment.