From 484cc6b3bc828a0bb62aebefd7fdc2c86cab4f57 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 30 Mar 2018 05:15:07 +0000 Subject: compile.c: do not dump unused callinfos * compile.c (compile_if): rewind callinfo indexes used in unreachable paths, to get rid of dumping unused callinfos. [ruby-core:86399] [Bug #14553] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_optimization.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby/test_optimization.rb') diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 38da8b6c45..d77651f2eb 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -721,6 +721,17 @@ class TestRubyOptimization < Test::Unit::TestCase END end + def test_callinfo_unreachable_path + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + iseq = RubyVM::InstructionSequence.compile("if false; foo(bar: :baz); else :ok end") + bin = iseq.to_binary + iseq = RubyVM::InstructionSequence.load_from_binary(bin) + assert_instance_of(RubyVM::InstructionSequence, iseq) + assert_equal(:ok, iseq.eval) + end; + end + def test_side_effect_in_popped_splat bug = '[ruby-core:84340] [Bug #14201]' eval("{**(bug = nil; {})};42") -- cgit v1.2.1