<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 - Warning inconsistently reported on dead code"
   href="https://bugs.llvm.org/show_bug.cgi?id=39938">39938</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Warning inconsistently reported on dead code
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>7.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>serge.guelton@telecom-bretagne.eu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When compiled with -Wall, the following code reports a warning only on the live
path, as showcased in <a href="https://godbolt.org/z/3PD-eF">https://godbolt.org/z/3PD-eF</a>

int case0(int num) {
    if(0)
        return num / 0; << no warning
    else
        return 1;
}
int case1(int num) {
    if(num)
        return num / 0; << warning
    else
        return 1;
}


Yet, when the following code is compiled with -Wall -Wdouble-conversion, we
have a warning even in the dead path, as showcased in
<a href="https://godbolt.org/z/58Q5oA">https://godbolt.org/z/58Q5oA</a>


double foo(double);

int case0(float num) {
    if(0)
        return foo(num); << warning
    else
        return 1;
}
int case1(float num) {
    if(num)
        return foo(num); << warning
    else
        return 1;
}</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>