valgrind 抱怨 __mktime - 这是我的错吗?
第一次(在我的新开发环境中)我看到 valgrind 抱怨 mktime,但我不确定这是否是 libc 库、valgrind 或我的代码中的错误。我将从错误开始(如下) - 这些信息足以解释原因吗?
==3682== at 0x38ACE9A505: __mktime_internal (in /lib64/libc-2.12.so)
==3682== by 0x4D66F7: ???
==3682== by 0x4D7611: ???
==3682== by 0x4D23CD: ???
==3682== by 0x4D175B: ???
==3682== by 0x38ACE1ECDC: (below main) (in /lib64/libc-2.12.so)
==3682== Uninitialised value was created by a stack allocation
==3682== at 0x4D64BE: ???
==3682==
==3682== Conditional jump or move depends on uninitialised value(s)
==3682== at 0x38ACE9A505: __mktime_internal (in /lib64/libc-2.12.so)
==3682== by 0x4D67DA: ???
==3682== by 0x4D7611: ???
==3682== by 0x4D23CD: ???
==3682== by 0x4D175B: ???
==3682== by 0x38ACE1ECDC: (below main) (in /lib64/libc-2.12.so)
==3682== Uninitialised value was created by a stack allocation
==3682== at 0x4D64BE: ???
For the first time (in my new dev environment) I'm seeing valgrind complain about mktime, but I'm not sure if this is a bug in the libc library, valgrind, or my code. I'll start with the error (below) - is this enough info to explain the cause?
==3682== at 0x38ACE9A505: __mktime_internal (in /lib64/libc-2.12.so)
==3682== by 0x4D66F7: ???
==3682== by 0x4D7611: ???
==3682== by 0x4D23CD: ???
==3682== by 0x4D175B: ???
==3682== by 0x38ACE1ECDC: (below main) (in /lib64/libc-2.12.so)
==3682== Uninitialised value was created by a stack allocation
==3682== at 0x4D64BE: ???
==3682==
==3682== Conditional jump or move depends on uninitialised value(s)
==3682== at 0x38ACE9A505: __mktime_internal (in /lib64/libc-2.12.so)
==3682== by 0x4D67DA: ???
==3682== by 0x4D7611: ???
==3682== by 0x4D23CD: ???
==3682== by 0x4D175B: ???
==3682== by 0x38ACE1ECDC: (below main) (in /lib64/libc-2.12.so)
==3682== Uninitialised value was created by a stack allocation
==3682== at 0x4D64BE: ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于遇到此问题的其他人...
该结构由 strptime 填充,它显然不会填充未使用的结构成员(dst)...但 mktime 不喜欢这样:)所以将其设置为零
For anyone else who runs into this...
The struct was filled by strptime, which apparently doesn't fill in struct members that aren't used (dst)...but mktime doesn't like this :) so memset it to zero