Commit | Line | Data |
---|---|---|
599cee73 PM |
1 | pp.c TODO |
2 | ||
3 | substr outside of string | |
4 | $a = "ab" ; $a = substr($a, 4,5) | |
5 | ||
6 | Attempt to use reference as lvalue in substr | |
7 | $a = "ab" ; $b = \$a ; substr($b, 1,1) = $b | |
8 | ||
9 | uninitialized in pp_rv2gv() | |
10 | my *b = *{ undef()} | |
11 | ||
12 | uninitialized in pp_rv2sv() | |
13 | my $a = undef ; my $b = $$a | |
14 | ||
15 | Odd number of elements in hash list | |
16 | my $a = { 1,2,3 } ; | |
17 | ||
18 | Invalid type in unpack: '%c | |
19 | my $A = pack ("A,A", 1,2) ; | |
20 | my @A = unpack ("A,A", "22") ; | |
21 | ||
22 | Attempt to pack pointer to temporary value | |
23 | pack("p", "abc") ; | |
24 | ||
25 | Explicit blessing to '' (assuming package main) | |
26 | bless \[], ""; | |
27 | ||
0453d815 PM |
28 | Constant subroutine %s undefined <<<TODO |
29 | Constant subroutine (anonymous) undefined <<<TODO | |
30 | ||
31 | Mandatory Warnings | |
32 | ------------------ | |
33 | Malformed UTF-8 character | |
599cee73 PM |
34 | |
35 | __END__ | |
36 | # pp.c | |
4438c4b7 | 37 | use warnings 'substr' ; |
599cee73 | 38 | $a = "ab" ; |
0453d815 | 39 | $a = substr($a, 4,5); |
4438c4b7 | 40 | no warnings 'substr' ; |
0453d815 PM |
41 | $a = "ab" ; |
42 | $a = substr($a, 4,5); | |
599cee73 PM |
43 | EXPECT |
44 | substr outside of string at - line 4. | |
45 | ######## | |
46 | # pp.c | |
4438c4b7 | 47 | use warnings 'substr' ; |
599cee73 PM |
48 | $a = "ab" ; |
49 | $b = \$a ; | |
50 | substr($b, 1,1) = "ab" ; | |
4438c4b7 | 51 | no warnings 'substr' ; |
0453d815 | 52 | substr($b, 1,1) = "ab" ; |
599cee73 PM |
53 | EXPECT |
54 | Attempt to use reference as lvalue in substr at - line 5. | |
55 | ######## | |
56 | # pp.c | |
4438c4b7 | 57 | use warnings 'uninitialized' ; |
599cee73 PM |
58 | # TODO |
59 | EXPECT | |
60 | ||
61 | ######## | |
62 | # pp.c | |
4438c4b7 | 63 | use warnings 'unsafe' ; |
599cee73 | 64 | my $a = { 1,2,3}; |
4438c4b7 | 65 | no warnings 'unsafe' ; |
0453d815 | 66 | my $b = { 1,2,3}; |
599cee73 PM |
67 | EXPECT |
68 | Odd number of elements in hash assignment at - line 3. | |
69 | ######## | |
70 | # pp.c | |
4438c4b7 | 71 | use warnings 'unsafe' ; |
599cee73 PM |
72 | my @a = unpack ("A,A", "22") ; |
73 | my $a = pack ("A,A", 1,2) ; | |
4438c4b7 | 74 | no warnings 'unsafe' ; |
0453d815 PM |
75 | my @b = unpack ("A,A", "22") ; |
76 | my $b = pack ("A,A", 1,2) ; | |
599cee73 PM |
77 | EXPECT |
78 | Invalid type in unpack: ',' at - line 3. | |
79 | Invalid type in pack: ',' at - line 4. | |
80 | ######## | |
81 | # pp.c | |
4438c4b7 | 82 | use warnings 'uninitialized' ; |
599cee73 | 83 | my $a = undef ; |
0453d815 | 84 | my $b = $$a; |
4438c4b7 | 85 | no warnings 'uninitialized' ; |
0453d815 | 86 | my $c = $$a; |
599cee73 | 87 | EXPECT |
146174a9 | 88 | Use of uninitialized value in scalar dereference at - line 4. |
599cee73 PM |
89 | ######## |
90 | # pp.c | |
4438c4b7 | 91 | use warnings 'unsafe' ; |
599cee73 PM |
92 | sub foo { my $a = "a"; return $a . $a++ . $a++ } |
93 | my $a = pack("p", &foo) ; | |
4438c4b7 | 94 | no warnings 'unsafe' ; |
0453d815 | 95 | my $b = pack("p", &foo) ; |
599cee73 PM |
96 | EXPECT |
97 | Attempt to pack pointer to temporary value at - line 4. | |
98 | ######## | |
99 | # pp.c | |
4438c4b7 | 100 | use warnings 'unsafe' ; |
599cee73 | 101 | bless \[], "" ; |
4438c4b7 | 102 | no warnings 'unsafe' ; |
0453d815 | 103 | bless \[], "" ; |
599cee73 PM |
104 | EXPECT |
105 | Explicit blessing to '' (assuming package main) at - line 3. | |
0453d815 PM |
106 | ######## |
107 | # pp.c | |
108 | use utf8 ; | |
109 | $_ = "\x80 \xff" ; | |
110 | reverse ; | |
111 | EXPECT | |
112 | Malformed UTF-8 character at - line 4. | |
113 | ######## | |
114 | # pp.c | |
146174a9 CB |
115 | BEGIN { |
116 | if (ord("\t") == 5) { | |
117 | print "SKIPPED\n# Character codes differ on ebcdic machines."; | |
118 | exit 0; | |
119 | } | |
120 | } | |
4438c4b7 | 121 | use warnings 'utf8' ; |
0453d815 PM |
122 | use utf8 ; |
123 | $_ = "\x80 \xff" ; | |
124 | reverse ; | |
4438c4b7 | 125 | no warnings 'utf8' ; |
0453d815 PM |
126 | $_ = "\x80 \xff" ; |
127 | reverse ; | |
128 | EXPECT | |
146174a9 CB |
129 | \x80 will produce malformed UTF-8 character; use \x{80} for that at - line 10. |
130 | \xff will produce malformed UTF-8 character; use \x{ff} for that at - line 10. | |
131 | Malformed UTF-8 character at - line 11. |