valgrind抱怨__mktime-是我的错吗? [英] valgrind complaining about __mktime - is that my fault?

查看:100
本文介绍了valgrind抱怨__mktime-是我的错吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次(在我的新开发环境中),我看到valgrind抱怨mktime,但是我不确定这是libc库,valgrind还是我的代码中的错误.我将从下面的错误开始-这是足够的信息来解释原因吗?

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: ???

推荐答案

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

For anyone else who runs into this...

该结构由strptime填充,显然不填充未使用(dst)的结构成员...但是mktime不喜欢这样:),因此将其设置为零

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

这篇关于valgrind抱怨__mktime-是我的错吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆