|
From: Jeroen N. W. <jn...@xs...> - 2004-08-17 22:50:25
|
Dear all,
When memchecking my C++ program SimpleExample with the CVS version of
valgrind, I get error:
==2241== Conditional jump or move depends on uninitialised value(s)
==2241== at 0x804FAB4: main (SimpleExample.cpp:240)
The relevant part of this source file SimpleExample.cpp is:
const unsigned int nFailed = speedy.getRunCount(Executor::Failed);
if (nFailed == 0) // <== line 240.
return 0;
else
return 1;
This seems to indicate that variable nFailed *is* initialised. The
corresponding part in the output of gdb command 'disassemble' is:
0x0804faa8 <main+566>: call 0x8051880
<_ZNK12UnitPlusPlus10TextRunner11getRunCountENS_8Executor5StateE>
0x0804faad <main+571>: mov %eax,0xffffffa4(%ebp)
0x0804fab0 <main+574>: cmpl $0x0,0xffffffa4(%ebp)
0x0804fab4 <main+578>: jne 0x804fad5 <main+611>
The expression 0xffffffa4(%ebp) adresses variable nFailed. This code was
generated by gcc version 3.3.4 (Debian 1:3.3.4-6sarge1). gcc version 3.2.2
20030222 (Red Hat Linux 3.2.2-5) generates essentially the same code, and
memchecking it with valgrind-2.1.0 results in the same error.
Can anybody tell me why I get this error?
Thanks in advance,
Jeroen.
|