1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

compile.c: restore stack at return

* compile.c (iseq_compile_each0): restore the stack depth after
  return to the previous depth, to fix the stack depth at
  returning from rescue iseq.  [ruby-core:82108] [Bug #13755]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-07-20 02:43:45 +00:00
parent ece6c6741e
commit 8c5e7c59ff
2 changed files with 4 additions and 0 deletions

View file

@ -5653,9 +5653,12 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp
enum iseq_type parent_type;
if (type == ISEQ_TYPE_TOP || type == ISEQ_TYPE_MAIN) {
LABEL *splabel = NEW_LABEL(line);
ADD_LABEL(ret, splabel);
ADD_ADJUST(ret, line, 0);
ADD_INSN(ret, line, putnil);
ADD_INSN(ret, line, leave);
ADD_ADJUST_RESTORE(ret, splabel);
}
else if ((type == ISEQ_TYPE_RESCUE || type == ISEQ_TYPE_ENSURE) &&
parent_iseq &&

View file

@ -986,6 +986,7 @@ eom
raise((return; "should not raise"))
begin raise; ensure return; end; self
begin raise; ensure return; end and self
nil&defined?0--begin e=no_method_error(); return; 0;end
end;
all_assertions(feature4840) do |a|
code.each_line do |s|