Return in rescue in while in eval dumps core

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

1.9 e$B$G0J2<$N$h$&$K$9$k$HMn$A$^$9!#e(B

$ ./ruby -ve ‘eval “while true; return; end rescue p $!”’
ruby 1.9.0 (2007-08-27 patchlevel 0) [i686-linux]
#<LocalJumpError: unexpected return>
(eval):1: – control frame ----------
c:0006 p:0008 s:0013 b:0012 l:000004 d:000011 EVAL (eval):1
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH :new
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :eval
c:0003 p:0009 s:0005 b:0005 l:000004 d:000004 TOP -e:1
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

DBG> : “-e:1:in eval'" DBG> : "-e:1:in'”
– backtrace of native function call (Use addr2line) –
0x80dea35
0x80f85e3
0x80f86ab
0x80dcb14
0x80dd304
0x805bac1
0x805bda5
0x80d535e
0x80d6fc6
0x80d9cac
0x80dd304
0x80dd63b
0x80597a9
0x805cdad
0x80573a2
0xb7d84ea8
0x80572d1

[BUG] Stack consistency error (sp: 13, bp: 12)
ruby 1.9.0 (2007-08-27) [i686-linux]

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

e$B;n9T:x8m$7$?$i$H$j$"$($:0J2<$GMn$A$J$/$J$j$^$7$?$,!"D>$C$F$J$$$+$be(B
e$B$7$l$^$;$s$7!“B>$KJQ$J1F6A$,$”$k$+$b$7$l$^$;$s!#e(B

catch type [email protected]$H$+0UL#$H$+A4A3$o$+$C$F$J$$e(B

Index: compile.c

— compile.c (revision 13289)
+++ compile.c (working copy)
@@ -3764,6 +3764,7 @@
else {
ADD_INSN1(ret, nd_line(node), throw,
INT2FIX(0x01) /* TAG_RETURN */ );

  •    ADD_INSN(ret, nd_line(node), pop);
    
    }
    break;
    }

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

07/08/27 e$B$Ke(B Yusuke ENDOHremoved_email_addr[email protected] e$B$5$s$O=q$-$^$7$?e(B:

1.9 e$B$G0J2<$N$h$&$K$9$k$HMn$A$^$9!#e(B

$ ./ruby -ve ‘eval “while true; return; end rescue p $!”’
(snip)
}
break;
}

e$B$3$N%Q%C%[email protected]$H0J2<$GMn$A$F$7$^$&$h$&$G$9!#$9$_$^$;$s!#e(B

$ ./ruby -e ‘eval “1.times { return rescue p $! }”’
#<LocalJumpError: unexpected return>
(eval):1: – control frame ----------
c:0009 p:0006 s:0017 b:0018 l:000004 d:000017 BLOCK (eval):1
c:0008 p:---- s:0017 b:0017 l:000016 d:000016 FINISH :each
c:0007 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC :times
c:0006 p:0008 s:0012 b:0012 l:000004 d:000011 EVAL (eval):1
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH :unshift
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :eval
c:0003 p:0009 s:0005 b:0005 l:000004 d:000004 TOP -e:1
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

DBG> : “(eval):1:in times'" DBG> : "(eval):1:in'”
DBG> : “-e:1:in eval'" DBG> : "-e:1:in'”
– backtrace of native function call (Use addr2line) –
0x80eb935
0x8109c43
0x8109d0b
0x80e9bd9
0x80ea1f4
0x80e3447
0x805adae
0x8077e8f
0x80e3f53
0x80e6b96
0x80ea1f4
0x805ccd2
0x805d095
0x80e21fe
0x80e3f53
0x80e6b96
0x80ea1f4
0x80ea52b
0x805a6a9
0x805e4e0
0x8058200
0xb7d65ea8
0x8058121

[BUG] Stack consistency error (sp: 17, bp: 18)
ruby 1.9.0 (2007-12-10) [i686-linux]

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

e$B$3$&$9$l$P$I$A$i$bMn$A$J$/$J$j$^$7$?!#$G$b$3$l$,@[email protected]$J$N$+$Oe(B
e$B$h$/$o$+$C$F$$$^$;$s!#e(B

e$B$J$s$Ge(B throw e$B$N8e$Ke(B pop

e$B$,$"$k$+$I$&$+$,[email protected]$m$&!)e(B

Index: compile.c

— compile.c (revision 14181)
+++ compile.c (working copy)
@@ -3776,6 +3776,7 @@
else {
ADD_INSN1(ret, nd_line(node), throw,
INT2FIX(0x01) /* TAG_RETURN */ );

  •    if (poped) ADD_INSN(ret, nd_line(node), pop);
    
    }
    break;
    }

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