<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 - False positive when returning an inner pointer from malloc'ed block"
   href="https://bugs.llvm.org/show_bug.cgi?id=35729">35729</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positive when returning an inner pointer from malloc'ed block
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.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>Static Analyzer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>christopher.crouzet@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19594" name="attach_19594" title="main.c">attachment 19594</a> <a href="attachment.cgi?id=19594&action=edit" title="main.c">[details]</a></span>
main.c

Hello,

As suggested by the FAQ
(<a href="https://clang-analyzer.llvm.org/faq.html#suppress_issue">https://clang-analyzer.llvm.org/faq.html#suppress_issue</a>), I am here to report
what I (and Valgrind) believe is a false positive.

When implementing an aligned allocator, it is common to allocate a block and
return to the user only a different pointer located within the block, which
Clang Static Analyzer flags as a potential leak of memory.

Attached is a short code snippet that triggers the false positive.


Regards,
Christopher.</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>