diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2004-03-18 14:13:16 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-03-18 14:13:16 +0000 |
commit | a1afd1046e98b52e81720705c71449e6a5438e69 (patch) | |
tree | c26a8861ed6414802699122a3ea322078cacb192 | |
parent | 57185c71ec028665c77b9bdf20d9fb51d8458287 (diff) | |
download | perl-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.c | 1 | ||||
-rw-r--r-- | t/lib/warnings/sv | 20 |
2 files changed, 21 insertions, 0 deletions
@@ -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 |