diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-06 08:01:58 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-06 08:01:58 +0000 |
commit | 5e7167f8fb954ec46eb12a4a0a1191a8f7d9543d (patch) | |
tree | ee282abc39fd8e887ebc4ee19aaa85ecfc57c000 /test | |
parent | 79f01d3972811e4388a257decea3e47445b42b59 (diff) | |
download | ruby-5e7167f8fb954ec46eb12a4a0a1191a8f7d9543d.tar.gz |
compile.c: remove unreachable jump only
* compile.c (iseq_peephole_optimize): remove unreachable jump
instruction only. if it is labeled and referred from other
instructions, it is reachable and must not be removed.
[ruby-core:87830] [Bug #14897]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_optimization.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 32bdcef13d..d4a1fdbcea 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -771,4 +771,17 @@ class TestRubyOptimization < Test::Unit::TestCase tap {true || tap {}} end; end + + def test_jump_elimination_with_optimized_out_block + x = Object.new + def x.bug(obj) + if obj || obj + obj = obj + else + raise "[ruby-core:87830] [Bug #14897]" + end + obj + end + assert_equal(:ok, x.bug(:ok)) + end end |