From: "puchuu (Andrew Aladjev)" Date: 2012-10-10T22:45:13+09:00 Subject: [ruby-core:47882] [ruby-trunk - Bug #7136][Open] 1.9.3-p194 segfault with c-extension Issue #7136 has been reported by puchuu (Andrew Aladjev). ---------------------------------------- Bug #7136: 1.9.3-p194 segfault with c-extension https://bugs.ruby-lang.org/issues/7136 Author: puchuu (Andrew Aladjev) Status: Open Priority: Normal Assignee: Category: ext Target version: 1.9.3 ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] file extconf.rb: require "mkmf" create_makefile("variables") file variables.c: #include "ruby.h" void Init_variables() { VALUE num, arr, str; num = INT2FIX ( 1024 ); rb_define_variable ( "$ext_var_num", & num ); str = rb_str_new2 ( "this is sparta!" ); rb_define_variable ( "$ext_var_str", & str ); } file ext.rb: ($LOAD_PATH << File.expand_path("../", __FILE__) ).uniq! require "variables" puts $ext_var_str puts $ext_var_num ruby extconf.rb && make clean && make && ruby ext.rb this is sparta! ext.rb:15: [BUG] Segmentation fault ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] -- Control frame information ----------------------------------------------- c:0005 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :puts c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :puts c:0003 p:0067 s:0006 b:0006 l:0003f8 d:0009c8 EVAL ext.rb:15 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:0003f8 d:0003f8 TOP -- Ruby level backtrace information ---------------------------------------- ext.rb:15:in `
' ext.rb:15:in `puts' ext.rb:15:in `puts' -- C level backtrace information ------------------------------------------- /usr/lib64/libruby19.so.1.9(+0x155ae6) [0x7fc3f5a3dae6] /usr/lib64/libruby19.so.1.9(+0x59fd3) [0x7fc3f5941fd3] /usr/lib64/libruby19.so.1.9(rb_bug+0xbb) [0x7fc3f594277b] /usr/lib64/libruby19.so.1.9(+0xf72bf) [0x7fc3f59df2bf] /lib64/libc.so.6(+0x37f80) [0x7fc3f5578f80] /usr/lib64/libruby19.so.1.9(rb_io_puts+0x90) [0x7fc3f5966bd0] /usr/lib64/libruby19.so.1.9(+0x14c192) [0x7fc3f5a34192] /usr/lib64/libruby19.so.1.9(+0x14fb93) [0x7fc3f5a37b93] /usr/lib64/libruby19.so.1.9(+0x145b69) [0x7fc3f5a2db69] /usr/lib64/libruby19.so.1.9(+0x14b1c4) [0x7fc3f5a331c4] /usr/lib64/libruby19.so.1.9(rb_iseq_eval_main+0xad) [0x7fc3f5a3a63d] /usr/lib64/libruby19.so.1.9(+0x5d80a) [0x7fc3f594580a] /usr/lib64/libruby19.so.1.9(ruby_exec_node+0x1d) [0x7fc3f59462ad] /usr/lib64/libruby19.so.1.9(ruby_run_node+0x1e) [0x7fc3f5947d3e] ruby() [0x40099b] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7fc3f55656c5] ruby() [0x4009c9] -- http://bugs.ruby-lang.org/