Peephole_optimize ignores ADJUST

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

e$B0J2<$Ge(B SEGV e$B$7$^$9!#e(B

$ ./ruby -e ’
1.times do
begin
ensure
redo unless false
end
end

-e:4: [BUG] Segmentation fault
ruby 1.9.0 (2008-05-22 revision 16531) [i686-linux]

– stack frame ------------
– control frame ----------
c:0006 p:0001 s:302711808 b:0011 l:000005 d:000010 BLOCK -e:4
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH :class_eval
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :times
c:0003 p:0008 s:0006 b:0006 l:000005 d:000005 TOP -e:2
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
:private_class_method
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17

Segmentation fault

ISEQ_ELEMENT_ADJUST e$B$,DI2C$5$l$?$N$K!"e(Bpeephole_optimize e$B$,e(B
ISEQ_ELEMENT_INSN e$B$7$+C5$5$J$$$3$H$,860x$N$h$&$G$9!#e(B

Index: compile.c

— compile.c (revision 16534)
+++ compile.c (working copy)
@@ -1362,7 +1362,7 @@

 list = lobj->link.next;
 while (list) {
  • if (list->type == ISEQ_ELEMENT_INSN) {
  • if (list->type == ISEQ_ELEMENT_INSN || list->type ==
    ISEQ_ELEMENT_ADJUST) {
    break;
    }
    list = list->next;
    @@ -1376,7 +1376,7 @@
    LINK_ELEMENT *list = iobj->link.next;

    while (list) {

  • if (list->type == ISEQ_ELEMENT_INSN) {
  • if (list->type == ISEQ_ELEMENT_INSN || list->type ==
    ISEQ_ELEMENT_ADJUST) {
    return list;
    }
    list = list->next;
    @@ -1390,7 +1390,7 @@
    LINK_ELEMENT *list = iobj->link.prev;

    while (list) {

  • if (list->type == ISEQ_ELEMENT_INSN) {
  • if (list->type == ISEQ_ELEMENT_INSN || list->type ==
    ISEQ_ELEMENT_ADJUST) {
    return list;
    }
    list = list->prev;