Ary[]+=1 dumps core

e$B1sF#$H?=$7$^$9!#e(B

1.9 e$B$G0J2<$N$h$&$K$9$k$HMn$A$^$9!#e(B

$ ./ruby -e ‘ary[]+=1’
– control frame ----------
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

– backtrace of native function call (Use addr2line) –
0x80dac65
0x80f3ec0
0x810a349
0x8105841
0x810ad37
0x80d01a2
0x80d0276
0x80dbac2
0x80dbb26
0x8059052
0x8059076
0x805d601
0x8056d2f
0xb7dacea8
0x8056c61

[BUG] compile_array: This node is not NODE_ARRAY, but NODE_ZARRAY
ruby 1.9.0 (2007-07-02) [i686-linux]

e$B%"%!<%H$7$^$7$?e(B (core dumped)

e$B$H$j$"$($:0J2<$N%Q%C%A$GMn$A$J$/$J$j$^$9!#e(B
e$B$A$c$s$H9M$($F$$$J$$1~5^=hCV$J$N$G$^[email protected]$,$"$k$+$b$7$l$^$;$s!#e(B
e$B$"$H!"[email protected][email protected]<($9$k$?$a$K4:$($F%$%s%G%s%H$rJQ$($F$$$^$;$s!#e(B

Index: compile.c

— compile.c (revision 12678)
+++ compile.c (working copy)
@@ -1831,6 +1831,7 @@
int len = node->nd_alen, line = nd_line(node), i=0;
DECL_ANCHOR(anchor);

+if(nd_type(node) != NODE_ZARRAY) {
while (node) {
if (nd_type(node) != NODE_ARRAY) {
rb_bug(“compile_array: This node is not NODE_ARRAY, but %s”,
@@ -1844,6 +1845,7 @@
COMPILE(anchor, “array element”, node->nd_head);
node = node->nd_next;
}
+}

 if (len != i) {

if (0) rb_bug(“node error: compile_array (%d: %d-%d)”,

[email protected]$G$9!#e(B

Yusuke ENDOH wrote:

1.9 e$B$G0J2<$N$h$&$K$9$k$HMn$A$^$9!#e(B

$ ./ruby -e ‘ary[]+=1’
e$B$H$j$"$($:0J2<$N%Q%C%A$GMn$A$J$/$J$j$^$9!#e(B
e$B$A$c$s$H9M$($F$$$J$$1~5^=hCV$J$N$G$^[email protected]$,$"$k$+$b$7$l$^$;$s!#e(B
e$B$"$H!"[email protected][email protected]<($9$k$?$a$K4:$($F%$%s%G%s%H$rJQ$($F$$$^$;$s!#e(B

e$B!!$"$j$,$H$&$4$6$$$^$7$?!#$?$V$s!"LdBj$J$$$h$&$J5$$,$9$k$N$G<he(B
e$B$j9~$_$^$9!#e(B