X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/c7764d57491b2cc21ae721b2de1e960a792ccc93..4df352a81ba92beb6467d6dafdf988d8aba963c4:/pp_sort.c diff --git a/pp_sort.c b/pp_sort.c index 1de1ca9..3bd9f2a 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -1706,18 +1706,22 @@ PP(pp_sort) (is_xsub ? S_sortcv_xsub : hasargs ? S_sortcv_stacked : S_sortcv), sort_flags); + /* Reset cx, in case the context stack has been reallocated. */ + cx = &cxstack[cxstack_ix]; + + PL_stack_sp = PL_stack_base + cx->blk_oldsp; + if (!(flags & OPf_SPECIAL)) { - /* Reset cx, in case the context stack has been - reallocated. */ - cx = &cxstack[cxstack_ix]; - POPSUB(cx); + assert(CxTYPE(cx) == CXt_SUB); + POPSUB(cx); } else + assert(CxTYPE(cx) == CXt_NULL); /* mimic POPSUB */ PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor; POPBLOCK(cx,PL_curpm); - PL_stack_sp = PL_stack_base + cx->blk_oldsp; + cxstack_ix--; POPSTACK; CATCH_SET(oldcatch); }