Commit | Line | Data |
599cee73 |
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 |
28 | Constant subroutine %s undefined <<<TODO |
29 | Constant subroutine (anonymous) undefined <<<TODO |
30 | |
31 | Mandatory Warnings |
32 | ------------------ |
7e2040f0 |
33 | Malformed UTF-8 character (not tested: difficult to produce with |
34 | perl now) |
599cee73 |
35 | |
36 | __END__ |
37 | # pp.c |
4438c4b7 |
38 | use warnings 'substr' ; |
599cee73 |
39 | $a = "ab" ; |
0453d815 |
40 | $a = substr($a, 4,5); |
4438c4b7 |
41 | no warnings 'substr' ; |
0453d815 |
42 | $a = "ab" ; |
43 | $a = substr($a, 4,5); |
599cee73 |
44 | EXPECT |
45 | substr outside of string at - line 4. |
46 | ######## |
47 | # pp.c |
4438c4b7 |
48 | use warnings 'substr' ; |
599cee73 |
49 | $a = "ab" ; |
50 | $b = \$a ; |
51 | substr($b, 1,1) = "ab" ; |
4438c4b7 |
52 | no warnings 'substr' ; |
0453d815 |
53 | substr($b, 1,1) = "ab" ; |
599cee73 |
54 | EXPECT |
55 | Attempt to use reference as lvalue in substr at - line 5. |
56 | ######## |
57 | # pp.c |
4438c4b7 |
58 | use warnings 'uninitialized' ; |
599cee73 |
59 | # TODO |
60 | EXPECT |
61 | |
62 | ######## |
63 | # pp.c |
4438c4b7 |
64 | use warnings 'unsafe' ; |
599cee73 |
65 | my $a = { 1,2,3}; |
4438c4b7 |
66 | no warnings 'unsafe' ; |
0453d815 |
67 | my $b = { 1,2,3}; |
599cee73 |
68 | EXPECT |
69 | Odd number of elements in hash assignment at - line 3. |
70 | ######## |
71 | # pp.c |
4438c4b7 |
72 | use warnings 'unsafe' ; |
599cee73 |
73 | my @a = unpack ("A,A", "22") ; |
74 | my $a = pack ("A,A", 1,2) ; |
4438c4b7 |
75 | no warnings 'unsafe' ; |
0453d815 |
76 | my @b = unpack ("A,A", "22") ; |
77 | my $b = pack ("A,A", 1,2) ; |
599cee73 |
78 | EXPECT |
79 | Invalid type in unpack: ',' at - line 3. |
80 | Invalid type in pack: ',' at - line 4. |
81 | ######## |
82 | # pp.c |
4438c4b7 |
83 | use warnings 'uninitialized' ; |
599cee73 |
84 | my $a = undef ; |
0453d815 |
85 | my $b = $$a; |
4438c4b7 |
86 | no warnings 'uninitialized' ; |
0453d815 |
87 | my $c = $$a; |
599cee73 |
88 | EXPECT |
b89fed5f |
89 | Use of uninitialized value in scalar dereference at - line 4. |
599cee73 |
90 | ######## |
91 | # pp.c |
4438c4b7 |
92 | use warnings 'unsafe' ; |
599cee73 |
93 | sub foo { my $a = "a"; return $a . $a++ . $a++ } |
94 | my $a = pack("p", &foo) ; |
4438c4b7 |
95 | no warnings 'unsafe' ; |
0453d815 |
96 | my $b = pack("p", &foo) ; |
599cee73 |
97 | EXPECT |
98 | Attempt to pack pointer to temporary value at - line 4. |
99 | ######## |
100 | # pp.c |
4438c4b7 |
101 | use warnings 'unsafe' ; |
599cee73 |
102 | bless \[], "" ; |
4438c4b7 |
103 | no warnings 'unsafe' ; |
0453d815 |
104 | bless \[], "" ; |
599cee73 |
105 | EXPECT |
106 | Explicit blessing to '' (assuming package main) at - line 3. |
0453d815 |
107 | ######## |
108 | # pp.c |
109 | use utf8 ; |
110 | $_ = "\x80 \xff" ; |
111 | reverse ; |
112 | EXPECT |
0453d815 |
113 | ######## |
114 | # pp.c |
59af8754 |
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 |
122 | use utf8 ; |
123 | $_ = "\x80 \xff" ; |
124 | reverse ; |
4438c4b7 |
125 | no warnings 'utf8' ; |
0453d815 |
126 | $_ = "\x80 \xff" ; |
127 | reverse ; |
128 | EXPECT |
dc26be07 |
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. |