facebook / facebook/infer

UNINITIALIZED_VALUE false positive in rax

Open
#1,317 0 comments 0 reactions 0 assignees View on GitHub
false-positive
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.