bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gas value truncation warning reports truncated values, does


From: Bart Samwel
Subject: Re: [PATCH] gas value truncation warning reports truncated values, doesn't look at signedness.
Date: Mon, 12 Jan 2004 08:18:25 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031221 Thunderbird/0.4

Alan Modra wrote:
On Mon, Jan 12, 2004 at 02:20:25AM +0100, Bart Samwel wrote:

In 64-bit, ~0x80000000 is 0xffffffff7fffffff.

True if int is 64 bits.  Note that most (all?) 64 bit gcc targets
have a 32 bit int.  I'm harping on about this because it's a common
error to think ~0x80000000 is something other than 0x7fffffff when
writing C for a 64 bit target.  Try this:

#include <stdio.h>
int main (void)
{
  long long x = ~0x80000000;
  printf ("%llx\n", x);
  return 0;
}

I understand why that doesn't work -- if 0x80000000 is an int, ~0x80000000 is going to use 32-bit arithmetic. It should be ~0x80000000LL, of course. I'm working on a 32-bit architecture however -- i386, to be precise. So I don't know why Debian compiles with a 64-bit bfd for a 32-bit arch. Would there be any reason for them to do so, or might this just be something that slipped between the cracks when they added 64-bit architectures?

-- Bart




reply via email to

[Prev in Thread] Current Thread [Next in Thread]