Open Abramo-Bagnara opened 5 years ago
The typescript below shows the wrong warning and the proof it is wrong:
abramo@igor:/tmp$ cat p.c
void g() { printf("reached\n"); }
void f(int btn) { static int x = 0; if (btn == x) { if (btn != 0) { g(); } else { x = 2; } } }
abramo@igor:/tmp$ cat q.c extern void f(int); int main() { f(0); f(2); } abramo@igor:/tmp$ scan-build-8 -enable-checker alpha.deadcode.UnreachableCode gcc p.c q.c scan-build: Using '/usr/lib/llvm-8/bin/clang' for static analysis p.c:11:9: warning: This statement is never executed g(); ^ 1 warning generated. scan-build: 1 bug found. scan-build: Run 'scan-view /tmp/scan-build-2018-12-07-124451-16359-1' to examine bug reports. abramo@igor:/tmp$ ./a.out reached
assigned to @devincoughlin
Extended Description
The typescript below shows the wrong warning and the proof it is wrong:
abramo@igor:/tmp$ cat p.c
include
void g() { printf("reached\n"); }
void f(int btn) { static int x = 0; if (btn == x) { if (btn != 0) { g(); } else { x = 2; } } }
abramo@igor:/tmp$ cat q.c extern void f(int); int main() { f(0); f(2); } abramo@igor:/tmp$ scan-build-8 -enable-checker alpha.deadcode.UnreachableCode gcc p.c q.c scan-build: Using '/usr/lib/llvm-8/bin/clang' for static analysis p.c:11:9: warning: This statement is never executed g(); ^ 1 warning generated. scan-build: 1 bug found. scan-build: Run 'scan-view /tmp/scan-build-2018-12-07-124451-16359-1' to examine bug reports. abramo@igor:/tmp$ ./a.out reached