<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - -Wundefined-bool-conversion not raised in all cases where optimization is applied"
   href="http://llvm.org/bugs/show_bug.cgi?id=21726">21726</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wundefined-bool-conversion not raised in all cases where optimization is applied
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>clang@martinien.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

in function indirect() below, no warning for the check of the address of the
reference is raised, but the check is still optimized out at -O1. This is a big
problem for codebases that have such constructs, since it can be hard to track
down the resulting errors at runtime. direct() raises the warning as expected.

int indirect()
{
    int a = 42;
    int &r = a;
    int *p = &r;
    if (p) // no warning!
        return 0;
    else
        return 1;
}

int direct()
{
    int a = 42;
    int &r = a;
    if (&r) // -Wundefined-bool-conversion
        return 0;
    else
        return 1;
}

Best regards,
Martin</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>