Purify 在类/结构填充上的 Uninit Memory Read (UMR)
我遇到了使用 Purify 进行类/结构填充的相当烦人的副作用。例如,
struct something {
int field1;
char field2;
};
/* ... */
struct something smth, smth2;
smth.field1 = 1;
smth.field2 = 'A';
smth2 = smth;
最后一行很可能会触发 UMR 警告,指出已访问了 3 个字节的初始化内存。这显然是一个误报:结构的最后三个字节中没有用户数据,它只是一个填充。
通常,警告很快就会填满日志文件,从而很难看到其他真正的问题。
有人知道有什么方法可以抑制误报吗?
I experience quite annoying side-effect of class/structure padding with Purify. E.g.
struct something {
int field1;
char field2;
};
/* ... */
struct something smth, smth2;
smth.field1 = 1;
smth.field2 = 'A';
smth2 = smth;
The last line would highly likely trigger UMR warning saying that 3 bytes of initialized memory are accessed. This is obviously a false positive: there are no user data in the last three bytes of the struct, it's just a padding.
Often the warnings very very quickly fill up log files making it very hard to see the other, real problems.
Does anybody know any way to suppress the false positives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有 purify 的经验,但也许显式初始化第一个结构会删除此警告:
我假设您的结构具有块作用域(而不是文件)。如果它们具有文件范围,则隐式进行零初始化。
I have no experience with purify, but perhaps explicitly initialising the first struct removes this warning:
I assume your structs have block scope (not file). If they have file scope the zero initialising is implicit.