Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Jim Paradis <jrp@jrp.tiac.net>
Subject: Re: some questions.
Date: Wed, 16 Apr 1997 21:20:40 -0400	[thread overview]
Message-ID: <359d4167f81f02bd29ebfec556f77b9c.axp-list@archive.invalid> (raw)

Anthony Pardini wrote:
> 
> On Almost every piece of software I try to compile on my alpha running
> redhat 4.1 with the applicable updates, I get warning cast form pointer
> to integer of different size.

You have what's called a "64-bit-dirtiness" problem.  Throughout the
80s, nearly all implementations of C on 32-bit processors sized data
types such that ints, longs, and pointers were all 32 bits.  A lot of
lazy programmers used these datatypes interchangeably, and their code
still worked.  Hell *I* even did this in my early years in the
industry (hanging head in shame 8-) ).

With Linux/Alpha and Digital UNIX, these assumptions no longer apply.  
Ints are 32 bits, while longs and pointers are 64 bits.  If you try
to stuff a 64-bit pointer into a 32-bit int, you chop off the high
bits.  If you push a 32-bit int into a 64-bit pointer, you may have
sign-extension problems.  Then again, you may get away with it.

> kernel: makedepend: memory violation at pc=155556c7a40 rp=1555556b129c
> (bad address == 20115cb0

This is exactly symptomatic of using an int to hold a pointer.  64-bit
Linux/Alpha programs put the program code by default at 0x120000000,
followed by the initialized data, the uninitialized data, and the heap.
Shared libraries go in starting at 0x15555556000.

Chances are what happened above is you stuffed a pointer value 0x120115cb0
into an int, which lopped it off to 0x20115cb0, which is an invalid address.

-- 
Jim Paradis   jrp@jrp.tiac.net   http://www.tiac.net/users/jrp/index.html
"It's not procrastination, it's my new Just-In-Time Workload Management System!"

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

             reply	other threads:[~1997-04-17  1:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-17  1:20 Jim Paradis [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-09-10 19:25 Some Questions Torsten Zirzlaff
1997-04-18  2:15 some questions Jim Paradis
1997-04-17 22:06 david l nicol
     [not found] <Pine.A32.3.91.970416195518.18696A-100000@olvera.seas.ucla.edu>
1997-04-17 21:52 ` Richard Henderson
     [not found] <3356D92E.2DFC19BD@jrp.tiac.net>
1997-04-17 17:45 ` jestabro
1997-04-17  3:16 Javier Henderson
     [not found] <33557AE8.73908639@jrp.tiac.net>
1997-04-17  2:59 ` CHIH-HSIANG HENRY YAO
1997-04-16 20:06 Anthony Pardini
     [not found] <Pine.LNX.3.91.970416144742.30218B-100000@ns2.cmpu.net>
1997-04-16 19:52 ` Ximenes
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