Project

General

Profile

Actions

Bug #8518

closed

assertion failed in rb_ary_sort_bang

Added by znz (Kazuhiro NISHIYAMA) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.1.0dev (2013-06-12 trunk 41248) [x86_64-linux]
[ruby-dev:47419]

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));
Actions

Also available in: Atom PDF

Like0
Like0