Reputation: 81
I am getting many errors with valgrind saying "Conditional jump or move depends on uninitialized value(s)".
Below is the one of the blocks. All of them are similar:
vasm_sourceline_info_t* line = asmState->firstLine;
if (line == NULL) return;
while ((line = line->next) != NULL)
{
printf ("[%s(%i)] %s\n", line->fileName, line->lineNumber, line->data);
}
The error itself is on the while() line. vasm_sourceline_info
is a doubly linked list structure. The code ~works~ but this error is worrying. Is there something else in code stomping on memory, or is the above function flawed in some way?
Upvotes: 8
Views: 29275
Reputation: 118500
Compile with optimizations OFF (-O0
). Run valgrind with --track-origins=yes
to determine the source of the errors. See here for more.
Upvotes: 14
Reputation: 370142
There's nothing wrong with the code per se, but if one of the lines' next
field has not been initialized (presumably the last line's next
field), that would explain the message.
Upvotes: 6