Bug #8510

assertion failed in ary_resize_capa

Added by Kazuhiro NISHIYAMA almost 2 years ago. Updated almost 2 years ago.

[ruby-dev:47416]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
ruby -v:ruby 2.1.0dev (2013-06-10 trunk 41220) [x86_64-linux] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

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

があるからのようです。

Associated revisions

Revision 41227
Added by Nobuyoshi Nakada almost 2 years ago

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. [Bug #8510]

Revision 41227
Added by Nobuyoshi Nakada almost 2 years ago

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. [Bug #8510]

History

#1 Updated by Kazuhiro NISHIYAMA almost 2 years ago

  • Status changed from Open to Assigned
  • Assignee set to Nobuyoshi Nakada

#2 Updated by Nobuyoshi Nakada almost 2 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. [Bug #8510]

Also available in: Atom PDF