Next in while may dumps core

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

1.9 e$B$,0J2<$GMn$A$^$9!#$^$?!"e(Bnext e$B$re(B redo
e$B$KJQ$($F$bMn$A$^$9!#e(B

$ ./ruby -e ’
def foo
while true
begin
yield
next
rescue
end
end
rescue
retry
end

foo { raise }

-e:5: [BUG] Segmentation fault
ruby 1.9.0 (2008-01-28 revision 15294) [i686-linux]

– control frame ----------
c:0004 p:0003 s:0008 b:0009 l:000008 d:000008 METHOD -e:5
c:0003 p:0012 s:0006 b:0006 l:000005 d:000005 TOP -e:14
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17

DBG> : “-e:14:in `’”
– backtrace of native function call (Use addr2line) –
0x80ef855
0x810e2ce
0x810e32b
0x80be760
0xffffe440
0x80ed264
0x80ed59d
0x805a7f9
0x805e940
0x8058221
0xb7e00ea8
0x8058131

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

e$B$"$s$^$j$A$c$s$HDI$C$F$$$^$;$s$,!"e(BNODE_NEXT e$B$de(B _REDO
e$B$re(B while e$B$NCf$Ge(B
e$B%3%s%Q%$%k$9$k$H$-!"e(Bpoped
e$B$rL5;k$7$F$$$k$?$aH/@8$9$kLdBj$N$h$&$G$9!#e(B

Index: compile.c

— compile.c (revision 15294)
+++ compile.c (working copy)
@@ -3049,6 +3049,10 @@
ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label);
ADD_INSNL(ret, nd_line(node), jump,
iseq->compile_data->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
+

  •  if (!poped) {
    
  • ADD_INSN(ret, nd_line(node), putnil);
  •  }
    
    }
    else if (iseq->compile_data->end_label) {
    LABEL *splabel = NEW_LABEL(0);
    @@ -3110,6 +3114,10 @@
    add_ensure_iseq(ret, iseq);
    ADD_INSNL(ret, nd_line(node), jump,
    iseq->compile_data->redo_label);
    ADD_ADJUST_RESTORE(ret, splabel);
  •  if (!poped) {
    
  • ADD_INSN(ret, nd_line(node), putnil);
  •  }
    
    }
    else if (iseq->type == ISEQ_TYPE_EVAL) {
    redo_in_eval:

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