This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Pointers Extend Unsigned Question
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: Pointers Extend Unsigned Question
- From: Donn Terry <donn at interix dot com>
- Date: Thu, 29 Apr 1999 14:50:40 -0600
- CC: "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>, Jim Wilson <wilson at cygnus dot com>
- References: <37287C0D.4AFC5D1D@interix.com> <19990429133715.C4270@cygnus.com>
Richard Henderson wrote:
>
> 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.
Had *I* a choice, I'd choose putting a chip into 32 bit mode,
but that's me :-).
> > 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?
That was one of the directions I was planning to explore, pending
some indication of original intent. For the moment, I'll take this as
an indication that the RTL was wrong (which is what the change you
suggest below implies) and see what happens.
If there's disagreement, PLEASE let me know as soon as possible.
(If I run into any more problems like this, I'm going to continue
in the same direction.)
Thanks!
Donn
>
> 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;
>
--
===================================================
Donn Terry mailto:donn@interix.com
Softway Systems, Inc. http://www.interix.com
2850 McClelland Dr, Ste. 1800 Ft.Collins CO 80525
Tel: +1-970-204-9900 Fax: +1-970-204-9951
===================================================