diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-15 04:52:39 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-15 04:52:39 +0000 |
commit | 1d7247e6941ed1630ad172834bbaaf25b968be02 (patch) | |
tree | 7eab386e843b1995852b91b060c0c9a6a1f82a71 /test/ruby/test_optimization.rb | |
parent | 5570dba96fe017692a5790a176619234301ff3cb (diff) |
fix uninitialized memory reference.
* compile.c (iseq_set_sequence): clear kwargs (in ci_entries) memory area.
kwargs ci entries are initialized by compiler. However, sometimes these
initializations are skipped because corresponding calls are eliminated
by some optimizations (for example, `if true` syntax elimnates else code).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_optimization.rb')
-rw-r--r-- | test/ruby/test_optimization.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 40015c57dd..3ea867e8e1 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -647,4 +647,19 @@ class TestRubyOptimization < Test::Unit::TestCase eval "def foo; 1.times{|(a), &b| nil && a}; end" END end + + def test_clear_unreachable_keyword_args + assert_separately [], <<-END + script = <<-EOS + if true + else + foo(k1:1) + end + EOS + GC.stress = true + 30.times{ + RubyVM::InstructionSequence.compile(script) + } + END + end end |