This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: tc-arm.c 0xFFFFFFFFFFFFF breaks on 32-bit hosts
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Sat, 8 Aug 2015 08:31:12 +0100
- Subject: Re: tc-arm.c 0xFFFFFFFFFFFFF breaks on 32-bit hosts
- Authentication-results: sourceware.org; auth=none
- References: <201508072327 dot t77NRunR024508 at ignucius dot se dot axis dot com>
- Reply-to: ramrad01 at arm dot com
On Sat, Aug 8, 2015 at 12:27 AM, Hans-Peter Nilsson
<hans-peter.nilsson@axis.com> wrote:
> In a i686-linux (remember those? 32-bit long!)
> with gcc-4.1.2, I get this compiling gas for arm-eabi:
>
> x/src/gas/config/tc-arm.c: In function 'is_double_a_single':
> x/src/gas/config/tc-arm.c:7763: warning: integer constant is too large for 'long' type
> x/src/gas/config/tc-arm.c: In function 'double_to_single':
> x/src/gas/config/tc-arm.c:7778: warning: integer constant is too large for 'long' type
>
> gas:
> * tc-arm.c (double_to_single, is_double_a_single): Append ULL to
> 0xFFFFFFFFFFFFF to avoid errors on 32-bit hosts.
>
> Maybe you want to fix that some other way, but this works for me.
> Ok to commit?
This is OK - thanks, Please apply.
Ramana
>
> diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
> index 7b3b5c9..899bfa2 100644
> --- a/gas/config/tc-arm.c
> +++ b/gas/config/tc-arm.c
> @@ -7760,7 +7760,7 @@ static bfd_boolean
> is_double_a_single (bfd_int64_t v)
> {
> int exp = (int)((v >> 52) & 0x7FF);
> - bfd_int64_t mantissa = (v & (bfd_int64_t)0xFFFFFFFFFFFFF);
> + bfd_int64_t mantissa = (v & (bfd_int64_t)0xFFFFFFFFFFFFFULL);
>
> return (exp == 0 || exp == 0x7FF
> || (exp >= 1023 - 126 && exp <= 1023 + 127))
> @@ -7775,7 +7775,7 @@ double_to_single (bfd_int64_t v)
> {
> int sign = (int) ((v >> 63) & 1l);
> int exp = (int) ((v >> 52) & 0x7FF);
> - bfd_int64_t mantissa = (v & (bfd_int64_t)0xFFFFFFFFFFFFF);
> + bfd_int64_t mantissa = (v & (bfd_int64_t)0xFFFFFFFFFFFFFULL);
>
> if (exp == 0x7FF)
> exp = 0xFF;M