# Return in rescue in while in eval dumps core

**URL:** <https://www.ruby-forum.com/t/return-in-rescue-in-while-in-eval-dumps-core/113098>\
**Category:** Development\
**Created:** [August 27, 2007, 4:43pm UTC](https://www.ruby-forum.com/t/return-in-rescue-in-while-in-eval-dumps-core/113098 "2007-08-27T16:43:44Z")\
**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:** [August 27, 2007, 4:43pm UTC](https://www.ruby-forum.com/t/return-in-rescue-in-while-in-eval-dumps-core/113098/1 "2007-08-27T16:43:44Z")

</div>

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 e$B$N9=@.$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;  
}

---

<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 10, 2007, 1:49pm UTC](https://www.ruby-forum.com/t/return-in-rescue-in-while-in-eval-dumps-core/113098/2 "2007-12-10T13:49:13Z")

</div>

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

07/08/27 e$B$Ke(B Yusuke ENDOH[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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%A$@$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$,@5$7$$=$@5$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$&$+$,1F6A$9$k$s$@$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;  
}
