Re: 96 bit pointer reset only the least 64 bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nir Piterman wrote:

> 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?

Your'e almost certainly looking at memory corruption.  Valgrind's memory
checker would be a good start.  Also, gdb supports watchpoints, so you
can see when the pointer is changed.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux