Skip to content

Commit

Permalink
OP_ASGN vsp may be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jul 25, 2016
1 parent 4170923 commit 34ac707
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mrbgems/mruby-compiler/core/codegen.c
Expand Up @@ -1785,7 +1785,7 @@ codegen(codegen_scope *s, node *tree, int val)
int pos;

pop();
if (val) {
if (val && vsp >= 0) {
genop(s, MKOP_AB(OP_MOVE, vsp, cursp()));
pos = genop(s, MKOP_AsBx(name[0]=='|'?OP_JMPIF:OP_JMPNOT, cursp(), 0));
}
Expand All @@ -1794,7 +1794,7 @@ codegen(codegen_scope *s, node *tree, int val)
}
codegen(s, tree->cdr->cdr->car, VAL);
pop();
if (val) {
if (val && vsp >= 0) {
genop(s, MKOP_AB(OP_MOVE, vsp, cursp()));
}
if ((intptr_t)tree->car->car == NODE_CALL) {
Expand Down Expand Up @@ -1855,7 +1855,7 @@ codegen(codegen_scope *s, node *tree, int val)
gen_assignment(s, tree->car, cursp(), val);
}
else {
if (val) {
if (val && vsp >= 0) {
genop(s, MKOP_AB(OP_MOVE, vsp, cursp()));
}
if (callargs == CALL_MAXARGS) {
Expand Down

0 comments on commit 34ac707

Please sign in to comment.