This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
authorNicholas Clark <nick@ccl4.org>
Mon, 22 Mar 2004 18:48:29 +0000 (18:48 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 22 Mar 2004 18:48:29 +0000 (18:48 +0000)
[ 22525]
make ~$x give warning is $x isn't initialised.
Also add test for uninitialised warning in & op.

[ 22531]
add code comment for change 22525
p4raw-link: @22531 on //depot/perl: 5ab053b06800167d2bc083dd4186b23d7cb95fce
p4raw-link: @22525 on //depot/perl: a1afd1046e98b52e81720705c71449e6a5438e69

p4raw-id: //depot/maint-5.8/perl@22551
p4raw-integrated: from //depot/perl@22550 'copy in' t/lib/warnings/sv
(@19752..)
p4raw-integrated: from //depot/perl@22531 'edit in' pp.c (@22525..)

pp.c
t/lib/warnings/sv

diff --git a/pp.c b/pp.c
index dbe784b..7e760a4 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2359,6 +2359,7 @@ PP(pp_complement)
        register I32 anum;
        STRLEN len;
 
+       (void)SvPV_nomg(sv,len); /* force check for uninit var */
        SvSetSV(TARG, sv);
        tmps = (U8*)SvPV_force(TARG, len);
        anum = len;
index 6060fbc..b38200d 100644 (file)
@@ -112,6 +112,26 @@ Use of uninitialized value in bitwise or (|) at - line 4.
 ########
 # sv.c
 use warnings 'uninitialized' ;
+my $Y = 1 ; 
+my $x = 1 & $a[$Y] ;
+no warnings 'uninitialized' ;
+my $Y = 1 ; 
+$x = 1 & $b[$Y] ;
+EXPECT
+Use of uninitialized value in bitwise and (&) at - line 4.
+########
+# sv.c
+use warnings 'uninitialized' ;
+my $Y = 1 ; 
+my $x = ~$a[$Y] ;
+no warnings 'uninitialized' ;
+my $Y = 1 ; 
+$x = ~$b[$Y] ;
+EXPECT
+Use of uninitialized value in 1's complement (~) at - line 4.
+########
+# sv.c
+use warnings 'uninitialized' ;
 my $x *= 1 ; # d
 no warnings 'uninitialized' ;
 my $y *= 1 ; # d