summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-04 16:13:13 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-04 16:13:13 +0000
commitf7bd8a08ec161a5a6cb079313559fb3b4fc5861d (patch)
tree47436ce96b3389604edeac324f80d5b0148144bc
parent2badceae641d795adddd048e4f9f8686d9768ae2 (diff)
merge revision(s) 59374: [Backport #13755]
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/branches/ruby_2_4@59507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c3
-rw-r--r--test/ruby/test_syntax.rb1
-rw-r--r--version.h2
3 files changed, 5 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 56d885aa27..20466d01f9 100644
--- a/compile.c
+++ b/compile.c
@@ -5480,9 +5480,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
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 &&
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 9838680e6a..42866630ad 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -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|
diff --git a/version.h b/version.h
index 463319935c..da628b993f 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.2"
#define RUBY_RELEASE_DATE "2017-08-05"
-#define RUBY_PATCHLEVEL 172
+#define RUBY_PATCHLEVEL 173
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 8