summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-05 14:23:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-05 14:23:23 +0000
commit43c1eb440a7adedfb3cc1063b63573ade714c76a (patch)
tree429d5b41acd5419e15b1435cbe9fc8b24d2b15f9 /test
parent665839dddaa33f733682f5446fce04d457803fda (diff)
compile.c: fix stack consistency error
* compile.c (iseq_peephole_optimize): fix stack consistency error from return in loop, by adding extra `pop` when replacing `jump` with `leave`, which is never reached but needed to adjust sp calculation. [ruby-core:84589] [Bug #14273] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index aa82f52987..8bf1627f3b 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1128,6 +1128,15 @@ eom
assert_equal(:begin, result)
end
+ def test_return_in_loop
+ obj = Object.new
+ def obj.test
+ x = nil
+ return until x unless x
+ end
+ assert_nil obj.test
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end