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 | ||
6bc102ca GS |
35 | Possible Y2K bug: %d format string following '19' |
36 | ||
767a6a26 PM |
37 | Reference is already weak [Perl_sv_rvweaken] <<TODO |
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 |
b89fed5f | 61 | Use of uninitialized value 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 |
b89fed5f | 76 | Use of uninitialized value 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 |
b89fed5f | 85 | Use of uninitialized value 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 |
b89fed5f | 101 | Use of uninitialized value 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 |
b89fed5f | 111 | Use of uninitialized value in bitwise or (|) at - line 4. |
599cee73 PM |
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 PM |
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 PM |
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 PM |
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 PM |
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 PM |
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 PM |
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 PM |
175 | $B = "" ; |
176 | $B .= $A ; | |
4438c4b7 | 177 | no warnings 'uninitialized' ; |
0453d815 PM |
178 | $C = "" ; |
179 | $C .= $A ; | |
599cee73 | 180 | EXPECT |
b89fed5f | 181 | Use of uninitialized value in concatenation (.) at - line 10. |
599cee73 PM |
182 | ######## |
183 | # sv.c | |
4438c4b7 | 184 | use warnings 'numeric' ; |
599cee73 PM |
185 | sub TIESCALAR{bless[]} ; |
186 | sub FETCH {"def"} ; | |
187 | tie $a,"main" ; | |
0453d815 | 188 | my $b = 1 + $a; |
4438c4b7 | 189 | no warnings 'numeric' ; |
0453d815 | 190 | my $c = 1 + $a; |
599cee73 | 191 | EXPECT |
42d38218 | 192 | Argument "def" isn't numeric in addition (+) at - line 6. |
599cee73 PM |
193 | ######## |
194 | # sv.c | |
4438c4b7 | 195 | use warnings 'numeric' ; |
599cee73 | 196 | my $x = 1 + "def" ; |
4438c4b7 | 197 | no warnings 'numeric' ; |
0453d815 | 198 | my $z = 1 + "def" ; |
599cee73 | 199 | EXPECT |
42d38218 | 200 | Argument "def" isn't numeric in addition (+) at - line 3. |
599cee73 PM |
201 | ######## |
202 | # sv.c | |
4438c4b7 | 203 | use warnings 'numeric' ; |
599cee73 PM |
204 | my $a = "def" ; |
205 | my $x = 1 + $a ; | |
4438c4b7 | 206 | no warnings 'numeric' ; |
0453d815 | 207 | my $y = 1 + $a ; |
599cee73 | 208 | EXPECT |
42d38218 | 209 | Argument "def" isn't numeric in addition (+) at - line 4. |
599cee73 PM |
210 | ######## |
211 | # sv.c | |
4438c4b7 | 212 | use warnings 'numeric' ; use integer ; |
599cee73 PM |
213 | my $a = "def" ; |
214 | my $x = 1 + $a ; | |
4438c4b7 | 215 | no warnings 'numeric' ; |
0453d815 | 216 | my $z = 1 + $a ; |
599cee73 | 217 | EXPECT |
42d38218 | 218 | Argument "def" isn't numeric in integer addition (+) at - line 4. |
599cee73 PM |
219 | ######## |
220 | # sv.c | |
4438c4b7 | 221 | use warnings 'numeric' ; |
599cee73 | 222 | my $x = 1 & "def" ; |
4438c4b7 | 223 | no warnings 'numeric' ; |
0453d815 | 224 | my $z = 1 & "def" ; |
599cee73 | 225 | EXPECT |
42d38218 | 226 | Argument "def" isn't numeric in bitwise and (&) at - line 3. |
599cee73 PM |
227 | ######## |
228 | # sv.c | |
4438c4b7 | 229 | use warnings 'redefine' ; |
599cee73 PM |
230 | sub fred {} |
231 | sub joe {} | |
232 | *fred = \&joe ; | |
4438c4b7 | 233 | no warnings 'redefine' ; |
0453d815 PM |
234 | sub jim {} |
235 | *jim = \&joe ; | |
599cee73 PM |
236 | EXPECT |
237 | Subroutine fred redefined at - line 5. | |
238 | ######## | |
239 | # sv.c | |
4438c4b7 | 240 | use warnings 'printf' ; |
3eeba6fb | 241 | open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ; |
cf2093f6 JH |
242 | printf F "%z\n" ; |
243 | my $a = sprintf "%z" ; | |
599cee73 PM |
244 | printf F "%" ; |
245 | $a = sprintf "%" ; | |
246 | printf F "%\x02" ; | |
247 | $a = sprintf "%\x02" ; | |
4438c4b7 | 248 | no warnings 'printf' ; |
cf2093f6 JH |
249 | printf F "%z\n" ; |
250 | $a = sprintf "%z" ; | |
0453d815 PM |
251 | printf F "%" ; |
252 | $a = sprintf "%" ; | |
253 | printf F "%\x02" ; | |
254 | $a = sprintf "%\x02" ; | |
599cee73 | 255 | EXPECT |
cf2093f6 | 256 | Invalid conversion in sprintf: "%z" at - line 5. |
599cee73 PM |
257 | Invalid conversion in sprintf: end of string at - line 7. |
258 | Invalid conversion in sprintf: "%\002" at - line 9. | |
cf2093f6 | 259 | Invalid conversion in printf: "%z" at - line 4. |
599cee73 PM |
260 | Invalid conversion in printf: end of string at - line 6. |
261 | Invalid conversion in printf: "%\002" at - line 8. | |
262 | ######## | |
263 | # sv.c | |
e476b1b5 | 264 | use warnings 'misc' ; |
599cee73 | 265 | *a = undef ; |
e476b1b5 | 266 | no warnings 'misc' ; |
0453d815 | 267 | *b = undef ; |
599cee73 PM |
268 | EXPECT |
269 | Undefined value assigned to typeglob at - line 3. | |
0453d815 PM |
270 | ######## |
271 | # sv.c | |
e476b1b5 | 272 | use warnings 'y2k'; |
6bc102ca GS |
273 | use Config; |
274 | BEGIN { | |
275 | unless ($Config{ccflags} =~ /Y2KWARN/) { | |
276 | print "SKIPPED\n# perl not built with -DPERL_Y2KWARN"; | |
277 | exit 0; | |
278 | } | |
279 | $|=1; | |
280 | } | |
281 | my $x; | |
282 | my $yy = 78; | |
283 | $x = printf "19%02d\n", $yy; | |
284 | $x = sprintf "#19%02d\n", $yy; | |
285 | $x = printf " 19%02d\n", 78; | |
286 | $x = sprintf "19%02d\n", 78; | |
287 | $x = printf "319%02d\n", $yy; | |
288 | $x = sprintf "319%02d\n", $yy; | |
e476b1b5 | 289 | no warnings 'y2k'; |
6bc102ca GS |
290 | $x = printf "19%02d\n", $yy; |
291 | $x = sprintf "19%02d\n", $yy; | |
292 | $x = printf "19%02d\n", 78; | |
293 | $x = sprintf "19%02d\n", 78; | |
294 | EXPECT | |
295 | Possible Y2K bug: %d format string following '19' at - line 16. | |
296 | Possible Y2K bug: %d format string following '19' at - line 13. | |
297 | 1978 | |
298 | Possible Y2K bug: %d format string following '19' at - line 14. | |
299 | Possible Y2K bug: %d format string following '19' at - line 15. | |
300 | 1978 | |
301 | 31978 | |
302 | 1978 | |
303 | 1978 |