This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #119311] Keep CvDEPTH and savestack in sync
[perl5.git] / pp_ctl.c
index 262c930..a5e293c 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2460,8 +2460,8 @@ PP(pp_return)
        }
        break;
     case CXt_FORMAT:
-       POPFORMAT(cx);
        retop = cx->blk_sub.retop;
+       POPFORMAT(cx);
        break;
     default:
        DIE(aTHX_ "panic: return, type=%u", (unsigned) CxTYPE(cx));
@@ -2550,8 +2550,8 @@ PP(pp_leavesublv)
     S_return_lvalues(aTHX_ newsp, SP, newsp, gimme, cx, newpm);
 
     LEAVE;
-    cxstack_ix--;
     POPSUB(cx,sv);     /* Stack values are safe: release CV and @_ ... */
+    cxstack_ix--;
     PL_curpm = newpm;  /* ... and pop $1 et al */
 
     LEAVESUB(sv);