96 bit pointer reset only the least 64 bits

Nir Piterman nir.piterman@doc.ic.ac.uk
Fri Oct 31 01:29:00 GMT 2008


Hello,

I have a strange problem with setting pointers to 0. It happens in a 64 
bit environment.

I am using a big package (which I know very little about) and get it to 
crash.
I can narrow the problem to some function that handles a pointer and on 
returning from the function the pointer is changed (I completely don't 
understand how is it possible that returning from a function can change 
the pointer unless there is some memory leak).

The thing is, when I print the pointer using printf instead of getting 8 
chars I get 12 chars.
The change that is done to the pointer is that the least 64 bits are set 
to 0 and the top 32 bits remain unchanged (which could make some sense 
if this memory was deallocated by some side effect that I don't see).
Furthermore, when I compare this pointer to 0 I get that it is not 0 
(and in my opinion this is what causes the program to crash).

Does this ring a bell to anyone?

Thanks,
Nir



More information about the Gcc-help mailing list