sv.c:varname: Fix bad assertion added by c6fb3f6e
authorFather Chrysostomos <sprout@cpan.org>
Sat, 4 Aug 2012 17:16:01 +0000 (10:16 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 4 Aug 2012 22:56:22 +0000 (15:56 -0700)
#!perl -w
my $x;
format =
@
"$x";
.
write;
__END__
Assertion failed: (!cv || SvTYPE(cv) == SVt_PVCV), function Perl_varname, file sv.c, line 13924.
Abort trap

sv.c
t/lib/warnings/9uninit

diff --git a/sv.c b/sv.c
index 4ad53cd..dd4f19a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -13921,7 +13921,7 @@ Perl_varname(pTHX_ const GV *const gv, const char gvtype, PADOFFSET targ,
        SV *sv;
        AV *av;
 
-       assert(!cv || SvTYPE(cv) == SVt_PVCV);
+       assert(!cv || SvTYPE(cv) == SVt_PVCV || SvTYPE(cv) == SVt_PVFM);
 
        if (!cv || !CvPADLIST(cv))
            return NULL;
index 4068fab..717e7f6 100644 (file)
@@ -2034,3 +2034,15 @@ use warnings 'uninitialized';
 "@{[ $x ]}";
 EXPECT
 Use of uninitialized value in join or string at - line 3.
+########
+# inside formats
+use warnings 'uninitialized';
+my $x;
+format =
+@
+"$x";
+.
+write;
+EXPECT
+Use of uninitialized value $x in string at - line 6.
+