summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-03-18 14:13:16 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-03-18 14:13:16 +0000
commita1afd1046e98b52e81720705c71449e6a5438e69 (patch)
treec26a8861ed6414802699122a3ea322078cacb192
parent57185c71ec028665c77b9bdf20d9fb51d8458287 (diff)
downloadperl-a1afd1046e98b52e81720705c71449e6a5438e69.tar.gz
make ~$x give warning is $x isn't initialised.
Also add test for uninitialised warning in & op. p4raw-id: //depot/perl@22525
-rw-r--r--pp.c1
-rw-r--r--t/lib/warnings/sv20
2 files changed, 21 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 8b485fda1f..866d55459e 100644
--- a/pp.c
+++ b/pp.c
@@ -2377,6 +2377,7 @@ PP(pp_complement)
register I32 anum;
STRLEN len;
+ (void)SvPV_nomg(sv,len);
sv_setsv_nomg(TARG, sv);
tmps = (U8*)SvPV_force(TARG, len);
anum = len;
diff --git a/t/lib/warnings/sv b/t/lib/warnings/sv
index 6060fbc38d..b38200d4c8 100644
--- a/t/lib/warnings/sv
+++ b/t/lib/warnings/sv
@@ -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