Reading a variable messes it up?!?!
Posted
by EpsilonVector
on Stack Overflow
See other posts from Stack Overflow
or by EpsilonVector
Published on 2010-05-21T12:16:39Z
Indexed on
2010/05/21
12:40 UTC
Read the original article
Hit count: 175
We have the following line of code:
printf("%d\n", toc->runlist.next);
printf("%d\n", toc->runlist.next);
These are the definitions:
typedef struct thread_overview_control{
int id[NR_UTHREADS];
list_t runlist;
int active_counter;
int main_thread;
int need_resched;
} thread_overview_control;
thread_overview_control* toc;
What I'm trying to do is implement user threads. For some reason the output of the above code at the point where our test run crushes is:
12345678 //some address
0 //NOW IT'S NULL?!?!?!
How can this happen?? All we do is read a variable. And the strange thing is, without printf's there are no crashes. What's going on?
© Stack Overflow or respective owner