# A\[\*a\]+=1 dumps core

**URL:** <https://www.ruby-forum.com/t/a-a-1-dumps-core/121193>\
**Category:** Development\
**Created:** [November 25, 2007, 3:10am UTC](https://www.ruby-forum.com/t/a-a-1-dumps-core/121193 "2007-11-25T03:10:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yusuke\_ENDOH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c89c15/32.png) [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Post date:** [November 25, 2007, 3:10am UTC](https://www.ruby-forum.com/t/a-a-1-dumps-core/121193/1 "2007-11-25T03:10:32Z")

</div>

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

1.9 e$B$G0J2\<$r\<B9T$9$k$HMn$A$^$9!#e(B

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

## – backtrace of native function call (Use addr2line) – 0x80e8065 0x8105bd3 0x8105c9b 0x8116a6d 0x8116a88 0x81106e4 0x811725e 0x80dc4e2 0x80dc5b6 0x8059ec4 0x805de00 0x8057be0 0xb7dd3ea8 0x8057b01

[BUG] compile\_array: This node is not NODE\_ARRAY, but NODE\_SPLAT  
ruby 1.9.0 (2007-11-23) [i686-linux]

e$B%"%!\<%H$7$^$7$?e(B

e$B$A$c$s$He(B setup\_args e$B$9$k$h$&$K$9$l$P$$$$$H;W$$$^$9!#e(B  
e$B$\*$=$i$/$3$s$J46$8$G$7$g$&$+!#e(B

# Index: compile.c

— compile.c (revision 14010)  
+++ compile.c (working copy)  
@@ -3298,8 +3298,9 @@  
break;  
}  
case NODE\_OP\_ASGN1:{

- unsigned long flag = 0;  
DECL\_ANCHOR(args);

- int argc;

- VALUE argc;  
ID id = node-\>nd\_mid;

- argc = compile\_array(iseq, args, node-\>nd\_args-\>nd\_body, Qfalse);
- POP\_ELEMENT(args);
- ADD\_SEQ(ret, args);
- ADD\_INSN1(ret, nd\_line(node), dupn, INT2FIX(argc+1));
- ADD\_SEND(ret, nd\_line(node), ID2SYM(idAREF), INT2FIX(argc));

- if (nd\_type(node-\>nd\_args-\>nd\_body) != NODE\_ZARRAY) {

- 

```
 argc = setup_args(iseq, args, node->nd_args->nd_body, &flag);

```

- 

```
 ADD_SEQ(ret, args);

```

- }

- else {

- 

```
 argc = FIX2INT(0);

```

- }

- ADD\_INSN1(ret, nd\_line(node), dupn, INT2FIX(FIX2INT(argc)+1));

- ADD\_SEND\_R(ret, nd\_line(node), ID2SYM(idAREF), argc, Qfalse,  
LONG2FIX(flag));

- 

```
 ADD_SEND(ret, nd_line(node), ID2SYM(idASET),

```

- 

```
    INT2FIX(argc + 1));

```

- 

```
 if (flag & VM_CALL_ARGS_SPLAT_BIT) {

```

- ADD\_INSN1(ret, nd\_line(node), newarray, INT2FIX(1));
- ADD\_INSN(ret, nd\_line(node), concatarray);
- ADD\_SEND\_R(ret, nd\_line(node), ID2SYM(idASET),
- 

```
    argc, Qfalse, LONG2FIX(flag));

```

- 

```
 }

```

- 

```
 else {

```

- ADD\_SEND\_R(ret, nd\_line(node), ID2SYM(idASET),
- 

```
    INT2FIX(FIX2INT(argc) + 1), Qfalse, LONG2FIX(flag));

```

- 

```
 }
 ADD_INSNL(ret, nd_line(node), jump, lfin);
 ADD_LABEL(ret, label);
 if (id == 0) { /* or */

```

@@ -3377,8 +3390,16 @@  
COMPILE(ret, "NODE\_OP\_ASGN1 args-\>head: ",  
node-\>nd\_args-\>nd\_head);  
ADD\_SEND(ret, nd\_line(node), ID2SYM(id), INT2FIX(1));

- 

```
 ADD_SEND(ret, nd_line(node), ID2SYM(idASET),

```

- 

```
    INT2FIX(argc + 1));

```

- 

```
 if (flag & VM_CALL_ARGS_SPLAT_BIT) {

```

- ADD\_INSN1(ret, nd\_line(node), newarray, INT2FIX(1));

- ADD\_INSN(ret, nd\_line(node), concatarray);

- ADD\_SEND\_R(ret, nd\_line(node), ID2SYM(idASET),

- 

```
    argc, Qfalse, LONG2FIX(flag));

```

- 

```
 }

```

- 

```
 else {

```

- ADD\_SEND\_R(ret, nd\_line(node), ID2SYM(idASET),

- 

```
    INT2FIX(FIX2INT(argc) + 1), Qfalse, LONG2FIX(flag));

```

- 

```
 }

```

}

if (poped) {
