Bug #2964
closedSegmentation Fault is occurred by Array#sample in a child process
Description
=begin
ruby -ve 'Process.wait fork { p [1, 2].sample }'
-e:1: [BUG] Segmentation fault
ruby 1.9.2dev (2010-03-15 trunk 26932) [x86_64-darwin10.2.0]
-- control frame ----------
c:0007 p:---- s:0018 b:0018 l:000017 d:000017 CFUNC :sample
c:0006 p:0011 s:0015 b:0014 l:000e18 d:000013 BLOCK -e:1
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :fork
c:0003 p:0016 s:0007 b:0006 l:000e18 d:001ac8 EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000e18 d:000e18 TOP
-- Ruby level backtrace information ----------------------------------------
-e:1:in <main>' -e:1:in
fork'
-e:1:in block in <main>' -e:1:in
sample'
-- C level backtrace information -------------------------------------------
0 ruby 0x000000010019a5d2 rb_vm_bugreport + 210
1 ruby 0x000000010003da44 report_bug + 372
2 ruby 0x000000010003dc2b rb_bug + 219
3 ruby 0x0000000100111c74 sigsegv + 148
4 libSystem.B.dylib 0x00007fff804b4eaa _sigtramp + 26
5 ??? 0x000000010060dc19 0x0 + 4301315097
6 ruby 0x000000010000b35c rb_ary_sample + 108
7 ruby 0x00000001001805e2 vm_call_method + 978
8 ruby 0x0000000100183473 vm_exec_core + 8531
9 ruby 0x000000010018af33 vm_exec + 1507
10 ruby 0x0000000100197b34 rb_yield + 676
11 ruby 0x0000000100042aad rb_protect + 253
12 ruby 0x00000001000cf038 rb_f_fork + 136
13 ruby 0x00000001001805e2 vm_call_method + 978
14 ruby 0x0000000100183473 vm_exec_core + 8531
15 ruby 0x000000010018af33 vm_exec + 1507
16 ruby 0x000000010018b240 rb_iseq_eval_main + 496
17 ruby 0x00000001000430a2 ruby_exec_internal + 226
18 ruby 0x0000000100045f44 ruby_run_node + 84
19 ruby 0x0000000100001460 main + 96
20 ruby 0x00000001000013f4 start + 52
21 ??? 0x0000000000000003 0x0 + 3
[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
ruby 1.9.2dev (2010-03-15 trunk 26932) [x86_64-darwin10.2.0]
=end