[MacRuby] #1087: Assertion fails when Array#[]= was specified with very large index.

MacRuby ruby-noreply at macosforge.org
Thu Dec 30 00:07:02 PST 2010


#1087: Assertion fails when Array#[]= was specified with very large index.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 LONGP = [127, 63, 31, 15, 7].map {|x| 2**x-1 }.find do |x|
   begin
     [].first(x)
   rescue ArgumentError
     true
   rescue RangeError
     false
   end
 end
 p LONGP
 ary = []
 ary[LONGP] = 1
 }}}

 Result:
 {{{
 $ ruby19 tc.rb
 9223372036854775807
 tc.rb:12:in `[]=': index 9223372036854775807 too big (IndexError)
         from tc.rb:12:in `<main>'

 $ macruby tc.rb
 9223372036854775807
 Assertion failed: (size > 0), function ruby_xmalloc_memory, file gc.c,
 line 107.
 zsh: abort      macruby tc.rb
 }}}

 BackTrace:
 {{{
 Assertion failed: (size > 0), function ruby_xmalloc_memory, file gc.c,
 line 107.

 Program received signal SIGABRT, Aborted.
 0x00007fff88411616 in __kill ()
 (gdb) bt
 #0  0x00007fff88411616 in __kill ()
 #1  0x00007fff884b1cca in abort ()
 #2  0x00007fff8849ec90 in __assert_rtn ()
 #3  0x000000010004e4ad in rb_objc_no_gc_error [inlined] () at
 /Users/watson/src/MacRuby/gc.c:107
 #4  0x000000010004e4ad in ruby_xmalloc_ptrs (size=0) at gc.c:109
 #5  0x0000000100015f87 in rary_reserve (ary=8590002080,
 newlen=9223372036854775808) at array.c:50
 #6  0x000000010001e23c in rary_aset (ary=8590002080, sel=<value
 temporarily unavailable, due to optimizations>, argc=<value temporarily
 unavailable, due to optimizations>, argv=<value temporarily unavailable,
 due to optimizations>) at array.h:106
 #7  0x000000010014ae35 in rb_vm_dispatch (_vm=0x100d25050,
 cache=0x100ce4520, top=0, self=8590002080, klass=0x200067ae0,
 sel=0x100d2c460, block=0x0, opt=0 '\0', argc=2, argv=0x7fff5fbfed10) at
 dispatcher.cpp:448
 #8  0x0000000102d5ac26 in ?? ()
 #9  0x0000000102d5a61e in ?? ()
 #10 0x0000000102d5a2d0 in ?? ()
 #11 0x0000000100158e03 in rb_vm_run (fname=<value temporarily unavailable,
 due to optimizations>, node=0x200055dc0, binding=<value temporarily
 unavailable, due to optimizations>, inside_eval=false) at vm.cpp:3942
 #12 0x0000000100041830 in ruby_run_node (n=0x200055dc0) at eval.c:211
 #13 0x0000000100000d28 in main (argc=3, argv=0x100d1de30, envp=<value
 temporarily unavailable, due to optimizations>) at main.cpp:40
 (gdb)
 }}}

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



More information about the macruby-tickets mailing list