[BUG: ruby 1.9.3dev (2011-08-27 revision 33101) [i686-linux]] class オブジェクトの開放時に segv

$B<G$H?=$7$^$9!#(B

$B<!$N$h$&$J%3!<%I$r<B9T$9$k$H!"(Bgc $B$N(B sweep $B%U%’!<%:$G(B segv
$B$7$^$9!#(B

$B:F8=%3!<%I(B

####################################
class BasicObject
def singleton_method_added(mid)
raise
end
end

b = proc {}
class << b; end
b.clone
####################################

b.clone $B$G$O!"(Bclass.c $BFb$N(B rb_singleton_class_clone
$B$r8F$S=P$7!"(Bclass $B%(B
$B%V%8%’%/%H$NJ#@=$r$7$^$9!#$3$N$H$-!"(Bclass_alloc $B$r8F$S=P$7$F@8$N(B
class
$B%
%V%8%’%/%H$r3d$jEv$F$k$s$G$9$,!"%a%=%C%I%F!<%V%k$N3d$jEv$F$r9T$&A0$K(B
singleton_method_added $B$N%3!<%k%P%C%/$r8F$S=P$7$F$$$^$9!#$3$N$?$a!"(B
singleton_method_added
$B$N%3!<%k%P%C%/$GNc30$rEG$$$?$H$-$K!"%a%=%C%I%F!<(B
$B%V%k$N3d$jEv$F$,9T$o$l$F$$$J$$(B class
$B%*%V%8%’%/%H$,=PMh$F$7$^$C$F$$$^$9!#(B

obj_free $B$G$O!"(Bclass
$B%%V%8%’%/%H$N3+J|;~$K!"%a%=%C%I%F!<%V%k$,3d$jEv$F(B
$B$i$l$F$$$k$+$I$&$+$N%A%’%C%/L5$7$K!"(Brb_free_m_table(RCLASS_M_TBL(obj));
$B$H$7!"%a%=%C%I%F!<%V%k$r3+J|$7$h$&$H$7$^$9!#(Brb_free_m_table
$B$O!“0z?t$H$7(B
$B$F$o$?$C$F$/$k%O%C%7%e%F!<%V%k$,(B NULL
$B$G$O$J$$$b$N$H$7$F=hM}$r?J$a$F$$$k(B
$B$?$a!”>e$K5-=R$7$?$h$&$J!"%a%=%C%I%F!<%V%k$N3d$jEv$F$,9T$o$l$F$$$J$$(B
class $B%
%V%8%’%/%H$r3+J|$7$h$&$H$7$?$H$-$K!"(Bsegv
$B$rEG$$$F$7$^$&$h$&$G$9!#(B

obj_free $B$+$i$N8F$S=P$74X78$H(B segv $B$N0LCV$O<!$N$h$&$J46$8$G$9!#(B

obj_free
rb_free_m_table
st_foreach
if (table->entries_packed) { <= $B$3$3$G(B segv

$B$3$l$KBP$9$kBP=h$H$7$F$O!"(Brb_singleton_class_clone
$B$N%a%=%C%I%F!<%V%k=i(B
$B4|2=$N0LCV$r$:$i$9$+!"(Bobj_free
$B$G%a%=%C%I%F!<%V%k$N2rJ|A0$K%a%=%C%I%F!<(B
$B%V%k$,3d$jEv$F$i$l$F$$$k$+$I$&$+$N%A%’%C%/$r$9$k$+$N#2$D$,$"$j$^$9!#(B
rb_singleton_class_clone $B$N$h$&$K!"(Bclass
$B%%V%8%’%/%H$N=i4|2=$H%3!<%k(B
$B%P%C%/$N8F$S=P$7$r6&$K9T$&$h$&$J=hM}$,B>$KL5$$$H$b8B$i$J$$$N$G!"(Bobj_free
$BB&$K<j$r2C$($k$N$,$$$$$H;W$$$^$9!#K%a!<%kKvHx$K$=$N$h$&$J%Q%C%A$rE:IU$7(B
$B$F$
$-$^$9!#(B

$B;29M$K$7$F$$$?$@$1$l$P9,$$$G$9!#(B
$B$h$m$7$/$*4j$$$$$?$7$^$9!#(B

$B%Q%C%A(B

Index: gc.c

— gc.c (revision 33101)
+++ gc.c (working copy)
@@ -2273,7 +2273,9 @@
case T_MODULE:
case T_CLASS:
rb_clear_cache_by_class((VALUE)obj);

  •   rb_free_m_table(RCLASS_M_TBL(obj));
    
  •   if (RCLASS_M_TBL(obj)) {
    
  •       rb_free_m_table(RCLASS_M_TBL(obj));
    
  •   }
      if (RCLASS_IV_TBL(obj)) {
          st_free_table(RCLASS_IV_TBL(obj));
      }