[llvm-bugs] [Bug 39913] New: alpha.deadcode.UnreachableCode trivial false positive

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 7 03:47:48 PST 2018


            Bug ID: 39913
           Summary: alpha.deadcode.UnreachableCode trivial false positive
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: abramo.bagnara at bugseng.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

The typescript below shows the wrong warning and the proof it is wrong:

abramo at igor:/tmp$ cat p.c
#include <stdio.h>

void g() {

void f(int btn) {
    static int x = 0;
    if (btn == x) {
      if (btn != 0) {
      } else {
        x = 2;

abramo at igor:/tmp$ cat q.c
extern void f(int);
int main() {
abramo at 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
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 at igor:/tmp$ ./a.out

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181207/bbb5afcd/attachment.html>

More information about the llvm-bugs mailing list