develooper Front page | perl.perl5.porters | Postings from May 2004

uninitialized variable name fix

From:
Dave Mitchell
Date:
May 7, 2004 12:36
Subject:
uninitialized variable name fix
Message ID:
20040507194113.GD2707@iabyn.com
Another good reason for this feature not to be added to maint!

Dave.

-- 
Monto Blanco... scorchio!

Change 22802 by davem@davem-percy on 2004/05/07 19:12:29

	symbolic references like ${"foo$index"}*3 would incorrectly warn
	that $index was the uninitialized value, when in fact it was $foo1

Affected files ...

... //depot/perl/sv.c#740 edit
... //depot/perl/t/lib/warnings/9uninit#4 edit

Differences ...

==== //depot/perl/sv.c#740 (text) ====

@@ -1000,6 +1000,7 @@
 	goto do_op2;
 
 
+    case OP_RV2SV:
     case OP_CUSTOM:
     case OP_ENTERSUB:
 	match = 1; /* XS or custom code could trigger random warnings */

==== //depot/perl/t/lib/warnings/9uninit#4 (text) ====

@@ -311,6 +311,10 @@
 $v = @$g1;
 $v = %$m2;
 $v = %$g2;
+
+$v = ${"foo.bar"}+1;
+$v = ${"foo$m1"}+1;
+$v = ${"foo$g1"}+1;
 EXPECT
 Use of uninitialized value $m1 in scalar dereference at - line 5.
 Use of uninitialized value $g1 in scalar dereference at - line 6.
@@ -318,6 +322,11 @@
 Use of uninitialized value $g1 in array dereference at - line 9.
 Use of uninitialized value $m2 in hash dereference at - line 10.
 Use of uninitialized value $g2 in hash dereference at - line 11.
+Use of uninitialized value in addition (+) at - line 13.
+Use of uninitialized value $m1 in concatenation (.) or string at - line 14.
+Use of uninitialized value in addition (+) at - line 14.
+Use of uninitialized value $g1 in concatenation (.) or string at - line 15.
+Use of uninitialized value in addition (+) at - line 15.
 ########
 use warnings 'uninitialized';
 my ($m1, $v);



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About