Bug #8518
closedassertion failed in rb_ary_sort_bang
Description
-DARRAY_DEBUG の続きです。
test/ruby/test_array.rb の test_sort! の以下に相当する部分で assertion failed になります。
% ./miniruby -e 'a=Array[4, 1, 2, 3]; a.sort! {|m, n| a.replace([9, 8, 7]); m <=> n }'
miniruby: .../ruby/array.c:2336: rb_ary_sort_bang: Assertion `!(((!((!(((VALUE)((ary)) & RUBY_IMMEDIATE_MASK) || !!(((VALUE)((ary)) & ~((VALUE)RUBY_Qnil)) == 0)) && (int)(((struct RBasic*)((ary)))->flags & RUBY_T_MASK) != RUBY_T_NODE)?(((struct RBasic*)(((ary))))->flags&(((((VALUE)1)<<(12+2))))):0) || !((!(((VALUE)((ary)) & RUBY_IMMEDIATE_MASK) || !!(((VALUE)((ary)) & ~((VALUE)RUBY_Qnil)) == 0)) && (int)(((struct RBasic*)((ary)))->flags & RUBY_T_MASK) != RUBY_T_NODE)?(((struct RBasic*)(((ary))))->flags&(((((VALUE)1)<<(12+1))))):0)) ? (void) (0) : __assert_fail ("!((!(((VALUE)((ary)) & RUBY_IMMEDIATE_MASK) || !!(((VALUE)((ary)) & ~((VALUE)RUBY_Qnil)) == 0)) && (int)(((struct RBasic*)((ary)))->flags & RUBY_T_MASK) != RUBY_T_NODE)?(((struct RBasic*)(((ary))))->flags&(((((VALUE)1)<<(12+2))))):0) || !((!(((VALUE)((ary)) & RUBY_IMMEDIATE_MASK) || !!(((VALUE)((ary)) & ~((VALUE)RUBY_Qnil)) == 0)) && (int)(((struct RBasic*)((ary)))->flags & RUBY_T_MASK) != RUBY_T_NODE)?(((struct RBasic*)(((ary))))->flags&(((((VALUE)1)<<(12+1))))):0)", "/home/kazu/z/wc/CI/ruby/array.c", 2336, PRETTY_FUNCTION)), ((!(((VALUE)((ary)) & RUBY_IMMEDIATE_MASK) || !!(((VALUE)((ary)) & ~((VALUE)RUBY_Qnil)) == 0)) && (int)(((struct RBasic*)((ary)))->flags & RUBY_T_MASK) != RUBY_T_NODE)?(((struct RBasic*)(((ary))))->flags&(((((VALUE)1)<<(12+1))))):0)!=0)' failed.
なぜか行番号がずれていて 2336 行目は以下の if 文の行ですが、その下の ary の方がひっかかっているようです。
assert(!ARY_EMBED_P(tmp));
if (ARY_HEAP_PTR(ary) == ARY_HEAP_PTR(tmp)) {
assert(!ARY_EMBED_P(ary));
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r41253.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
array.c: fix false assertions
- array.c (rb_ary_sort_bang): remove duplicated assertions.
ARY_HEAP_PTR() implies ary not to be embedded. [ruby-dev:47419]
[Bug #8518]