A[] += 1 $B$G(B SEGV

e$BK\5H$H?=$7$^$9!#e(B

e$B0J2<$N%9%/%j%W%H$,!"e(B
ruby-1.8.4e$B$G$O@5>o$KF0$/$N$G$9$,!"e(B
ruby-1.8.5e$B$G$Oe(BSEGVe$B$7$^$9!#e(B


class A
def initialize (v)
@value = v
end
def []
return @value
end
def []= (v)
@value = v
end
end

a = A.new(1)

a[] += 1 ### e$B$3$3$Ge(BSEGVe$B$9$k!#e(B -= e$B$de(B *=
e$B$G$bF1MM!#e(B

p a[] ### => 2

Vine Linux 4.0 e$B$G!"<B9T$9$k$H0J2<$N$h$&$J=PNO$G$7$?!#e(B

% ruby184 -v test.rb
ruby 1.8.4 (2005-12-24) [i686-linux]
2

% ruby -v test.rb
ruby 1.8.5 (2006-08-25) [i386-linux]
Segmentation fault

NArraye$B$J$I$G>e5-$N5-K!$rMQ$$$k$3$H$,$"$j5$$,$D$$$?$N$G$9$,!"e(B
e$B3’MM$N4D6-$G$b:F8=$7$^$9$G$7$g$&$+!#e(B

e$B0J>e!"Js9p$^$G!#e(B

e$B$h$m$7$/$*4j$$$$$?$7$^$9!#e(B

e$B$I$&$b!":XF#$H?=$7$^$9!#e(B

On Thu, 1 Mar 2007 09:36:20 +0900
“Hiroki Motoyoshi” [email protected] wrote:

e$BK\5H$H?=$7$^$9!#e(B

e$B0J2<$N%9%/%j%W%H$,!"e(B
ruby-1.8.4e$B$G$O@5>o$KF0$/$N$G$9$,!"e(B
ruby-1.8.5e$B$G$Oe(BSEGVe$B$7$^$9!#e(B
(snip)
e$B3’MM$N4D6-$G$b:F8=$7$^$9$G$7$g$&$+!#e(B

e$B<+J,$N4D6-$G$b!“e(B1.8.6-preview2e$B$*$h$Se(Bruby_1_8_6e$B:G?7!”$H$d$C$Q$je(Btrunke$B$G$be(B
e$B:F8=$7$^$7$?!#e(B

$ ./ruby-1.8.6/bin/ruby-1.8.6 -v segv186.rb
ruby 1.8.6 (2007-02-28 patchlevel 0) [i686-linux]
e$B%;%0%a%s%F!<%7%g%s0cH?$G$9e(B (core dumped)
$ gdb ./ruby-1.8.6/bin/ruby-1.8.6
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions. Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for
details. This GDB was configured as “i386-linux”…Using host
libthread_db library “/lib/tls/i686/cmov/libthread_db.so.1”.

(gdb) run segv186.rb
Starting program: /home/tadashi/ruby-1.8.6/bin/ruby-1.8.6 segv186.rb

Program received signal SIGSEGV, Segmentation fault.
0x4003ec09 in rb_eval (self=1076521380, n=0x3)
at …/…/1.8.6/eval.c:2907 2907 switch (nd_type(node)) {
(gdb) l
2902
2903 again:
2904 if (!node) RETURN(Qnil);
2905
2906 ruby_current_node = node;
2907 switch (nd_type(node)) {
2908 case NODE_BLOCK:
2909 if (contnode) {
2910 result = rb_eval(self, node);
2911 break;
(gdb) bt
#0 0x4003ec09 in rb_eval (self=1076521380, n=0x3) at
…/…/1.8.6/eval.c:2907
#1 0x400401af in rb_eval (self=1076521380, n=0x3) at
…/…/1.8.6/eval.c:3563
#2 0x4003c50c in ruby_exec_internal () at …/…/1.8.6/eval.c:1599
#3 0x4003c564 in ruby_exec () at …/…/1.8.6/eval.c:1619
#4 0x4003c5a1 in ruby_run () at …/…/1.8.6/eval.c:1629
#5 0x0804874e in main (argc=3, argv=0x3, envp=0xbffff880)
at …/…/1.8.6/main.c:48
(gdb)

e$B;~4V$,$J$$$N$G!“$H$j$”$($:Js9p$N$_$G!#e(B

e$B$K$7$F$b!"$$$^$^$G%(%i!<$K$J$i$J$+$C$?$N$OCN$i$J$+$C$?$C$9e(B

e$B$J$+$@$G$9!#e(B

At Thu, 1 Mar 2007 09:55:43 +0900,
Tadashi S. wrote in [ruby-dev:30456]:

e$B0J2<$N%9%/%j%W%H$,!"e(B
ruby-1.8.4e$B$G$O@5>o$KF0$/$N$G$9$,!"e(B
ruby-1.8.5e$B$G$Oe(BSEGVe$B$7$^$9!#e(B
(snip)
e$B3’MM$N4D6-$G$b:F8=$7$^$9$G$7$g$&$+!#e(B

e$B<+J,$N4D6-$G$b!“e(B1.8.6-preview2e$B$*$h$Se(Bruby_1_8_6e$B:G?7!”$H$d$C$Q$je(Btrunke$B$G$be(B
e$B:F8=$7$^$7$?!#e(B

e$B$3$l$G$I$&$G$7$g$&$+!#e(B

Index: parse.y

— parse.y (revision 11953)
+++ parse.y (working copy)
@@ -543,4 +543,5 @@ stmt : kALIAS fitem {lex_state = EXPR_F

   value_expr($6);
  •  if (!$3) $3 = NEW_ZARRAY();
     args = arg_concat($6, $3);
     if ($5 == tOROP) {
    

@@ -1010,4 +1011,5 @@ arg : lhs ‘=’ arg

   value_expr($6);
  •  if (!$3) $3 = NEW_ZARRAY();
     args = arg_concat($6, $3);
     if ($5 == tOROP) {

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

In message “Re: [ruby-dev:30459] Re: a[] += 1 e$B$Ge(B SEGV”
on Thu, 1 Mar 2007 11:40:40 +0900, “Nobuyoshi N.”
[email protected] writes:

|e$B$3$l$G$I$&$G$7$g$&$+!#e(B
|
|
|Index: parse.y
|===================================================================
|— parse.y (revision 11953)
|+++ parse.y (working copy)

e$B%3%_%C%H$7$F$/$@$5$$!#e(B

At Thu, 1 Mar 2007 12:30:56 +0900,
matz wrote:

|— parse.y (revision 11953)
|+++ parse.y (working copy)

e$B%3%_%C%H$7$F$/$@$5$$!#e(B

e$B!!e(Bruby_1_8 e$B$G$b3NG’$7$^$7$?!#%3%_%C%H$r$*4j$$$7$^$9!#e(B


/
/__ __ Akinori.org / MUSHA.org
/ ) ) ) ) / FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp

“Different eyes see different things,
Different hearts beat on different strings –
But there are times for you and me when all such things agree”

e$BK\5H$H?=$7$^$9!#e(B

e$BCfED$5$s$N%3%%C%H$N$"$H!"e(Bruby_1_8e$B$He(Btrunke$B$GF0:n3NG’$7$Fe(B
e$B$
$?$H$3$m!"e(Bruby_1_8e$B$O4|BTDL$j$NF0:n$r$7$^$7$?$,!"e(B
trunke$B$OJL$NNc30$,H/@8$7$F$7$^$$$^$9!#e(B

% ./ruby -v test_segv.rb
ruby 1.8.6 (2007-03-01 patchlevel 5000) [i686-linux]
2

% ./ruby -v test_segv.rb
ruby 1.9.0 (2007-03-02 patchlevel 0) [i686-linux]
test_segv.rb:16:in `’: wrong number of arguments (1 for 0)
(ArgumentError)

e$B;HMQe(BOSe$B$Oe(BCentOS4.3e$B$G$9!#e(B

e$BJs9p$@$1$G?=$7Lu$"$j$^$;$s$,!"$h$m$7$/$*4j$$$$$?$7$^$9!#e(B