I am using clang 4.0.0 static analyzer. In the following example
int fun(){
int aa = 1,bb = 0;
int cc = aa/bb;
int *pt = nullptr;
int a = *pt;
int b;
int c = a + b;
return cc;
}
The Clang static analyzer reports only two problems 1 and 3 and skips question 2.
If I changed the release order, like this
int fun(){
int *pt = nullptr;
int a = *pt;
int aa = 1,bb = 0;
int cc = aa/bb;
int b;
int c = a + b;
return cc;
}
then write static analysis reports 1 and 3 and skip 2.
I run the clang static analyzer with this command
clang-check.exe -analyze D: \ testsrc \ anothercpp.cpp
This is a very controversial behavior. Regardless of the order in which problems arise, one of the questions is skipped. In addition, I tested this script with clang 5.0.1 only to get the same results.
Does anyone know why this is happening with a static analyzer?
Thanks in advance.
-Hemant