BEGIN { require Config ; import Config }
$^W =1 ;
sub make_bin { "1" x $_[0] }
-$n = make_bin(8 * $Config{longsize} ) ;
-$o = make_bin(8 * $Config{longsize} + 1) ;
+my $s = $Config{longsize};
+eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@;
+$n = make_bin(8 * $s ) ;
+$o = make_bin(8 * $s + 1) ;
{
use warning 'unsafe' ;
my $a = oct "0b$n" ;
}
my $b = oct "0b$o" ;
EXPECT
-Integer overflow in binary number at - line 10.
-Integer overflow in binary number at - line 14.
+Integer overflow in binary number at - line 12.
+Integer overflow in binary number at - line 16.
########
# util.c
BEGIN { require Config ; import Config }
$^W =1 ;
sub make_oct { ("","1","3")[$_[0]%3] . "7" x int($_[0]/3) }
-$n = make_oct(8 * $Config{longsize} );
-$o = make_oct(8 * $Config{longsize} + 1);
+my $s = $Config{longsize};
+eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@;
+$n = make_oct(8 * $s );
+$o = make_oct(8 * $s + 1);
{
use warning 'unsafe' ;
my $a = oct "$n" ;
}
my $b = oct "$o" ;
EXPECT
-Integer overflow in octal number at - line 10.
-Integer overflow in octal number at - line 14.
+Integer overflow in octal number at - line 12.
+Integer overflow in octal number at - line 16.
########
# util.c
BEGIN { require Config ; import Config }
$^W =1 ;
sub make_hex { ("","1","3","7")[$_[0]%4] . "f" x int($_[0]/4) }
-$n = make_hex(8 * $Config{longsize} ) ;
-$o = make_hex(8 * $Config{longsize} + 1) ;
+my $s = $Config{longsize};
+eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@;
+$n = make_hex(8 * $s ) ;
+$o = make_hex(8 * $s + 1) ;
{
use warning 'unsafe' ;
my $a = hex "$n" ;
}
my $b = hex "$o" ;
EXPECT
-Integer overflow in hexadecimal number at - line 10.
-Integer overflow in hexadecimal number at - line 14.
+Integer overflow in hexadecimal number at - line 12.
+Integer overflow in hexadecimal number at - line 16.