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 | |
6bc102ca |
35 | Possible Y2K bug: %d format string following '19' |
36 | |
767a6a26 |
37 | Reference is already weak [Perl_sv_rvweaken] <<TODO |
38 | |
0453d815 |
39 | Mandatory Warnings |
40 | ------------------ |
7e2040f0 |
41 | Malformed UTF-8 character [sv_pos_b2u] (not tested: difficult to produce |
42 | with perl now) |
0453d815 |
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 |
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 |
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 |
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 |
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 |
95 | $B = 0 ; |
96 | $B |= $A ; |
4438c4b7 |
97 | no warnings 'uninitialized' ; |
0453d815 |
98 | $B = 0 ; |
99 | $B |= $A ; |
599cee73 |
100 | EXPECT |
29489e7c |
101 | Use of uninitialized value $A in bitwise or (|) at - line 10. |
599cee73 |
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 |
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 |
112 | ######## |
113 | # sv.c |
4438c4b7 |
114 | use warnings 'uninitialized' ; |
a1afd104 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
195 | $B = "" ; |
196 | $B .= $A ; |
4438c4b7 |
197 | no warnings 'uninitialized' ; |
0453d815 |
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 |
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 |
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 |
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 |
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 |
232 | ######## |
233 | # sv.c |
4438c4b7 |
234 | use warnings 'numeric' ; |
599cee73 |
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 |
241 | ######## |
242 | # sv.c |
4438c4b7 |
243 | use warnings 'numeric' ; use integer ; |
599cee73 |
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 |
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 |
258 | ######## |
259 | # sv.c |
59bb5845 |
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 |
278 | sub fred {} |
279 | sub joe {} |
280 | *fred = \&joe ; |
4438c4b7 |
281 | no warnings 'redefine' ; |
0453d815 |
282 | sub jim {} |
283 | *jim = \&joe ; |
599cee73 |
284 | EXPECT |
910764e6 |
285 | Subroutine main::fred redefined at - line 5. |
599cee73 |
286 | ######## |
287 | # sv.c |
4438c4b7 |
288 | use warnings 'printf' ; |
3eeba6fb |
289 | open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ; |
cf2093f6 |
290 | printf F "%z\n" ; |
291 | my $a = sprintf "%z" ; |
599cee73 |
292 | printf F "%" ; |
293 | $a = sprintf "%" ; |
294 | printf F "%\x02" ; |
295 | $a = sprintf "%\x02" ; |
4438c4b7 |
296 | no warnings 'printf' ; |
cf2093f6 |
297 | printf F "%z\n" ; |
298 | $a = sprintf "%z" ; |
0453d815 |
299 | printf F "%" ; |
300 | $a = sprintf "%" ; |
301 | printf F "%\x02" ; |
302 | $a = sprintf "%\x02" ; |
599cee73 |
303 | EXPECT |
cf2093f6 |
304 | Invalid conversion in sprintf: "%z" at - line 5. |
599cee73 |
305 | Invalid conversion in sprintf: end of string at - line 7. |
306 | Invalid conversion in sprintf: "%\002" at - line 9. |
cf2093f6 |
307 | Invalid conversion in printf: "%z" at - line 4. |
599cee73 |
308 | Invalid conversion in printf: end of string at - line 6. |
309 | Invalid conversion in printf: "%\002" at - line 8. |
310 | ######## |
311 | # sv.c |
e476b1b5 |
312 | use warnings 'misc' ; |
599cee73 |
313 | *a = undef ; |
e476b1b5 |
314 | no warnings 'misc' ; |
0453d815 |
315 | *b = undef ; |
599cee73 |
316 | EXPECT |
317 | Undefined value assigned to typeglob at - line 3. |
0453d815 |
318 | ######## |
319 | # sv.c |
e476b1b5 |
320 | use warnings 'y2k'; |
6bc102ca |
321 | use Config; |
322 | BEGIN { |
323 | unless ($Config{ccflags} =~ /Y2KWARN/) { |
324 | print "SKIPPED\n# perl not built with -DPERL_Y2KWARN"; |
325 | exit 0; |
326 | } |
327 | $|=1; |
328 | } |
329 | my $x; |
330 | my $yy = 78; |
331 | $x = printf "19%02d\n", $yy; |
332 | $x = sprintf "#19%02d\n", $yy; |
333 | $x = printf " 19%02d\n", 78; |
334 | $x = sprintf "19%02d\n", 78; |
335 | $x = printf "319%02d\n", $yy; |
336 | $x = sprintf "319%02d\n", $yy; |
e476b1b5 |
337 | no warnings 'y2k'; |
6bc102ca |
338 | $x = printf "19%02d\n", $yy; |
339 | $x = sprintf "19%02d\n", $yy; |
340 | $x = printf "19%02d\n", 78; |
341 | $x = sprintf "19%02d\n", 78; |
342 | EXPECT |
343 | Possible Y2K bug: %d format string following '19' at - line 16. |
344 | Possible Y2K bug: %d format string following '19' at - line 13. |
345 | 1978 |
346 | Possible Y2K bug: %d format string following '19' at - line 14. |
347 | Possible Y2K bug: %d format string following '19' at - line 15. |
348 | 1978 |
349 | 31978 |
350 | 1978 |
351 | 1978 |
94463019 |
352 | ######## |
353 | # sv.c |
354 | use warnings 'numeric' ; |
355 | $a = "\x{100}\x{200}" * 42; |
356 | no warnings 'numeric' ; |
357 | $a = "\x{100}\x{200}" * 42; |
358 | EXPECT |
359 | Argument "\x{100}\x{200}" isn't numeric in multiplication (*) at - line 3. |
8eb28a70 |
360 | ######## |
361 | # sv.c |
362 | use warnings 'numeric' ; |
363 | $a = "\x{100}\x{200}"; $a = -$a; |
364 | no warnings 'numeric' ; |
365 | $a = "\x{100}\x{200}"; $a = -$a; |
366 | EXPECT |
367 | Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3. |