UNINITIALIZED_VALUE - false positive C
Open
c
false-positive
- Dominant language
- OCaml
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 19h 36m
- Merged PRs (30d)
- 13
Description
In the following minimal example, the `var` variable is initialized into a `while(true)`, however, Infer reports an UNINITIALIZED_VALUE. I checked this case with `if (true)`, `for ( ; ; )` and `while(1)` and Infer returns the same error.
```
int main(){
int var;
while(true){
var = 0;
if(var==0) break;
}
printf("Var:%d\n",var);
return 0;
}
```
This is the Infer's report:
```
Found 1 issue
while_true.c:12: error: UNINITIALIZED_VALUE
The value read from var was never initialized.
10. if(var==0) break;
11. }
12. > printf("Var:%d\n",var);
13. return 0;
14. }
Summary of the reports
UNINITIALIZED_VALUE: 1
```
Contributor guide
Assessment
This issue has not been assessed yet.