Fixed uninitialized local variable bug; ref #3692

parent b32ad130
...@@ -1241,7 +1241,7 @@ RETRY_TRY_BLOCK: ...@@ -1241,7 +1241,7 @@ RETRY_TRY_BLOCK:
int n = GETARG_C(i); int n = GETARG_C(i);
struct RProc *m; struct RProc *m;
struct RClass *c; struct RClass *c;
mrb_callinfo *ci; mrb_callinfo *ci = mrb->c->ci;
mrb_value recv, result; mrb_value recv, result;
mrb_sym mid = syms[GETARG_B(i)]; mrb_sym mid = syms[GETARG_B(i)];
int bidx; int bidx;
...@@ -1255,19 +1255,19 @@ RETRY_TRY_BLOCK: ...@@ -1255,19 +1255,19 @@ RETRY_TRY_BLOCK:
bidx = a+n+1; bidx = a+n+1;
} }
if (GET_OPCODE(i) != OP_SENDB) { if (GET_OPCODE(i) != OP_SENDB) {
if (bidx >= mrb->c->ci->nregs) { if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1); stack_extend(mrb, bidx+1);
mrb->c->ci->nregs = bidx+1; ci->nregs = bidx+1;
} }
SET_NIL_VALUE(regs[bidx]); SET_NIL_VALUE(regs[bidx]);
SET_NIL_VALUE(blk); blk = mrb_nil_value();
} }
else { else {
mrb_value blk = regs[bidx]; blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) { if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
if (bidx >= mrb->c->ci->nregs) { if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1); stack_extend(mrb, bidx+1);
mrb->c->ci->nregs = bidx+1; ci->nregs = bidx+1;
} }
result = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc"); result = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
blk = regs[bidx] = result; blk = regs[bidx] = result;
...@@ -1294,10 +1294,8 @@ RETRY_TRY_BLOCK: ...@@ -1294,10 +1294,8 @@ RETRY_TRY_BLOCK:
} }
mid = missing; mid = missing;
if (n != CALL_MAXARGS) { if (n != CALL_MAXARGS) {
mrb_value blk = regs[bidx]; if (a+2 >= irep->nregs) {
stack_extend(mrb, a+3);
if (a+2 > irep->nregs) {
stack_extend(mrb, a+2);
} }
regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1); regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);
regs[a+2] = blk; regs[a+2] = blk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment