Bug #8510

assertion failed in ary_resize_capa

Added by Kazuhiro NISHIYAMA 11 months ago. Updated 11 months ago.

[ruby-dev:47416]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
Category:core
Target version:2.1.0
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: aryresizecapa: Assertion `!(!!((!(((VALUE)(ary) & RUBYIMMEDIATEMASK) || !!(((VALUE)(ary) & ~((VALUE)RUBYQnil)) == 0)) && (int)(((struct RBasic*)(ary))->flags & RUBYTMASK) != RUBYTNODE)?(((struct RBasic*)(ary))->flags&((((VALUE)1)<<11))):((((int)(long)(ary))&RUBYFIXNUMFLAG)||((((int)(long)(ary))&RUBYFLONUMMASK) == RUBYFLONUM_FLAG))))' failed.
Aborted (core dumped)

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

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

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

assert(!OBJ_FROZEN(ary));                                                             

があるからのようです。

Associated revisions

Revision 41227
Added by Nobuyoshi Nakada 11 months ago

array.c: fix false assertion in arymakeshared

  • array.c (aryshrinkcapa): shrink the capacity so it fits just with the length.
  • array.c (arymakeshared): release never used elements from frozen array to be shared. [Bug #8510]

History

#1 Updated by Kazuhiro NISHIYAMA 11 months ago

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

#2 Updated by Nobuyoshi Nakada 11 months 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 arymakeshared

  • array.c (aryshrinkcapa): shrink the capacity so it fits just with the length.
  • array.c (arymakeshared): release never used elements from frozen array to be shared. [Bug #8510]

Also available in: Atom PDF