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, doesn


From: Alan Modra
Subject: Re: [PATCH] gas value truncation warning reports truncated values, doesn't look at signedness.
Date: Mon, 12 Jan 2004 12:00:57 +1030
User-agent: Mutt/1.4i

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;
}

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre




reply via email to

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