From: Dave Mitchell Date: Sun, 9 Sep 2007 22:27:38 +0000 (+0000) Subject: ununit pos value warning identified the wrong variable name X-Git-Tag: accepted/trunk/20130322.191538~14651 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc4b8646f4297d1d601d9f445953d91eaef16779;p=platform%2Fupstream%2Fperl.git ununit pos value warning identified the wrong variable name p4raw-id: //depot/perl@31834 --- diff --git a/sv.c b/sv.c index 4a21107..5cc15b1 100644 --- a/sv.c +++ b/sv.c @@ -12077,6 +12077,11 @@ S_find_uninit_var(pTHX_ OP* obase, SV* uninit_sv, bool match) match = 1; /* XS or custom code could trigger random warnings */ goto do_op; + case OP_POS: + /* def-ness of rval pos() is independent of the def-ness of its arg */ + if ( !(obase->op_flags & OPf_MOD)) + break; + case OP_SCHOMP: case OP_CHOMP: if (SvROK(PL_rs) && uninit_sv == SvRV(PL_rs)) diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index f49ca66..9fb5df1 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -759,6 +759,22 @@ Use of uninitialized value $m1 in scalar assignment at - line 5. ######## use warnings 'uninitialized'; my ($m1); +our ($g1); + +$v = pos($m1) + 1; +$v = pos($g1) + 1; +$m1 = 0; +$g1 = ""; +$v = pos($m1) + 1; +$v = pos($g1) + 1; +EXPECT +Use of uninitialized value in addition (+) at - line 5. +Use of uninitialized value in addition (+) at - line 6. +Use of uninitialized value in addition (+) at - line 9. +Use of uninitialized value in addition (+) at - line 10. +######## +use warnings 'uninitialized'; +my ($m1); { my $x = "a" x $m1 } # NB LHS of repeat does not warn { my @x = ("a") x $m1 }