summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-06 15:13:01 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-06 15:13:01 +0000
commit756009186bceca331a18ce91604b03027432bf4b (patch)
tree1c7e131a6afc1a705fffeb7393e02c9e8cd07e08 /test
parenta2d9317d04a32eb255885eb125d0657af684f4e9 (diff)
merge revision(s) 65350: [Backport #15245]
compile.c: fix peephole optimization * compile.c (iseq_peephole_optimize): should `pop` before jump instruction which succeeds to `newarray` of a literal object, not after. [ruby-core:89536] [Bug #15245] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_optimization.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index d4557ddbbb..a59115443c 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -743,4 +743,10 @@ class TestRubyOptimization < Test::Unit::TestCase
end
assert_equal(:ok, x.bug(:ok))
end
+
+ def test_peephole_jump_after_newarray
+ i = 0
+ %w(1) || 2 while (i += 1) < 100
+ assert_equal(100, i)
+ end
end