From: Niko Tyni Subject: Fix a crash in format/write Bug-Debian: http://bugs.debian.org/579537 Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=22977 Origin: upstream, http://perl5.git.perl.org/perl.git/commit/421f30ed1e95009450bdc7905bf3433ee806ea4f The perly.act and perly.tab changes were generated with flex 2.5.35-6 and bison 1:2.3.dfsg-5 from Debian Lenny to avoid unnecessary changes. --- MANIFEST | 1 + perly.act | 284 ++++++++++++++++++++++++++------------------------- perly.tab | 30 +++--- perly.y | 8 ++- t/comp/form_scope.t | 18 ++++ 5 files changed, 186 insertions(+), 155 deletions(-) diff --git a/MANIFEST b/MANIFEST index 2b5a968..15ce1c7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3944,6 +3944,7 @@ t/comp/cpp.aux main file for cpp.t t/comp/cpp.t See if C preprocessor works t/comp/decl.t See if declarations work t/comp/fold.t See if constant folding works +t/comp/form_scope.t See if format scoping works t/comp/hints.t See if %^H works t/comp/multiline.t See if multiline strings work t/comp/opsubs.t See if q() etc. are not parsed as functions diff --git a/perly.act b/perly.act index b610294..e426f9e 100644 --- a/perly.act +++ b/perly.act @@ -450,7 +450,9 @@ case 2: case 60: #line 509 "perly.y" - { SvREFCNT_inc_simple_void(PL_compcv); + { + CV *fmtcv = PL_compcv; + SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD (yyval.opval) = newFORM((ps[(2) - (4)].val.ival), (ps[(3) - (4)].val.opval), (ps[(4) - (4)].val.opval)); prepend_madprops((ps[(1) - (4)].val.i_tkval)->tk_mad, (yyval.opval), 'F'); @@ -460,21 +462,25 @@ case 2: newFORM((ps[(2) - (4)].val.ival), (ps[(3) - (4)].val.opval), (ps[(4) - (4)].val.opval)); (yyval.opval) = (OP*)NULL; #endif + if (CvOUTSIDE(fmtcv) && !CvUNIQUE(CvOUTSIDE(fmtcv))) { + SvREFCNT_inc_simple_void(fmtcv); + pad_add_anon((SV*)fmtcv, OP_NULL); + } ;} break; case 61: -#line 522 "perly.y" +#line 528 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 62: -#line 523 "perly.y" +#line 529 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 63: -#line 528 "perly.y" +#line 534 "perly.y" { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD (yyval.opval) = newMYSUB((ps[(2) - (6)].val.ival), (ps[(3) - (6)].val.opval), (ps[(4) - (6)].val.opval), (ps[(5) - (6)].val.opval), (ps[(6) - (6)].val.opval)); @@ -487,7 +493,7 @@ case 2: break; case 64: -#line 541 "perly.y" +#line 547 "perly.y" { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD { @@ -510,25 +516,25 @@ case 2: break; case 65: -#line 563 "perly.y" +#line 569 "perly.y" { (yyval.ival) = start_subparse(FALSE, 0); SAVEFREESV(PL_compcv); ;} break; case 66: -#line 569 "perly.y" +#line 575 "perly.y" { (yyval.ival) = start_subparse(FALSE, CVf_ANON); SAVEFREESV(PL_compcv); ;} break; case 67: -#line 574 "perly.y" +#line 580 "perly.y" { (yyval.ival) = start_subparse(TRUE, 0); SAVEFREESV(PL_compcv); ;} break; case 68: -#line 579 "perly.y" +#line 585 "perly.y" { const char *const name = SvPV_nolen_const(((SVOP*)(ps[(1) - (1)].val.opval))->op_sv); if (strEQ(name, "BEGIN") || strEQ(name, "END") || strEQ(name, "INIT") || strEQ(name, "CHECK") @@ -538,24 +544,24 @@ case 2: break; case 69: -#line 589 "perly.y" +#line 595 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 71: -#line 595 "perly.y" +#line 601 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 72: -#line 597 "perly.y" +#line 603 "perly.y" { (yyval.opval) = (ps[(2) - (2)].val.opval); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),':'); ;} break; case 73: -#line 601 "perly.y" +#line 607 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL, 0), (OP*)NULL @@ -565,14 +571,14 @@ case 2: break; case 74: -#line 611 "perly.y" +#line 617 "perly.y" { (yyval.opval) = (ps[(2) - (2)].val.opval); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),':'); ;} break; case 75: -#line 615 "perly.y" +#line 621 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL, 0), (OP*)NULL @@ -582,12 +588,12 @@ case 2: break; case 76: -#line 624 "perly.y" +#line 630 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 77: -#line 625 "perly.y" +#line 631 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL,0), (OP*)NULL @@ -598,7 +604,7 @@ case 2: break; case 78: -#line 635 "perly.y" +#line 641 "perly.y" { #ifdef MAD (yyval.opval) = package((ps[(2) - (3)].val.opval)); @@ -612,12 +618,12 @@ case 2: break; case 79: -#line 648 "perly.y" +#line 654 "perly.y" { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ ;} break; case 80: -#line 650 "perly.y" +#line 656 "perly.y" { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD (yyval.opval) = utilize(IVAL((ps[(1) - (7)].val.i_tkval)), (ps[(2) - (7)].val.ival), (ps[(4) - (7)].val.opval), (ps[(5) - (7)].val.opval), (ps[(6) - (7)].val.opval)); @@ -634,28 +640,28 @@ case 2: break; case 81: -#line 667 "perly.y" +#line 673 "perly.y" { (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 82: -#line 671 "perly.y" +#line 677 "perly.y" { (yyval.opval) = newLOGOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 83: -#line 675 "perly.y" +#line 681 "perly.y" { (yyval.opval) = newLOGOP(OP_DOR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 85: -#line 683 "perly.y" +#line 689 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -668,7 +674,7 @@ case 2: break; case 86: -#line 693 "perly.y" +#line 699 "perly.y" { OP* term = (ps[(3) - (3)].val.opval); DO_MAD( @@ -680,7 +686,7 @@ case 2: break; case 88: -#line 706 "perly.y" +#line 712 "perly.y" { (yyval.opval) = convert(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_STACKED, prepend_elem(OP_LIST, newGVREF(IVAL((ps[(1) - (3)].val.i_tkval)),(ps[(2) - (3)].val.opval)), (ps[(3) - (3)].val.opval)) ); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o'); @@ -688,7 +694,7 @@ case 2: break; case 89: -#line 711 "perly.y" +#line 717 "perly.y" { (yyval.opval) = convert(IVAL((ps[(1) - (5)].val.i_tkval)), OPf_STACKED, prepend_elem(OP_LIST, newGVREF(IVAL((ps[(1) - (5)].val.i_tkval)),(ps[(3) - (5)].val.opval)), (ps[(4) - (5)].val.opval)) ); TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'o'); @@ -698,7 +704,7 @@ case 2: break; case 90: -#line 718 "perly.y" +#line 724 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, scalar((ps[(1) - (6)].val.opval)), (ps[(5) - (6)].val.opval)), @@ -710,7 +716,7 @@ case 2: break; case 91: -#line 727 "perly.y" +#line 733 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, scalar((ps[(1) - (3)].val.opval)), newUNOP(OP_METHOD, 0, (ps[(3) - (3)].val.opval)))); @@ -719,7 +725,7 @@ case 2: break; case 92: -#line 733 "perly.y" +#line 739 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, (ps[(2) - (3)].val.opval), (ps[(3) - (3)].val.opval)), @@ -728,7 +734,7 @@ case 2: break; case 93: -#line 739 "perly.y" +#line 745 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, (ps[(2) - (5)].val.opval), (ps[(4) - (5)].val.opval)), @@ -739,14 +745,14 @@ case 2: break; case 94: -#line 747 "perly.y" +#line 753 "perly.y" { (yyval.opval) = convert(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 95: -#line 751 "perly.y" +#line 757 "perly.y" { (yyval.opval) = convert(IVAL((ps[(1) - (4)].val.i_tkval)), 0, (ps[(3) - (4)].val.opval)); TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'o'); TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'('); @@ -755,13 +761,13 @@ case 2: break; case 96: -#line 757 "perly.y" +#line 763 "perly.y" { SvREFCNT_inc_simple_void(PL_compcv); (yyval.opval) = newANONATTRSUB((ps[(2) - (3)].val.ival), 0, (OP*)NULL, (ps[(3) - (3)].val.opval)); ;} break; case 97: -#line 760 "perly.y" +#line 766 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval)), (ps[(1) - (5)].val.opval))); @@ -769,7 +775,7 @@ case 2: break; case 100: -#line 775 "perly.y" +#line 781 "perly.y" { (yyval.opval) = newBINOP(OP_GELEM, 0, (ps[(1) - (5)].val.opval), scalar((ps[(3) - (5)].val.opval))); PL_parser->expect = XOPERATOR; TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'{'); @@ -779,7 +785,7 @@ case 2: break; case 101: -#line 782 "perly.y" +#line 788 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, oopsAV((ps[(1) - (4)].val.opval)), scalar((ps[(3) - (4)].val.opval))); TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'['); TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),']'); @@ -787,7 +793,7 @@ case 2: break; case 102: -#line 787 "perly.y" +#line 793 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, ref(newAVREF((ps[(1) - (5)].val.opval)),OP_RV2AV), scalar((ps[(4) - (5)].val.opval))); @@ -798,7 +804,7 @@ case 2: break; case 103: -#line 795 "perly.y" +#line 801 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, ref(newAVREF((ps[(1) - (4)].val.opval)),OP_RV2AV), scalar((ps[(3) - (4)].val.opval))); @@ -808,7 +814,7 @@ case 2: break; case 104: -#line 802 "perly.y" +#line 808 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, oopsHV((ps[(1) - (5)].val.opval)), jmaybe((ps[(3) - (5)].val.opval))); PL_parser->expect = XOPERATOR; TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'{'); @@ -818,7 +824,7 @@ case 2: break; case 105: -#line 809 "perly.y" +#line 815 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, ref(newHVREF((ps[(1) - (6)].val.opval)),OP_RV2HV), jmaybe((ps[(4) - (6)].val.opval))); @@ -831,7 +837,7 @@ case 2: break; case 106: -#line 819 "perly.y" +#line 825 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, ref(newHVREF((ps[(1) - (5)].val.opval)),OP_RV2HV), jmaybe((ps[(3) - (5)].val.opval))); @@ -843,7 +849,7 @@ case 2: break; case 107: -#line 828 "perly.y" +#line 834 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, newCVREF(0, scalar((ps[(1) - (4)].val.opval)))); TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'a'); @@ -853,7 +859,7 @@ case 2: break; case 108: -#line 835 "perly.y" +#line 841 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (ps[(4) - (5)].val.opval), newCVREF(0, scalar((ps[(1) - (5)].val.opval))))); @@ -864,7 +870,7 @@ case 2: break; case 109: -#line 844 "perly.y" +#line 850 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (ps[(3) - (4)].val.opval), newCVREF(0, scalar((ps[(1) - (4)].val.opval))))); @@ -874,7 +880,7 @@ case 2: break; case 110: -#line 851 "perly.y" +#line 857 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, newCVREF(0, scalar((ps[(1) - (3)].val.opval)))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'('); @@ -883,7 +889,7 @@ case 2: break; case 111: -#line 857 "perly.y" +#line 863 "perly.y" { (yyval.opval) = newSLICEOP(0, (ps[(5) - (6)].val.opval), (ps[(2) - (6)].val.opval)); TOKEN_GETMAD((ps[(1) - (6)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(3) - (6)].val.i_tkval),(yyval.opval),')'); @@ -893,7 +899,7 @@ case 2: break; case 112: -#line 864 "perly.y" +#line 870 "perly.y" { (yyval.opval) = newSLICEOP(0, (ps[(4) - (5)].val.opval), (OP*)NULL); TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),')'); @@ -903,21 +909,21 @@ case 2: break; case 113: -#line 874 "perly.y" +#line 880 "perly.y" { (yyval.opval) = newASSIGNOP(OPf_STACKED, (ps[(1) - (3)].val.opval), IVAL((ps[(2) - (3)].val.i_tkval)), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 114: -#line 878 "perly.y" +#line 884 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 115: -#line 882 "perly.y" +#line 888 "perly.y" { if (IVAL((ps[(2) - (3)].val.i_tkval)) != OP_REPEAT) scalar((ps[(1) - (3)].val.opval)); (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, (ps[(1) - (3)].val.opval), scalar((ps[(3) - (3)].val.opval))); @@ -926,49 +932,49 @@ case 2: break; case 116: -#line 888 "perly.y" +#line 894 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 117: -#line 892 "perly.y" +#line 898 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 118: -#line 896 "perly.y" +#line 902 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 119: -#line 900 "perly.y" +#line 906 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 120: -#line 904 "perly.y" +#line 910 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 121: -#line 908 "perly.y" +#line 914 "perly.y" { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 122: -#line 912 "perly.y" +#line 918 "perly.y" { (yyval.opval) = newRANGE(IVAL((ps[(2) - (3)].val.i_tkval)), scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval))); DO_MAD({ @@ -983,28 +989,28 @@ case 2: break; case 123: -#line 924 "perly.y" +#line 930 "perly.y" { (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 124: -#line 928 "perly.y" +#line 934 "perly.y" { (yyval.opval) = newLOGOP(OP_OR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 125: -#line 932 "perly.y" +#line 938 "perly.y" { (yyval.opval) = newLOGOP(OP_DOR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o'); ;} break; case 126: -#line 936 "perly.y" +#line 942 "perly.y" { (yyval.opval) = bind_match(IVAL((ps[(2) - (3)].val.i_tkval)), (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval), ((yyval.opval)->op_type == OP_NOT @@ -1014,14 +1020,14 @@ case 2: break; case 127: -#line 946 "perly.y" +#line 952 "perly.y" { (yyval.opval) = newUNOP(OP_NEGATE, 0, scalar((ps[(2) - (2)].val.opval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 128: -#line 950 "perly.y" +#line 956 "perly.y" { (yyval.opval) = IF_MAD( newUNOP(OP_NULL, 0, (ps[(2) - (2)].val.opval)), (ps[(2) - (2)].val.opval) @@ -1031,21 +1037,21 @@ case 2: break; case 129: -#line 957 "perly.y" +#line 963 "perly.y" { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((ps[(2) - (2)].val.opval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 130: -#line 961 "perly.y" +#line 967 "perly.y" { (yyval.opval) = newUNOP(OP_COMPLEMENT, 0, scalar((ps[(2) - (2)].val.opval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 131: -#line 965 "perly.y" +#line 971 "perly.y" { (yyval.opval) = newUNOP(OP_POSTINC, 0, mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTINC)); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o'); @@ -1053,7 +1059,7 @@ case 2: break; case 132: -#line 970 "perly.y" +#line 976 "perly.y" { (yyval.opval) = newUNOP(OP_POSTDEC, 0, mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTDEC)); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o'); @@ -1061,7 +1067,7 @@ case 2: break; case 133: -#line 975 "perly.y" +#line 981 "perly.y" { (yyval.opval) = newUNOP(OP_PREINC, 0, mod(scalar((ps[(2) - (2)].val.opval)), OP_PREINC)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); @@ -1069,7 +1075,7 @@ case 2: break; case 134: -#line 980 "perly.y" +#line 986 "perly.y" { (yyval.opval) = newUNOP(OP_PREDEC, 0, mod(scalar((ps[(2) - (2)].val.opval)), OP_PREDEC)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); @@ -1077,7 +1083,7 @@ case 2: break; case 135: -#line 989 "perly.y" +#line 995 "perly.y" { (yyval.opval) = newANONLIST((ps[(2) - (3)].val.opval)); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'['); TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),']'); @@ -1085,7 +1091,7 @@ case 2: break; case 136: -#line 994 "perly.y" +#line 1000 "perly.y" { (yyval.opval) = newANONLIST((OP*)NULL); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'['); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),']'); @@ -1093,7 +1099,7 @@ case 2: break; case 137: -#line 999 "perly.y" +#line 1005 "perly.y" { (yyval.opval) = newANONHASH((ps[(2) - (4)].val.opval)); TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'{'); TOKEN_GETMAD((ps[(3) - (4)].val.i_tkval),(yyval.opval),';'); @@ -1102,7 +1108,7 @@ case 2: break; case 138: -#line 1005 "perly.y" +#line 1011 "perly.y" { (yyval.opval) = newANONHASH((OP*)NULL); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'{'); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),';'); @@ -1111,7 +1117,7 @@ case 2: break; case 139: -#line 1011 "perly.y" +#line 1017 "perly.y" { SvREFCNT_inc_simple_void(PL_compcv); (yyval.opval) = newANONATTRSUB((ps[(2) - (5)].val.ival), (ps[(3) - (5)].val.opval), (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval)); TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'o'); @@ -1121,21 +1127,21 @@ case 2: break; case 140: -#line 1022 "perly.y" +#line 1028 "perly.y" { (yyval.opval) = dofile((ps[(2) - (2)].val.opval), IVAL((ps[(1) - (2)].val.i_tkval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 141: -#line 1026 "perly.y" +#line 1032 "perly.y" { (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, scope((ps[(2) - (2)].val.opval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'D'); ;} break; case 142: -#line 1030 "perly.y" +#line 1036 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, @@ -1150,7 +1156,7 @@ case 2: break; case 143: -#line 1042 "perly.y" +#line 1048 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, append_elem(OP_LIST, @@ -1166,7 +1172,7 @@ case 2: break; case 144: -#line 1055 "perly.y" +#line 1061 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, scalar(newCVREF(0,scalar((ps[(2) - (4)].val.opval)))), (OP*)NULL)); dep(); @@ -1177,7 +1183,7 @@ case 2: break; case 145: -#line 1063 "perly.y" +#line 1069 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, (ps[(4) - (5)].val.opval), @@ -1189,7 +1195,7 @@ case 2: break; case 150: -#line 1079 "perly.y" +#line 1085 "perly.y" { (yyval.opval) = newCONDOP(0, (ps[(1) - (5)].val.opval), (ps[(3) - (5)].val.opval), (ps[(5) - (5)].val.opval)); TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'?'); TOKEN_GETMAD((ps[(4) - (5)].val.i_tkval),(yyval.opval),':'); @@ -1197,26 +1203,26 @@ case 2: break; case 151: -#line 1084 "perly.y" +#line 1090 "perly.y" { (yyval.opval) = newUNOP(OP_REFGEN, 0, mod((ps[(2) - (2)].val.opval),OP_REFGEN)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 152: -#line 1088 "perly.y" +#line 1094 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 153: -#line 1090 "perly.y" +#line 1096 "perly.y" { (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'k'); ;} break; case 154: -#line 1094 "perly.y" +#line 1100 "perly.y" { (yyval.opval) = sawparens(IF_MAD(newUNOP(OP_NULL,0,(ps[(2) - (3)].val.opval)), (ps[(2) - (3)].val.opval))); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')'); @@ -1224,7 +1230,7 @@ case 2: break; case 155: -#line 1099 "perly.y" +#line 1105 "perly.y" { (yyval.opval) = sawparens(newNULLLIST()); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),')'); @@ -1232,37 +1238,37 @@ case 2: break; case 156: -#line 1104 "perly.y" +#line 1110 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 157: -#line 1106 "perly.y" +#line 1112 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 158: -#line 1108 "perly.y" +#line 1114 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 159: -#line 1110 "perly.y" +#line 1116 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 160: -#line 1112 "perly.y" +#line 1118 "perly.y" { (yyval.opval) = newUNOP(OP_AV2ARYLEN, 0, ref((ps[(1) - (1)].val.opval), OP_AV2ARYLEN));;} break; case 161: -#line 1114 "perly.y" +#line 1120 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 162: -#line 1116 "perly.y" +#line 1122 "perly.y" { (yyval.opval) = prepend_elem(OP_ASLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_ASLICE, 0, @@ -1274,7 +1280,7 @@ case 2: break; case 163: -#line 1125 "perly.y" +#line 1131 "perly.y" { (yyval.opval) = prepend_elem(OP_HSLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_HSLICE, 0, @@ -1288,17 +1294,17 @@ case 2: break; case 164: -#line 1136 "perly.y" +#line 1142 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 165: -#line 1138 "perly.y" +#line 1144 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, 0, scalar((ps[(1) - (1)].val.opval))); ;} break; case 166: -#line 1140 "perly.y" +#line 1146 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (3)].val.opval))); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')'); @@ -1306,7 +1312,7 @@ case 2: break; case 167: -#line 1145 "perly.y" +#line 1151 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (ps[(3) - (4)].val.opval), scalar((ps[(1) - (4)].val.opval)))); @@ -1322,7 +1328,7 @@ case 2: break; case 168: -#line 1158 "perly.y" +#line 1164 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (ps[(3) - (3)].val.opval), scalar((ps[(2) - (3)].val.opval)))); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o'); @@ -1330,7 +1336,7 @@ case 2: break; case 169: -#line 1163 "perly.y" +#line 1169 "perly.y" { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), OPf_SPECIAL); PL_hints |= HINT_BLOCK_SCOPE; TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o'); @@ -1338,74 +1344,74 @@ case 2: break; case 170: -#line 1168 "perly.y" +#line 1174 "perly.y" { (yyval.opval) = newLOOPEX(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 171: -#line 1172 "perly.y" +#line 1178 "perly.y" { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((ps[(2) - (2)].val.opval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 172: -#line 1176 "perly.y" +#line 1182 "perly.y" { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0); TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o'); ;} break; case 173: -#line 1180 "perly.y" +#line 1186 "perly.y" { (yyval.opval) = newUNOP(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 174: -#line 1184 "perly.y" +#line 1190 "perly.y" { (yyval.opval) = newUNOP(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 175: -#line 1188 "perly.y" +#line 1194 "perly.y" { (yyval.opval) = newOP(OP_REQUIRE, (ps[(1) - (1)].val.i_tkval) ? OPf_SPECIAL : 0); TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o'); ;} break; case 176: -#line 1192 "perly.y" +#line 1198 "perly.y" { (yyval.opval) = newUNOP(OP_REQUIRE, (ps[(1) - (2)].val.i_tkval) ? OPf_SPECIAL : 0, (ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 177: -#line 1196 "perly.y" +#line 1202 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;} break; case 178: -#line 1198 "perly.y" +#line 1204 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (ps[(2) - (2)].val.opval), scalar((ps[(1) - (2)].val.opval)))); ;} break; case 179: -#line 1201 "perly.y" +#line 1207 "perly.y" { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0); TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o'); ;} break; case 180: -#line 1205 "perly.y" +#line 1211 "perly.y" { (yyval.opval) = newOP(IVAL((ps[(1) - (3)].val.i_tkval)), 0); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o'); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'('); @@ -1414,13 +1420,13 @@ case 2: break; case 181: -#line 1211 "perly.y" +#line 1217 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;} break; case 182: -#line 1214 "perly.y" +#line 1220 "perly.y" { (yyval.opval) = (IVAL((ps[(1) - (3)].val.i_tkval)) == OP_NOT) ? newUNOP(IVAL((ps[(1) - (3)].val.i_tkval)), 0, newSVOP(OP_CONST, 0, newSViv(0))) : newOP(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_SPECIAL); @@ -1432,7 +1438,7 @@ case 2: break; case 183: -#line 1223 "perly.y" +#line 1229 "perly.y" { (yyval.opval) = newUNOP(IVAL((ps[(1) - (4)].val.i_tkval)), 0, (ps[(3) - (4)].val.opval)); TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'o'); TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'('); @@ -1441,7 +1447,7 @@ case 2: break; case 184: -#line 1229 "perly.y" +#line 1235 "perly.y" { (yyval.opval) = pmruntime((ps[(1) - (4)].val.opval), (ps[(3) - (4)].val.opval), 1); TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),')'); @@ -1449,7 +1455,7 @@ case 2: break; case 187: -#line 1239 "perly.y" +#line 1245 "perly.y" { (yyval.opval) = my_attrs((ps[(2) - (3)].val.opval),(ps[(3) - (3)].val.opval)); DO_MAD( token_getmad((ps[(1) - (3)].val.i_tkval),(yyval.opval),'d'); @@ -1460,14 +1466,14 @@ case 2: break; case 188: -#line 1247 "perly.y" +#line 1253 "perly.y" { (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'d'); ;} break; case 189: -#line 1254 "perly.y" +#line 1260 "perly.y" { (yyval.opval) = sawparens((ps[(2) - (3)].val.opval)); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')'); @@ -1475,7 +1481,7 @@ case 2: break; case 190: -#line 1259 "perly.y" +#line 1265 "perly.y" { (yyval.opval) = sawparens(newNULLLIST()); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),')'); @@ -1483,42 +1489,42 @@ case 2: break; case 191: -#line 1264 "perly.y" +#line 1270 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 192: -#line 1266 "perly.y" +#line 1272 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 193: -#line 1268 "perly.y" +#line 1274 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 194: -#line 1273 "perly.y" +#line 1279 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 195: -#line 1275 "perly.y" +#line 1281 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 196: -#line 1279 "perly.y" +#line 1285 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 197: -#line 1281 "perly.y" +#line 1287 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 198: -#line 1283 "perly.y" +#line 1289 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -1532,69 +1538,69 @@ case 2: break; case 199: -#line 1298 "perly.y" +#line 1304 "perly.y" { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;} break; case 200: -#line 1302 "perly.y" +#line 1308 "perly.y" { (yyval.opval) = newCVREF(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'&'); ;} break; case 201: -#line 1308 "perly.y" +#line 1314 "perly.y" { (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$'); ;} break; case 202: -#line 1314 "perly.y" +#line 1320 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@'); ;} break; case 203: -#line 1320 "perly.y" +#line 1326 "perly.y" { (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%'); ;} break; case 204: -#line 1326 "perly.y" +#line 1332 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l'); ;} break; case 205: -#line 1332 "perly.y" +#line 1338 "perly.y" { (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*'); ;} break; case 206: -#line 1339 "perly.y" +#line 1345 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 207: -#line 1341 "perly.y" +#line 1347 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 208: -#line 1343 "perly.y" +#line 1349 "perly.y" { (yyval.opval) = scope((ps[(1) - (1)].val.opval)); ;} break; case 209: -#line 1346 "perly.y" +#line 1352 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; diff --git a/perly.tab b/perly.tab index 8dd02ed..5980559 100644 --- a/perly.tab +++ b/perly.tab @@ -171,21 +171,21 @@ static const yytype_uint16 yyrline[] = 311, 314, 320, 321, 328, 341, 353, 364, 374, 384, 416, 424, 434, 440, 441, 446, 449, 453, 458, 462, 466, 472, 481, 485, 487, 489, 491, 493, 498, 502, - 508, 522, 523, 527, 540, 563, 569, 574, 579, 589, - 590, 595, 596, 600, 610, 614, 624, 625, 634, 648, - 647, 666, 670, 674, 678, 682, 692, 701, 705, 710, - 717, 726, 732, 738, 746, 750, 757, 756, 767, 768, - 772, 781, 786, 794, 801, 808, 818, 827, 834, 843, - 850, 856, 863, 873, 877, 881, 887, 891, 895, 899, - 903, 907, 911, 923, 927, 931, 935, 945, 949, 956, - 960, 964, 969, 974, 979, 988, 993, 998, 1004, 1010, - 1021, 1025, 1029, 1041, 1054, 1062, 1074, 1075, 1076, 1077, - 1078, 1083, 1087, 1089, 1093, 1098, 1103, 1105, 1107, 1109, - 1111, 1113, 1115, 1124, 1135, 1137, 1139, 1144, 1157, 1162, - 1167, 1171, 1175, 1179, 1183, 1187, 1191, 1195, 1197, 1200, - 1204, 1210, 1213, 1222, 1228, 1233, 1234, 1238, 1246, 1253, - 1258, 1263, 1265, 1267, 1272, 1274, 1279, 1280, 1282, 1297, - 1301, 1307, 1313, 1319, 1325, 1331, 1338, 1340, 1342, 1345 + 508, 528, 529, 533, 546, 569, 575, 580, 585, 595, + 596, 601, 602, 606, 616, 620, 630, 631, 640, 654, + 653, 672, 676, 680, 684, 688, 698, 707, 711, 716, + 723, 732, 738, 744, 752, 756, 763, 762, 773, 774, + 778, 787, 792, 800, 807, 814, 824, 833, 840, 849, + 856, 862, 869, 879, 883, 887, 893, 897, 901, 905, + 909, 913, 917, 929, 933, 937, 941, 951, 955, 962, + 966, 970, 975, 980, 985, 994, 999, 1004, 1010, 1016, + 1027, 1031, 1035, 1047, 1060, 1068, 1080, 1081, 1082, 1083, + 1084, 1089, 1093, 1095, 1099, 1104, 1109, 1111, 1113, 1115, + 1117, 1119, 1121, 1130, 1141, 1143, 1145, 1150, 1163, 1168, + 1173, 1177, 1181, 1185, 1189, 1193, 1197, 1201, 1203, 1206, + 1210, 1216, 1219, 1228, 1234, 1239, 1240, 1244, 1252, 1259, + 1264, 1269, 1271, 1273, 1278, 1280, 1285, 1286, 1288, 1303, + 1307, 1313, 1319, 1325, 1331, 1337, 1344, 1346, 1348, 1351 }; #endif diff --git a/perly.y b/perly.y index 6b8b4e3..9164cab 100644 --- a/perly.y +++ b/perly.y @@ -506,7 +506,9 @@ peg : PEG ; format : FORMAT startformsub formname block - { SvREFCNT_inc_simple_void(PL_compcv); + { + CV *fmtcv = PL_compcv; + SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD $$ = newFORM($2, $3, $4); prepend_madprops($1->tk_mad, $$, 'F'); @@ -516,6 +518,10 @@ format : FORMAT startformsub formname block newFORM($2, $3, $4); $$ = (OP*)NULL; #endif + if (CvOUTSIDE(fmtcv) && !CvUNIQUE(CvOUTSIDE(fmtcv))) { + SvREFCNT_inc_simple_void(fmtcv); + pad_add_anon((SV*)fmtcv, OP_NULL); + } } ; diff --git a/t/comp/form_scope.t b/t/comp/form_scope.t new file mode 100644 index 0000000..3ef891e --- /dev/null +++ b/t/comp/form_scope.t @@ -0,0 +1,18 @@ +#!./perl +# +# Tests bug #22977. Test case from Dave Mitchell. + +print "1..2\n"; + +sub f ($); +sub f ($) { +my $test = $_[0]; +write; +format STDOUT = +ok @<<<<<<< +$test +. +} + +f(1); +f(2); -- tg: (daf8b46..) fixes/format-write-crash (depends on: upstream)