Skip to content

Commit

Permalink
wrong stack position for headless case; close #675
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Dec 28, 2012
1 parent be122b7 commit 9d56acb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ codegen(codegen_scope *s, node *tree, int val)
pop();
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern(s->mrb, "===")), 1));
}
pop();
tmp = new_label(s);
genop(s, MKOP_AsBx(OP_JMPIF, cursp(), pos2));
pos2 = tmp;
Expand All @@ -1215,19 +1216,18 @@ codegen(codegen_scope *s, node *tree, int val)
genop(s, MKOP_sBx(OP_JMP, 0));
dispatch_linked(s, pos2);
}
pop(); /* pop HEAD */
codegen(s, tree->car->cdr, val);
if (val) pop();
tmp = new_label(s);
genop(s, MKOP_sBx(OP_JMP, pos3));
pos3 = tmp;
if (pos1) dispatch(s, pos1);
tree = tree->cdr;
push(); /* push HEAD */
}
pop(); /* pop HEAD */
genop(s, MKOP_A(OP_LOADNIL, cursp()));
if (val) push();
if (val) {
genop(s, MKOP_A(OP_LOADNIL, cursp()));
push();
}
if (pos3) dispatch_linked(s, pos3);
}
break;
Expand Down

0 comments on commit 9d56acb

Please sign in to comment.