From: Vincent Pit Date: Tue, 26 May 2009 14:56:39 +0000 (+0200) Subject: Explicitely point to $. when it causes an uninitialized warning for ranges in scalar... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f187fc91707286d3f695e2ea5e34351c2516fc6;p=p5sagit%2Fp5-mst-13.2.git Explicitely point to $. when it causes an uninitialized warning for ranges in scalar context --- diff --git a/sv.c b/sv.c index 1dad3cf..9944724 100644 --- a/sv.c +++ b/sv.c @@ -12984,6 +12984,14 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, Need a better fix at dome point. DAPM 11/2007 */ break; + case OP_FLIP: + case OP_FLOP: + { + GV * const gv = gv_fetchpvs(".", GV_NOTQUAL, SVt_PV); + if (gv && GvSV(gv) == uninit_sv) + return newSVpvs_flags("$.", SVs_TEMP); + goto do_op; + } case OP_POS: /* def-ness of rval pos() is independent of the def-ness of its arg */ diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index 50db322..50e7f50 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -446,6 +446,29 @@ Use of uninitialized value $m1 in exists at - line 7. Use of uninitialized value $g1 in exists at - line 8. ######## use warnings 'uninitialized'; +my ($m1, $m2); +my ($v, @a); + +local $.; + +@ma = (1 .. 2); +@ma = ($m1 .. 2); +@ma = (1 .. $m2); +@ma = ($m1 .. $m2); + +$v = (1 .. 2); +$v = ($m1 .. 2); +$v = (1 .. $m2); +$v = ($m1 .. $m2); +EXPECT +Use of uninitialized value $m1 in range (or flop) at - line 8. +Use of uninitialized value $m2 in range (or flop) at - line 9. +Use of uninitialized value in range (or flop) at - line 10. +Use of uninitialized value in range (or flop) at - line 10. +Use of uninitialized value $. in range (or flip) at - line 12. +Use of uninitialized value $. in range (or flip) at - line 14. +######## +use warnings 'uninitialized'; my ($m1, $v); our ($g1);