Project

General

Profile

Actions

Bug #8510

closed

assertion failed in ary_resize_capa

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-10 trunk 41220) [x86_64-linux]
[ruby-dev:47416]

Description

-DARRAY_DEBUG を付けていると enc.mk のあたりで make が通りません。

generating enc.mk
miniruby: .../ruby/array.c:153: ary_resize_capa: 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)<<11))):((((int)(long)(ary))&RUBY_FIXNUM_FLAG)||((((int)(long)(ary))&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG))))' failed.
Aborted (core dumped)

原因を調べてみたところ、 ary_make_shared で

else if (OBJ_FROZEN(ary)) {                                                           
    ary_resize_capa(ary, ARY_HEAP_LEN(ary));                                          

という条件で ary_resize_capa を呼び出しているのに、ary_resize_capa の中に

assert(!OBJ_FROZEN(ary));                                                             

があるからのようです。

Updated by znz (Kazuhiro NISHIYAMA) over 11 years ago

  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)
Actions #2

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 r41227.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


array.c: fix false assertion in ary_make_shared

  • array.c (ary_shrink_capa): shrink the capacity so it fits just with
    the length.
  • array.c (ary_make_shared): release never used elements from frozen
    array to be shared. [ruby-dev:47416] [Bug #8510]
Actions

Also available in: Atom PDF

Like0
Like0Like0