Issue #10460 has been updated by Greg Navis.


I think the bug is still there. I'm able to reproduce it on the nightly snapshot (dated 25 June 2015 on the FTP server).

# How to Reproduce

Use the following snippet:

~~~
require 'minitest'
require 'minitest/autorun'

class TestBug < MiniTest::Test
  def test_bug
    bang!
  end

  define_method(:bang!) do
    bang!
  end
end
~~~

It produced the following output:

~~~
Run options: --seed 28198

# Running:

EEE/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:293: [BUG] vm_call_cfunc - cfp consistency error
ruby 2.3.0dev (2015-06-26 trunk 51033) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0011 p:---- s:0050 e:000049 CFUNC  :each
c:0010 p:0008 s:0047 e:000046 BLOCK  /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:293
c:0009 p:0034 s:0045 e:000044 METHOD /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:332
c:0008 p:0020 s:0038 E:001468 METHOD /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:319
c:0007 p:0062 s:0032 E:0013a0 METHOD /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:292
c:0006 p:0012 s:0025 e:000024 BLOCK  /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:155 [FINISH]
c:0005 p:---- s:0022 e:000021 CFUNC  :map
c:0004 p:0036 s:0019 e:000018 METHOD /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:155
c:0003 p:0140 s:0011 e:000010 METHOD /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:129
c:0002 p:0065 s:0005 E:000ae8 BLOCK  /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:56 [FINISH]
c:0001 p:0000 s:0002 E:001bf0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:56:in `block in autorun'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:129:in `run'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:155:in `__run'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:155:in `map'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:155:in `block in __run'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:292:in `run'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:319:in `with_info_handler'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:332:in `on_signal'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:293:in `block in run'
/tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb:293:in `each'

-- C level backtrace information -------------------------------------------
/tmp/ruby/bin/ruby(rb_vm_bugreport+0xc36) [0x7f135c361346] vm_dump.c:695
/tmp/ruby/bin/ruby(rb_bug+0xca) [0x7f135c3cbf6a] error.c:406
/tmp/ruby/bin/ruby(vm_call_cfunc+0x9ab) [0x7f135c34a1db] vm_insnhelper.c:1598
/tmp/ruby/bin/ruby(vm_call_method+0x10e) [0x7f135c35cb7e] vm_insnhelper.c:1921
/tmp/ruby/bin/ruby(vm_exec_core+0x1310) [0x7f135c34ffb0] insns.def:947
/tmp/ruby/bin/ruby(vm_exec+0x7b) [0x7f135c35526b] vm.c:1486
/tmp/ruby/bin/ruby(invoke_block_from_c+0x71b) [0x7f135c34bbbb] vm.c:857
/tmp/ruby/bin/ruby(vm_invoke_proc+0xcb) [0x7f135c34c04b] vm.c:920
/tmp/ruby/bin/ruby(rb_vm_invoke_proc+0x28) [0x7f135c34c0f8] vm.c:951
/tmp/ruby/bin/ruby(rb_proc_call+0x42) [0x7f135c20a382] proc.c:774
/tmp/ruby/bin/ruby(rb_exec_end_proc+0x131) [0x7f135c202411] eval_jump.c:107
/tmp/ruby/bin/ruby(ruby_finalize_0+0x83) [0x7f135c202543] eval.c:124
/tmp/ruby/bin/ruby(ruby_cleanup+0x1e2) [0x7f135c202a32] eval.c:182
/tmp/ruby/bin/ruby(ruby_run_node+0x36) [0x7f135c202f76] eval.c:314
/tmp/ruby/bin/ruby(main+0x5f) [0x7f135c1fecef] parse.y:8809

-- Other runtime information -----------------------------------------------

* Loaded script: ruby_crash.rb

* Loaded features:

    0 enumerator.so
    1 rational.so
    2 complex.so
    3 /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/encdb.so
    4 /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/trans/transdb.so
    5 /tmp/ruby/lib/ruby/2.3.0/unicode_normalize.rb
    6 /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/rbconfig.rb
    7 thread.rb
    8 /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/thread.so
    9 /tmp/ruby/lib/ruby/2.3.0/rubygems/compatibility.rb
   10 /tmp/ruby/lib/ruby/2.3.0/rubygems/defaults.rb
   11 /tmp/ruby/lib/ruby/2.3.0/rubygems/deprecate.rb
   12 /tmp/ruby/lib/ruby/2.3.0/rubygems/errors.rb
   13 /tmp/ruby/lib/ruby/2.3.0/rubygems/version.rb
   14 /tmp/ruby/lib/ruby/2.3.0/rubygems/requirement.rb
   15 /tmp/ruby/lib/ruby/2.3.0/rubygems/platform.rb
   16 /tmp/ruby/lib/ruby/2.3.0/rubygems/basic_specification.rb
   17 /tmp/ruby/lib/ruby/2.3.0/rubygems/stub_specification.rb
   18 /tmp/ruby/lib/ruby/2.3.0/rubygems/util/stringio.rb
   19 /tmp/ruby/lib/ruby/2.3.0/rubygems/specification.rb
   20 /tmp/ruby/lib/ruby/2.3.0/rubygems/exceptions.rb
   21 /tmp/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb
   22 /tmp/ruby/lib/ruby/2.3.0/monitor.rb
   23 /tmp/ruby/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb
   24 /tmp/ruby/lib/ruby/2.3.0/rubygems.rb
   25 /tmp/ruby/lib/ruby/2.3.0/rubygems/path_support.rb
   26 /tmp/ruby/lib/ruby/2.3.0/rubygems/dependency.rb
   27 /tmp/ruby/lib/ruby/2.3.0/optparse.rb
   28 /tmp/ruby/lib/ruby/2.3.0/mutex_m.rb
   29 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/parallel.rb
   30 /tmp/ruby/lib/ruby/2.3.0/delegate.rb
   31 /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/etc.so
   32 /tmp/ruby/lib/ruby/2.3.0/fileutils.rb
   33 /tmp/ruby/lib/ruby/2.3.0/tmpdir.rb
   34 /tmp/ruby/lib/ruby/2.3.0/tempfile.rb
   35 /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/stringio.so
   36 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/assertions.rb
   37 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/unit.rb
   38 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/test.rb
   39 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest.rb
   40 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/expectations.rb
   41 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/spec.rb
   42 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/mock.rb
   43 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/autorun.rb
   44 /tmp/ruby/lib/ruby/gems/2.3.0/gems/minitest-5.7.0/lib/minitest/pride_plugin.rb

* Process memory map:

7f1344000000-7f1344021000 rw-p 00000000 00:00 0 
7f1344021000-7f1348000000 ---p 00000000 00:00 0 
7f134c000000-7f134c021000 rw-p 00000000 00:00 0 
7f134c021000-7f1350000000 ---p 00000000 00:00 0 
7f1352b8a000-7f1352d87000 r--s 00000000 08:01 269523                     /usr/lib64/libc-2.20.so
7f1352d87000-7f1353b77000 r--s 00000000 00:24 203922                     /tmp/ruby/bin/ruby
7f1353b77000-7f1353b8d000 r-xp 00000000 08:01 276025                     /usr/lib64/libgcc_s-4.9.2-20150212.so.1
7f1353b8d000-7f1353d8c000 ---p 00016000 08:01 276025                     /usr/lib64/libgcc_s-4.9.2-20150212.so.1
7f1353d8c000-7f1353d8d000 r--p 00015000 08:01 276025                     /usr/lib64/libgcc_s-4.9.2-20150212.so.1
7f1353d8d000-7f1353d8e000 rw-p 00016000 08:01 276025                     /usr/lib64/libgcc_s-4.9.2-20150212.so.1
7f1353d8e000-7f1353d8f000 ---p 00000000 00:00 0 
7f1353d8f000-7f1353f90000 rw-p 00000000 00:00 0                          [stack:10738]
7f1353f90000-7f1353f91000 ---p 00000000 00:00 0 
7f1353f91000-7f1354091000 rw-p 00000000 00:00 0                          [stack:10737]
7f1354091000-7f1354099000 r-xp 00000000 00:24 203933                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/stringio.so
7f1354099000-7f1354298000 ---p 00008000 00:24 203933                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/stringio.so
7f1354298000-7f1354299000 r--p 00007000 00:24 203933                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/stringio.so
7f1354299000-7f135429a000 rw-p 00008000 00:24 203933                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/stringio.so
7f135429a000-7f13542a0000 r-xp 00000000 00:24 203931                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/etc.so
7f13542a0000-7f135449f000 ---p 00006000 00:24 203931                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/etc.so
7f135449f000-7f13544a0000 r--p 00005000 00:24 203931                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/etc.so
7f13544a0000-7f13544a1000 rw-p 00006000 00:24 203931                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/etc.so
7f13544a1000-7f13544a4000 r-xp 00000000 00:24 203935                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/thread.so
7f13544a4000-7f13546a3000 ---p 00003000 00:24 203935                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/thread.so
7f13546a3000-7f13546a4000 r--p 00002000 00:24 203935                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/thread.so
7f13546a4000-7f13546a5000 rw-p 00003000 00:24 203935                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/thread.so
7f13546a5000-7f13546a7000 r-xp 00000000 00:24 175157                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/trans/transdb.so
7f13546a7000-7f13548a7000 ---p 00002000 00:24 175157                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/trans/transdb.so
7f13548a7000-7f13548a8000 r--p 00002000 00:24 175157                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/trans/transdb.so
7f13548a8000-7f13548a9000 rw-p 00003000 00:24 175157                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/trans/transdb.so
7f13548a9000-7f13548ab000 r-xp 00000000 00:24 203974                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/encdb.so
7f13548ab000-7f1354aaa000 ---p 00002000 00:24 203974                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/encdb.so
7f1354aaa000-7f1354aab000 r--p 00001000 00:24 203974                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/encdb.so
7f1354aab000-7f1354aac000 rw-p 00002000 00:24 203974                     /tmp/ruby/lib/ruby/2.3.0/x86_64-linux/enc/encdb.so
7f1354aac000-7f135b01f000 r--p 00000000 08:01 279468                     /usr/lib/locale/locale-archive
7f135b01f000-7f135b097000 r-xp 00000000 08:01 269065                     /usr/lib64/libfreebl3.so
7f135b097000-7f135b296000 ---p 00078000 08:01 269065                     /usr/lib64/libfreebl3.so
7f135b296000-7f135b298000 r--p 00077000 08:01 269065                     /usr/lib64/libfreebl3.so
7f135b298000-7f135b299000 rw-p 00079000 08:01 269065                     /usr/lib64/libfreebl3.so
7f135b299000-7f135b29d000 rw-p 00000000 00:00 0 
7f135b29d000-7f135b450000 r-xp 00000000 08:01 269523                     /usr/lib64/libc-2.20.so
7f135b450000-7f135b650000 ---p 001b3000 08:01 269523                     /usr/lib64/libc-2.20.so
7f135b650000-7f135b654000 r--p 001b3000 08:01 269523                     /usr/lib64/libc-2.20.so
7f135b654000-7f135b656000 rw-p 001b7000 08:01 269523                     /usr/lib64/libc-2.20.so
7f135b656000-7f135b65a000 rw-p 00000000 00:00 0 
7f135b65a000-7f135b761000 r-xp 00000000 08:01 269656                     /usr/lib64/libm-2.20.so
7f135b761000-7f135b960000 ---p 00107000 08:01 269656                     /usr/lib64/libm-2.20.so
7f135b960000-7f135b961000 r--p 00106000 08:01 269656                     /usr/lib64/libm-2.20.so
7f135b961000-7f135b962000 rw-p 00107000 08:01 269656                     /usr/lib64/libm-2.20.so
7f135b962000-7f135b969000 r-xp 00000000 08:01 269606                     /usr/lib64/libcrypt-2.20.so
7f135b969000-7f135bb68000 ---p 00007000 08:01 269606                     /usr/lib64/libcrypt-2.20.so
7f135bb68000-7f135bb69000 r--p 00006000 08:01 269606                     /usr/lib64/libcrypt-2.20.so
7f135bb69000-7f135bb6a000 rw-p 00007000 08:01 269606                     /usr/lib64/libcrypt-2.20.so
7f135bb6a000-7f135bb98000 rw-p 00000000 00:00 0 
7f135bb98000-7f135bb9b000 r-xp 00000000 08:01 269633                     /usr/lib64/libdl-2.20.so
7f135bb9b000-7f135bd9a000 ---p 00003000 08:01 269633                     /usr/lib64/libdl-2.20.so
7f135bd9a000-7f135bd9b000 r--p 00002000 08:01 269633                     /usr/lib64/libdl-2.20.so
7f135bd9b000-7f135bd9c000 rw-p 00003000 08:01 269633                     /usr/lib64/libdl-2.20.so
7f135bd9c000-7f135bdb3000 r-xp 00000000 08:01 270055                     /usr/lib64/libpthread-2.20.so
7f135bdb3000-7f135bfb2000 ---p 00017000 08:01 270055                     /usr/lib64/libpthread-2.20.so
7f135bfb2000-7f135bfb3000 r--p 00016000 08:01 270055                     /usr/lib64/libpthread-2.20.so
7f135bfb3000-7f135bfb4000 rw-p 00017000 08:01 270055                     /usr/lib64/libpthread-2.20.so
7f135bfb4000-7f135bfb8000 rw-p 00000000 00:00 0 
7f135bfb8000-7f135bfd9000 r-xp 00000000 08:01 279457                     /usr/lib64/ld-2.20.so
7f135c0d8000-7f135c1d9000 rw-p 00000000 00:00 0 
7f135c1d9000-7f135c1da000 r--p 00021000 08:01 279457                     /usr/lib64/ld-2.20.so
7f135c1da000-7f135c1db000 rw-p 00022000 08:01 279457                     /usr/lib64/ld-2.20.so
7f135c1db000-7f135c1dc000 rw-p 00000000 00:00 0 
7f135c1dc000-7f135c4b4000 r-xp 00000000 00:24 203922                     /tmp/ruby/bin/ruby
7f135c56a000-7f135c69a000 rw-p 00000000 00:00 0 
7f135c6ae000-7f135c6af000 rw-p 00000000 00:00 0 
7f135c6af000-7f135c6b0000 ---p 00000000 00:00 0 
7f135c6b0000-7f135c6b4000 rw-p 00000000 00:00 0                          [stack:10736]
7f135c6b4000-7f135c6b9000 r--p 002d8000 00:24 203922                     /tmp/ruby/bin/ruby
7f135c6b9000-7f135c6ba000 rw-p 002dd000 00:24 203922                     /tmp/ruby/bin/ruby
7f135c6ba000-7f135c6cc000 rw-p 00000000 00:00 0 
7f135daba000-7f135e0a7000 rw-p 00000000 00:00 0                          [heap]
7fffdec3f000-7fffdf43f000 rw-p 00000000 00:00 0                          [stack]
7fffdf512000-7fffdf514000 r--p 00000000 00:00 0                          [vvar]
7fffdf514000-7fffdf516000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

~~~

# System Information

~~~
$ uname -a
Linux localhost.localdomain 4.0.5-200.fc21.x86_64 #1 SMP Mon Jun 8 16:25:02 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ ruby --version
ruby 2.3.0dev (2015-06-26 trunk 51033) [x86_64-linux]
~~~

----------------------------------------
Bug #10460: Segfault instead of stack level too deep
https://bugs.ruby-lang.org/issues/10460#change-53124

* Author: Arne Brasseur
* Status: Open
* Priority: High
* Assignee: Nobuyoshi Nakada
* ruby -v: ruby 2.2.0dev (2014-10-29 trunk 48188) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The code to trigger this can be found here: https://gist.github.com/mbj/31163a8e712573877268

Also have a look at the comments there. A lot of different people tried it, in some cases it segfaults, in others it doesn't. It seems to have to do with version of gcc or specific CFLAGS. 

I can reproduce the problem for 2.1.3, 2.1.4, and trunk.

---Files--------------------------------
rspec_ruby_segfault.rb (233 Bytes)
sample_output (26 KB)


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