0..$1=0 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 ‘0…$1=0’
Can’t set variable $1
– control frame ----------
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

– backtrace of native function call (Use addr2line) –
0x80dad25
0x80f3f90
0x80b2620
0xffffe420
0x809108f
0x809137f
0x809140e
0x80b16c1
0x80b1a57
0x805c5d4
0x8056d8a
0xb7da3ea8
0x8056cc1

[BUG] Segmentation fault
ruby 1.9.0 (2007-07-03) [i686-linux]

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

e$BB>$K$b0J2<$N$h$&$J$b$N$G$bMn$A$^$9!#e(B

0…$1+=0
0…A::A+=0
0…::A+=0

[ruby-dev:31085] e$B$de(B [ruby-dev:31100] e$B$bF1$8860x$G$9$,!"e(B
e$B$3$l$i$O$R$g$C$H$7$Fe(B arg tDOT2 arg (e$B$^$?$Oe(B value_expr)
e$B$H$+$NJ}$Ge(B
e$BBP1~$9$Y$-$3$H$G$7$g$&$+!#e(B

Index: parse.y

— parse.y (revision 12681)
+++ parse.y (working copy)
@@ -1884,6 +1884,10 @@
| arg tDOT2 arg
{
/%%%/

  •  if(!$1 || !$3) {
    
  •      $$ = 0;
    
  •  }
    
  •  else {
     value_expr($1);
     value_expr($3);
     if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
    

@@ -1894,6 +1898,7 @@
else {
$$ = NEW_DOT2($1, $3);
}

  •  }
       /*%
     $$ = dispatch2(dot2, $1, $3);
       %*/
    

@@ -1901,6 +1906,10 @@
| arg tDOT3 arg
{
/%%%/

  •  if(!$1 || !$3) {
    
  •      $$ = 0;
    
  •  }
    
  •  else {
     value_expr($1);
     value_expr($3);
     if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
    

@@ -1911,6 +1920,7 @@
else {
$$ = NEW_DOT3($1, $3);
}

  •  }
       /*%
     $$ = dispatch2(dot3, $1, $3);
       %*/

e$B!!$5$5$@$G$9!#e(B

Yusuke ENDOH wrote:

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

$ ./ruby -e ‘0…$1=0’

[ruby-dev:31085] e$B$de(B [ruby-dev:31100] e$B$bF1$8860x$G$9$,!"e(B
e$B$3$l$i$O$R$g$C$H$7$Fe(B arg tDOT2 arg (e$B$^$?$Oe(B value_expr) e$B$H$+$NJ}$Ge(B
e$BBP1~$9$Y$-$3$H$G$7$g$&$+!#e(B

e$B!!;d$O%Q!<%5$O$J$k$Y$/?($i$J$$$h$&$K$7$F$$$k$s$G$9$,!J:#2s$NOCe(B
e$B$bH=CG$,$G$-$J$$!K!"$^$D$b$H$5$s$rBT$F$P$$$$$G$7$g$&$+!#$=$l$He(B
e$B$b!";d$bFI$^$J$$$HBLL$+$J$!!JFI$a$?$[$&$,$$$$$s$@$m$&$1$I!K!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:31158] Re: 0…$1=0 dumps core”
on Sat, 7 Jul 2007 16:12:16 +0900, SASADA Koichi [email protected]
writes:

|> [ruby-dev:31085] e$B$de(B [ruby-dev:31100] e$B$bF1$8860x$G$9$,!“e(B
|> e$B$3$l$i$O$R$g$C$H$7$Fe(B arg tDOT2 arg (e$B$^$?$Oe(B value_expr) e$B$H$+$NJ}$Ge(B
|> e$BBP1~$9$Y$-$3$H$G$7$g$&$+!#e(B
|
|e$B!!;d$O%Q!<%5$O$J$k$Y$/?($i$J$$$h$&$K$7$F$$$k$s$G$9$,!J:#2s$NOCe(B
|e$B$bH=CG$,$G$-$J$$!K!”$^$D$b$H$5$s$rBT$F$P$$$$$G$7$g$&$+!#$=$l$He(B
|e$B$b!";d$bFI$^$J$$$HBLL$+$J$!!JFI$a$?$[$&$,$$$$$s$@$m$&$1$I!K!#e(B

e$B;d$NC4Ev$J$s$GBT$C$F$F$$$$$G$9!#$G$b!“FI$s$G$/$l$F$b$$$$$G$9!#e(B
e$B$=$7$?$i!”;d$KK|0l$,$"$C$F$b0B?4!#e(B

                            e$B%P%9$K5$$r$D$1$h$&e(B
                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)