看我有一个程序 #include stdio.hint call(){ int x=25; ++x; return x; } int main(){ int ptr; ptr=call(); printf("%d",ptr); return 0;} 当我使用-g选项编译它时用valgrind运行它显示 ==15469== 1 errors in context 1 of 8:==154
#include <stdio.h> int call(){ int x=25; ++x; return x; } int main(){ int ptr; ptr=call(); printf("%d",ptr); return 0; }
当我使用-g选项&编译它时用valgrind运行它显示
==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 0x546DF9: _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)
我不知道为什么我收到这个错误?
这是什么意思 ?
我怎么能删除它?
他们怎么会伤害我的节目?
这些不是来自您的代码,而是来自/lib/ld-*.so,它是动态库加载器.这是一个广泛使用的代码片段,我很难想象它有如此明显的错误,所以我认为valgrind会给你误报.你可以安全地忽略它们.