This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Pointers Extend Unsigned Question
- To: Donn Terry <donn at interix dot com>, "egcs at egcs dot cygnus dot com" <egcs at egcs dot cygnus dot com>, egcs-bugs at egcs dot cygnus dot com, Richard Kenner <kenner at gnat dot com>
- Subject: Re: Pointers Extend Unsigned Question
- From: Richard Henderson <rth at cygnus dot com>
- Date: Thu, 29 Apr 1999 13:37:15 -0700
- Cc: Jim Wilson <wilson at cygnus dot com>
- References: <37287C0D.4AFC5D1D@interix.com>
On Thu, Apr 29, 1999 at 09:34:37AM -0600, Donn Terry wrote:
> Alpha 32 is (as far as I can find with a grep) the only architecture
> where POINTERS_EXTEND_UNSIGNED is true.
The only other target I can think of where this should be a problem
is a mips3 target running in 64-bit mode with 32-bit pointers. I
don't know if anyone actually uses such a configuration in practice.
I suspect that normally the chip is simply put into 32-bit mode.
> For most purposes Alpha32 works. On NT, user space pointers
> are (except in rare circumstances, which may never have been
> hit) by definition in the low half of the address
> space, so sign extension is in practice not an issue,
> most of the time. (No comment on VMS).
I suspect that simply not having told the compiler that pointers
are unsigned will solve the problem. Something like this?
Thoughts?
r~
Index: stor-layout.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/stor-layout.c,v
retrieving revision 1.25
diff -c -p -d -r1.25 stor-layout.c
*** stor-layout.c 1999/03/11 13:56:20 1.25
--- stor-layout.c 1999/04/29 20:33:51
*************** layout_type (type)
*** 795,801 ****
--- 795,805 ----
TYPE_MODE (type) = ptr_mode;
TYPE_SIZE (type) = bitsize_int (POINTER_SIZE, 0L);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
+ #if defined(POINTERS_EXTEND_UNSIGNED)
+ TREE_UNSIGNED (type) = ! POINTERS_EXTEND_UNSIGNED;
+ #else
TREE_UNSIGNED (type) = 1;
+ #endif
TYPE_PRECISION (type) = POINTER_SIZE;
break;