This is the mail archive of the gcc@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]

Re: Pointers Extend Unsigned Question


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;
  

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