This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 bits
would all be 0. As it stands now, that may or may not be true: pointers get
sign-extended.

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?

--Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]