Commit | Line | Data |
---|---|---|
0453d815 | 1 | sv.c |
599cee73 PM |
2 | |
3 | warn(warn_uninit); | |
4 | ||
5 | warn(warn_uninit); | |
6 | ||
7 | warn(warn_uninit); | |
8 | ||
9 | warn(warn_uninit); | |
10 | ||
11 | not_a_number(sv); | |
12 | ||
13 | not_a_number(sv); | |
14 | ||
15 | warn(warn_uninit); | |
16 | ||
17 | not_a_number(sv); | |
18 | ||
19 | warn(warn_uninit); | |
20 | ||
21 | not_a_number(sv); | |
22 | ||
23 | not_a_number(sv); | |
24 | ||
25 | warn(warn_uninit); | |
26 | ||
27 | warn(warn_uninit); | |
28 | ||
29 | Subroutine %s redefined | |
30 | ||
31 | Invalid conversion in %s: | |
32 | ||
33 | Undefined value assigned to typeglob | |
34 | ||
767a6a26 PM |
35 | Reference is already weak [Perl_sv_rvweaken] <<TODO |
36 | ||
8b6051f1 FC |
37 | vector argument not supported with alpha versions |
38 | ||
0453d815 PM |
39 | Mandatory Warnings |
40 | ------------------ | |
7e2040f0 GS |
41 | Malformed UTF-8 character [sv_pos_b2u] (not tested: difficult to produce |
42 | with perl now) | |
0453d815 PM |
43 | |
44 | Mandatory Warnings TODO | |
45 | ------------------ | |
46 | Attempt to free non-arena SV: 0x%lx [del_sv] | |
47 | Reference miscount in sv_replace() [sv_replace] | |
48 | Attempt to free unreferenced scalar [sv_free] | |
49 | Attempt to free temp prematurely: SV 0x%lx [sv_free] | |
50 | semi-panic: attempt to dup freed string [newSVsv] | |
51 | ||
599cee73 PM |
52 | |
53 | __END__ | |
54 | # sv.c | |
55 | use integer ; | |
4438c4b7 | 56 | use warnings 'uninitialized' ; |
599cee73 | 57 | $x = 1 + $a[0] ; # a |
4438c4b7 | 58 | no warnings 'uninitialized' ; |
0453d815 | 59 | $x = 1 + $b[0] ; # a |
599cee73 | 60 | EXPECT |
29489e7c | 61 | Use of uninitialized value $a[0] in integer addition (+) at - line 4. |
599cee73 PM |
62 | ######## |
63 | # sv.c (sv_2iv) | |
64 | package fred ; | |
65 | sub TIESCALAR { my $x ; bless \$x} | |
66 | sub FETCH { return undef } | |
67 | sub STORE { return 1 } | |
68 | package main ; | |
69 | tie $A, 'fred' ; | |
70 | use integer ; | |
4438c4b7 | 71 | use warnings 'uninitialized' ; |
599cee73 | 72 | $A *= 2 ; |
4438c4b7 | 73 | no warnings 'uninitialized' ; |
0453d815 | 74 | $A *= 2 ; |
599cee73 | 75 | EXPECT |
29489e7c | 76 | Use of uninitialized value $A in integer multiplication (*) at - line 10. |
599cee73 PM |
77 | ######## |
78 | # sv.c | |
79 | use integer ; | |
4438c4b7 | 80 | use warnings 'uninitialized' ; |
599cee73 | 81 | my $x *= 2 ; #b |
4438c4b7 | 82 | no warnings 'uninitialized' ; |
0453d815 | 83 | my $y *= 2 ; #b |
599cee73 | 84 | EXPECT |
29489e7c | 85 | Use of uninitialized value $x in integer multiplication (*) at - line 4. |
599cee73 PM |
86 | ######## |
87 | # sv.c (sv_2uv) | |
88 | package fred ; | |
89 | sub TIESCALAR { my $x ; bless \$x} | |
90 | sub FETCH { return undef } | |
91 | sub STORE { return 1 } | |
92 | package main ; | |
93 | tie $A, 'fred' ; | |
4438c4b7 | 94 | use warnings 'uninitialized' ; |
599cee73 PM |
95 | $B = 0 ; |
96 | $B |= $A ; | |
4438c4b7 | 97 | no warnings 'uninitialized' ; |
0453d815 PM |
98 | $B = 0 ; |
99 | $B |= $A ; | |
599cee73 | 100 | EXPECT |
29489e7c | 101 | Use of uninitialized value $A in bitwise or (|) at - line 10. |
599cee73 PM |
102 | ######## |
103 | # sv.c | |
4438c4b7 | 104 | use warnings 'uninitialized' ; |
599cee73 | 105 | my $Y = 1 ; |
0453d815 | 106 | my $x = 1 | $a[$Y] ; |
4438c4b7 | 107 | no warnings 'uninitialized' ; |
0453d815 PM |
108 | my $Y = 1 ; |
109 | $x = 1 | $b[$Y] ; | |
599cee73 | 110 | EXPECT |
29489e7c | 111 | Use of uninitialized value within @a in bitwise or (|) at - line 4. |
599cee73 PM |
112 | ######## |
113 | # sv.c | |
4438c4b7 | 114 | use warnings 'uninitialized' ; |
a1afd104 DM |
115 | my $Y = 1 ; |
116 | my $x = 1 & $a[$Y] ; | |
117 | no warnings 'uninitialized' ; | |
118 | my $Y = 1 ; | |
119 | $x = 1 & $b[$Y] ; | |
120 | EXPECT | |
29489e7c | 121 | Use of uninitialized value within @a in bitwise and (&) at - line 4. |
a1afd104 DM |
122 | ######## |
123 | # sv.c | |
124 | use warnings 'uninitialized' ; | |
125 | my $Y = 1 ; | |
126 | my $x = ~$a[$Y] ; | |
127 | no warnings 'uninitialized' ; | |
128 | my $Y = 1 ; | |
129 | $x = ~$b[$Y] ; | |
130 | EXPECT | |
29489e7c | 131 | Use of uninitialized value within @a in 1's complement (~) at - line 4. |
a1afd104 DM |
132 | ######## |
133 | # sv.c | |
134 | use warnings 'uninitialized' ; | |
599cee73 | 135 | my $x *= 1 ; # d |
4438c4b7 | 136 | no warnings 'uninitialized' ; |
0453d815 | 137 | my $y *= 1 ; # d |
599cee73 | 138 | EXPECT |
29489e7c | 139 | Use of uninitialized value $x in multiplication (*) at - line 3. |
599cee73 PM |
140 | ######## |
141 | # sv.c | |
4438c4b7 | 142 | use warnings 'uninitialized' ; |
599cee73 | 143 | $x = 1 + $a[0] ; # e |
4438c4b7 | 144 | no warnings 'uninitialized' ; |
0453d815 | 145 | $x = 1 + $b[0] ; # e |
599cee73 | 146 | EXPECT |
29489e7c | 147 | Use of uninitialized value $a[0] in addition (+) at - line 3. |
599cee73 PM |
148 | ######## |
149 | # sv.c (sv_2nv) | |
150 | package fred ; | |
151 | sub TIESCALAR { my $x ; bless \$x} | |
152 | sub FETCH { return undef } | |
153 | sub STORE { return 1 } | |
154 | package main ; | |
155 | tie $A, 'fred' ; | |
4438c4b7 | 156 | use warnings 'uninitialized' ; |
599cee73 | 157 | $A *= 2 ; |
4438c4b7 | 158 | no warnings 'uninitialized' ; |
0453d815 | 159 | $A *= 2 ; |
599cee73 | 160 | EXPECT |
29489e7c | 161 | Use of uninitialized value $A in multiplication (*) at - line 9. |
599cee73 PM |
162 | ######## |
163 | # sv.c | |
4438c4b7 | 164 | use warnings 'uninitialized' ; |
599cee73 | 165 | $x = $y + 1 ; # f |
4438c4b7 | 166 | no warnings 'uninitialized' ; |
0453d815 | 167 | $x = $z + 1 ; # f |
599cee73 | 168 | EXPECT |
29489e7c | 169 | Use of uninitialized value $y in addition (+) at - line 3. |
599cee73 PM |
170 | ######## |
171 | # sv.c | |
4438c4b7 | 172 | use warnings 'uninitialized' ; |
599cee73 | 173 | $x = chop undef ; # g |
4438c4b7 | 174 | no warnings 'uninitialized' ; |
0453d815 | 175 | $x = chop undef ; # g |
599cee73 | 176 | EXPECT |
b0c98cec | 177 | Modification of a read-only value attempted at - line 3. |
599cee73 PM |
178 | ######## |
179 | # sv.c | |
4438c4b7 | 180 | use warnings 'uninitialized' ; |
599cee73 | 181 | $x = chop $y ; # h |
4438c4b7 | 182 | no warnings 'uninitialized' ; |
0453d815 | 183 | $x = chop $z ; # h |
599cee73 | 184 | EXPECT |
29489e7c | 185 | Use of uninitialized value $y in scalar chop at - line 3. |
599cee73 PM |
186 | ######## |
187 | # sv.c (sv_2pv) | |
188 | package fred ; | |
189 | sub TIESCALAR { my $x ; bless \$x} | |
190 | sub FETCH { return undef } | |
191 | sub STORE { return 1 } | |
192 | package main ; | |
193 | tie $A, 'fred' ; | |
4438c4b7 | 194 | use warnings 'uninitialized' ; |
599cee73 PM |
195 | $B = "" ; |
196 | $B .= $A ; | |
4438c4b7 | 197 | no warnings 'uninitialized' ; |
0453d815 PM |
198 | $C = "" ; |
199 | $C .= $A ; | |
599cee73 | 200 | EXPECT |
29489e7c | 201 | Use of uninitialized value $A in concatenation (.) or string at - line 10. |
599cee73 | 202 | ######## |
531d2254 MS |
203 | # perlbug 20011116.125 |
204 | use warnings 'uninitialized'; | |
205 | $a = undef; | |
206 | $foo = join '', $a, "\n"; | |
207 | $foo = "$a\n"; | |
208 | $foo = "a:$a\n"; | |
209 | EXPECT | |
29489e7c DM |
210 | Use of uninitialized value $a in join or string at - line 4. |
211 | Use of uninitialized value $a in concatenation (.) or string at - line 5. | |
212 | Use of uninitialized value $a in concatenation (.) or string at - line 6. | |
531d2254 | 213 | ######## |
599cee73 | 214 | # sv.c |
4438c4b7 | 215 | use warnings 'numeric' ; |
599cee73 PM |
216 | sub TIESCALAR{bless[]} ; |
217 | sub FETCH {"def"} ; | |
218 | tie $a,"main" ; | |
0453d815 | 219 | my $b = 1 + $a; |
4438c4b7 | 220 | no warnings 'numeric' ; |
0453d815 | 221 | my $c = 1 + $a; |
599cee73 | 222 | EXPECT |
42d38218 | 223 | Argument "def" isn't numeric in addition (+) at - line 6. |
599cee73 PM |
224 | ######## |
225 | # sv.c | |
4438c4b7 | 226 | use warnings 'numeric' ; |
599cee73 | 227 | my $x = 1 + "def" ; |
4438c4b7 | 228 | no warnings 'numeric' ; |
0453d815 | 229 | my $z = 1 + "def" ; |
599cee73 | 230 | EXPECT |
42d38218 | 231 | Argument "def" isn't numeric in addition (+) at - line 3. |
599cee73 PM |
232 | ######## |
233 | # sv.c | |
4438c4b7 | 234 | use warnings 'numeric' ; |
599cee73 PM |
235 | my $a = "def" ; |
236 | my $x = 1 + $a ; | |
4438c4b7 | 237 | no warnings 'numeric' ; |
0453d815 | 238 | my $y = 1 + $a ; |
599cee73 | 239 | EXPECT |
42d38218 | 240 | Argument "def" isn't numeric in addition (+) at - line 4. |
599cee73 PM |
241 | ######## |
242 | # sv.c | |
4438c4b7 | 243 | use warnings 'numeric' ; use integer ; |
599cee73 PM |
244 | my $a = "def" ; |
245 | my $x = 1 + $a ; | |
4438c4b7 | 246 | no warnings 'numeric' ; |
0453d815 | 247 | my $z = 1 + $a ; |
599cee73 | 248 | EXPECT |
42d38218 | 249 | Argument "def" isn't numeric in integer addition (+) at - line 4. |
599cee73 PM |
250 | ######## |
251 | # sv.c | |
4438c4b7 | 252 | use warnings 'numeric' ; |
599cee73 | 253 | my $x = 1 & "def" ; |
4438c4b7 | 254 | no warnings 'numeric' ; |
0453d815 | 255 | my $z = 1 & "def" ; |
599cee73 | 256 | EXPECT |
42d38218 | 257 | Argument "def" isn't numeric in bitwise and (&) at - line 3. |
599cee73 PM |
258 | ######## |
259 | # sv.c | |
59bb5845 RB |
260 | use warnings 'numeric' ; |
261 | my $x = pack i => "def" ; | |
262 | no warnings 'numeric' ; | |
263 | my $z = pack i => "def" ; | |
264 | EXPECT | |
265 | Argument "def" isn't numeric in pack at - line 3. | |
266 | ######## | |
267 | # sv.c | |
268 | use warnings 'numeric' ; | |
269 | my $a = "d\0f" ; | |
270 | my $x = 1 + $a ; | |
271 | no warnings 'numeric' ; | |
272 | my $z = 1 + $a ; | |
273 | EXPECT | |
274 | Argument "d\0f" isn't numeric in addition (+) at - line 4. | |
275 | ######## | |
276 | # sv.c | |
4438c4b7 | 277 | use warnings 'redefine' ; |
599cee73 PM |
278 | sub fred {} |
279 | sub joe {} | |
280 | *fred = \&joe ; | |
4438c4b7 | 281 | no warnings 'redefine' ; |
0453d815 PM |
282 | sub jim {} |
283 | *jim = \&joe ; | |
599cee73 | 284 | EXPECT |
910764e6 | 285 | Subroutine main::fred redefined at - line 5. |
599cee73 PM |
286 | ######## |
287 | # sv.c | |
4438c4b7 | 288 | use warnings 'printf' ; |
3eeba6fb | 289 | open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ; |
bc6e9114 CS |
290 | printf F "%y\n" ; |
291 | my $a = sprintf "%y" ; | |
599cee73 PM |
292 | printf F "%" ; |
293 | $a = sprintf "%" ; | |
294 | printf F "%\x02" ; | |
295 | $a = sprintf "%\x02" ; | |
bc6e9114 CS |
296 | printf F "%lly" ; |
297 | $a = sprintf "%lly" ; | |
298 | printf F "%25lly" ; | |
299 | $a = sprintf "%25lly" ; | |
300 | printf F "%+2Ly" ; | |
301 | $a = sprintf "%+2Ly" ; | |
1d1ac7bc MHM |
302 | printf F "%+2ll" ; |
303 | $a = sprintf "%+2ll" ; | |
304 | printf F "%+2L\x03" ; | |
305 | $a = sprintf "%+2L\x03" ; | |
4438c4b7 | 306 | no warnings 'printf' ; |
bc6e9114 CS |
307 | printf F "%y\n" ; |
308 | $a = sprintf "%y" ; | |
0453d815 PM |
309 | printf F "%" ; |
310 | $a = sprintf "%" ; | |
311 | printf F "%\x02" ; | |
312 | $a = sprintf "%\x02" ; | |
bc6e9114 CS |
313 | printf F "%lly" ; |
314 | $a = sprintf "%lly" ; | |
315 | printf F "%25lly" ; | |
316 | $a = sprintf "%25lly" ; | |
317 | printf F "%+2Ly" ; | |
318 | $a = sprintf "%+2Ly" ; | |
1d1ac7bc MHM |
319 | printf F "%+2ll" ; |
320 | $a = sprintf "%+2ll" ; | |
321 | printf F "%+2L\x03" ; | |
322 | $a = sprintf "%+2L\x03" ; | |
599cee73 | 323 | EXPECT |
bc6e9114 CS |
324 | Invalid conversion in printf: "%y" at - line 4. |
325 | Invalid conversion in sprintf: "%y" at - line 5. | |
599cee73 | 326 | Invalid conversion in printf: end of string at - line 6. |
fc7325bb | 327 | Invalid conversion in sprintf: end of string at - line 7. |
599cee73 | 328 | Invalid conversion in printf: "%\002" at - line 8. |
fc7325bb | 329 | Invalid conversion in sprintf: "%\002" at - line 9. |
bc6e9114 CS |
330 | Invalid conversion in printf: "%lly" at - line 10. |
331 | Invalid conversion in sprintf: "%lly" at - line 11. | |
332 | Invalid conversion in printf: "%25lly" at - line 12. | |
333 | Invalid conversion in sprintf: "%25lly" at - line 13. | |
334 | Invalid conversion in printf: "%+2Ly" at - line 14. | |
335 | Invalid conversion in sprintf: "%+2Ly" at - line 15. | |
1d1ac7bc MHM |
336 | Invalid conversion in printf: "%+2ll" at - line 16. |
337 | Invalid conversion in sprintf: "%+2ll" at - line 17. | |
338 | Invalid conversion in printf: "%+2L\003" at - line 18. | |
339 | Invalid conversion in sprintf: "%+2L\003" at - line 19. | |
599cee73 PM |
340 | ######## |
341 | # sv.c | |
e476b1b5 | 342 | use warnings 'misc' ; |
599cee73 | 343 | *a = undef ; |
e476b1b5 | 344 | no warnings 'misc' ; |
0453d815 | 345 | *b = undef ; |
599cee73 PM |
346 | EXPECT |
347 | Undefined value assigned to typeglob at - line 3. | |
0453d815 PM |
348 | ######## |
349 | # sv.c | |
94463019 JH |
350 | use warnings 'numeric' ; |
351 | $a = "\x{100}\x{200}" * 42; | |
352 | no warnings 'numeric' ; | |
353 | $a = "\x{100}\x{200}" * 42; | |
354 | EXPECT | |
355 | Argument "\x{100}\x{200}" isn't numeric in multiplication (*) at - line 3. | |
8eb28a70 JH |
356 | ######## |
357 | # sv.c | |
358 | use warnings 'numeric' ; | |
359 | $a = "\x{100}\x{200}"; $a = -$a; | |
360 | no warnings 'numeric' ; | |
361 | $a = "\x{100}\x{200}"; $a = -$a; | |
362 | EXPECT | |
363 | Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3. | |
012bcf7e BF |
364 | ######## |
365 | # sv.c | |
37b8cdd1 RGS |
366 | use warnings 'numeric' ; |
367 | $a = "\x{100}\x{1000}" x 10; $b = $a < 1; | |
368 | no warnings 'numeric' ; | |
369 | $a = "\x{100}\x{1000}" x 10; $b = $a < 1; | |
370 | EXPECT | |
371 | Argument "\x{100}\x{1000}\x{100}\x{1000}\x{100}..." isn't numeric in numeric lt (<) at - line 3. | |
372 | ######## | |
373 | # sv.c | |
012bcf7e BF |
374 | use warnings 'redefine' ; |
375 | use utf8; | |
376 | use open qw( :utf8 :std ); | |
377 | sub frèd {} | |
378 | sub jòè {} | |
379 | *frèd = \&jòè; | |
380 | no warnings 'redefine' ; | |
381 | sub jìm {} | |
382 | *jìm = \&jòè ; | |
383 | EXPECT | |
384 | Subroutine main::frèd redefined at - line 7. | |
385 | ######## | |
386 | # sv.c | |
387 | use warnings 'redefine' ; | |
388 | use utf8; | |
389 | use open qw( :utf8 :std ); | |
390 | sub f렏 {} | |
391 | sub 조Ȩ {} | |
392 | *f렏 = \&조Ȩ ; | |
393 | no warnings 'redefine' ; | |
394 | sub 짐 {} | |
395 | *짐 = \&조Ȩ ; | |
396 | EXPECT | |
397 | Subroutine main::f렏 redefined at - line 7. | |
8b6051f1 FC |
398 | ######## |
399 | # sv.c | |
3f7602fa TC |
400 | my $x = "a_c"; |
401 | ++$x; | |
402 | use warnings "numeric"; | |
403 | $x = "a_c"; ++$x; | |
404 | $x = ${ qr/abc/ }; ++$x; | |
405 | $x = "123x"; ++$x; | |
406 | $x = "123e"; ++$x; | |
407 | $x = 0; ++$x; # none of these should warn | |
408 | $x = "ABC"; ++$x; | |
409 | $x = "ABC123"; ++$x; | |
410 | $x = " +10"; ++$x; | |
411 | EXPECT | |
0c7e610f JH |
412 | Argument "a_c" isn't numeric in preincrement (++) at - line 5. |
413 | Argument "(?^:abc)" isn't numeric in preincrement (++) at - line 6. | |
3f7602fa TC |
414 | Argument "123x" isn't numeric in preincrement (++) at - line 7. |
415 | Argument "123e" isn't numeric in preincrement (++) at - line 8. |