SEGV by block.call

e$B$I$&$be(B boron e$B$G$Ne(B SEGV e$B$,D>$i$J$$$N$G!“e(B
http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/log/20060625T000310.txt.gz
e$B$7$g$&$,$J$/e(B drb e$B$r$_$k$3$H$K$7$F!”$J$s$H$+=L$a$F8+$^$7$?!#e(B

e$B$3$&$9$k$He(B SEGV e$B$K$J$k$h$&$G$9!#e(B

% ./ruby -ve ’
def m(&b)
p b
b.call
end
m {|one| p one }

ruby 1.9.0 (2006-06-24) [i686-linux]
#Proc:0xb7df64b8@-e:6
zsh: segmentation fault (core dumped) ./ruby -ve ’ def m(&b) p b
b.call end m {|one| p one } ’
% gdb ruby core
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/libthread_db.so.1”.

Core was generated by `./ruby -ve
def m(&b)
p b
b.call
end
m {|one| p one }
'.
Program terminated with signal 11, Segmentation fault.

warning: current_sos: Can’t read pathname for load map: Input/output
error

Reading symbols from /lib/tls/libdl.so.2…Reading symbols from
/usr/lib/debug/lib/tls/libdl-2.3.2.so…done.
done.
Loaded symbols for /lib/tls/libdl.so.2
Reading symbols from /lib/tls/libcrypt.so.1…Reading symbols from
/usr/lib/debug/lib/tls/libcrypt-2.3.2.so…done.
done.
Loaded symbols for /lib/tls/libcrypt.so.1
Reading symbols from /lib/tls/libm.so.6…Reading symbols from
/usr/lib/debug/lib/tls/libm-2.3.2.so…done.
done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/tls/libc.so.6…Reading symbols from
/usr/lib/debug/lib/tls/libc-2.3.2.so…done.
done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2…Reading symbols from
/usr/lib/debug/lib/ld-2.3.2.so…done.
done.
Loaded symbols for /lib/ld-linux.so.2
#0 0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x080d3848 in st_lookup (table=0xb7f3b950, key=3169,
value=0xbfaa9494) at st.c:240
#2 0x08054ed9 in search_method (klass=3086203216, id=3169,
origin=0xbfaa94cc, flag=0) at eval.c:480
#3 0x08054f59 in rb_get_method_body (klassp=0xbfaa9620, idp=0xbfaa95f4,
noexp=0xbfaa95f8) at eval.c:499
#4 0x0806195a in rb_call (klass=3086203216, recv=3086203224, mid=3169,
argc=0, argv=0x0, block=0x0, scope=CALLING_FUNCALL,
iter=0) at eval.c:5863
#5 0x08061eb6 in rb_funcall (recv=3086203224, mid=3169, n=0) at
eval.c:6014
#6 0x0808def9 in rb_inspect (obj=3086203224) at object.c:263
#7 0x08081292 in rb_p (obj=3086203224) at io.c:3872
#8 0x080812f2 in rb_f_p (argc=1, argv=0xbfaa9ae0) at io.c:3899
#9 0x0806edaa in call_cfunc (func=0x80812c3 <rb_f_p>, recv=3084937760,
len=-1, argc=1, argv=0xbfaa9ae0) at eval.c:5480
#10 0x08060ebe in rb_call0 (klass=3084942300, recv=3084937760, id=7593,
oid=7593, argc=1, argv=0xbfaa9ae0, block=0x0,
body=0xb7dfda10, flags=18) at eval.c:5703
#11 0x08061c59 in rb_call (klass=3084942300, recv=3084937760, mid=7593,
argc=1, argv=0xbfaa9ae0, block=0x0,
scope=CALLING_FCALL, iter=0) at eval.c:5908
#12 0x0805b310 in rb_eval (self=3084937760, n=0xb7df64b8) at eval.c:3301
#13 0x0805ecbb in rb_yield_0 (val=3086203224, self=3084937760, klass=0,
flags=1) at eval.c:4795
#14 0x08066aba in proc_invoke (proc=3084870660, args=3084870600, self=6,
klass=0, call=1) at eval.c:8389
#15 0x08066cad in rb_proc_call (proc=3084870660, args=3084870600) at
eval.c:8459
#16 0x0806ed89 in call_cfunc (func=0x8066c7d <rb_proc_call>,
recv=3084870660, len=-2, argc=0, argv=0x0) at eval.c:5477
#17 0x08060ebe in rb_call0 (klass=3084877740, recv=3084870660, id=5425,
oid=5425, argc=0, argv=0x0, block=0x0,
body=0xb7df7ef8, flags=0) at eval.c:5703
#18 0x08061c59 in rb_call (klass=3084877740, recv=3084870660, mid=5425,
argc=0, argv=0x0, block=0x0, scope=CALLING_NORMAL,
iter=0) at eval.c:5908
#19 0x0805b08d in rb_eval (self=3084937760, n=0xb7df6648) at eval.c:3287
#20 0x0806156b in rb_call0 (klass=3084942620, recv=3084937760, id=10761,
oid=10761, argc=0, argv=0x0, block=0xbfaaba60,
body=0xb7df6648, flags=18) at eval.c:5784
#21 0x08061c59 in rb_call (klass=3084942620, recv=3084937760, mid=10761,
argc=0, argv=0x0, block=0xbfaaba60,
scope=CALLING_FCALL, iter=1) at eval.c:5908
#22 0x0805ad95 in rb_eval (self=3084937760, n=0xb7df6490) at eval.c:3257
#23 0x08056574 in eval_node (self=3084937760, node=0xb7df6490) at
eval.c:1408
#24 0x08056b06 in ruby_exec_internal () at eval.c:1583
#25 0x08056b4d in ruby_exec () at eval.c:1598
#26 0x08056b88 in ruby_run () at eval.c:1614
#27 0x08054714 in main (argc=3, argv=0xbfaac3e4, envp=0xbfaac3f4) at
main.c:43

In article [email protected],
Tanaka A. [email protected] writes:

#Proc:0xb7df64b8@-e:6
zsh: segmentation fault (core dumped) ./ruby -ve ’ def m(&b) p b b.call end m {|one| p one } ’

e$B$H$j$“$($:!”@5$7$5$OL5;k$7$FMn$A$J$$$H$$$&$3$H$@$15a$a$l$P!"e(B
e$B$3$&$G$7$g$&$+!#e(B

Index: eval.c

RCS file: /src/ruby/eval.c,v
retrieving revision 1.904
diff -u -r1.904 eval.c
— eval.c 24 Jun 2006 14:52:59 -0000 1.904
+++ eval.c 25 Jun 2006 05:41:53 -0000
@@ -4740,7 +4740,10 @@
}
else {
if (pcall) {

  •       val = RARRAY(val)->ptr[0];
    
  •                if (RARRAY(val)->len == 0)
    
  •                    val = Qnil;
    
  •                else
    
  •                    val = RARRAY(val)->ptr[0];
      }
      assign(self, var, val, pcall);
      }
    

boron e$B$GMn$A$F$$$k$N$O$3$l$H$b$Y$D$_$?$$$J$s$G$J$s$G$9$,!#e(B

In article [email protected],
Tanaka A. [email protected] writes:

e$B$H$j$“$($:!”@5$7$5$OL5;k$7$FMn$A$J$$$H$$$&$3$H$@$15a$a$l$P!"e(B
e$B$3$&$G$7$g$&$+!#e(B

boron e$B$Ne(B chkbuild e$B$G$be(B
2) Error:
test_01_one(TestDRbYield):
NotImplementedError: method `respond_to?’ called on terminated object
(0x401a3948)
e$B$H!“e(Bdrb e$B$N$H$3$m$Ge(B called on terminated object
e$B$K$J$C$F$$$Fe(B
e$B7uF]$G$9$7!“0c$&4D6-$G$OMn$A$F$7$^$&$3$H$b$”$C$?$N$G!”$H$j$"e(B
e$B$($:$$$l$H$-$^$7$?!#e(B

e$BLdBj$OB>$K$b$“$k46$8$G!”$$$l$H$+$J$$$HB>$N$r07$&$N$,LLE]$J$Ne(B
e$B$G!#e(B

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

In message “Re: [ruby-dev:28842] Re: SEGV by block.call”
on Sun, 25 Jun 2006 15:54:37 +0900, Tanaka A. [email protected]
writes:

|In article [email protected],
| Tanaka A. [email protected] writes:
|
|> e$B$3$&$9$k$He(B SEGV e$B$K$J$k$h$&$G$9!#e(B
|>
|> % ./ruby -ve ’
|> def m(&b)
|> p b
|> b.call
|> end
|> m {|one| p one }
|> ’
|> ruby 1.9.0 (2006-06-24) [i686-linux]
|> #Proc:0xb7df64b8@-e:6
|> zsh: segmentation fault (core dumped) ./ruby -ve ’ def m(&b) p b b.call end m {|one| p one } ’
|
|e$B$H$j$“$($:!”@5$7$5$OL5;k$7$FMn$A$J$$$H$$$&$3$H$@$15a$a$l$P!"e(B
|e$B$3$&$G$7$g$&$+!#e(B

e$B7k6I$O$=$l$,@52r$G$7$?!#%3%_%C%H$"$j$,$H$&$4$6$$$^$7$?!#e(B