<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58180>58180</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Static analyzer misses a Dead Initialization warning
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dilyanpalauzov
</td>
</tr>
</table>
<pre>
For a.c:
```c
#include <stdio.h>
int z(int y) {
int i = 0;
if (y == 2)
i = 3;
else
i = 4;
return i;
}
int main() {
printf("%i %i\n", z(2), z(3));
return 0;
}
```
the static analyzer shall report on `int i = 0;` - Dead initialization, the value stored here in `i` is never read, but it does not. I use clang 15.0.1 and then call:
> CodeChecker log -b 'cc a.c -o a' --output ./compile_commands.json
> CodeChecker analyze ./compile_commands.json --output ./reports
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1Uttu4yAQ_Rr8MoqF7_aDH9qkkfq8H7AigG26BCzAqZKv38FJNm3UlRAwnJkzh6M5WHHu99YBSzkpXgjdEfpCanpd_BbnhTJcL0ICKbY-CGXTiRRvN3TdlQlwIXkbzzPJOyDN6xUBiG8KS3dASfF4HQDzz_E9QjkW3SG4pRdf0qX28hkv_-F3xMmwOAPqATS7Z5lHpgx2fhI5O8SG9R2lVNgAN1JtzRpv18-tGm_3Yr13XxTeetMfet8NvYZhkuADC4oDM0yfL9KBn5jWSDFbF8AawOQn22oKG9hJJtBPFRTT6oIU1kRBkfHE9BJ5rZMCJukk5q00sVJ5MPKEfRwSxIrDguQBhJWI2JACvMPiJXDNzAhZldI0Q3UiUhvgKO4xHsUbbK2Q20nyP0ip7QibA_rVcB7nCDYWGEaw2dglzNgoJfme2-OstPyN5xF5ffrhUfuPhDdT_l_2nflqmodE9lldV7Qs87ZJRF-IruhYElTQsv_15PdReY9fZ1dH3785Cp_MGWXGZHG6n0KYffx7vsc1qjAthxTVYKD16X5sZmc_JA8YIvEiPV6qNmtpMqGooeokbdpy4HU2UC5E2XVtlrdt2dV1l2h2wOnuSfWKs2bkJ6wUce6qXaL6nOZ5RmlNI1-TtoI1tGrpMGRNVXYVKanEkdZp1JFaNyauXyUdltEjqJUP_gEy79VopFzbIT9bwmRdL5Q-MzMzzZaLPSWrgn79wV9JTzao">