# Next dumps core when poped is 0

**URL:** <https://www.ruby-forum.com/t/next-dumps-core-when-poped-is-0/124104>\
**Category:** Development\
**Created:** [December 24, 2007, 7:48pm UTC](https://www.ruby-forum.com/t/next-dumps-core-when-poped-is-0/124104 "2007-12-24T19:48:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yusuke\_ENDOH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c89c15/32.png) [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Post date:** [December 24, 2007, 7:48pm UTC](https://www.ruby-forum.com/t/next-dumps-core-when-poped-is-0/124104/1 "2007-12-24T19:48:51Z")

</div>

e$B1sF#$H?=$7$^$9e(B

1.9 e$B$,0J2\<$GMn$A$^$9!#e(B

$ ./miniruby -e ’

> counter = 2  
> while true  
> counter -= 1  
> break if counter == 0  
> “#{next}”  
> end  
> ’  
> -e:5: – control frame ----------  
> c:0003 p:0021 s:0005 b:0006 l:000005 d:000005 TOP -e:5  
> c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited  
> c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

* * *

## – backtrace of native function call (Use addr2line) – 0x811a795 0x8070a93 0x8070b5b 0x81179f6 0x81181d4 0x811850b 0x8073db9 0x8077ca0 0x8058a91 0xb7d53ea8 0x80589a1

[BUG] Stack consistency error (sp: 5, bp: 6)  
ruby 1.9.0 (2007-12-25) [i686-linux]

e$B%"%!\<%H$7$^$7$?e(B

e$BB?J,0J2\<$GD\>$j$^$9!#e(B

# Index: compile.c

— compile.c (revision 14628)  
+++ compile.c (working copy)  
@@ -2973,7 +2973,7 @@  
if (iseq-\>compile\_data-\>redo\_label != 0) {  
/\* next in while loop \*/  
debugs(“next in while\n”);

- 

```
 pop_after_throw = 1;

```

- 

```
 pop_after_throw = poped;
 goto next_by_throw;

```

}  
else if (iseq-\>compile\_data-\>end\_label) {

---

<div class="post-metadata">

**Author:** ![Yusuke\_ENDOH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c89c15/32.png) [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Post date:** [December 24, 2007, 8:46pm UTC](https://www.ruby-forum.com/t/next-dumps-core-when-poped-is-0/124104/2 "2007-12-24T20:46:46Z")

</div>

e$B1sF#$G$9!#e(B

next e$B$@$1$G$J$/e(B redo e$B$K$bLdBj$,$"$j$^$7$?e(B  
(e$B$^$L$1$J8+Mn$H$7$9$\_$^$;$se(B) e$B!#e(B  
e$B0J2\<$GMn$A$^$9!#e(B

counter = 2  
while true  
counter -= 1  
break if counter == 0  
next  
“#{ redo }”  
end

e$B$^$?!"e(Bredo e$B$K4X$7$F$O0J2\<$@$1$G$bMn$A$^$9!#e(B

counter = 2  
while true  
counter -= 1  
break if counter == 0  
next  
redo  
end

e$BB?J,0J2\<$GD\>$k$H;W$&$N$G$9$,!"e(Bredo e$B$Ne(B throw e$B$ND\>A0$Ke(B  
putnil e$B$,e(B  
e$BB-$j$J$$$N$,:#$^$GH/\>I$7$J$+$C$?$N$O$A$g$C$HIT;W5D$G$9!#e(B  
e$B$3$3$O$3$l$G@5$7$/$F!"B\>$NLdBj$H$+$@$C$?$i$9$\_$^$;$s!#e(B

# Index: compile.c

— compile.c (revision 14631)  
+++ compile.c (working copy)  
@@ -3026,7 +3026,7 @@  
if (iseq-\>compile\_data-\>redo\_label) {  
debugs(“redo in while”);  
#if 1

- 

```
 pop_after_throw = 1;

```

- 

```
 pop_after_throw = poped;
 goto redo_by_throw;

```

#else  
add\_ensure\_iseq(ret, iseq);  
@@ -3069,6 +3069,7 @@  
ip = ip-\>parent\_iseq;  
}  
if (ip != 0) {

- ADD\_INSN(ret, nd\_line(node), putnil);  
ADD\_INSN1(ret, nd\_line(node), throw,  
INT2FIX(level | 0x05) /\* TAG\_REDO \*/ );
