xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/lib/warnings/util (revision 0:68f95e015346)
1*0Sstevel@tonic-gate  util.c AOK
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate     Illegal octal digit ignored
4*0Sstevel@tonic-gate	my $a = oct "029" ;
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gate     Illegal hex digit ignored
7*0Sstevel@tonic-gate	my $a = hex "0xv9" ;
8*0Sstevel@tonic-gate
9*0Sstevel@tonic-gate     Illegal binary digit ignored
10*0Sstevel@tonic-gate      my $a = oct "0b9" ;
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate     Integer overflow in binary number
13*0Sstevel@tonic-gate	my $a =  oct "0b111111111111111111111111111111111111111111" ;
14*0Sstevel@tonic-gate     Binary number > 0b11111111111111111111111111111111 non-portable
15*0Sstevel@tonic-gate   	$a =  oct "0b111111111111111111111111111111111" ;
16*0Sstevel@tonic-gate     Integer overflow in octal number
17*0Sstevel@tonic-gate	my $a =  oct "077777777777777777777777777777" ;
18*0Sstevel@tonic-gate     Octal number > 037777777777 non-portable
19*0Sstevel@tonic-gate   	$a =  oct "0047777777777" ;
20*0Sstevel@tonic-gate     Integer overflow in hexadecimal number
21*0Sstevel@tonic-gate	my $a =  hex "0xffffffffffffffffffff" ;
22*0Sstevel@tonic-gate     Hexadecimal number > 0xffffffff non-portable
23*0Sstevel@tonic-gate   	$a =  hex "0x1ffffffff" ;
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate__END__
26*0Sstevel@tonic-gate# util.c
27*0Sstevel@tonic-gateuse warnings 'digit' ;
28*0Sstevel@tonic-gatemy $a = oct "029" ;
29*0Sstevel@tonic-gateno warnings 'digit' ;
30*0Sstevel@tonic-gate$a = oct "029" ;
31*0Sstevel@tonic-gateEXPECT
32*0Sstevel@tonic-gateIllegal octal digit '9' ignored at - line 3.
33*0Sstevel@tonic-gate########
34*0Sstevel@tonic-gate# util.c
35*0Sstevel@tonic-gateuse warnings 'digit' ;
36*0Sstevel@tonic-gatemy $a =  hex "0xv9" ;
37*0Sstevel@tonic-gateno warnings 'digit' ;
38*0Sstevel@tonic-gate$a =  hex "0xv9" ;
39*0Sstevel@tonic-gateEXPECT
40*0Sstevel@tonic-gateIllegal hexadecimal digit 'v' ignored at - line 3.
41*0Sstevel@tonic-gate########
42*0Sstevel@tonic-gate# util.c
43*0Sstevel@tonic-gateuse warnings 'digit' ;
44*0Sstevel@tonic-gatemy $a =  oct "0b9" ;
45*0Sstevel@tonic-gateno warnings 'digit' ;
46*0Sstevel@tonic-gate$a =  oct "0b9" ;
47*0Sstevel@tonic-gateEXPECT
48*0Sstevel@tonic-gateIllegal binary digit '9' ignored at - line 3.
49*0Sstevel@tonic-gate########
50*0Sstevel@tonic-gate# util.c
51*0Sstevel@tonic-gateuse warnings 'overflow' ;
52*0Sstevel@tonic-gatemy $a =  oct "0b11111111111111111111111111111111111111111111111111111111111111111";
53*0Sstevel@tonic-gateno warnings 'overflow' ;
54*0Sstevel@tonic-gate$a =  oct "0b11111111111111111111111111111111111111111111111111111111111111111";
55*0Sstevel@tonic-gateEXPECT
56*0Sstevel@tonic-gateInteger overflow in binary number at - line 3.
57*0Sstevel@tonic-gate########
58*0Sstevel@tonic-gate# util.c
59*0Sstevel@tonic-gateuse warnings 'overflow' ;
60*0Sstevel@tonic-gatemy $a =  hex "0xffffffffffffffffffff" ;
61*0Sstevel@tonic-gateno warnings 'overflow' ;
62*0Sstevel@tonic-gate$a =  hex "0xffffffffffffffffffff" ;
63*0Sstevel@tonic-gateEXPECT
64*0Sstevel@tonic-gateInteger overflow in hexadecimal number at - line 3.
65*0Sstevel@tonic-gate########
66*0Sstevel@tonic-gate# util.c
67*0Sstevel@tonic-gateuse warnings 'overflow' ;
68*0Sstevel@tonic-gatemy $a =  oct "077777777777777777777777777777" ;
69*0Sstevel@tonic-gateno warnings 'overflow' ;
70*0Sstevel@tonic-gate$a =  oct "077777777777777777777777777777" ;
71*0Sstevel@tonic-gateEXPECT
72*0Sstevel@tonic-gateInteger overflow in octal number at - line 3.
73*0Sstevel@tonic-gate########
74*0Sstevel@tonic-gate# util.c
75*0Sstevel@tonic-gateuse warnings 'portable' ;
76*0Sstevel@tonic-gatemy $a =  oct "0b011111111111111111111111111111110" ;
77*0Sstevel@tonic-gate   $a =  oct "0b011111111111111111111111111111111" ;
78*0Sstevel@tonic-gate   $a =  oct "0b111111111111111111111111111111111" ;
79*0Sstevel@tonic-gateno warnings 'portable' ;
80*0Sstevel@tonic-gate   $a =  oct "0b011111111111111111111111111111110" ;
81*0Sstevel@tonic-gate   $a =  oct "0b011111111111111111111111111111111" ;
82*0Sstevel@tonic-gate   $a =  oct "0b111111111111111111111111111111111" ;
83*0Sstevel@tonic-gateEXPECT
84*0Sstevel@tonic-gateBinary number > 0b11111111111111111111111111111111 non-portable at - line 5.
85*0Sstevel@tonic-gate########
86*0Sstevel@tonic-gate# util.c
87*0Sstevel@tonic-gateuse warnings 'portable' ;
88*0Sstevel@tonic-gatemy $a =  hex "0x0fffffffe" ;
89*0Sstevel@tonic-gate   $a =  hex "0x0ffffffff" ;
90*0Sstevel@tonic-gate   $a =  hex "0x1ffffffff" ;
91*0Sstevel@tonic-gateno warnings 'portable' ;
92*0Sstevel@tonic-gate   $a =  hex "0x0fffffffe" ;
93*0Sstevel@tonic-gate   $a =  hex "0x0ffffffff" ;
94*0Sstevel@tonic-gate   $a =  hex "0x1ffffffff" ;
95*0Sstevel@tonic-gateEXPECT
96*0Sstevel@tonic-gateHexadecimal number > 0xffffffff non-portable at - line 5.
97*0Sstevel@tonic-gate########
98*0Sstevel@tonic-gate# util.c
99*0Sstevel@tonic-gateuse warnings 'portable' ;
100*0Sstevel@tonic-gatemy $a =  oct "0037777777776" ;
101*0Sstevel@tonic-gate   $a =  oct "0037777777777" ;
102*0Sstevel@tonic-gate   $a =  oct "0047777777777" ;
103*0Sstevel@tonic-gateno warnings 'portable' ;
104*0Sstevel@tonic-gate   $a =  oct "0037777777776" ;
105*0Sstevel@tonic-gate   $a =  oct "0037777777777" ;
106*0Sstevel@tonic-gate   $a =  oct "0047777777777" ;
107*0Sstevel@tonic-gateEXPECT
108*0Sstevel@tonic-gateOctal number > 037777777777 non-portable at - line 5.
109*0Sstevel@tonic-gate########
110*0Sstevel@tonic-gate# util.c
111*0Sstevel@tonic-gateuse warnings;
112*0Sstevel@tonic-gate$x = 1;
113*0Sstevel@tonic-gateif ($x) {
114*0Sstevel@tonic-gate    print $y;
115*0Sstevel@tonic-gate}
116*0Sstevel@tonic-gateEXPECT
117*0Sstevel@tonic-gateName "main::y" used only once: possible typo at - line 5.
118*0Sstevel@tonic-gateUse of uninitialized value in print at - line 5.
119*0Sstevel@tonic-gate########
120*0Sstevel@tonic-gate# util.c
121*0Sstevel@tonic-gateuse warnings;
122*0Sstevel@tonic-gate$x = 1;
123*0Sstevel@tonic-gateif ($x) {
124*0Sstevel@tonic-gate    $x++;
125*0Sstevel@tonic-gate    print $y;
126*0Sstevel@tonic-gate}
127*0Sstevel@tonic-gateEXPECT
128*0Sstevel@tonic-gateName "main::y" used only once: possible typo at - line 6.
129*0Sstevel@tonic-gateUse of uninitialized value in print at - line 6.
130*0Sstevel@tonic-gate########
131*0Sstevel@tonic-gate# util.c
132*0Sstevel@tonic-gateuse warnings;
133*0Sstevel@tonic-gate$x = 0;
134*0Sstevel@tonic-gateif ($x) {
135*0Sstevel@tonic-gate    print "1\n";
136*0Sstevel@tonic-gate} elsif (!$x) {
137*0Sstevel@tonic-gate    print $y;
138*0Sstevel@tonic-gate} else {
139*0Sstevel@tonic-gate    print "0\n";
140*0Sstevel@tonic-gate}
141*0Sstevel@tonic-gateEXPECT
142*0Sstevel@tonic-gateName "main::y" used only once: possible typo at - line 7.
143*0Sstevel@tonic-gateUse of uninitialized value in print at - line 7.
144*0Sstevel@tonic-gate########
145*0Sstevel@tonic-gate# util.c
146*0Sstevel@tonic-gateuse warnings;
147*0Sstevel@tonic-gate$x = 0;
148*0Sstevel@tonic-gateif ($x) {
149*0Sstevel@tonic-gate    print "1\n";
150*0Sstevel@tonic-gate} elsif (!$x) {
151*0Sstevel@tonic-gate    $x++;
152*0Sstevel@tonic-gate    print $y;
153*0Sstevel@tonic-gate} else {
154*0Sstevel@tonic-gate    print "0\n";
155*0Sstevel@tonic-gate}
156*0Sstevel@tonic-gateEXPECT
157*0Sstevel@tonic-gateName "main::y" used only once: possible typo at - line 8.
158*0Sstevel@tonic-gateUse of uninitialized value in print at - line 8.
159