Project

General

Profile

Bug #2727

make: *** [encdb.h] Aborted

Added by znz (Kazuhiro NISHIYAMA) over 9 years ago. Updated about 8 years ago.

Status:
Third Party's Issue
Priority:
Normal
Assignee:
-
ruby -v:
ruby 1.9.1p420 (2010-02-04 revision 26571) [i686-linux]
[ruby-dev:40377]

Description

=begin
Ubuntu 9.10 の環境で ruby_1_9_1 を make すると encdb.h のところでアボートします。
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) なので #1299 と似ている気がしますが、よくわかりませんでした。

./miniruby -I/home/kazu/wc/ruby/branches/ruby_1_9_1/lib -I.ext/common -I./- -r/home/kazu/wc/ruby/branches/ruby_1_9_1/ext/purelib.rb /home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb -c -o encdb.h /home/kazu/wc/ruby/branches/ruby_1_9_1/template/encdb.h.tmpl /home/kazu/wc/ruby/branches/ruby_1_9_1/enc enc
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1310: [BUG] Segmentation fault
ruby 1.9.1p420 (2010-02-04 revision 26571) [i686-linux]

-- control frame ----------
c:0013 p:---- s:0060 b:0060 l:000059 d:000059 CFUNC :catch
c:0012 p:0049 s:0056 b:0056 l:001d30 d:001024 BLOCK /home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1310
c:0011 p:---- s:0050 b:0050 l:000049 d:000049 FINISH
c:0010 p:---- s:0048 b:0048 l:000047 d:000047 CFUNC :catch
c:0009 p:0062 s:0044 b:0044 l:001d30 d:001d30 METHOD /home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1258
c:0008 p:0024 s:0034 b:0034 l:000033 d:000033 METHOD /home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1252
c:0007 p:0066 s:0029 b:0029 l:000c7c d:0004f8 BLOCK /home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb:12
c:0006 p:0116 s:0026 b:0026 l:000025 d:000025 METHOD /home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:793
c:0005 p:---- s:0020 b:0020 l:000019 d:000019 FINISH
c:0004 p:---- s:0018 b:0018 l:000017 d:000017 CFUNC :new
c:0003 p:0069 s:0015 b:0015 l:000c7c d:001ae8 EVAL /home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb:8
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000c7c d:000c7c TOP


-- Ruby level backtrace information-----------------------------------------
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1310:in catch'
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1310:in
block in parse_in_order'
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1258:in catch'
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1258:in
parse_in_order'
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:1252:in order!'
/home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb:12:in
block in '
/home/kazu/wc/ruby/branches/ruby_1_9_1/lib/optparse.rb:793:in initialize'
/home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb:8:in
new'
/home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb:8:in `'

-- C level backtrace information -------------------------------------------
0x816a589 ./miniruby(rb_vm_bugreport+0x69) [0x816a589]
0x808674f ./miniruby [0x808674f]
0x80867ea ./miniruby(rb_bug+0x3a) [0x80867ea]
0x8111974 ./miniruby [0x8111974]
0x4001d410 [0x4001d410]
0x8158368 ./miniruby [0x8158368]
0x81586a4 ./miniruby [0x81586a4]
0x81631a6 ./miniruby [0x81631a6]
0x815e40a ./miniruby [0x815e40a]
0x81617b9 ./miniruby [0x81617b9]
0x8167f16 ./miniruby [0x8167f16]
0x8158368 ./miniruby [0x8158368]
0x81586a4 ./miniruby [0x81586a4]
0x81631a6 ./miniruby [0x81631a6]
0x815e40a ./miniruby [0x815e40a]
0x81617b9 ./miniruby [0x81617b9]
0x81637c3 ./miniruby [0x81637c3]
0x815af7e ./miniruby(rb_funcall2+0xfe) [0x815af7e]
0x8087a60 ./miniruby(rb_obj_call_init+0x50) [0x8087a60]
0x80bd48a ./miniruby(rb_class_new_instance+0x3a) [0x80bd48a]
0x8158368 ./miniruby [0x8158368]
0x81586a4 ./miniruby [0x81586a4]
0x81631a6 ./miniruby [0x81631a6]
0x815e40a ./miniruby [0x815e40a]
0x81617b9 ./miniruby [0x81617b9]
0x8161a0b ./miniruby(rb_iseq_eval_main+0xab) [0x8161a0b]
0x8088737 ./miniruby(ruby_exec_node+0xb7) [0x8088737]
0x8089d46 ./miniruby(ruby_run_node+0x56) [0x8089d46]
0x805cfde ./miniruby(main+0x7e) [0x805cfde]
0x400ccb56 /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x400ccb56]
0x805cec1 ./miniruby [0x805cec1]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

make: *** [encdb.h] Aborted

gdb でちょっと調べてみた感じだと th が 0xffffffff になっていて th->errinfo で落ちているようです。

% gdb --args ./miniruby -I/home/kazu/wc/ruby/branches/ruby_1_9_1/lib -I.ext/common -I./- -r/home/kazu/wc/ruby/branches/ruby_1_9_1/ext/purelib.rb /home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb -c -o encdb.h /home/kazu/wc/ruby/branches/ruby_1_9_1/template/encdb.h.tmpl /home/kazu/wc/ruby/branches/ruby_1_9_1/enc enc
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/kazu/build/ruby/ruby_1_9_1/ruby/miniruby...done.
(gdb) r
Starting program: /home/kazu/build/ruby/ruby_1_9_1/ruby/miniruby -I/home/kazu/wc/ruby/branches/ruby_1_9_1/lib -I.ext/common -I./- -r/home/kazu/wc/ruby/branches/ruby_1_9_1/ext/purelib.rb /home/kazu/wc/ruby/branches/ruby_1_9_1/tool/generic_erb.rb -c -o encdb.h /home/kazu/wc/ruby/branches/ruby_1_9_1/template/encdb.h.tmpl /home/kazu/wc/ruby/branches/ruby_1_9_1/enc enc
[Thread debugging using libthread_db enabled]
[New Thread 0xb7c00b70 (LWP 14843)]

Program received signal SIGSEGV, Segmentation fault.
0x08167f46 in rb_f_catch (argc=1, argv=0xb7c010ec)
at /home/kazu/wc/ruby/branches/ruby_1_9_1/vm_eval.c:1258
1258 else if (state == TAG_THROW && RNODE(th->errinfo)->u1.value == tag) {
(gdb) p state == TAG_THROW
$1 = 1
(gdb) p th
$2 = (rb_thread_t *) 0xffffffff
(gdb)
=end


Related issues

Related to Ruby trunk - Bug #1299: Build failure on i586Closed03/18/2009Actions
Related to Backport191 - Bug #3243: Can't build Ruby after r26506Open05/03/2010Actions
Related to Backport191 - Bug #3293: fails to build with gcc 4.4.3Open05/14/2010Actions

History

#1

Updated by kosaki (Motohiro KOSAKI) over 9 years ago

=begin
Ubuntu 10.04β x86_64, gcc version 4.4.3 (Ubuntu 4.4.3-2ubuntu2) で試してみましたが再現しませんでした。gccのバージョンとCPUアーキの両方に差異があるので、若干絞り込みが弱いですがご報告まで。
=end

#2

Updated by naruse (Yui NARUSE) over 9 years ago

=begin
minirubyが壊れているように思えるので、make test していただけませんか。
そこまでいけば実行可能なはずなので。
=end

#3

Updated by znz (Kazuhiro NISHIYAMA) over 9 years ago

=begin
make test でも同じ状態だったので、該当部分を見て最小ケースを調べてみると catch した時点で落ちているようです。

% make test

sample/test.rb:assignment ....................................................................................................................................................................................................................................................................................................................................................................................
sample/test.rb:condition ..
sample/test.rb:if/unless ...
sample/test.rb:case .....
sample/test.rb:while/until ........
sample/test.rb:exception ........./home/kazu/wc/ruby/branches/ruby_1_9_1/sample/test.rb:713: [BUG] Segmentation fault
ruby 1.9.1p420 (2010-02-04 revision 26571) [i686-linux]

-- control frame ----------
c:0004 p:---- s:0053 b:0053 l:000052 d:000052 CFUNC :catch
c:0003 p:14355 s:0049 b:0048 l:0017dc d:0007cc EVAL /home/kazu/wc/ruby/branches/ruby_1_9_1/sample/test.rb:713
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0017dc d:0017dc TOP


-- Ruby level backtrace information-----------------------------------------
/home/kazu/wc/ruby/branches/ruby_1_9_1/sample/test.rb:713:in catch'
/home/kazu/wc/ruby/branches/ruby_1_9_1/sample/test.rb:713:in
'

-- C level backtrace information -------------------------------------------
0x4014a1e9 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1(rb_vm_bugreport+0x69) [0x4014a1e9]
0x400663af /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x400663af]
0x4006644a /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1(rb_bug+0x3a) [0x4006644a]
0x400f15d4 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x400f15d4]
0x4001d410 [0x4001d410]
0x40137fc8 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x40137fc8]
0x40138304 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x40138304]
0x40142e06 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x40142e06]
0x4013e06a /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x4013e06a]
0x40141419 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1 [0x40141419]
0x4014166b /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1(rb_iseq_eval_main+0xab) [0x4014166b]
0x40068397 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1(ruby_exec_node+0xb7) [0x40068397]
0x400699a6 /home/kazu/build/ruby/ruby_1_9_1/ruby/libruby-1.9.1.so.1.9.1(ruby_run_node+0x56) [0x400699a6]
0x804887e /home/kazu/build/ruby/ruby_1_9_1/ruby/ruby-1.9.1(main+0x7e) [0x804887e]
0x40254b56 /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x40254b56]
0x8048761 /home/kazu/build/ruby/ruby_1_9_1/ruby/ruby-1.9.1 [0x8048761]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

test failed
make: *** [test-sample] エラー 1

% ./miniruby -e 'catch(:foo){}'
% ./miniruby -e 'catch(:foo){throw :bar}'
-e:1:in throw': uncaught throw :bar (ArgumentError)
from -e:1:in
block in '
from -e:1:in catch'
from -e:1:in
'
% ./miniruby -e 'catch(:foo){throw :foo}'
-e:1: [BUG] Segmentation fault
ruby 1.9.1p420 (2010-02-04 revision 26571) [i686-linux]

-- control frame ----------
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :catch
c:0003 p:0011 s:0006 b:0006 l:0010ec d:00218c EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0010ec d:0010ec TOP


-- Ruby level backtrace information-----------------------------------------
-e:1:in catch'
-e:1:in
'

-- C level backtrace information -------------------------------------------
0x816a589 ./miniruby(rb_vm_bugreport+0x69) [0x816a589]
0x808674f ./miniruby [0x808674f]
0x80867ea ./miniruby(rb_bug+0x3a) [0x80867ea]
0x8111974 ./miniruby [0x8111974]
0xb7861410 [0xb7861410]
0x8158368 ./miniruby [0x8158368]
0x81586a4 ./miniruby [0x81586a4]
0x81631a6 ./miniruby [0x81631a6]
0x815e40a ./miniruby [0x815e40a]
0x81617b9 ./miniruby [0x81617b9]
0x8161a0b ./miniruby(rb_iseq_eval_main+0xab) [0x8161a0b]
0x8088737 ./miniruby(ruby_exec_node+0xb7) [0x8088737]
0x8089d46 ./miniruby(ruby_run_node+0x56) [0x8089d46]
0x805cfde ./miniruby(main+0x7e) [0x805cfde]
0xb769ab56 /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xb769ab56]
0x805cec1 ./miniruby [0x805cec1]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

=end

#4

Updated by znz (Kazuhiro NISHIYAMA) over 9 years ago

=begin
いくつかの環境で試してみたところ、Fedora 11 の「gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC)」(gcc-4.4.1-2.fc11.i586) でも再現しました。

最適化の影響かと思って Ubuntu 9.10 で optflags=-O0 や optflags=-O1 や optflags=-O3 を試してみたところ「./miniruby -e 'catch(:foo){throw :foo}'」は落ちなくなりました。

amd64 だと再現しなかったり gcc のバージョンが違うと再現しなかったりするようなので、x86 の gcc 4.4.1 の最適化のバグの可能性が高そうです。
=end

#5

Updated by mame (Yusuke Endoh) about 9 years ago

  • Status changed from Open to Third Party's Issue

=begin
遠藤です。

やはりおそらく gcc 4.4.1 のバグだと思います。
調べてみたところ、inline 展開した callee がなぜか caller のスタックを
書き潰しているような気がします。
ということで、Third Party's issue としておきます。

--
Yusuke Endoh mame@tsg.ne.jp
=end

#6

Updated by lucas (Lucas Nussbaum) about 9 years ago

=begin
Yusuke Endoh, why is this marked as "Third Party's issue" ?
=end

#7

Updated by mame (Yusuke Endoh) about 9 years ago

=begin
Hi Lucas,

I'm suspecting that there is a bug in gcc 4.4.1.
A local variable of caller seems to be changed by callee if the
callee is inlined. You can avoid this issue by using -O0 or -O1.

If you have anything to indicate ruby's bug, not gcc's, please
let us know.

Even if this is gcc's bug, we have no reluctance to import a
patch to avoid this issue, if you have.

--
Yusuke Endoh mame@tsg.ne.jp
=end

#8

Updated by naruse (Yui NARUSE) almost 9 years ago

=begin
一応まとめまで。

これは gcc 4.4 の 32bit 版で発生する問題で、catch したところで落ちるのが特徴です。
踏む環境は例えば Ubuntu 9.10、Ubuntu 10.04、Fedora 11 (全て32bit) などになります。

Ruby 側としては、この問題は gcc のバグであって、特に回避策は入れない方針です。
=end

Also available in: Atom PDF