mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
OP_ASGN vsp may be negative
reported by https://gist.github.com/miura1729/53fbd8af889c289a79108e38635b2378 fix proposed by @miura1729 in https://github.com/miura1729/mruby/commit/b1b7933f7aa950cfb747b06327a0d0340f3e4ff8
This commit is contained in:
@@ -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));
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user