Issue #9965 has been reported by Egor Sapozhnikov.

----------------------------------------
Bug #9965: Segmentation Fault in Ruby
https://bugs.ruby-lang.org/issues/9965

* Author: Egor Sapozhnikov
* Status: Open
* Priority: Normal
* Assignee: _ wanabe
* Category: platform/linux
* Target version: 
* ruby -v: 2.1.2
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Hi, i found freaky bug. He is my enviroment:

~~~
$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]

awesome_print (1.2.0)
rails (3.2.17)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:        14.04
Codename:       trusty

~~~

When i do **rails c**, then print **require 'awesome_print'** and then **ap User.first.methods**
i get this 

~~~
2.1.2 :021 > ap User.first.methods
  User Load (1.1ms)  SELECT "users".* FROM "users" WHERE "users"."type" IN ('User', 'AnonymousUser', 'Person') LIMIT 1
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:298: [BUG] Segmentation fault at 0x000000
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]

-- Control frame information -----------------------------------------------
c:0033 p:---- s:0150 e:000149 CFUNC  :to_s
c:0032 p:0078 s:0147 e:000146 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:298
c:0031 p:0074 s:0139 e:000138 BLOCK  /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:246 [FINISH]
c:0030 p:---- s:0134 e:000133 CFUNC  :map
c:0029 p:0025 s:0131 e:000130 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:241
c:0028 p:0036 s:0121 e:000120 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:79
c:0027 p:0043 s:0115 e:000114 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:26
c:0026 p:0016 s:0108 e:000107 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/inspector.rb:137
c:0025 p:0077 s:0104 e:000103 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/inspector.rb:104
c:0024 p:0030 s:0100 e:000099 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/kernel.rb:10
c:0023 p:0015 s:0094 e:000092 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/kernel.rb:20
c:0022 p:0016 s:0088 e:000087 EVAL   (irb):21 [FINISH]
c:0021 p:---- s:0086 e:000085 CFUNC  :eval
c:0020 p:0024 s:0079 e:000078 METHOD /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/workspace.rb:86
c:0019 p:0025 s:0072 e:000070 METHOD /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/context.rb:380
c:0018 p:0022 s:0066 e:000065 BLOCK  /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:492
c:0017 p:0040 s:0058 e:000057 METHOD /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:624
c:0016 p:0009 s:0053 e:000052 BLOCK  /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:489
c:0015 p:0118 s:0049 e:000048 BLOCK  /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:247 [FINISH]
c:0014 p:---- s:0046 e:000045 CFUNC  :loop
c:0013 p:0007 s:0043 e:000042 BLOCK  /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:233 [FINISH]
c:0012 p:---- s:0041 e:000040 CFUNC  :catch
c:0011 p:0015 s:0037 e:000036 METHOD /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:232
c:0010 p:0030 s:0034 E:00060c METHOD /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:488
c:0009 p:0008 s:0031 e:000030 BLOCK  /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:397 [FINISH]
c:0008 p:---- s:0029 e:000028 CFUNC  :catch
c:0007 p:0143 s:0025 E:0014d4 METHOD /home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:396
c:0006 p:0195 s:0020 E:001940 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/railties-3.2.17/lib/rails/commands/console.rb:47
c:0005 p:0011 s:0016 e:000015 METHOD /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/railties-3.2.17/lib/rails/commands/console.rb:8
c:0004 p:0426 s:0012 e:000011 TOP    /home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/railties-3.2.17/lib/rails/commands.rb:41 [FINISH]
c:0003 p:---- s:0008 e:000007 CFUNC  :require
c:0002 p:0045 s:0004 E:002204 EVAL   script/rails:6 [FINISH]
c:0001 p:0000 s:0002 E:001b84 TOP    [FINISH]

script/rails:6:in `<main>'
script/rails:6:in `require'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/railties-3.2.17/lib/rails/commands.rb:41:in `<top (required)>'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/railties-3.2.17/lib/rails/commands/console.rb:8:in `start'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/railties-3.2.17/lib/rails/commands/console.rb:47:in `start'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:396:in `start'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:396:in `catch'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:397:in `block in start'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:488:in `eval_input'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in `each_top_level_statement'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in `catch'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in `block in each_top_level_statement'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in `loop'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:247:in `block (2 levels) in each_top_level_statement'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:489:in `block in eval_input'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:624:in `signal_status'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:492:in `block (2 levels) in eval_input'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/context.rb:380:in `evaluate'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/workspace.rb:86:in `evaluate'
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/workspace.rb:86:in `eval'
(irb):21:in `irb_binding'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/kernel.rb:20:in `ap'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/kernel.rb:10:in `ai'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/inspector.rb:104:in `awesome'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/inspector.rb:137:in `unnested'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:26:in `format'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:79:in `awesome_array'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:241:in `methods_array'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:241:in `map'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:246:in `block in methods_array'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:298:in `method_tuple'
/home/sapotero/.rvm/gems/ruby-2.1.2@redmine/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:298:in `to_s'

-- C level backtrace information -------------------------------------------
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1e8b50) [0xb76dcb50] vm_dump.c:685
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x6c4ed) [0xb75604ed] wfileops.c:688
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_bug+0x40) [0xb7560fa0] wfileops.c:467
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x159523) [0xb764d523] signal.c:704
[0xb77cb40c]
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_class_real+0x13) [0xb75d2753] ftw.c:611
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_class_name+0x1b) [0xb76a0d2b] variable.c:393
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x7b008) [0xb756f008] ../sysdeps/i386/i686/multiarch/../../i586/strchr.S:211
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5ce) [0xb76be5ce] vm_insnhelper.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ce0bb) [0xb76c20bb] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d385f) [0xb76c785f] insns.def:1028
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_yield+0x30f) [0xb76d524f] vm.c:732
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x26193) [0xb751a193] loadarchive.c:303
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5ce) [0xb76be5ce] vm_insnhelper.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ddc4e) [0xb76d1c4e] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d4023) [0xb76c8023] insns.def:999
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d9371) [0xb76cd371] vm_eval.c:1288
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d9a34) [0xb76cda34] vm_eval.c:1329
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5ae) [0xb76be5ae] vm_insnhelper.c:1298
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ce0bb) [0xb76c20bb] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d385f) [0xb76c785f] insns.def:1028
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1e0912) [0xb76d4912] vm.c:732
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_rescue2+0xdf) [0xb75693df] malloc.c:3489
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1cc8f2) [0xb76c08f2] vm_eval.c:1042
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5ce) [0xb76be5ce] vm_insnhelper.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ddc4e) [0xb76d1c4e] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d4023) [0xb76c8023] insns.def:999
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1e0d90) [0xb76d4d90] vm.c:732
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1cff67) [0xb76c3f67] vm_eval.c:1858
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_catch_obj+0x36) [0xb76c3fe6] vm_eval.c:1837
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d00d7) [0xb76c40d7] vm_eval.c:1823
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5ae) [0xb76be5ae] vm_insnhelper.c:1298
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ddc4e) [0xb76d1c4e] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d4023) [0xb76c8023] insns.def:999
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1e0d90) [0xb76d4d90] vm.c:732
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1cff67) [0xb76c3f67] vm_eval.c:1858
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_catch_obj+0x36) [0xb76c3fe6] vm_eval.c:1837
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d00d7) [0xb76c40d7] vm_eval.c:1823
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5ae) [0xb76be5ae] vm_insnhelper.c:1298
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ddc4e) [0xb76d1c4e] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d4023) [0xb76c8023] insns.def:999
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_iseq_eval+0x240) [0xb76d7170] vm.c:1549
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x78176) [0xb756c176] arena.c:462
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_require_safe+0x548) [0xb756dad8] mcheck.c:231
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_f_require+0x24) [0xb756de04] mcheck.c:307
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ca5f8) [0xb76be5f8] vm_insnhelper.c:1310
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1ddc4e) [0xb76d1c4e] vm_insnhelper.c:1470
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d385f) [0xb76c785f] insns.def:1028
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x1d8b8a) [0xb76ccb8a] vm.c:1304
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(rb_iseq_eval_main+0x26f) [0xb76d749f] vm.c:1562
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(+0x729d7) [0xb75669d7] strops.c:140
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(ruby_exec_node+0x24) [0xb7568b34] arena.c:688
/home/sapotero/.rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1(ruby_run_node+0x35) [0xb756ae45] arena.c:796
/home/sapotero/.rvm/rubies/ruby-2.1.2/bin/ruby() [0x80486a8] main.c:36
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0xb7345a83] libc-start.c:287
/home/sapotero/.rvm/rubies/ruby-2.1.2/bin/ruby() [0x80486ce] main.c:38


~~~



-- 
https://bugs.ruby-lang.org/