1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
|
DAPM 4/2004.
Test the appearance of variable names in "Use of uninitialized value"
warnings.
The following ops aren't tested, mainly because they do IO or non-portable
stuff:
send recv bind conect listen accept shutdown chdir chown chroot unlink
chmod utime rename link symlink readlink mkdir rmdir opendir seekdir
system exec kill getpgrp alarm sleep dofile require gethostbyname
gethostbyaddr getnetbyname getnetbyaddr getprotobyname getprotobynumber
getservbyname getservbyport sethostent setnetent setprotoent setservent
getpwnam getpwuid getgrnam getgrgid waitpid setpgrp setpriority
getpriority syscall dbmopen ioctl fcntl truncate getsockopt setsockopt
semctl semop semget msgget msgctl msgsnd msgrcv shmget shmctl shmread
shmwrite
---------------------------------------------------
__END__
use warnings 'uninitialized';
my ($m1, $m2, $v);
$v = $m1 + 10;
$v = 22 + $m2;
$v = $m1 + $m2;
EXPECT
Use of uninitialized value $m1 in addition (+) at - line 4.
Use of uninitialized value $m2 in addition (+) at - line 5.
Use of uninitialized value $m2 in addition (+) at - line 6.
Use of uninitialized value $m1 in addition (+) at - line 6.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1, $g2);
$v = $g1 + 21;
$v = 31 + $g2;
$v = $g1 + $g2;
$v = $m1 + $g2;
EXPECT
Use of uninitialized value $g1 in addition (+) at - line 5.
Use of uninitialized value $g2 in addition (+) at - line 6.
Use of uninitialized value $g2 in addition (+) at - line 7.
Use of uninitialized value $g1 in addition (+) at - line 7.
Use of uninitialized value $g2 in addition (+) at - line 8.
Use of uninitialized value $m1 in addition (+) at - line 8.
########
use warnings 'uninitialized';
my ($m1, @ma, $v);
$v = $ma[5] + 45;
$v = 56 + $ma[6];
$v = $ma[7] + $m1;
$v = $ma[8] + $ma[9];
$v = $ma[-1] + $ma[-2];
EXPECT
Use of uninitialized value $ma[5] in addition (+) at - line 4.
Use of uninitialized value $ma[6] in addition (+) at - line 5.
Use of uninitialized value $m1 in addition (+) at - line 6.
Use of uninitialized value in addition (+) at - line 6.
Use of uninitialized value in addition (+) at - line 7.
Use of uninitialized value in addition (+) at - line 7.
Use of uninitialized value in addition (+) at - line 8.
Use of uninitialized value in addition (+) at - line 8.
########
use warnings 'uninitialized';
my ($v);
my @mau = (undef) x 258;
my %mhu = ('foo', undef, 'bar', undef);
$v = $mau[5] + 23;
$v = $mau[-5] + 45;
$v = 56 + $mau[6];
$v = 78 + $mau[-6];
$v = $mau[7] + $mau[8];
$v = $mau[256] + $mau[257];
$v = $mau[-1] + $mau[-2];
$v = $mhu{foo} + $mhu{bar};
EXPECT
Use of uninitialized value $mau[5] in addition (+) at - line 6.
Use of uninitialized value $mau[-5] in addition (+) at - line 7.
Use of uninitialized value $mau[6] in addition (+) at - line 8.
Use of uninitialized value $mau[-6] in addition (+) at - line 9.
Use of uninitialized value $mau[8] in addition (+) at - line 10.
Use of uninitialized value $mau[7] in addition (+) at - line 10.
Use of uninitialized value $mau[257] in addition (+) at - line 11.
Use of uninitialized value $mau[256] in addition (+) at - line 11.
Use of uninitialized value $mau[-2] in addition (+) at - line 12.
Use of uninitialized value $mau[-1] in addition (+) at - line 12.
Use of uninitialized value $mhu{"bar"} in addition (+) at - line 13.
Use of uninitialized value $mhu{"foo"} in addition (+) at - line 13.
########
use warnings 'uninitialized';
my ($v);
our (@ga);
$v = $ga[8] + 21;
$v = $ga[-8] + 46;
$v = 57 + $ga[9];
$v = 58 + $ga[-9];
$v = $ga[10] + $ga[11];
$v = $ga[-10] + $ga[-11];
EXPECT
Use of uninitialized value $ga[8] in addition (+) at - line 5.
Use of uninitialized value $ga[-8] in addition (+) at - line 6.
Use of uninitialized value $ga[9] in addition (+) at - line 7.
Use of uninitialized value $ga[-9] in addition (+) at - line 8.
Use of uninitialized value in addition (+) at - line 9.
Use of uninitialized value in addition (+) at - line 9.
Use of uninitialized value in addition (+) at - line 10.
Use of uninitialized value in addition (+) at - line 10.
########
use warnings 'uninitialized';
my ($v);
our @gau = (undef) x 258;
our %ghu = ('foo', undef, 'bar', undef);
$v = $gau[8] + 46;
$v = $gau[-8] + 47;
$v = 57 + $gau[9];
$v = 57 + $gau[-9];
$v = $gau[10] + $gau[11];
$v = $gau[256] + $gau[257];
$v = $gau[-1] + $gau[-2];
$v = $ghu{foo} + $ghu{bar};
EXPECT
Use of uninitialized value $gau[8] in addition (+) at - line 6.
Use of uninitialized value $gau[-8] in addition (+) at - line 7.
Use of uninitialized value $gau[9] in addition (+) at - line 8.
Use of uninitialized value $gau[-9] in addition (+) at - line 9.
Use of uninitialized value $gau[11] in addition (+) at - line 10.
Use of uninitialized value $gau[10] in addition (+) at - line 10.
Use of uninitialized value $gau[257] in addition (+) at - line 11.
Use of uninitialized value $gau[256] in addition (+) at - line 11.
Use of uninitialized value $gau[-2] in addition (+) at - line 12.
Use of uninitialized value $gau[-1] in addition (+) at - line 12.
Use of uninitialized value $ghu{"bar"} in addition (+) at - line 13.
Use of uninitialized value $ghu{"foo"} in addition (+) at - line 13.
########
use warnings 'uninitialized';
my ($v);
our @gau = (undef) x 258;
our %ghu = ('foo', undef, 'bar', undef);
my @mau = (undef) x 258;
my %mhu = ('foo', undef, 'bar', undef);
my $i1 = 10;
my $i2 = 20;
my $i3 = 2000;
my $k1 = 'foo';
my $k2 = 'bar';
my $k3 = 'baz';
$v = $mau[$i1] + $mau[$i2];
$v = $gau[$i1] + $gau[$i2];
$v = $gau[$i1] + $gau[$i3];
$v = $mhu{$k1} + $mhu{$k2};
$v = $ghu{$k1} + $ghu{$k2};
$v = $ghu{$k1} + $ghu{$k3};
EXPECT
Use of uninitialized value $mau[20] in addition (+) at - line 14.
Use of uninitialized value $mau[10] in addition (+) at - line 14.
Use of uninitialized value $gau[20] in addition (+) at - line 15.
Use of uninitialized value $gau[10] in addition (+) at - line 15.
Use of uninitialized value in addition (+) at - line 16.
Use of uninitialized value $gau[10] in addition (+) at - line 16.
Use of uninitialized value $mhu{"bar"} in addition (+) at - line 17.
Use of uninitialized value $mhu{"foo"} in addition (+) at - line 17.
Use of uninitialized value $ghu{"bar"} in addition (+) at - line 18.
Use of uninitialized value $ghu{"foo"} in addition (+) at - line 18.
Use of uninitialized value in addition (+) at - line 19.
Use of uninitialized value $ghu{"foo"} in addition (+) at - line 19.
########
use warnings 'uninitialized';
my ($m1, $m2, @ma, %mh, $v);
our ($g1, $g2, @ga, %gh);
$v = $ma[$m1];
$v = $ma[$g1];
$v = $ga[$m2];
$v = $ga[$g2];
$v = $mh{$m1};
$v = $mh{$g1};
$v = $gh{$m2};
$v = $gh{$g2};
$v = $m1+($m2-$g1);
$v = $ma[$ga[3]];
$v = $ga[$ma[4]];
EXPECT
Use of uninitialized value $m1 in array element at - line 5.
Use of uninitialized value $g1 in array element at - line 6.
Use of uninitialized value $m2 in array element at - line 7.
Use of uninitialized value $g2 in array element at - line 8.
Use of uninitialized value $m1 in hash element at - line 10.
Use of uninitialized value $g1 in hash element at - line 11.
Use of uninitialized value $m2 in hash element at - line 12.
Use of uninitialized value $g2 in hash element at - line 13.
Use of uninitialized value $g1 in subtraction (-) at - line 15.
Use of uninitialized value $m2 in subtraction (-) at - line 15.
Use of uninitialized value $m1 in addition (+) at - line 15.
Use of uninitialized value $ga[3] in array element at - line 16.
Use of uninitialized value $ma[4] in array element at - line 17.
########
use warnings 'uninitialized';
my (@ma, %mh, $v);
our (@ga, %gh);
$v = sin $ga[1000];
$v = sin $ma[1000];
$v = sin $gh{foo};
$v = sin $mh{bar};
$v = sin $ga[$$];
$v = sin $ma[$$];
$v = sin $gh{$$};
$v = sin $mh{$$};
EXPECT
Use of uninitialized value $ga[1000] in sin at - line 5.
Use of uninitialized value $ma[1000] in sin at - line 6.
Use of uninitialized value $gh{"foo"} in sin at - line 7.
Use of uninitialized value $mh{"bar"} in sin at - line 8.
Use of uninitialized value within @ga in sin at - line 10.
Use of uninitialized value within @ma in sin at - line 11.
Use of uninitialized value within %gh in sin at - line 12.
Use of uninitialized value within %mh in sin at - line 13.
########
use warnings 'uninitialized';
my (@mat, %mht, $v);
sub X::TIEARRAY { bless [], 'X' }
sub X::TIEHASH { bless [], 'X' }
sub X::FETCH { undef }
tie @mat, 'X';
tie %mht, 'X';
my $key1 = 'akey';
my $key2 = 'bkey';
my $index1 = 33;
my $index2 = 55;
$v = sin $mat[0];
$v = $mat[0] + $mat[1];
$v = sin $mat[1000];
$v = $mat[1000] + $mat[1001];
$v = sin $mat[$index1];
$v = $mat[$index1] + $mat[$index2];
$v = sin $mht{foo};
$v = $mht{foo} + $mht{bar};
$v = sin $mht{$key1};
$v = $mht{$key1} + $mht{$key2};
$v = $1+1;
EXPECT
Use of uninitialized value $mat[0] in sin at - line 13.
Use of uninitialized value in addition (+) at - line 14.
Use of uninitialized value in addition (+) at - line 14.
Use of uninitialized value $mat[1000] in sin at - line 15.
Use of uninitialized value in addition (+) at - line 16.
Use of uninitialized value in addition (+) at - line 16.
Use of uninitialized value within @mat in sin at - line 18.
Use of uninitialized value in addition (+) at - line 19.
Use of uninitialized value in addition (+) at - line 19.
Use of uninitialized value $mht{"foo"} in sin at - line 21.
Use of uninitialized value in addition (+) at - line 22.
Use of uninitialized value in addition (+) at - line 22.
Use of uninitialized value within %mht in sin at - line 24.
Use of uninitialized value in addition (+) at - line 25.
Use of uninitialized value in addition (+) at - line 25.
Use of uninitialized value $1 in addition (+) at - line 27.
########
use warnings 'uninitialized';
my ($m1);
our ($g1, @ga);
print $ga[1000];
print STDERR $ga[1000];
print STDERR $m1, $g1, $ga[1],$m2;
print STDERR "", $ga[1],"";
EXPECT
Use of uninitialized value $ga[1000] in print at - line 5.
Use of uninitialized value $ga[1000] in print at - line 6.
Use of uninitialized value $m1 in print at - line 7.
Use of uninitialized value $g1 in print at - line 7.
Use of uninitialized value in print at - line 7.
Use of uninitialized value $m2 in print at - line 7.
Use of uninitialized value $ga[1] in print at - line 8.
########
use warnings 'uninitialized';
my ($m1);
our ($g1);
close $m1; # exercises rv2gv
close $g1; # exercises rv2gv
EXPECT
Use of uninitialized value $m1 in ref-to-glob cast at - line 5.
Use of uninitialized value $g1 in ref-to-glob cast at - line 6.
########
use warnings 'uninitialized';
my ($m1, $m2, $v);
our ($g1, $g2);
$v = $$m1;
$v = $$g1;
$v = @$m1;
$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.
Use of uninitialized value $m1 in array dereference at - line 8.
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);
our ($g1);
$v = $m1 | $m2;
$v = $m1 & $m2;
$v = $m1 ^ $m2;
$v = ~$m1;
$v = $g1 | $g2;
$v = $g1 & $g2;
$v = $g1 ^ $g2;
$v = ~$g1;
EXPECT
Use of uninitialized value $m1 in bitwise or (|) at - line 5.
Use of uninitialized value $m2 in bitwise or (|) at - line 5.
Use of uninitialized value $m1 in bitwise and (&) at - line 6.
Use of uninitialized value $m2 in bitwise and (&) at - line 6.
Use of uninitialized value $m1 in bitwise xor (^) at - line 7.
Use of uninitialized value $m2 in bitwise xor (^) at - line 7.
Use of uninitialized value $m1 in 1's complement (~) at - line 8.
Use of uninitialized value $g1 in bitwise or (|) at - line 10.
Use of uninitialized value $g2 in bitwise or (|) at - line 10.
Use of uninitialized value $g1 in bitwise and (&) at - line 11.
Use of uninitialized value $g2 in bitwise and (&) at - line 11.
Use of uninitialized value $g1 in bitwise xor (^) at - line 12.
Use of uninitialized value $g2 in bitwise xor (^) at - line 12.
Use of uninitialized value $g1 in 1's complement (~) at - line 13.
########
use warnings 'uninitialized';
my ($v);
my $tmp1; $v = $tmp1++; # (doesn't warn)
our $tmp2; $v = $tmp2++; # (doesn't warn)
my $tmp3; $v = ++$tmp1; # (doesn't warn)
our $tmp4; $v = ++$tmp2; # (doesn't warn)
my $tmp5; $v = $tmp5--; # (doesn't warn)
our $tmp6; $v = $tmp6--; # (doesn't warn)
my $tmp7; $v = --$tmp7; # (doesn't warn)
our $tmp8; $v = --$tmp8; # (doesn't warn)
EXPECT
########
use warnings 'uninitialized';
my $s1; chomp $s1;
my $s2; chop $s2;
my ($s3,$s4); chomp ($s3,$s4);
my ($s5,$s6); chop ($s5,$s6);
EXPECT
Use of uninitialized value $s1 in scalar chomp at - line 3.
Use of uninitialized value $s2 in scalar chop at - line 4.
Use of uninitialized value $s4 in chomp at - line 5.
Use of uninitialized value $s3 in chomp at - line 5.
Use of uninitialized value $s5 in chop at - line 6.
Use of uninitialized value $s6 in chop at - line 6.
########
use warnings 'uninitialized';
my ($m1);
local $/ =\$m1;
my $x = "abc";
chomp $x; chop $x;
my $y;
chomp ($x, $y); chop ($x, $y);
EXPECT
Use of uninitialized value ${$/} in scalar chomp at - line 6.
Use of uninitialized value ${$/} in chomp at - line 8.
Use of uninitialized value $y in chomp at - line 8.
Use of uninitialized value ${$/} in chomp at - line 8.
Use of uninitialized value $y in chop at - line 8.
########
use warnings 'uninitialized';
my ($m1, @ma, %mh);
our ($g1);
delete $ma[$m1];
delete @ma[$m1, $g1];
delete $mh{$m1};
delete @mh{$m1, $g1};
EXPECT
Use of uninitialized value $m1 in delete at - line 5.
Use of uninitialized value $m1 in delete at - line 6.
Use of uninitialized value $g1 in delete at - line 6.
Use of uninitialized value $m1 in delete at - line 7.
Use of uninitialized value $m1 in delete at - line 8.
Use of uninitialized value $g1 in delete at - line 8.
########
use warnings 'uninitialized';
my ($m1, @ma, %mh);
our ($g1);
my @a = @ma[$m1, $g1];
@a = (4,5)[$m1, $g1];
@a = @mh{$m1, $g1};
EXPECT
Use of uninitialized value $m1 in array slice at - line 5.
Use of uninitialized value $g1 in array slice at - line 5.
Use of uninitialized value $m1 in list slice at - line 6.
Use of uninitialized value $g1 in list slice at - line 6.
Use of uninitialized value $m1 in hash slice at - line 7.
Use of uninitialized value $g1 in hash slice at - line 7.
########
use warnings 'uninitialized';
my ($m1, @ma, %mh, $v);
our ($g1, @ga, %gh);
$v = exists $ma[$m1];
$v = exists $ga[$g1];
$v = exists $mh{$m1};
$v = exists $gh{$g1};
EXPECT
Use of uninitialized value $m1 in exists at - line 5.
Use of uninitialized value $g1 in exists at - line 6.
Use of uninitialized value $m1 in exists at - line 7.
Use of uninitialized value $g1 in exists at - line 8.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
my ($x1,$x2);
$v = $x1 << $m1;
$v = $x2 << $g1;
EXPECT
Use of uninitialized value $m1 in left bitshift (<<) at - line 6.
Use of uninitialized value $x1 in left bitshift (<<) at - line 6.
Use of uninitialized value $g1 in left bitshift (<<) at - line 7.
Use of uninitialized value $x2 in left bitshift (<<) at - line 7.
########
use warnings 'uninitialized';
my ($m1, $m2, $v);
our ($g1, $g2);
use integer;
$v = $m1 + $g1;
$v = $m1 - $g1;
$v = $m1 * $g1;
eval {$v = $m1 / $g1};
$v = $m2 / 2;
eval {$v = $m1 % $g1};
$v = $m2 % 2;
$v = $m1 < $g1;
$v = $m1 > $g1;
$v = $m1 <= $g1;
$v = $m1 >= $g1;
$v = $m1 == $g1;
$v = $m1 != $g1;
$v = $m1 <=> $g1;
$v = -$m1;
EXPECT
Use of uninitialized value $g1 in integer addition (+) at - line 6.
Use of uninitialized value $m1 in integer addition (+) at - line 6.
Use of uninitialized value $g1 in integer subtraction (-) at - line 7.
Use of uninitialized value $m1 in integer subtraction (-) at - line 7.
Use of uninitialized value $g1 in integer multiplication (*) at - line 8.
Use of uninitialized value $m1 in integer multiplication (*) at - line 8.
Use of uninitialized value $g1 in integer division (/) at - line 9.
Use of uninitialized value $m2 in integer division (/) at - line 10.
Use of uninitialized value $g1 in integer modulus (%) at - line 11.
Use of uninitialized value $m1 in integer modulus (%) at - line 11.
Use of uninitialized value $m2 in integer modulus (%) at - line 12.
Use of uninitialized value $g1 in integer lt (<) at - line 13.
Use of uninitialized value $m1 in integer lt (<) at - line 13.
Use of uninitialized value $g1 in integer gt (>) at - line 14.
Use of uninitialized value $m1 in integer gt (>) at - line 14.
Use of uninitialized value $g1 in integer le (<=) at - line 15.
Use of uninitialized value $m1 in integer le (<=) at - line 15.
Use of uninitialized value $g1 in integer ge (>=) at - line 16.
Use of uninitialized value $m1 in integer ge (>=) at - line 16.
Use of uninitialized value $g1 in integer eq (==) at - line 17.
Use of uninitialized value $m1 in integer eq (==) at - line 17.
Use of uninitialized value $g1 in integer ne (!=) at - line 18.
Use of uninitialized value $m1 in integer ne (!=) at - line 18.
Use of uninitialized value $g1 in integer comparison (<=>) at - line 19.
Use of uninitialized value $m1 in integer comparison (<=>) at - line 19.
Use of uninitialized value $m1 in integer negation (-) at - line 20.
########
use warnings 'uninitialized';
my ($m1, $m2, $v);
our ($g1, $g2);
$v = int($g1);
$v = abs($g2);
EXPECT
Use of uninitialized value $g1 in int at - line 5.
Use of uninitialized value $g2 in abs at - line 6.
########
use warnings 'uninitialized';
my ($m1, $m2, $v);
our ($g1);
$v = pack $m1;
$v = pack "i*", $m2, $g1, $g2;
my @unpack = unpack $m1, $m2;
EXPECT
Use of uninitialized value $m1 in pack at - line 5.
Use of uninitialized value $m2 in pack at - line 6.
Use of uninitialized value $g1 in pack at - line 6.
Use of uninitialized value $g2 in pack at - line 6.
Use of uninitialized value $m1 in unpack at - line 7.
Use of uninitialized value $m2 in unpack at - line 7.
########
use warnings 'uninitialized';
my ($m1);
our ($g1);
my @sort;
@sort = sort $m1, $g1;
@sort = sort {$a <=> $b} $m1, $g1;
sub sortf {$a-1 <=> $b-1};
@sort = sort &sortf, $m1, $g1;
EXPECT
Use of uninitialized value $m1 in sort at - line 6.
Use of uninitialized value $g1 in sort at - line 6.
Use of uninitialized value $m1 in sort at - line 6.
Use of uninitialized value $g1 in sort at - line 6.
Use of uninitialized value $m1 in sort at - line 7.
Use of uninitialized value $g1 in sort at - line 7.
Use of uninitialized value $m1 in sort at - line 7.
Use of uninitialized value $g1 in sort at - line 7.
Use of uninitialized value $a in subtraction (-) at - line 8.
Use of uninitialized value $b in subtraction (-) at - line 8.
Use of uninitialized value $m1 in sort at - line 9.
Use of uninitialized value $g1 in sort at - line 9.
Use of uninitialized value $m1 in sort at - line 9.
Use of uninitialized value $m1 in sort at - line 9.
Use of uninitialized value $g1 in sort at - line 9.
Use of uninitialized value $g1 in sort at - line 9.
########
use warnings 'uninitialized';
my ($m1, $m2, $v);
our ($g1);
eval { $v = $m1 / $g1 };
$v = $m2 / 2;
eval { $v = $m1 % $g1 };
$v = $m2 % 2;
$v = $m1 == $g1;
$v = $m1 >= $g1;
$v = $m1 > $g1;
$v = $m1 <= $g1;
$v = $m1 < $g1;
$v = $m1 * $g1;
$v = $m1 <=>$g1;
$v = $m1 != $g1;
$v = $m1 -$g1;
$v = $m1 ** $g1;
$v = $m1 + $g1;
$v = $m1 - $g1;
EXPECT
Use of uninitialized value $g1 in division (/) at - line 5.
Use of uninitialized value $m1 in division (/) at - line 5.
Use of uninitialized value $m2 in division (/) at - line 6.
Use of uninitialized value $g1 in modulus (%) at - line 7.
Use of uninitialized value $m1 in modulus (%) at - line 7.
Use of uninitialized value $m2 in modulus (%) at - line 8.
Use of uninitialized value $g1 in numeric eq (==) at - line 9.
Use of uninitialized value $m1 in numeric eq (==) at - line 9.
Use of uninitialized value $g1 in numeric ge (>=) at - line 10.
Use of uninitialized value $m1 in numeric ge (>=) at - line 10.
Use of uninitialized value $g1 in numeric gt (>) at - line 11.
Use of uninitialized value $m1 in numeric gt (>) at - line 11.
Use of uninitialized value $g1 in numeric le (<=) at - line 12.
Use of uninitialized value $m1 in numeric le (<=) at - line 12.
Use of uninitialized value $g1 in numeric lt (<) at - line 13.
Use of uninitialized value $m1 in numeric lt (<) at - line 13.
Use of uninitialized value $g1 in multiplication (*) at - line 14.
Use of uninitialized value $m1 in multiplication (*) at - line 14.
Use of uninitialized value $g1 in numeric comparison (<=>) at - line 15.
Use of uninitialized value $m1 in numeric comparison (<=>) at - line 15.
Use of uninitialized value $g1 in numeric ne (!=) at - line 16.
Use of uninitialized value $m1 in numeric ne (!=) at - line 16.
Use of uninitialized value $g1 in subtraction (-) at - line 17.
Use of uninitialized value $m1 in subtraction (-) at - line 17.
Use of uninitialized value $g1 in exponentiation (**) at - line 18.
Use of uninitialized value $m1 in exponentiation (**) at - line 18.
Use of uninitialized value $g1 in addition (+) at - line 19.
Use of uninitialized value $m1 in addition (+) at - line 19.
Use of uninitialized value $g1 in subtraction (-) at - line 20.
Use of uninitialized value $m1 in subtraction (-) at - line 20.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = *global1{$m1};
$v = prototype $g1;
$v = bless [], $g1;
$v = `$m1`;
$v = $m1 . $g1;
EXPECT
Use of uninitialized value $m1 in glob elem at - line 5.
Use of uninitialized value $g1 in subroutine prototype at - line 6.
Use of uninitialized value $g1 in bless at - line 7.
Use of uninitialized value $m1 in quoted execution (``, qx) at - line 8.
Use of uninitialized value $m1 in concatenation (.) or string at - line 10.
Use of uninitialized value $g1 in concatenation (.) or string at - line 10.
########
use warnings 'uninitialized';
my ($m1);
our ($g1, $g2);
/y/;
/$m1/;
/$g1/;
s/y/z/; undef $_;
s/$m1/z/; undef $_;
s//$g1/; undef $_;
s/$m1/$g1/; undef $_;
tr/x/y/; undef $_;
my $_;
/y/;
/$m1/;
/$g1/;
s/y/z/; undef $_;
s/$m1/z/; undef $_;
s//$g1/; undef $_;
s/$m1/$g1/; undef $_;
tr/x/y/; undef $_;
$g2 =~ /y/;
$g2 =~ /$m1/;
$g2 =~ /$g1/;
$g2 =~ s/y/z/; undef $g2;
$g2 =~ s/$m1/z/; undef $g2;
$g2 =~ s//$g1/; undef $g2;
$g2 =~ s/$m1/$g1/; undef $g2;
$g2 =~ tr/x/y/; undef $g2; # XXX can't extract var name yet
my $foo = "abc";
$foo =~ /$m1/;
$foo =~ /$g1/;
$foo =~ s/y/z/;
$foo =~ s/$m1/z/;
$foo =~ s//$g1/;
$foo =~ s/$m1/$g1/;
$foo =~ s/./$m1/e;
EXPECT
Use of uninitialized value $_ in pattern match (m//) at - line 5.
Use of uninitialized value $m1 in regexp compilation at - line 6.
Use of uninitialized value $_ in pattern match (m//) at - line 6.
Use of uninitialized value $g1 in regexp compilation at - line 7.
Use of uninitialized value $_ in pattern match (m//) at - line 7.
Use of uninitialized value $_ in substitution (s///) at - line 9.
Use of uninitialized value $m1 in regexp compilation at - line 10.
Use of uninitialized value $_ in substitution (s///) at - line 10.
Use of uninitialized value $_ in substitution (s///) at - line 10.
Use of uninitialized value $_ in substitution (s///) at - line 11.
Use of uninitialized value $g1 in substitution (s///) at - line 11.
Use of uninitialized value $_ in substitution (s///) at - line 11.
Use of uninitialized value $g1 in substitution (s///) at - line 11.
Use of uninitialized value $m1 in regexp compilation at - line 12.
Use of uninitialized value $_ in substitution (s///) at - line 12.
Use of uninitialized value $_ in substitution (s///) at - line 12.
Use of uninitialized value $g1 in substitution iterator at - line 12.
Use of uninitialized value $_ in transliteration (tr///) at - line 13.
Use of uninitialized value $_ in pattern match (m//) at - line 16.
Use of uninitialized value $m1 in regexp compilation at - line 17.
Use of uninitialized value $_ in pattern match (m//) at - line 17.
Use of uninitialized value $g1 in regexp compilation at - line 18.
Use of uninitialized value $_ in pattern match (m//) at - line 18.
Use of uninitialized value $_ in substitution (s///) at - line 19.
Use of uninitialized value $m1 in regexp compilation at - line 20.
Use of uninitialized value $_ in substitution (s///) at - line 20.
Use of uninitialized value $_ in substitution (s///) at - line 20.
Use of uninitialized value $_ in substitution (s///) at - line 21.
Use of uninitialized value $g1 in substitution (s///) at - line 21.
Use of uninitialized value $_ in substitution (s///) at - line 21.
Use of uninitialized value $g1 in substitution (s///) at - line 21.
Use of uninitialized value $m1 in regexp compilation at - line 22.
Use of uninitialized value $_ in substitution (s///) at - line 22.
Use of uninitialized value $_ in substitution (s///) at - line 22.
Use of uninitialized value $g1 in substitution iterator at - line 22.
Use of uninitialized value $_ in transliteration (tr///) at - line 23.
Use of uninitialized value $g2 in pattern match (m//) at - line 25.
Use of uninitialized value $m1 in regexp compilation at - line 26.
Use of uninitialized value $g2 in pattern match (m//) at - line 26.
Use of uninitialized value $g1 in regexp compilation at - line 27.
Use of uninitialized value $g2 in pattern match (m//) at - line 27.
Use of uninitialized value $g2 in substitution (s///) at - line 28.
Use of uninitialized value $m1 in regexp compilation at - line 29.
Use of uninitialized value $g2 in substitution (s///) at - line 29.
Use of uninitialized value $g2 in substitution (s///) at - line 29.
Use of uninitialized value $g2 in substitution (s///) at - line 30.
Use of uninitialized value $g1 in substitution (s///) at - line 30.
Use of uninitialized value $g2 in substitution (s///) at - line 30.
Use of uninitialized value $g1 in substitution (s///) at - line 30.
Use of uninitialized value $m1 in regexp compilation at - line 31.
Use of uninitialized value $g2 in substitution (s///) at - line 31.
Use of uninitialized value $g2 in substitution (s///) at - line 31.
Use of uninitialized value $g1 in substitution iterator at - line 31.
Use of uninitialized value in transliteration (tr///) at - line 32.
Use of uninitialized value $m1 in regexp compilation at - line 35.
Use of uninitialized value $g1 in regexp compilation at - line 36.
Use of uninitialized value $m1 in regexp compilation at - line 38.
Use of uninitialized value $g1 in substitution (s///) at - line 39.
Use of uninitialized value $m1 in regexp compilation at - line 40.
Use of uninitialized value $g1 in substitution iterator at - line 40.
Use of uninitialized value $m1 in substitution iterator at - line 41.
########
use warnings 'uninitialized';
my ($m1);
{ my $foo = "abc"; (substr($foo,0,0)) = ($m1) }
EXPECT
Use of uninitialized value $m1 in list assignment at - line 4.
########
use warnings 'uninitialized';
our ($g1);
study;
study $g1;
EXPECT
Use of uninitialized value $_ in study at - line 4.
Use of uninitialized value $g1 in study at - line 5.
########
use warnings 'uninitialized';
my ($m1);
pos()=0;
pos($m1)=0;
EXPECT
Use of uninitialized value $_ in scalar assignment at - line 4.
Use of uninitialized value $m1 in scalar assignment at - line 5.
########
use warnings 'uninitialized';
my ($m1);
{ my $x = "a" x $m1 } # NB LHS of repeat does not warn
{ my @x = ("a") x $m1 }
EXPECT
Use of uninitialized value $m1 in repeat (x) at - line 4.
Use of uninitialized value $m1 in repeat (x) at - line 5.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = "$m1";
$v = $m1 lt $g1;
$v = $m1 le $g1;
$v = $m1 gt $g1;
$v = $m1 ge $g1;
$v = $m1 eq $g1;
$v = $m1 ne $g1;
$v = $m1 cmp $g1;
EXPECT
Use of uninitialized value $m1 in string at - line 5.
Use of uninitialized value $m1 in string lt at - line 7.
Use of uninitialized value $g1 in string lt at - line 7.
Use of uninitialized value $m1 in string le at - line 8.
Use of uninitialized value $g1 in string le at - line 8.
Use of uninitialized value $m1 in string gt at - line 9.
Use of uninitialized value $g1 in string gt at - line 9.
Use of uninitialized value $m1 in string ge at - line 10.
Use of uninitialized value $g1 in string ge at - line 10.
Use of uninitialized value $m1 in string eq at - line 11.
Use of uninitialized value $g1 in string eq at - line 11.
Use of uninitialized value $m1 in string ne at - line 12.
Use of uninitialized value $g1 in string ne at - line 12.
Use of uninitialized value $m1 in string comparison (cmp) at - line 13.
Use of uninitialized value $g1 in string comparison (cmp) at - line 13.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = atan2($m1,$g1);
$v = sin $m1;
$v = cos $m1;
$v = rand $m1;
$v = srand $m1;
$v = exp $m1;
$v = eval {log $m1};
$v = sqrt $m1;
$v = hex $m1;
$v = oct $m1;
$v = length $m1;
$v = length;
EXPECT
Use of uninitialized value $g1 in atan2 at - line 5.
Use of uninitialized value $m1 in atan2 at - line 5.
Use of uninitialized value $m1 in sin at - line 6.
Use of uninitialized value $m1 in cos at - line 7.
Use of uninitialized value $m1 in rand at - line 8.
Use of uninitialized value $m1 in srand at - line 9.
Use of uninitialized value $m1 in exp at - line 10.
Use of uninitialized value $m1 in log at - line 11.
Use of uninitialized value $m1 in sqrt at - line 12.
Use of uninitialized value $m1 in hex at - line 13.
Use of uninitialized value $m1 in oct at - line 14.
Use of uninitialized value $m1 in length at - line 15.
Use of uninitialized value $_ in length at - line 16.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = substr $m1, $g1;
$v = substr $m1, $g1, $m2;
$v = substr $m1, $g1, $m2, $g2; undef $m1;
substr($m1, $g1) = $g2; undef $m1; # NB global2
substr($m1, $g1, $m2) = $g2; undef $m1; # isn't identified
$v = eval {vec ($m1, $g1, $m2)};
eval {vec ($m1, $g1, $m2) = $g2}; undef $m1; # ditto
$v = index $m1, $m2;
$v = index $m1, $m2, $g1;
$v = rindex $m1, $m2;
$v = rindex $m1, $m2, $g1;
EXPECT
Use of uninitialized value $g1 in substr at - line 5.
Use of uninitialized value $m1 in substr at - line 5.
Use of uninitialized value $m2 in substr at - line 6.
Use of uninitialized value $g1 in substr at - line 6.
Use of uninitialized value $m1 in substr at - line 6.
Use of uninitialized value $g2 in substr at - line 7.
Use of uninitialized value $m2 in substr at - line 7.
Use of uninitialized value $g1 in substr at - line 7.
Use of uninitialized value $m1 in substr at - line 7.
Use of uninitialized value $m1 in substr at - line 7.
Use of uninitialized value $g1 in substr at - line 8.
Use of uninitialized value $m1 in substr at - line 8.
Use of uninitialized value in scalar assignment at - line 8.
Use of uninitialized value $m2 in substr at - line 9.
Use of uninitialized value $g1 in substr at - line 9.
Use of uninitialized value $m1 in substr at - line 9.
Use of uninitialized value in scalar assignment at - line 9.
Use of uninitialized value $m2 in vec at - line 11.
Use of uninitialized value $g1 in vec at - line 11.
Use of uninitialized value $m1 in vec at - line 11.
Use of uninitialized value $m2 in vec at - line 12.
Use of uninitialized value $g1 in vec at - line 12.
Use of uninitialized value $m1 in vec at - line 12.
Use of uninitialized value $m1 in index at - line 14.
Use of uninitialized value $m2 in index at - line 14.
Use of uninitialized value $g1 in index at - line 15.
Use of uninitialized value $m1 in index at - line 15.
Use of uninitialized value $m2 in index at - line 15.
Use of uninitialized value $m1 in rindex at - line 16.
Use of uninitialized value $m2 in rindex at - line 16.
Use of uninitialized value $g1 in rindex at - line 17.
Use of uninitialized value $m1 in rindex at - line 17.
Use of uninitialized value $m2 in rindex at - line 17.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = sprintf $m1;
$v = sprintf '%d%d%d%d', $m1, $m2, $g1, $g2;
my $m3; eval {formline $m3 };
formline '@<<@<<@<<@<<', $m1, $m2, $g1, $g2;
EXPECT
Use of uninitialized value $m1 in sprintf at - line 5.
Use of uninitialized value $m1 in sprintf at - line 6.
Use of uninitialized value $m2 in sprintf at - line 6.
Use of uninitialized value $g1 in sprintf at - line 6.
Use of uninitialized value $g2 in sprintf at - line 6.
Use of uninitialized value $m3 in formline at - line 7.
Use of uninitialized value $m1 in formline at - line 8.
Use of uninitialized value $m2 in formline at - line 8.
Use of uninitialized value $g1 in formline at - line 8.
Use of uninitialized value $g2 in formline at - line 8.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = crypt $m1, $g1;
$v = ord;
$v = ord $m1;
$v = chr;
$v = chr $m1;
# XXX these functions don't warn!
$v = ucfirst;
$v = ucfirst $m1;
$v = lcfirst;
$v = lcfirst $m1;
$v = uc;
$v = uc $m1;
$v = lc;
$v = lc $m1;
$v = quotemeta;
$v = quotemeta $m1;
EXPECT
Use of uninitialized value $m1 in crypt at - line 5.
Use of uninitialized value $g1 in crypt at - line 5.
Use of uninitialized value $_ in ord at - line 7.
Use of uninitialized value $m1 in ord at - line 8.
Use of uninitialized value $_ in chr at - line 9.
Use of uninitialized value $m1 in chr at - line 10.
Use of uninitialized value $_ in quotemeta at - line 22.
Use of uninitialized value $m1 in quotemeta at - line 23.
########
use warnings 'uninitialized';
my ($m1, $v1, $v2, $v3, $v4);
our ($g1);
($v1,$v2,$v3,$v4) = split;
($v1,$v2,$v3,$v4) = split $m1;
($v1,$v2,$v3,$v4) = split $m1, $m2;
($v1,$v2,$v3,$v4) = split $m1, $m2, $g1;
$v1 = join $m1;
$v2 = join $m1, $m2;
$v3 = join $m1, $m2, $m3;
EXPECT
Use of uninitialized value $_ in split at - line 5.
Use of uninitialized value $m1 in regexp compilation at - line 6.
Use of uninitialized value $_ in split at - line 6.
Use of uninitialized value $m1 in regexp compilation at - line 7.
Use of uninitialized value $m2 in split at - line 7.
Use of uninitialized value $m1 in regexp compilation at - line 8.
Use of uninitialized value $g1 in split at - line 8.
Use of uninitialized value $m2 in split at - line 8.
Use of uninitialized value $m1 in join or string at - line 10.
Use of uninitialized value $m1 in join or string at - line 11.
Use of uninitialized value $m2 in join or string at - line 11.
Use of uninitialized value $m1 in join or string at - line 12.
Use of uninitialized value $m2 in join or string at - line 12.
Use of uninitialized value $m3 in join or string at - line 12.
########
use warnings 'uninitialized';
my ($m1, $m2, @ma, $v);
our @foo1=(1,undef); chomp @foo1;
my @foo2=(1,undef); chomp @foo2;
our @foo3=(1,undef); chop @foo3;
my @foo4=(1,undef); chop @foo4;
our @foo5=(1,undef); $v = sprintf "%s%s",@foo5;
my @foo6=(1,undef); $v = sprintf "%s%s",@foo6;
our %foo7=('foo'=>'bar','baz'=>undef); $v = sprintf "%s%s",%foo7;
my %foo8=('foo'=>'bar','baz'=>undef); $v = sprintf "%s%s",%foo8;
our @foo9 =(1,undef); $v = sprintf "%s%s%s%s",$m1,@foo9, $ma[2];
my @foo10=(1,undef); $v = sprintf "%s%s%s%s",$m2,@foo10,$ma[2];
our %foo11=('foo'=>'bar','baz'=>undef); $v = join '', %foo11;
my %foo12=('foo'=>'bar','baz'=>undef); $v = join '', %foo12;
our %foo13=(1..2000,'foo'=>'bar','baz'=>undef); $v = join '', %foo13;
my %foo14=(1..2000,'foo'=>'bar','baz'=>undef); $v = join '', %foo14;
EXPECT
Use of uninitialized value $foo1[1] in chomp at - line 4.
Use of uninitialized value $foo2[1] in chomp at - line 5.
Use of uninitialized value $foo3[1] in chop at - line 6.
Use of uninitialized value $foo4[1] in chop at - line 7.
Use of uninitialized value $foo5[1] in sprintf at - line 8.
Use of uninitialized value $foo6[1] in sprintf at - line 9.
Use of uninitialized value $foo7{"baz"} in sprintf at - line 10.
Use of uninitialized value $foo8{"baz"} in sprintf at - line 11.
Use of uninitialized value $m1 in sprintf at - line 12.
Use of uninitialized value $foo9[1] in sprintf at - line 12.
Use of uninitialized value in sprintf at - line 12.
Use of uninitialized value $m2 in sprintf at - line 13.
Use of uninitialized value $foo10[1] in sprintf at - line 13.
Use of uninitialized value in sprintf at - line 13.
Use of uninitialized value $foo11{"baz"} in join or string at - line 14.
Use of uninitialized value $foo12{"baz"} in join or string at - line 15.
Use of uninitialized value within %foo13 in join or string at - line 16.
Use of uninitialized value within %foo14 in join or string at - line 17.
########
use warnings 'uninitialized';
my ($v);
undef $^A; $v = $^A + ${^FOO}; # should output '^A' not chr(1)
*GLOB1 = *GLOB2;
$v = $GLOB1 + 1;
$v = $GLOB2 + 1;
EXPECT
Use of uninitialized value $^FOO in addition (+) at - line 4.
Use of uninitialized value $^A in addition (+) at - line 4.
Use of uninitialized value $GLOB1 in addition (+) at - line 6.
Use of uninitialized value $GLOB2 in addition (+) at - line 7.
########
use warnings 'uninitialized';
my ($v);
# check hash key is sanitised
my %h = ("\0011\002\r\n\t\f\"\\abcdefghijklmnopqrstuvwxyz", undef);
$v = join '', %h;
EXPECT
Use of uninitialized value $h{"\0011\2\r\n\t\f\"\\abcdefghijklm"...} in join or string at - line 6.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = eval { \&$m1 };
$v = eval { \&$g1 };
my @a;
@a = splice @a, $m1, $g1;
$v = 1 + splice @a, $m1, $g1;
my $x = bless [], 'Z';
eval { $x->$m1() };
eval { &$m1() };
eval { &$g1() };
warn $m1,$g1,"foo";
eval { die $m1, $g1 };
reset $m1;
reset $g1;
EXPECT
Use of uninitialized value $m1 in subroutine dereference at - line 5.
Use of uninitialized value $m1 in subroutine dereference at - line 5.
Use of uninitialized value $g1 in subroutine dereference at - line 6.
Use of uninitialized value $g1 in subroutine dereference at - line 6.
Use of uninitialized value $m1 in splice at - line 9.
Use of uninitialized value $g1 in splice at - line 9.
Use of uninitialized value $m1 in splice at - line 10.
Use of uninitialized value $g1 in splice at - line 10.
Use of uninitialized value in addition (+) at - line 10.
Use of uninitialized value $m1 in method lookup at - line 13.
Use of uninitialized value $m1 in subroutine entry at - line 15.
Use of uninitialized value $g1 in subroutine entry at - line 16.
Use of uninitialized value $m1 in warn at - line 18.
Use of uninitialized value $g1 in warn at - line 18.
foo at - line 18.
Use of uninitialized value $m1 in die at - line 20.
Use of uninitialized value $g1 in die at - line 20.
Use of uninitialized value $m1 in symbol reset at - line 22.
Use of uninitialized value $g1 in symbol reset at - line 23.
########
use warnings 'uninitialized';
my ($m1);
our ($g1);
open FOO; # accesses $FOO
my $foo = 'FO';
open($foo."O"); # accesses $FOO
open my $x; # accesses ${*$x}
open $foobar; # accesses ${*$foobar}
my $y;
open $y, $m1;
eval { open $y, $m1, $g1 };
open $y, '<', $g1;
sysopen $y, $m1, $m2;
sysopen $y, $m1, $g1, $m2;
my $old = umask;
umask $m1;
umask $g1;
umask $old;
binmode STDIN, $m1;
EXPECT
Use of uninitialized value $FOO in open at - line 5.
Use of uninitialized value in open at - line 7.
Use of uninitialized value in open at - line 8.
Use of uninitialized value in open at - line 9.
Use of uninitialized value $m1 in open at - line 11.
Use of uninitialized value $m1 in open at - line 12.
Use of uninitialized value $g1 in open at - line 13.
Use of uninitialized value $m2 in sysopen at - line 15.
Use of uninitialized value $m1 in sysopen at - line 15.
Use of uninitialized value $m2 in sysopen at - line 16.
Use of uninitialized value $g1 in sysopen at - line 16.
Use of uninitialized value $m1 in sysopen at - line 16.
Use of uninitialized value $m1 in umask at - line 19.
Use of uninitialized value $g1 in umask at - line 20.
Use of uninitialized value $m1 in binmode at - line 23.
Use of uninitialized value $m1 in binmode at - line 23.
########
use warnings 'uninitialized';
my ($m1);
our ($g1);
eval { my $x; tie $x, $m1 };
eval { my $x; read $m1, $x, $g1 };
eval { my $x; read $m1, $x, $g1, $g2 };
eval { my $x; sysread $m1, $x, $g1 };
eval { my $x; sysread $m1, $x, $g1, $g2 };
EXPECT
Use of uninitialized value $m1 in tie at - line 5.
Use of uninitialized value $m1 in tie at - line 5.
Use of uninitialized value $m1 in ref-to-glob cast at - line 7.
Use of uninitialized value $g1 in read at - line 7.
Use of uninitialized value $m1 in ref-to-glob cast at - line 8.
Use of uninitialized value $g1 in read at - line 8.
Use of uninitialized value $g2 in read at - line 8.
Use of uninitialized value $m1 in ref-to-glob cast at - line 9.
Use of uninitialized value $g1 in sysread at - line 9.
Use of uninitialized value $m1 in ref-to-glob cast at - line 10.
Use of uninitialized value $g1 in sysread at - line 10.
Use of uninitialized value $g2 in sysread at - line 10.
########
use warnings 'uninitialized';
my ($m1);
our ($g1, @ga);
printf $m1;
printf STDERR "%d%d%d%d\n", $m1, $m2, $g1, $g2;
printf $ga[1000];
printf STDERR "FOO1:%s\n", $ga[1000];
printf STDERR "FOO2:%s%s%s%s\n", $m1, $g1, $ga[1],$m2;
printf STDERR "FOO3:%s%s%s\n", "X", $ga[1],"Y";
EXPECT
Use of uninitialized value $m1 in printf at - line 5.
Use of uninitialized value $m1 in printf at - line 6.
Use of uninitialized value $m2 in printf at - line 6.
Use of uninitialized value $g1 in printf at - line 6.
Use of uninitialized value $g2 in printf at - line 6.
0000
Use of uninitialized value $ga[1000] in printf at - line 7.
Use of uninitialized value $ga[1000] in printf at - line 8.
FOO1:
Use of uninitialized value $m1 in printf at - line 9.
Use of uninitialized value $g1 in printf at - line 9.
Use of uninitialized value in printf at - line 9.
Use of uninitialized value $m2 in printf at - line 9.
FOO2:
Use of uninitialized value $ga[1] in printf at - line 10.
FOO3:XY
########
use warnings 'uninitialized';
my ($m1);
our ($g1);
eval { my $x; seek $x,$m1, $g1 };
eval { my $x; sysseek $x,$m1, $g1 };
eval { syswrite $m1, $g1 }; # logic changed - now won't try $g1 if $m1 is bad
# eval { syswrite STDERR, $m1 }; # XXX under utf8, can give
# eval { syswrite STDERR, $m1, $g1 }; # XXX different warnings
# eval { syswrite STDERR, $m1, $g1, $m2 };
eval { my $x; socket $x, $m1, $g1, $m2 };
eval { my ($x,$y); socketpair $x, $y, $m1, $g1, $m2 };
EXPECT
Use of uninitialized value $x in ref-to-glob cast at - line 5.
Use of uninitialized value $g1 in seek at - line 5.
Use of uninitialized value $m1 in seek at - line 5.
Use of uninitialized value $x in ref-to-glob cast at - line 6.
Use of uninitialized value $g1 in sysseek at - line 6.
Use of uninitialized value $m1 in sysseek at - line 6.
Use of uninitialized value $m1 in ref-to-glob cast at - line 7.
Use of uninitialized value $m2 in socket at - line 11.
Use of uninitialized value $g1 in socket at - line 11.
Use of uninitialized value $m1 in socket at - line 11.
Use of uninitialized value $m2 in socketpair at - line 12.
Use of uninitialized value $g1 in socketpair at - line 12.
Use of uninitialized value $m1 in socketpair at - line 12.
########
use Config;
BEGIN {
if ( !$Config{d_flock} &&
!$Config{d_fcntl_can_lock} &&
!$Config{d_lockf} ) {
print <<EOM ;
SKIPPED
# flock not present
EOM
exit ;
}
}
use warnings 'uninitialized';
our ($g1);
eval { my $x; flock $x, $g1 };
EXPECT
Use of uninitialized value $x in ref-to-glob cast at - line 16.
Use of uninitialized value $g1 in flock at - line 16.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
stat;
lstat;
stat $m1;
lstat $g1;
$v = -R $m1;
$v = -W $m1;
$v = -X $m1;
$v = -r $m1;
$v = -w $m1;
$v = -x $m1;
$v = -e $m1;
$v = -o $m1;
$v = -O $m1;
$v = -z $m1;
$v = -s $m1;
$v = -M $m1;
$v = -A $m1;
$v = -C $m1;
$v = -S $m1;
$v = -c $m1;
$v = -b $m1;
$v = -f $m1;
$v = -d $m1;
$v = -p $m1;
$v = -l $m1;
$v = -u $m1;
$v = -g $m1;
# $v = -k $m1; # XXX this is a no-op under win32
$v = -t $m1;
$v = -T $m1;
$v = -B $m1;
EXPECT
Use of uninitialized value $_ in stat at - line 5.
Use of uninitialized value $_ in lstat at - line 6.
Use of uninitialized value $m1 in stat at - line 7.
Use of uninitialized value $g1 in lstat at - line 8.
Use of uninitialized value $m1 in -R at - line 10.
Use of uninitialized value $m1 in -W at - line 11.
Use of uninitialized value $m1 in -X at - line 12.
Use of uninitialized value $m1 in -r at - line 13.
Use of uninitialized value $m1 in -w at - line 14.
Use of uninitialized value $m1 in -x at - line 15.
Use of uninitialized value $m1 in -e at - line 16.
Use of uninitialized value $m1 in -o at - line 17.
Use of uninitialized value $m1 in -O at - line 18.
Use of uninitialized value $m1 in -z at - line 19.
Use of uninitialized value $m1 in -s at - line 20.
Use of uninitialized value $m1 in -M at - line 21.
Use of uninitialized value $m1 in -A at - line 22.
Use of uninitialized value $m1 in -C at - line 23.
Use of uninitialized value $m1 in -S at - line 24.
Use of uninitialized value $m1 in -c at - line 25.
Use of uninitialized value $m1 in -b at - line 26.
Use of uninitialized value $m1 in -f at - line 27.
Use of uninitialized value $m1 in -d at - line 28.
Use of uninitialized value $m1 in -p at - line 29.
Use of uninitialized value $m1 in -l at - line 30.
Use of uninitialized value $m1 in -l at - line 30.
Use of uninitialized value $m1 in -u at - line 31.
Use of uninitialized value $m1 in -g at - line 32.
Use of uninitialized value $m1 in -t at - line 34.
Use of uninitialized value $m1 in -T at - line 35.
Use of uninitialized value $m1 in -B at - line 36.
########
use warnings 'uninitialized';
my ($m1, $v);
our ($g1);
$v = localtime $m1;
$v = gmtime $g1;
EXPECT
Use of uninitialized value $m1 in localtime at - line 5.
Use of uninitialized value $g1 in gmtime at - line 6.
########
use warnings 'uninitialized';
my ($m1, $v);
$v = eval;
$v = eval $m1;
EXPECT
Use of uninitialized value $_ in eval "string" at - line 4.
Use of uninitialized value $m1 in eval "string" at - line 5.
########
use warnings 'uninitialized';
my ($m1);
exit $m1;
EXPECT
Use of uninitialized value $m1 in exit at - line 4.
|