facebook / facebook/infer

UNINITIALIZED_VALUE false positive in rax

未关闭
#1,317 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
false-positive
主要语言
OCaml
星标
15.7k
派生
2.1k
平均合并
19 小时 36 分钟
30 天内合并 PR
13

描述

I'm using Infer version v0.17.0 and it incorrectly reports a `UNINITIALIZED_VALUE` error.

The report from infer complains about [line 1206](https://github.com/antirez/rax/blob/master/rax.c#L1206):
```
rax.c:1206: error: UNINITIALIZED_VALUE
The value read from parent was never initialized.
Showing all 1 steps of the trace

rax.c:1206:17:
1204.
1205. /* Fix parent link. */
1206. > if (parent) {
1207. raxNode **parentlink = raxFindParentLink(parent,start);
1208. memcpy(parentlink,&new,sizeof(new));
```

However, it is definitely initialized by this loop:

https://github.com/antirez/rax/blob/23f31ca89c669841a4dc9dda73fe09aa6f014f28/rax.c#L1144-L1151

If we set parent to NULL in [line 1144](https://github.com/antirez/rax/blob/23f31ca89c669841a4dc9dda73fe09aa6f014f28/rax.c#L1144) the error is gone.

Please clone the repository and run `infer -- make` to reproduce.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。