Next dumps core when poped is 0

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) {

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

next [email protected]$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<[email protected]$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
[email protected]$7$/$F!"B>[email protected]$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 */ );

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs