1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 55605: [Backport #12565]

* vm_args.c (vm_caller_setup_arg_block): disable symbol block
	  argument optimization when tail call optimization is enabled,
	  in order to avoid SEGV.  [ruby-core:76288] [Bug #12565]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2016-07-30 03:31:58 +00:00
parent 446bb33fa3
commit aeb980bdc6
4 changed files with 24 additions and 2 deletions

View file

@ -319,6 +319,21 @@ class TestRubyOptimization < Test::Unit::TestCase
assert_equal("should be rescued", result.message, bug12082)
end
def test_tailcall_symbol_block_arg
bug12565 = '[ruby-core:46065]'
tailcall(<<-EOF)
def apply_one_and_two(&block)
yield(1, 2)
end
def add_one_and_two
apply_one_and_two(&:+)
end
EOF
assert_equal(3, add_one_and_two,
message(bug12565) {disasm(:add_one_and_two)})
end
class Bug10557
def [](_)
block_given?