valgrind Error: Conditional jump or move depends on uninitialised value(s)
I have one program:
#include <stdio.h>
int call(){
int x=25;
++x;
return x;
}
int main(){
int p;
p=call();
printf("%d",p);
return 0;
}
When I compile the program with -g
option and run it with valgrind it shows:
==15469== 1 errors in context 1 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546F83: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E6CC: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 1 errors in context 2 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546E01: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E6CC: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 1 errors in context 3 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546D开发者_开发百科F9: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E6CC: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 1 errors in context 4 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546E01: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E7D9: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 1 errors in context 5 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546DF9: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E7D9: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 2 errors in context 6 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546F83: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E7D9: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 2 errors in context 7 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x547871: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E7D9: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469==
==15469== 4 errors in context 8 of 8:
==15469== Conditional jump or move depends on uninitialised value(s)
==15469== at 0x546F4D: _dl_relocate_object (in /lib/ld-2.12.90.so)
==15469== by 0x53E7D9: dl_main (in /lib/ld-2.12.90.so)
==15469== by 0x55094D: _dl_sysdep_start (in /lib/ld-2.12.90.so)
==15469== by 0x540222: _dl_start (in /lib/ld-2.12.90.so)
==15469== by 0x53B876: ??? (in /lib/ld-2.12.90.so)
==15469==
==15469== ERROR SUMMARY: 13 errors from 8 contexts (suppressed: 0 from 0)
I don't know why I am getting this error.
What does it mean?
How can they harm my program?
How can I remove them?
These are not from your code, but from /lib/ld-*.so
which is the dynamic library loader.
This is such a widely used piece of code that I can hardly imagine that it has such an obvious bug, so I think valgrind is giving you false positives. You can probably safely ignore them.
Though this is coming from system libraries and has nothing to do with your code (and looks harmless) ensure that you have correct .supp files in /usr/lib/valgrind
directory. Corresponding to your glibc version, there would be a section which suppresses such error messages:
#-------- glibc 2.3.4/ Fedora Core 3
{
dl_relocate_object
Memcheck:Cond
fun:_dl_relocate_object
}
Maybe you want to check your valgrind's installation.
精彩评论