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