diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-05 14:23:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-05 14:23:23 +0000 |
commit | 43c1eb440a7adedfb3cc1063b63573ade714c76a (patch) | |
tree | 429d5b41acd5419e15b1435cbe9fc8b24d2b15f9 /test | |
parent | 665839dddaa33f733682f5446fce04d457803fda (diff) | |
download | ruby-43c1eb440a7adedfb3cc1063b63573ade714c76a.tar.gz |
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.rb | 9 |
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 |