valgrind 抱怨 __mktime - 这是我的错吗?

发布于 2024-12-29 15:36:05 字数 906 浏览 2 评论 0原文

第一次(在我的新开发环境中)我看到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧伤慢歌 2025-01-05 15:36:05

对于遇到此问题的其他人...

该结构由 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文