Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: "B. James Phillippe" <bryan@terran.org>
To: axp-list@redhat.com
Subject: Re: So Y is my pointer so bogus
Date: Wed, 3 Feb 1999 15:32:23 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.05.9902031522050.15025-100000@earth.terran.org> (raw)
In-Reply-To: <Pine.LNX.4.04.9902031756480.6536-100000@sdi.aatech.com>

On Wed, 3 Feb 1999, Jason Duerstock wrote:

> a = (int *) a; 
> 
> dereferences null, thus causing your program to go kerfloom.

a = (int *) a; just means to tell the compiler to start _treating_ a as a
pointer-to-int for that expression in case you wish to do ptr arith on it
or deref it.  But he doesn't ever dereference it.

So: a = (int *)a + 1;  will increment a's address by sizeof(int) * 1, which
is 4 for Intel, Alpha, etc.

> On Wed, 3 Feb 1999, Uncle George wrote:
> 
> > This little example caused a (un-expected ) pointer failure in one of
> > the font routines in my java 1.2 port on linux/alpha. It was expected to
> > add a -1760 ( -1760 * sizeof(int)) but does not.
> > Ugg. what is a 64bitter to do.

I *think* I know what you're having problems with; I tried your sample code
and some other math and when I do a %p on just plain (int*) 0 - 1760; I got
a value of 0xffffffffffffe480 (which is expected), but your sample code
instead gave 0x7ffffe480.  Seems the 64bit range didn't get assigned in the
version of your code.  Is this what you were asking about?

-bp
--
B. James Phillippe	. bryan@terran.org
Linux Engineer/Admin	. http://www.terran.org/~bryan
Member since 1.1.59	. finger:bryan@earth.terran.org


  reply	other threads:[~1999-02-03 23:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-03 22:36 So Y is my pointer so bogus Uncle George
1999-02-03 22:59 ` Jason Duerstock
1999-02-03 23:32   ` B. James Phillippe [this message]
1999-02-03 23:45     ` Uncle George
1999-02-04  0:51       ` Michal Jaegermann
1999-02-04  0:55         ` Michal Jaegermann
1999-02-03 23:36   ` Uncle George
1999-02-03 23:40   ` Re[2]: " Dan
1999-02-04  0:38 ` Michal Jaegermann
1999-02-04 11:25 ` Phil Carmody
  -- strict thread matches above, loose matches on Subject: below --
1999-02-03 22:57 Lagodzinski, Andrew
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox