From 94f5787130bea9223ddb93b87f50ed5491276719 Mon Sep 17 00:00:00 2001 From: ktsj Date: Sun, 29 Sep 2013 09:50:24 +0000 Subject: * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_yield_setup_block_args): clear keyword arguments to prevent GC bug which occurs while marking VM stack. [ruby-dev:47729] [Bug #8964] * test/ruby/test_keyword.rb: tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_keyword.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/ruby/test_keyword.rb') diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index c21afe4495..dd4f6d1b42 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -396,4 +396,23 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([{}, {}], a.new.foo({})) assert_equal([{}, {:bar=>"x"}], a.new.foo({}, bar: "x")) end + + def test_gced_object_in_stack + bug8964 = '[ruby-dev:47729] [Bug #8964]' + assert_normal_exit %q{ + def m(a: []) + end + GC.stress = true + tap { m } + GC.start + tap { m } + }, bug8964 + assert_normal_exit %q{ + prc = Proc.new {|a: []|} + GC.stress = true + tap { prc.call } + GC.start + tap { prc.call } + }, bug8964 + end end -- cgit v1.2.3