<div dir="ltr">Hi All,<div><br></div><div>Given the following code:</div><div><br></div><div>// test.cpp</div><div>int foo(int len) {</div><div>    int j = 0;</div><div>    if (len < 10)</div><div>        j = 42 / j;</div><div>    return j;</div><div>}</div><div><br></div><div>the command</div><div><br></div><div>clang --analyze test.cpp</div><div><br></div><div>issues the bug report</div><div><br></div><div><div>tu.cpp:6:10: warning: Division by zero</div><div>                j = 42 / j;</div><div>                    ~~~^~~</div></div><div><br></div><div>However, it seems that merely introducing another function which calls foo() with an argument that would not trigger a division by zero nullifies the bug report. For instance, analyzing</div><div><br></div><div><div>// test.cpp</div><div>int foo(int len) {</div><div>    int j = 0;</div><div>    if (len < 10)</div><div>        j = 42 / j;</div><div>    return j;</div><div>}</div></div><div><br></div><div>void bar() {</div><div>    int m = 12;</div><div>    foo(m);</div><div>}</div><div><br></div><div>in the same way will NOT issue a bug report. Isn't this a bug in the static analyzer?</div><div><br></div><div>Note: I tested this with clang 3.7.0 and 3.8.0.</div><div><br></div><div>~Scott Constable</div></div>