facebook / facebook/infer

UNINITIALIZED_VALUE - false positive C

Ouverte
#974 2 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
c false-positive
Langage dominant
OCaml
Étoiles
15.7k
Forks
2.1k
Merge moyen
19 h 36 min
PR mergées (30 j)
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
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.