gpt4 book ai didi

c - valgrind 错误 : Conditional jump or move depends on uninitialised value(s)

转载 作者:IT王子 更新时间:2023-10-29 01:24:42 26 4
gpt4 key购买 nike

我有一个程序:

#include <stdio.h>

int call(){
int x=25;
++x;
return x;
}

int main(){
int p;
p=call();
printf("%d",p);
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 会给你误报。您可以安全地忽略它们。

关于c - valgrind 错误 : Conditional jump or move depends on uninitialised value(s),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7791012/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com