diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-05 16:42:27 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-05 16:42:27 +0000 |
commit | 11c37ed390478393b0ba9b7afd41c92aae27ae05 (patch) | |
tree | 47767a2da8bc746b269f4df18d93f1d6814ab000 /test | |
parent | b0569e3dde14df7b9acc703c6a4c7325573094f5 (diff) |
* compile.c (tailcallable_p): disable tail call optimization for
toplevel, eval, and load to avoid SEGV when interrupted by SIGINT.
[ruby-core:76327] [Bug #12576]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_optimization.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 89a9753f0e..c035a112cb 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -316,6 +316,33 @@ class TestRubyOptimization < Test::Unit::TestCase message(bug12565) {disasm(:add_one_and_two)}) end + def test_tailcall_interrupted_by_sigint + bug = 'ruby-core:76327' + script = <<EOS +RubyVM::InstructionSequence.compile_option = { + :tailcall_optimization => true, + :trace_instruction => false +} + +eval <<EOF +def foo + foo +end +foo +EOF +EOS + err = EnvUtil.invoke_ruby([], "", true, true, {}) { + |in_p, out_p, err_p, pid| + in_p.write(script) + in_p.close + sleep(1) + Process.kill(:SIGINT, pid) + Process.wait(pid) + err_p.read + } + assert_match(/Interrupt/, err, bug) + end + class Bug10557 def [](_) block_given? |