[MacRuby-devel] [MacRuby] #344: Segmentation fault: Hash and Array Inject

MacRuby ruby-noreply at macosforge.org
Mon Sep 21 08:39:57 PDT 2009


#344: Segmentation fault: Hash and Array Inject
------------------------+---------------------------------------------------
 Reporter:  dev@…       |       Owner:  lsansonetti@…        
     Type:  defect      |      Status:  new                  
 Priority:  critical    |   Milestone:  MacRuby 0.5          
Component:  MacRuby     |    Keywords:                       
------------------------+---------------------------------------------------
 {{{
 box $ cat crash.rb

 class Hash
   def symbolize_keys
     inject({}) do |hash, (key, value)|
       hash.merge(key.to_sym => value.respond_to?(:symbolize_keys) ?
 value.symbolize_keys : value)
     end
   end
 end

 class Array
   def symbolize_keys
     inject([]) do |array, element|
 #     array + [ element.respond_to?(:symbolize_keys) ?
 element.symbolize_keys : element ]
       "a"
     end
   end
 end

 p ({"data_sources"=>["xx"], "output_dir"=>"output"}).symbolize_keys

 box $ macruby crash.rb
 unknown: [BUG] Segmentation fault
 MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 Abort trap
 }}}

 With gdb:

 {{{
 (gdb) run crash.rb
 Starting program: /usr/local/bin/macruby crash.rb
 Reading symbols for shared libraries .++++......................... done

 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_INVALID_ADDRESS at address: 0x00007fff6077cd40
 0x0000000100d90283 in _cache_getMethod ()
 (gdb) bt
 #0  0x0000000100d90283 in _cache_getMethod ()
 #1  0x0000000100d8fa43 in look_up_method ()
 #2  0x0000000100176c4d in __rb_vm_dispatch [inlined] () at
 /Users/box/Documents/dev/macruby/macruby/vm.cpp:2780
 #3  0x0000000100176c4d in rb_vm_dispatch (cache=0x102bf7740,
 self=140734799783520, sel=0x102b8b570, block=0x0, opt=0 '\0', argc=1) at
 vm.cpp:3154
 #4  0x0000000104080545 in ?? ()
 #5  0x00000001001752b6 in rb_vm_yield0 [inlined] () at
 /Users/box/Documents/dev/macruby/macruby/vm.cpp:4207
 #6  0x00000001001752b6 in rb_vm_yield (argc=132064, argv=0x7fff5fbfcd70)
 at vm.cpp:4214
 #7  0x000000010011a978 in rb_yield_0 [inlined] () at
 /Users/box/Documents/dev/macruby/macruby/vm_eval.c:194
 #8  0x000000010011a978 in rb_yield_values (n=<value temporarily
 unavailable, due to optimizations>) at vm_eval.c:226
 #9  0x0000000100039c68 in inject_i (i=1, p=140734799783488, argc=132832,
 argv=0x7fff5fbfd008) at enum.c:429
 #10 0x00000001001741da in rb_vm_block_eval0 (b=0x20000e180, sel=0x0,
 self=8590066784, argc=1, argv=0x102bfb8e0) at vm.cpp:4082
 #11 0x00000001001752b6 in rb_vm_yield0 [inlined] () at
 /Users/box/Documents/dev/macruby/macruby/vm.cpp:4207
 #12 0x00000001001752b6 in rb_vm_yield (argc=1, argv=0x7fff5fbfd008) at
 vm.cpp:4214
 #13 0x000000010011a1f0 in rb_yield (val=8590067424) at vm_eval.c:194
 #14 0x000000010004d5f7 in each_pair_i (key=8590067424, value=0) at
 hash.c:1099
 #15 0x0000000100050c2c in rb_hash_foreach (hash=<value temporarily
 unavailable, due to optimizations>, func=0x10004d5e0 <each_pair_i>,
 farg=0) at hash.c:108
 #16 0x0000000100051321 in rb_hash_each_pair (hash=8590066592,
 sel=0x102b2b400) at hash.c:1125
 #17 0x00000001001738e1 in rb_vm_call_with_cache2 (cache=0x102b2b490,
 block=0x20000e180, self=8590066592, klass=4295299792, sel=0x102b2b400,
 argc=<value temporarily unavailable, due to optimizations>, argv=0x0) at
 vm.cpp:2336
 #18 0x0000000100037fd8 in enum_inject (obj=8590066592, sel=<value
 temporarily unavailable, due to optimizations>, argc=<value temporarily
 unavailable, due to optimizations>, argv=<value temporarily unavailable,
 due to optimizations>) at enum.c:521
 #19 0x0000000100177be1 in rb_vm_dispatch (cache=0x102bf6230,
 self=8590066592, sel=0x102b51b30, block=0x20000cf00, opt=2 '\002', argc=1)
 at vm.cpp:2679
 #20 0x0000000104080350 in ?? ()
 #21 0x00000001040801d4 in ?? ()
 Previous frame inner to this frame (gdb could not unwind past this frame)
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/344>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list