This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #72090] unitialized variable name wrong with no strict refs
authorFather Chrysostomos <sprout@cpan.org>
Fri, 10 Dec 2010 22:54:13 +0000 (14:54 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 11 Dec 2010 00:09:32 +0000 (16:09 -0800)
commit6d1f0892ce0bd77f843552ab189aa5f121c374d4
tree94a3bfc018033cdfc63ddd2519c51063f9498333
parent98be99db6ff47327a7754b282e66c6be7eb35bb6
[perl #72090] unitialized variable name wrong with no strict refs

$ ./perl -we '$a = @$a > 0'
Use of uninitialized value $a in array dereference at -e line 1.
Use of uninitialized value $a in numeric gt (>) at -e line 1.

S_find_uninit_var was not taking into account that rv2*v could return
undef. So it merrily looked at the child ops to find one that named
a variable.

This commit makes it skip any rv2av/rv2hv that does not have an OP_GV
as its child op.

In other words, it skips @{...} and %{...} (including the shorthand
forms @$foo and %$foo), but not @foo or %foo.
sv.c
t/lib/warnings/sv