https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109190
Bug ID: 109190
Summary: GCC Static Analyzer cannot handle the initialization
of an array with a for loop
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: geoffreydgr at icloud dot com
Target Milestone: ---
I got a false negative error when compiling the following program with
gcc(trunk) -fanalyzer -O0 in https://godbolt.org/z/KvoxvPq5c. When I replace
the array `m` with the variable `a` (https://godbolt.org/z/jTzo9bEo9), the NPD
appears.
```c
#include "stdio.h"
int main() {
int i = 0;
int *g = &i;
int m[1];
for (int j = 0; j < 1; j++) {
m[j] = 0;
}
if (m[0])
;
else
g = m[i];
printf("NPD_FLAG\n");
*g = 1;
}
```