X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/dd2a7f9048da2c440a4dfed5122c0bfd98f079d3..801d32ac4fd337a99a83ad6098cda0f368bb8b03:/pp_ctl.c diff --git a/pp_ctl.c b/pp_ctl.c index b7b3598..7fd27f8 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2776,7 +2776,7 @@ S_dofindlabel(pTHX_ OP *o, const char *label, STRLEN len, U32 flags, OP **opstac return 0; } -PP(pp_goto) +PP(pp_goto) /* also pp_dump */ { dVAR; dSP; OP *retop = NULL; @@ -2791,6 +2791,8 @@ PP(pp_goto) static const char* const must_have_label = "goto must have label"; if (PL_op->op_flags & OPf_STACKED) { + /* goto EXPR or goto &foo */ + SV * const sv = POPs; SvGETMAGIC(sv); @@ -2893,31 +2895,27 @@ PP(pp_goto) OP* const retop = cx->blk_sub.retop; SV **newsp; I32 gimme; - const SSize_t items = AvFILLp(arg) + 1; + const SSize_t items = arg ? AvFILLp(arg) + 1 : 0; SV** mark; PERL_UNUSED_VAR(newsp); PERL_UNUSED_VAR(gimme); /* put GvAV(defgv) back onto stack */ - EXTEND(SP, items+1); /* @_ could have been extended. */ - Copy(AvARRAY(arg), SP + 1, items, SV*); + if (items) { + EXTEND(SP, items+1); /* @_ could have been extended. */ + Copy(AvARRAY(arg), SP + 1, items, SV*); + } mark = SP; SP += items; - if (AvREAL(arg)) { - I32 index; + if (items && AvREAL(arg)) { + SSize_t index; for (index=0; indexop_flags & OPf_SPECIAL)) { + /* goto LABEL or dump LABEL */ label = cPVOP->op_pv; label_flags = (cPVOP->op_private & OPpPV_IS_UTF8) ? SVf_UTF8 : 0; label_len = strlen(label);