This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: don't sign-extend pointers when casting to unsigned long long
- From: Matt Austern <austern at apple dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 12 May 2003 16:36:02 -0700
- Subject: Re: PATCH: don't sign-extend pointers when casting to unsigned long long
On Monday, May 12, 2003, at 02:07 PM, Richard Henderson wrote:
On Mon, May 12, 2003 at 11:07:53AM -0700, Matt Austern wrote:
Suppose you're on a system where pointers are 32-bit and long long is
64-bit, and suppose you write
"unsigned long long n = (unsigned long long) p".
The results are counterintuitive. I would expect that the high 32
would all be 0. As it stands now, that may or may not be true:
I'd say this actually depends on what platform you're on.
If I were on a MIPS or Alpha, I *would* expect the value
to be sign-extended. Why? Because that's how the actual
ABI works with 32-bit pointers on 64-bit hardware.
If we're going to do anything of the sort, I think that
the most useful to honor POINTERS_EXTEND_UNSIGNED, if
defined. What this means for targets that neither sign
nor zero extend, like ia64-hpux, I'm not sure.
Hm... Any suggestions about what the test case would look
like, in that case?