Issue 58180
Summary Static analyzer misses a Dead Initialization warning
Labels new issue
Assignees
Reporter dilyanpalauzov
    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 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to