I’ve got a function
void* fn( void* ptr ){...}
that I am using as the starting method in a pthread. Somewhere in the function, I get an error where ptr (usually pointing to a struct) changes from its original value to 0x100000000000000 ( from printf("%p") ), although nowhere in the function fn is it being assigned to, I am only reading its values like ptr->value. Any ideas?
It could be a buffer overflow in a called function.
Assuming a Linux system, I usually debug such bugs with GDB hardware watchpoints.
You could also run your program thru
valgrind.