<html>
    <head>
      <base href="https://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 --- - Multiple if / else if checks for NULL result in incorrect reporting of NULL dereference in final else"
   href="https://llvm.org/bugs/show_bug.cgi?id=27674">27674</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Multiple if / else if checks for NULL result in incorrect reporting of NULL dereference in final else
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mark.rogers@powermapper.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Reproduction code:

class Buffer
{
    void* m_pBuffer;
    size_t m_size;

    bool Equal( const Buffer& rhs)
    {
        if( !m_pBuffer && rhs.m_pBuffer )
        {
            // m_pBuffer is null
            return false;
        }
        else if( m_pBuffer && !rhs.m_pBuffer )
        {
            // rhs.m_pBuffer is null
            return false;
        }
        else
        {
            // neither argument is null but analyzer warns:
            // Null pointer argument in call to memory comparison functions
            int cmp = memcmp( m_pBuffer, rhs.m_pBuffer, std::min( m_size,
rhs.m_size ) );
            return cmp == 0;
        }
    }
};</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>