From: Koji Arai Date: 1999-08-15T01:56:51+09:00 Subject: [ruby-dev:7670] [BUG] ruby-1.4 SEGV 新井です。 1.4ですが、悲しいことにSEGVしました。 mkmf.rb をデバッガで実行すると落ちます。 $ cat hoge.rb require "mkmf.rb" $ ruby -v -rdebug hoge.rb ruby 1.4.0 (1999-08-13) [i586-linux] /usr/local/lib/ruby/1.4/debug.rb:356: warning: instance var @no_step not initialized hoge.rb:1:require "mkmf.rb" (rdb:-) c /usr/local/lib/ruby/1.4/debug.rb:386: warning: instance var @finish_pos not initialized /usr/local/lib/ruby/1.4/debug.rb:386: warning: instance var @finish_pos not initialized /usr/local/lib/ruby/1.4/mkmf.rb:320: [BUG] Segmentation fault IOT trap/Abort (core dumped) となりました。修正は単純に以下でよろしいでしょうか? (落ちる直前のスタックトレースを最後に付けます) Index: eval.c =================================================================== RCS file: /home/cvs/ruby/eval.c,v retrieving revision 1.2 diff -u -r1.2 eval.c --- eval.c 1999/08/13 05:45:04 1.2 +++ eval.c 1999/08/14 16:10:03 @@ -5359,7 +5359,7 @@ MEMCPY(tmp, block->prev, struct BLOCK, 1); if (tmp->frame.argc > 0) { tmp->frame.argv = ALLOC_N(VALUE, tmp->frame.argc); - MEMCPY(tmp->frame.argv, block->frame.argv, VALUE, tmp->frame.argc); + MEMCPY(tmp->frame.argv, block->prev->frame.argv, VALUE, tmp->frame.argc); } scope_dup(tmp->scope); block->prev = tmp; #0 blk_copy_prev (block=0x8124010) at eval.c:5362 #1 0x805cceb in rb_f_binding (self=1074649624) at eval.c:5434 #2 0x805281b in call_trace_func (event=0x80bc401 "c-return", file=0x0, line=0, self=1074649624, id=3489, klass=1074804284) at eval.c:1704 #3 0x80590de in rb_call0 (klass=1074804284, recv=1074649624, id=3489, argc=0, argv=0x0, body=0x401032e0, nosuper=1) at eval.c:3809 #4 0x8059a70 in rb_call (klass=1074804284, recv=1074649624, mid=3489, argc=0, argv=0x0, scope=0) at eval.c:4007 #5 0x805343c in rb_eval (self=1074826964, node=0x400e757c) at eval.c:1945 #6 0x8052af4 in rb_eval (self=1074826964, node=0x400e7450) at eval.c:1740 #7 0x8059617 in rb_call0 (klass=1074830624, recv=1074826964, id=9489, argc=0, argv=0xbfffec44, body=0x400e7450, nosuper=0) at eval.c:3917 #8 0x8059a70 in rb_call (klass=1074830624, recv=1074826964, mid=9489, argc=2, argv=0xbfffec3c, scope=1) at eval.c:4007 #9 0x80543af in rb_eval (self=1074826964, node=0x400e7194) at eval.c:2178 #10 0x8059617 in rb_call0 (klass=1074830624, recv=1074826964, id=9521, argc=0, argv=0xbfffeec0, body=0x400e716c, nosuper=0) at eval.c:3917 #11 0x8059a70 in rb_call (klass=1074830624, recv=1074826964, mid=9521, argc=1, argv=0xbfffeebc, scope=1) at eval.c:4007 #12 0x80543af in rb_eval (self=1074826964, node=0x400e0678) at eval.c:2178 #13 0x805506c in rb_eval (self=1074826964, node=0x400e06c8) at eval.c:2322 #14 0x8052af4 in rb_eval (self=1074826964, node=0x400e0650) at eval.c:1740 #15 0x8051087 in eval_node (self=1074826964) at eval.c:987 #16 0x805b01a in rb_load (fname=1074728404, wrap=0) at eval.c:4644 #17 0x805b8b5 in rb_f_require (obj=1074826964, fname=1074728404) at eval.c:4819 #18 0x805881f in call_cfunc (func=0x805b474 , recv=1074826964, len=1, argc=1, argv=0xbffff554) at eval.c:3680 #19 0x80590a5 in rb_call0 (klass=1074830484, recv=1074826964, id=8137, argc=1, argv=0xbffff554, body=0x400fdcc8, nosuper=1) at eval.c:3806 #20 0x8059a70 in rb_call (klass=1074830484, recv=1074826964, mid=8137, argc=1, argv=0xbffff554, scope=1) at eval.c:4007 #21 0x80543af in rb_eval (self=1074826964, node=0x400fcee0) at eval.c:2178 #22 0x8051087 in eval_node (self=1074826964) at eval.c:987 #23 0x805117e in ruby_run () at eval.c:1023 #24 0x804fbd9 in main (argc=3, argv=0xbffff77c, envp=0xbffff78c) at main.c:39 (gdb)