Actions
Backport #4082
closedSegfault with tailcall_optimization and class definition
Status:
Closed
Assignee:
Description
=begin
Code:
RubyVM::InstructionSequence.compile_option = {
:tailcall_optimization => true,
:trace_instruction => false
}
RubyVM::InstructionSequence.new(<<-EOF).eval
class Foo
def fact_helper(n, res)
if n == 1
res
else
fact_helper(n - 1, n * res)
end
end
def fact(n)
fact_helper(n, 1)
end
end
EOF
p Foo.new.fact(30000)
Error:
<compiled>:6: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
-- control frame ----------
c:0004 p:0031 s:0014 b:0011 l:000010 d:000010 METHOD <compiled>:6
c:0003 p:0078 s:0007 b:0006 l:001588 d:001e68 EVAL -:22
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001588 d:001588 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
-:22:in `<main>'
<compiled>:6:in `fact_helper'
-- C level backtrace information -------------------------------------------
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap
=end
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
- Priority changed from Normal to 3
=begin
=end
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r29885.
Magnus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
- Category set to core
- Status changed from Closed to Assigned
- Assignee changed from ko1 (Koichi Sasada) to yugui (Yuki Sonoda)
- Priority changed from 3 to Normal
=begin
=end
Updated by yugui (Yuki Sonoda) over 13 years ago
- Status changed from Assigned to Closed
=begin
This issue was solved with changeset r30265.
Magnus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Actions
Like0
Like0Like0Like0Like0