summaryrefslogtreecommitdiff
path: root/t/pragma/warn/util
blob: bd29f7b25458c114673785d080bee90e4042f019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  util.c AOK
 
     Illegal octal digit ignored 
	my $a = oct "029" ;

     Illegal hex digit ignored 
	my $a = hex "0xv9" ;

     Illegal binary digit ignored
      my $a = oct "0b9" ;

     
     Mandatory Warnings
     ------------------
     Integer overflow in binary number
     Integer overflow in octal number
     Integer overflow in hex number

__END__
# util.c
use warning 'octal' ;
my $a = oct "029" ;
no warning 'octal' ;
my $a = oct "029" ;
EXPECT
Illegal octal digit '9' ignored at - line 3.
########
# util.c
use warning 'unsafe' ;
*a =  hex "0xv9" ;
no warning 'unsafe' ;
*a =  hex "0xv9" ;
EXPECT
Illegal hex digit 'v' ignored at - line 3.
########
# util.c
use warning 'unsafe' ;
*a =  oct "0b9" ;
no warning 'unsafe' ;
*a =  oct "0b9" ;
EXPECT
Illegal binary digit '9' ignored at - line 3.
########
# util.c
$^W =1 ;
{
  use warning 'unsafe' ;
  my $a = oct "0b111111111111111111111111111111111" ;
  no warning 'unsafe' ;
  $a = oct "0b111111111111111111111111111111111" ;
}
my $a = oct "0b111111111111111111111111111111111" ;
EXPECT
Integer overflow in binary number at - line 5.
Integer overflow in binary number at - line 9.
########
# util.c
$^W =1 ;
{
  use warning 'unsafe' ;
  my $a = oct "777777777777777777777777777777777777" ;
  no warning 'unsafe' ;
  $a = oct "777777777777777777777777777777777777" ;
}
my $a = oct "777777777777777777777777777777777777" ;
EXPECT
Integer overflow in octal number at - line 5.
Integer overflow in octal number at - line 9.
########
# util.c
$^W =1 ;
{
  use warning 'unsafe' ;
  my $a = hex "ffffffffffffffffffffffffffffffff" ;
  no warning 'unsafe' ;
  $a = hex "ffffffffffffffffffffffffffffffff" ;
}
my $a = hex "ffffffffffffffffffffffffffffffff" ;
EXPECT
Integer overflow in hex number at - line 5.
Integer overflow in hex number at - line 9.