Clear local (but non-argument) variables in OP_ENTER.

Otherwise, the following script prints an uninitialized value.

def f(*a)
  if false
    b = 15
  end
  p b
end
f(1,2,3)
parent 47f18151
...@@ -1637,6 +1637,10 @@ RETRY_TRY_BLOCK: ...@@ -1637,6 +1637,10 @@ RETRY_TRY_BLOCK:
} }
pc += o + 1; pc += o + 1;
} }
/* clear local (but non-argument) variables */
if (irep->nlocals-len-2 > 0) {
stack_clear(&regs[len+2], irep->nlocals-len-2);
}
JUMP; JUMP;
} }
......
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