summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-07-25 11:34:55 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-07-25 11:34:55 +0900
commit34ac707ea34880e168dc2428d477a33ca7ffec7d (patch)
treed90f9f24a2d613b508f623bc8a7de766dd8ff9ad /mrbgems
parent417092360dced241f9cc04884887a55c2407e81a (diff)
downloadmruby-34ac707ea34880e168dc2428d477a33ca7ffec7d.tar.gz
mruby-34ac707ea34880e168dc2428d477a33ca7ffec7d.zip
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
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index dde289e7c..6e9c3c147 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -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) {