[MacRuby] #1067: Segfault occurs when calls Struct#hash with recursive structs.

MacRuby ruby-noreply at macosforge.org
Mon Dec 20 17:25:47 PST 2010


#1067: Segfault occurs when calls Struct#hash with recursive structs.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 # "recursive structs"
 Car = Struct.new(:make, :model, :year)

 car = Car.new("Honda", "Accord", "1998")
 car[:make] = car
 p car.hash
 }}}

 BackTrace:
 {{{
 $ DYLD_LIBRARY_PATH=. gdb --args ./macruby ~/tmp/tt.rb
 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ff958
 0x0000000100136d4b in rb_vm_dispatch () at dispatcher.cpp:582
 582             int argc, const VALUE *argv)
 (gdb) bt 20
 #0  0x0000000100136d4b in rb_vm_dispatch () at dispatcher.cpp:582
 #1  0x00000001000469d9 in rb_vm_call0 (vm=0x100e1e6d0, top=0,
 self=8590170016, klass=0x200059ac0, sel=0x7fff8751dbe0, block=0x0, opt=2
 '\002', argc=0, argv=0x0) at vm.h:603
 #2  0x0000000100046861 in rb_vm_call (self=8590170016, sel=0x7fff8751dbe0,
 argc=0, argv=0x0) at vm.h:610
 #3  0x0000000100046783 in rb_hash_code (obj=8590170016) at hash.c:59
 #4  0x0000000100046aba in rb_hash (obj=8590170016) at hash.c:75
 #5  0x00000001000bda81 in rb_struct_hash (s=8590290688,
 sel=0x7fff8751dbe0) at struct.c:861
 #6  0x0000000100138304 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-trunk-svn/dispatcher.cpp:159
 #7  0x0000000100138304 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-trunk-svn/dispatcher.cpp:466
 #8  0x0000000100138304 in rb_vm_dispatch () at dispatcher.cpp:849
 #9  0x00000001000469d9 in rb_vm_call0 (vm=0x100e1e6d0, top=0,
 self=8590290688, klass=0x2000397a0, sel=0x7fff8751dbe0, block=0x0, opt=2
 '\002', argc=0, argv=0x0) at vm.h:603
 #10 0x0000000100046861 in rb_vm_call (self=8590290688, sel=0x7fff8751dbe0,
 argc=0, argv=0x0) at vm.h:610
 #11 0x0000000100046783 in rb_hash_code (obj=8590290688) at hash.c:59
 #12 0x0000000100046aba in rb_hash (obj=8590290688) at hash.c:75
 #13 0x00000001000bdae9 in rb_struct_hash (s=8590290688,
 sel=0x7fff8751dbe0) at struct.c:864
 #14 0x0000000100138304 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-trunk-svn/dispatcher.cpp:159
 #15 0x0000000100138304 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-trunk-svn/dispatcher.cpp:466
 #16 0x0000000100138304 in rb_vm_dispatch () at dispatcher.cpp:849
 #17 0x00000001000469d9 in rb_vm_call0 (vm=0x100e1e6d0, top=0,
 self=8590290688, klass=0x2000397a0, sel=0x7fff8751dbe0, block=0x0, opt=2
 '\002', argc=0, argv=0x0) at vm.h:603
 #18 0x0000000100046861 in rb_vm_call (self=8590290688, sel=0x7fff8751dbe0,
 argc=0, argv=0x0) at vm.h:610
 #19 0x0000000100046783 in rb_hash_code (obj=8590290688) at hash.c:59
 (More stack frames follow...)
 Current language:  auto; currently objective-c++
 (gdb)
 }}}

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



More information about the macruby-tickets mailing list