<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - alpha.deadcode.UnreachableCode trivial false positive"
   href="https://bugs.llvm.org/show_bug.cgi?id=39913">39913</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>alpha.deadcode.UnreachableCode trivial false positive
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>abramo.bagnara@bugseng.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The typescript below shows the wrong warning and the proof it is wrong:

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

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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>