[analyzer] Model initialization of const global variables without initialization expression in C
Open
clang:static analyzer
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
As @earnol discovered during discussing #199271, the following C code is not modelled properly by ClangSA.
```c
const int a[4] = {};
const int b[4];
int test() {
clang_analyzer_eval(a[0] == 0) // TRUE
clang_analyzer_eval(b[0] == 0) // should be TRUE, but currently is UNKNOWN
return 0;
}
```
In C, it is valid to have a const global variable without an initializer expression, and according to the language spec, it should be initialized to 0.
Contributor guide
Assessment
This issue has not been assessed yet.