From 15041a678a73e91c0e4cece2b3fd5f83d5128900 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 6 Sep 1999 20:33:43 +0000 Subject: Fix UV_SIZEOF to UVSIZE; change the overflow tests so that they overflow also on 64-bit platforms. p4raw-id: //depot/cfgperl@4093 --- t/pragma/warn/toke | 12 ++++++------ t/pragma/warn/util | 4 ++-- toke.c | 2 +- util.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/t/pragma/warn/toke b/t/pragma/warn/toke index 182cc1728c..ee02efa813 100644 --- a/t/pragma/warn/toke +++ b/t/pragma/warn/toke @@ -588,23 +588,23 @@ Octal number > 037777777777 non-portable at - line 11. use warnings 'overflow' ; my $a = 0b011111111111111111111111111111110 ; $a = 0b011111111111111111111111111111111 ; - $a = 0b111111111111111111111111111111111 ; + $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; $a = 0x0fffffffe ; $a = 0x0ffffffff ; - $a = 0x1ffffffff ; + $a = 0x10000000000000000 ; $a = 0037777777776 ; $a = 0037777777777 ; - $a = 0047777777777 ; + $a = 002000000000000000000000; no warnings 'overflow' ; $a = 0b011111111111111111111111111111110 ; $a = 0b011111111111111111111111111111111 ; - $a = 0b111111111111111111111111111111111 ; + $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; $a = 0x0fffffffe ; $a = 0x0ffffffff ; - $a = 0x1ffffffff ; + $a = 0x10000000000000000 ; $a = 0037777777776 ; $a = 0037777777777 ; - $a = 0047777777777 ; + $a = 002000000000000000000000; EXPECT Integer overflow in binary number at - line 5. Integer overflow in hexadecimal number at - line 8. diff --git a/t/pragma/warn/util b/t/pragma/warn/util index 6d82d133b8..6c9bc8c696 100644 --- a/t/pragma/warn/util +++ b/t/pragma/warn/util @@ -49,9 +49,9 @@ Illegal binary digit '9' ignored at - line 3. ######## # util.c use warnings 'overflow' ; -my $a = oct "0b111111111111111111111111111111111111111111" ; +my $a = oct "0b11111111111111111111111111111111111111111111111111111111111111111"; no warnings 'overflow' ; -$a = oct "0b111111111111111111111111111111111111111111" ; +$a = oct "0b11111111111111111111111111111111111111111111111111111111111111111"; EXPECT Integer overflow in binary number at - line 3. ######## diff --git a/toke.c b/toke.c index 354b1d4f0e..df965a38f9 100644 --- a/toke.c +++ b/toke.c @@ -6619,7 +6619,7 @@ Perl_scan_num(pTHX_ char *start) sv_setnv(sv, n); } else { -#if UV_SIZEOF > 4 +#if UVSIZE > 4 dTHR; if (ckWARN(WARN_PORTABLE) && u > 0xffffffff) Perl_warner(aTHX_ WARN_PORTABLE, diff --git a/util.c b/util.c index 51d757512b..628b9565d6 100644 --- a/util.c +++ b/util.c @@ -2829,7 +2829,7 @@ Perl_scan_bin(pTHX_ char *start, I32 len, I32 *retlen) if (!overflowed) rnv = (NV) ruv; if ( ( overflowed && rnv > 4294967295.0) -#if UV_SIZEOF > 4 +#if UVSIZE > 4 || (!overflowed && ruv > 0xffffffff ) #endif ) { @@ -2894,7 +2894,7 @@ Perl_scan_oct(pTHX_ char *start, I32 len, I32 *retlen) if (!overflowed) rnv = (NV) ruv; if ( ( overflowed && rnv > 4294967295.0) -#if UV_SIZEOF > 4 +#if UVSIZE > 4 || (!overflowed && ruv > 0xffffffff ) #endif ) { @@ -2962,7 +2962,7 @@ Perl_scan_hex(pTHX_ char *start, I32 len, I32 *retlen) if (!overflowed) rnv = (NV) ruv; if ( ( overflowed && rnv > 4294967295.0) -#if UV_SIZEOF > 4 +#if UVSIZE > 4 || (!overflowed && ruv > 0xffffffff ) #endif ) { -- cgit v1.2.1