Issue #14273 has been updated by jacobevelyn (Jacob Evelyn).


Ah okay sorry, thanks!

----------------------------------------
Bug #14273: Stack Consistency Error from return in loop
https://bugs.ruby-lang.org/issues/14273#change-71119

* Author: ccutrer (Cody Cutrer)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
* Backport: 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED
----------------------------------------
```
def foo(x)
  unless x
    while !x
      return nil
    end
  end
end
foo(nil)
```

```
(irb):18: [BUG] Stack consistency error (sp: 100, bp: 101)
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0020 p:0013 s:0100 e:000100 ------ (irb):18
c:0019 p:0005 s:0096 e:000095 EVAL   (irb):22 [FINISH]
c:0018 p:---- s:0093 e:000092 CFUNC  :eval
c:0017 p:0021 s:0085 e:000084 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/workspace.rb:85
c:0016 p:0021 s:0077 e:000075 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/context.rb:380
c:0015 p:0017 s:0070 e:000069 BLOCK  /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:491
c:0014 p:0025 s:0060 e:000059 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:621
c:0013 p:0008 s:0054 e:000053 BLOCK  /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:488
c:0012 p:0102 s:0049 e:000048 BLOCK  /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:246 [FINISH]
c:0011 p:---- s:0045 e:000044 CFUNC  :loop
c:0010 p:0006 s:0041 e:000040 BLOCK  /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:232 [FINISH]
c:0009 p:---- s:0038 e:000037 CFUNC  :catch
c:0008 p:0012 s:0033 e:000032 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:231
c:0007 p:0029 s:0029 E:000690 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:487
c:0006 p:0005 s:0025 e:000024 BLOCK  /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:428 [FINISH]
c:0005 p:---- s:0022 e:000021 CFUNC  :catch
c:0004 p:0063 s:0017 E:0007f8 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:427
c:0003 p:0102 s:0012 e:000011 METHOD /Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:383
c:0002 p:0019 s:0006 e:000005 EVAL   /Users/cody/.rubies/ruby-2.5.0/bin/irb:11 [FINISH]
c:0001 p:0000 s:0003 E:0000d0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/Users/cody/.rubies/ruby-2.5.0/bin/irb:11:in `<main>'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:383:in `start'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:427:in `run'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:427:in `catch'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:428:in `block in run'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:487:in `eval_input'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:231:in `catch'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:232:in `loop'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:488:in `block in eval_input'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:621:in `signal_status'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb.rb:491:in `block (2 levels) in eval_input'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/context.rb:380:in `evaluate'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/workspace.rb:85:in `evaluate'
/Users/cody/.rubies/ruby-2.5.0/lib/ruby/2.5.0/irb/workspace.rb:85:in `eval'
(irb):22:in `irb_binding'
(irb):18:in `foo'

-- C level backtrace information -------------------------------------------
0   ruby                                0x0000000103409dd7 rb_vm_bugreport + 135
1   ruby                                0x000000010328eca8 rb_bug + 472
2   ruby                                0x00000001033e78d3 vm_exec_core + 15955
3   ruby                                0x00000001033f7b8e vm_exec + 142
4   ruby                                0x0000000103405fda eval_string_with_cref + 1418
5   ruby                                0x00000001033f385e rb_f_eval + 334
6   ruby                                0x00000001033fd2be vm_call_cfunc + 286
7   ruby                                0x00000001033e6a24 vm_exec_core + 12196
8   ruby                                0x00000001033f7b8e vm_exec + 142
9   ruby                                0x00000001034052b4 invoke_block_from_c_bh + 372
10  ruby                                0x0000000103406323 loop_i + 35
11  ruby                                0x00000001032991a7 rb_rescue2 + 311
12  ruby                                0x00000001033fd2be vm_call_cfunc + 286
13  ruby                                0x00000001033e5f84 vm_exec_core + 9476
14  ruby                                0x00000001033f7b8e vm_exec + 142
15  ruby                                0x00000001034052b4 invoke_block_from_c_bh + 372
16  ruby                                0x00000001034062be catch_i + 78
17  ruby                                0x00000001033f49dd vm_catch_protect + 173
18  ruby                                0x00000001033f5092 rb_f_catch + 66
19  ruby                                0x00000001033fd2be vm_call_cfunc + 286
20  ruby                                0x00000001033e5f84 vm_exec_core + 9476
21  ruby                                0x00000001033f7b8e vm_exec + 142
22  ruby                                0x00000001034052b4 invoke_block_from_c_bh + 372
23  ruby                                0x00000001034062be catch_i + 78
24  ruby                                0x00000001033f49dd vm_catch_protect + 173
25  ruby                                0x00000001033f5092 rb_f_catch + 66
26  ruby                                0x00000001033fd2be vm_call_cfunc + 286
27  ruby                                0x00000001033e5f84 vm_exec_core + 9476
28  ruby                                0x00000001033f7b8e vm_exec + 142
29  ruby                                0x00000001032989d1 ruby_exec_internal + 177
30  ruby                                0x00000001032988c8 ruby_run_node + 56
31  ruby                                0x000000010321e11f main + 79
```



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>