From: CHIH-HSIANG HENRY YAO <chihhsia@seas.ucla.edu>
Subject: Re: some questions.
Date: Wed, 16 Apr 1997 19:59:26 -0700 (PDT) [thread overview]
Message-ID: <66c57f5a9de2e662c5d2858b99351dfa.axp-list@archive.invalid> (raw)
In-Reply-To: <33557AE8.73908639@jrp.tiac.net>
Since so many codes were written with this assumption, one would assume
that some body would come up with a C compiler that forces 32bit
compitablity you know like a compiler flag or something. Sure, would save
me a lot of time fixing idoitic bugs. All I really care is something
that works better than emulations. Does it exists? Are there any reason why
not?
from Henry Chih-Hsiang Yao
chihhsia@seas.ucla.edu
On Wed, 16 Apr 1997, Jim Paradis wrote:
> 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
>
>
--
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
next parent reply other threads:[~1997-04-17 2:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <33557AE8.73908639@jrp.tiac.net>
1997-04-17 2:59 ` CHIH-HSIANG HENRY YAO [this message]
1997-09-10 19:25 Some Questions Torsten Zirzlaff
-- strict thread matches above, loose matches on Subject: below --
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
1997-04-17 1:20 Jim Paradis
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