From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <359d4167f81f02bd29ebfec556f77b9c.axp-list@archive.invalid> X-Archive-Original-Message-ID: <33556C96.2EC51B31@lamar.colostate.edu> Date: Wed, 16 Apr 1997 21:20:40 -0400 From: Jim Paradis Subject: Re: some questions. 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