False positive UNINITIALIZED_VALUE in C
Open
c
false-positive
- Dominant language
- OCaml
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 19h 36m
- Merged PRs (30d)
- 13
Description
Infer (version v0.15.0) reports an UNINITIALIZED_VALUE when accessing an array item that was initialized:
```
main.c:10: error: UNINITIALIZED_VALUE
The value read from a[_] was never initialized.
8. a[i] = 0;
9. }
10. > printf("%c\n", a[3]);
11. return 0;
12. }
```
Case in point:
```c
#include
int main() {
unsigned len = 7;
char a[len];
unsigned i;
for (i = 0; i < len; ++i) {
a[i] = 65 + i;
}
printf("%c\n", a[3]);
return 0;
}
```
The same is true when `memset(a, 0, len);` is used to initialize `a`.
Contributor guide
Assessment
This issue has not been assessed yet.