From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <66c57f5a9de2e662c5d2858b99351dfa.axp-list@archive.invalid> X-Archive-Original-Message-ID: Date: Wed, 16 Apr 1997 19:59:26 -0700 (PDT) From: CHIH-HSIANG HENRY YAO Subject: Re: some questions. 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