facebook / facebook/infer

False Negative UNINITIALIZED_VALUE?

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

描述

Please include the following information:
- [x] The version of infer from `infer --version`.
```shell
$ infer --version
Infer version v1.0.0-03b330214
```

- [x] Your operating system and version, for example "Debian 9", "MacOS High Sierra", whether you are using Docker, etc.
```shell
Red Hat Enterprise Linux Server release 7.6
```

- [x] Which command you ran, for example `infer -- make`.
```shell
infer run -- gcc -c
```

- [x] The full output in a paste, for instance a [gist](https://gist.github.com/).
* Infer correctly flaged `entity_5` in `while`. However, it thought `2.c` is ok
```c
$ cat 1.c
main ( )
{
char entity_3 [ 61 ] ;
int entity_5 ;
while(entity_5)
entity_3 [ entity_5 ] = 1;
}
```
```shell
$ infer run -- gcc -c 1.c
Capturing in make/cc mode...
Found 1 source file to analyze in /u/zhengyu/tests/infer-out
1/1 [######################################################################] 100% 173ms

1.c:5: error: Uninitialized Value
The value read from entity_5 was never initialized.
3. char entity_3 [ 61 ] ;
4. int entity_5 ;
5. while(entity_5)
^
6. entity_3 [ entity_5 ] = 1;
7. }

Found 1 issue
Issue Type(ISSUED_TYPE_ID): #
Uninitialized Value(UNINITIALIZED_VALUE): 1
```
---

```c
$ cat 2.c
main ( )
{
char entity_3 [ 61 ] ;
int entity_5 ;
entity_3 [ entity_5 ] = 1; // "entity_5" is not initialized, right?
}
```

```shell
$ infer run -- gcc -c 2.c
Capturing in make/cc mode...
Found 1 source file to analyze in /u/zhengyu/tests/infer-out
1/1 [######################################################################] 100% 135ms
No issues found
```

- [x] If possible, a minimal example to reproduce your problem (for instance, some code where
infer reports incorrectly, together with the way you run infer to reproduce the incorrect
report).
* One example the pair `1.c` and `2.c` above
* Another example: infer correctly flaged `3.c` but thought `4.c` and `5.c` are ok
```c
$cat 3.c
main ( )
{
char entity_3 [ 61 ] ;
int entity_5 ;
for(;entity_5;)
entity_3 [ entity_5 ] = 1;
}
```
```shell
$infer run -- gcc -c 3.c
Capturing in make/cc mode...
Found 1 source file to analyze in /u/zhengyu/tests/infer-out
1/1 [######################################################################] 100% 196ms

3.c:5: error: Uninitialized Value
The value read from entity_5 was never initialized.
3. char entity_3 [ 61 ] ;
4. int entity_5 ;
5. for(;entity_5;)
^
6. entity_3 [ entity_5 ] = 1;
7. }

Found 1 issue
Issue Type(ISSUED_TYPE_ID): #
Uninitialized Value(UNINITIALIZED_VALUE): 1
````
----

```c
$ cat 4.c
main ( )
{
char entity_3 [ 61 ] ;
int entity_5 ;
for(entity_5;;)
entity_3 [ entity_5 ] = 1;
}
```

```shell
$ infer run -- gcc -c 4.c
Capturing in make/cc mode...
Found 1 source file to analyze in /u/zhengyu/tests/infer-out
1/1 [######################################################################] 100% 173ms
No issues found
```
---

```c
$ cat 5.c
main ( )
{
char entity_3 [ 61 ] ;
int entity_5 ;
for(;;entity_5)
entity_3 [ entity_5 ] = 1;
}

```

```shell
$ infer run -- gcc -c 5.c
Capturing in make/cc mode...
Found 1 source file to analyze in /u/zhengyu/tests/infer-out
1/1 [######################################################################] 100% 199ms
No issues found
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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