Change 33758 by nicholas@mouse-mill on 2008/04/27 10:20:10
Warnings within the conditional of until() and for() are not reported
with the correct line number. (See change 33756). Curiously, warnings
for the third expression of for() have the correct line number.
Affected files ...
... //depot/perl/t/lib/warnings/9uninit#26 edit
Differences ...
==== //depot/perl/t/lib/warnings/9uninit#26 (text) ====
Index: perl/t/lib/warnings/9uninit
--- perl/t/lib/warnings/9uninit#25~33756~ 2008-04-27 02:21:45.000000000 -0700
+++ perl/t/lib/warnings/9uninit 2008-04-27 03:20:10.000000000 -0700
@@ -1348,6 +1348,49 @@
Use of uninitialized value $c in numeric eq (==) at - line 5.
Use of uninitialized value $c in numeric eq (==) at - line 5.
########
+# TODO long standing bug - conditions of until loops
+use warnings;
+
+my $c;
+my $d;
+until ($c == 1) {
+ # a
+ # few
+ # blank
+ # lines
+ $c = 1 if ++$d == 2;
+}
+EXPECT
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+########
+# TODO long standing bug - conditions of for loops
+use warnings;
+
+my $c;
+my $d;
+for ($d = 1; $c == 0 && $d; ) {
+ # a
+ # few
+ # blank
+ # lines
+ undef $d;
+}
+
+my $e;
+for ($d = 2; $d > 0; $e = !($c == 0)) {
+ # a
+ # few
+ # blank
+ # lines
+ --$d;
+}
+EXPECT
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+Use of uninitialized value $c in numeric eq (==) at - line 14.
+Use of uninitialized value $c in numeric eq (==) at - line 14.
+########
# TODO long standing bug - more general variant of the above problem
use warnings;
my $undef;
End of Patch.