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 |
b89fed5f |
61 | Use of uninitialized value 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 |
b89fed5f |
76 | Use of uninitialized value 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 |
b89fed5f |
85 | Use of uninitialized value 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 |
b89fed5f |
101 | Use of uninitialized value 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 |
b89fed5f |
111 | Use of uninitialized value in bitwise or (|) at - line 4. |
599cee73 |
112 | ######## |
113 | # sv.c |
4438c4b7 |
114 | use warnings 'uninitialized' ; |
599cee73 |
115 | my $x *= 1 ; # d |
4438c4b7 |
116 | no warnings 'uninitialized' ; |
0453d815 |
117 | my $y *= 1 ; # d |
599cee73 |
118 | EXPECT |
b89fed5f |
119 | Use of uninitialized value in multiplication (*) at - line 3. |
599cee73 |
120 | ######## |
121 | # sv.c |
4438c4b7 |
122 | use warnings 'uninitialized' ; |
599cee73 |
123 | $x = 1 + $a[0] ; # e |
4438c4b7 |
124 | no warnings 'uninitialized' ; |
0453d815 |
125 | $x = 1 + $b[0] ; # e |
599cee73 |
126 | EXPECT |
b89fed5f |
127 | Use of uninitialized value in addition (+) at - line 3. |
599cee73 |
128 | ######## |
129 | # sv.c (sv_2nv) |
130 | package fred ; |
131 | sub TIESCALAR { my $x ; bless \$x} |
132 | sub FETCH { return undef } |
133 | sub STORE { return 1 } |
134 | package main ; |
135 | tie $A, 'fred' ; |
4438c4b7 |
136 | use warnings 'uninitialized' ; |
599cee73 |
137 | $A *= 2 ; |
4438c4b7 |
138 | no warnings 'uninitialized' ; |
0453d815 |
139 | $A *= 2 ; |
599cee73 |
140 | EXPECT |
b89fed5f |
141 | Use of uninitialized value in multiplication (*) at - line 9. |
599cee73 |
142 | ######## |
143 | # sv.c |
4438c4b7 |
144 | use warnings 'uninitialized' ; |
599cee73 |
145 | $x = $y + 1 ; # f |
4438c4b7 |
146 | no warnings 'uninitialized' ; |
0453d815 |
147 | $x = $z + 1 ; # f |
599cee73 |
148 | EXPECT |
b89fed5f |
149 | Use of uninitialized value in addition (+) at - line 3. |
599cee73 |
150 | ######## |
151 | # sv.c |
4438c4b7 |
152 | use warnings 'uninitialized' ; |
599cee73 |
153 | $x = chop undef ; # g |
4438c4b7 |
154 | no warnings 'uninitialized' ; |
0453d815 |
155 | $x = chop undef ; # g |
599cee73 |
156 | EXPECT |
b0c98cec |
157 | Modification of a read-only value attempted at - line 3. |
599cee73 |
158 | ######## |
159 | # sv.c |
4438c4b7 |
160 | use warnings 'uninitialized' ; |
599cee73 |
161 | $x = chop $y ; # h |
4438c4b7 |
162 | no warnings 'uninitialized' ; |
0453d815 |
163 | $x = chop $z ; # h |
599cee73 |
164 | EXPECT |
b89fed5f |
165 | Use of uninitialized value in scalar chop at - line 3. |
599cee73 |
166 | ######## |
167 | # sv.c (sv_2pv) |
168 | package fred ; |
169 | sub TIESCALAR { my $x ; bless \$x} |
170 | sub FETCH { return undef } |
171 | sub STORE { return 1 } |
172 | package main ; |
173 | tie $A, 'fred' ; |
4438c4b7 |
174 | use warnings 'uninitialized' ; |
599cee73 |
175 | $B = "" ; |
176 | $B .= $A ; |
4438c4b7 |
177 | no warnings 'uninitialized' ; |
0453d815 |
178 | $C = "" ; |
179 | $C .= $A ; |
599cee73 |
180 | EXPECT |
297b36dc |
181 | Use of uninitialized value in concatenation (.) or string at - line 10. |
599cee73 |
182 | ######## |
531d2254 |
183 | # perlbug 20011116.125 |
184 | use warnings 'uninitialized'; |
185 | $a = undef; |
186 | $foo = join '', $a, "\n"; |
187 | $foo = "$a\n"; |
188 | $foo = "a:$a\n"; |
189 | EXPECT |
190 | Use of uninitialized value in join or string at - line 4. |
191 | Use of uninitialized value in concatenation (.) or string at - line 5. |
192 | Use of uninitialized value in concatenation (.) or string at - line 6. |
193 | ######## |
599cee73 |
194 | # sv.c |
4438c4b7 |
195 | use warnings 'numeric' ; |
599cee73 |
196 | sub TIESCALAR{bless[]} ; |
197 | sub FETCH {"def"} ; |
198 | tie $a,"main" ; |
0453d815 |
199 | my $b = 1 + $a; |
4438c4b7 |
200 | no warnings 'numeric' ; |
0453d815 |
201 | my $c = 1 + $a; |
599cee73 |
202 | EXPECT |
42d38218 |
203 | Argument "def" isn't numeric in addition (+) at - line 6. |
599cee73 |
204 | ######## |
205 | # sv.c |
4438c4b7 |
206 | use warnings 'numeric' ; |
599cee73 |
207 | my $x = 1 + "def" ; |
4438c4b7 |
208 | no warnings 'numeric' ; |
0453d815 |
209 | my $z = 1 + "def" ; |
599cee73 |
210 | EXPECT |
42d38218 |
211 | Argument "def" isn't numeric in addition (+) at - line 3. |
599cee73 |
212 | ######## |
213 | # sv.c |
4438c4b7 |
214 | use warnings 'numeric' ; |
599cee73 |
215 | my $a = "def" ; |
216 | my $x = 1 + $a ; |
4438c4b7 |
217 | no warnings 'numeric' ; |
0453d815 |
218 | my $y = 1 + $a ; |
599cee73 |
219 | EXPECT |
42d38218 |
220 | Argument "def" isn't numeric in addition (+) at - line 4. |
599cee73 |
221 | ######## |
222 | # sv.c |
4438c4b7 |
223 | use warnings 'numeric' ; use integer ; |
599cee73 |
224 | my $a = "def" ; |
225 | my $x = 1 + $a ; |
4438c4b7 |
226 | no warnings 'numeric' ; |
0453d815 |
227 | my $z = 1 + $a ; |
599cee73 |
228 | EXPECT |
42d38218 |
229 | Argument "def" isn't numeric in integer addition (+) at - line 4. |
599cee73 |
230 | ######## |
231 | # sv.c |
4438c4b7 |
232 | use warnings 'numeric' ; |
599cee73 |
233 | my $x = 1 & "def" ; |
4438c4b7 |
234 | no warnings 'numeric' ; |
0453d815 |
235 | my $z = 1 & "def" ; |
599cee73 |
236 | EXPECT |
42d38218 |
237 | Argument "def" isn't numeric in bitwise and (&) at - line 3. |
599cee73 |
238 | ######## |
239 | # sv.c |
59bb5845 |
240 | use warnings 'numeric' ; |
241 | my $x = pack i => "def" ; |
242 | no warnings 'numeric' ; |
243 | my $z = pack i => "def" ; |
244 | EXPECT |
245 | Argument "def" isn't numeric in pack at - line 3. |
246 | ######## |
247 | # sv.c |
248 | use warnings 'numeric' ; |
249 | my $a = "d\0f" ; |
250 | my $x = 1 + $a ; |
251 | no warnings 'numeric' ; |
252 | my $z = 1 + $a ; |
253 | EXPECT |
254 | Argument "d\0f" isn't numeric in addition (+) at - line 4. |
255 | ######## |
256 | # sv.c |
4438c4b7 |
257 | use warnings 'redefine' ; |
599cee73 |
258 | sub fred {} |
259 | sub joe {} |
260 | *fred = \&joe ; |
4438c4b7 |
261 | no warnings 'redefine' ; |
0453d815 |
262 | sub jim {} |
263 | *jim = \&joe ; |
599cee73 |
264 | EXPECT |
80a5d8e7 |
265 | Subroutine main::fred redefined at - line 5. |
599cee73 |
266 | ######## |
267 | # sv.c |
4438c4b7 |
268 | use warnings 'printf' ; |
3eeba6fb |
269 | open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ; |
cf2093f6 |
270 | printf F "%z\n" ; |
271 | my $a = sprintf "%z" ; |
599cee73 |
272 | printf F "%" ; |
273 | $a = sprintf "%" ; |
274 | printf F "%\x02" ; |
275 | $a = sprintf "%\x02" ; |
4438c4b7 |
276 | no warnings 'printf' ; |
cf2093f6 |
277 | printf F "%z\n" ; |
278 | $a = sprintf "%z" ; |
0453d815 |
279 | printf F "%" ; |
280 | $a = sprintf "%" ; |
281 | printf F "%\x02" ; |
282 | $a = sprintf "%\x02" ; |
599cee73 |
283 | EXPECT |
cf2093f6 |
284 | Invalid conversion in sprintf: "%z" at - line 5. |
599cee73 |
285 | Invalid conversion in sprintf: end of string at - line 7. |
286 | Invalid conversion in sprintf: "%\002" at - line 9. |
cf2093f6 |
287 | Invalid conversion in printf: "%z" at - line 4. |
599cee73 |
288 | Invalid conversion in printf: end of string at - line 6. |
289 | Invalid conversion in printf: "%\002" at - line 8. |
290 | ######## |
291 | # sv.c |
e476b1b5 |
292 | use warnings 'misc' ; |
599cee73 |
293 | *a = undef ; |
e476b1b5 |
294 | no warnings 'misc' ; |
0453d815 |
295 | *b = undef ; |
599cee73 |
296 | EXPECT |
297 | Undefined value assigned to typeglob at - line 3. |
0453d815 |
298 | ######## |
299 | # sv.c |
e476b1b5 |
300 | use warnings 'y2k'; |
6bc102ca |
301 | use Config; |
302 | BEGIN { |
303 | unless ($Config{ccflags} =~ /Y2KWARN/) { |
304 | print "SKIPPED\n# perl not built with -DPERL_Y2KWARN"; |
305 | exit 0; |
306 | } |
307 | $|=1; |
308 | } |
309 | my $x; |
310 | my $yy = 78; |
311 | $x = printf "19%02d\n", $yy; |
312 | $x = sprintf "#19%02d\n", $yy; |
313 | $x = printf " 19%02d\n", 78; |
314 | $x = sprintf "19%02d\n", 78; |
315 | $x = printf "319%02d\n", $yy; |
316 | $x = sprintf "319%02d\n", $yy; |
e476b1b5 |
317 | no warnings 'y2k'; |
6bc102ca |
318 | $x = printf "19%02d\n", $yy; |
319 | $x = sprintf "19%02d\n", $yy; |
320 | $x = printf "19%02d\n", 78; |
321 | $x = sprintf "19%02d\n", 78; |
322 | EXPECT |
323 | Possible Y2K bug: %d format string following '19' at - line 16. |
324 | Possible Y2K bug: %d format string following '19' at - line 13. |
325 | 1978 |
326 | Possible Y2K bug: %d format string following '19' at - line 14. |
327 | Possible Y2K bug: %d format string following '19' at - line 15. |
328 | 1978 |
329 | 31978 |
330 | 1978 |
331 | 1978 |
94463019 |
332 | ######## |
333 | # sv.c |
334 | use warnings 'numeric' ; |
335 | $a = "\x{100}\x{200}" * 42; |
336 | no warnings 'numeric' ; |
337 | $a = "\x{100}\x{200}" * 42; |
338 | EXPECT |
339 | Argument "\x{100}\x{200}" isn't numeric in multiplication (*) at - line 3. |
8eb28a70 |
340 | ######## |
341 | # sv.c |
342 | use warnings 'numeric' ; |
343 | $a = "\x{100}\x{200}"; $a = -$a; |
344 | no warnings 'numeric' ; |
345 | $a = "\x{100}\x{200}"; $a = -$a; |
346 | EXPECT |
347 | Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3. |