<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 --- - false positive smartptr release (unique_ptr) in std::<memory>"
href="http://llvm.org/bugs/show_bug.cgi?id=21333">21333</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>false positive smartptr release (unique_ptr) in std::<memory>
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stevemac321@live.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Not sure anything can be done about this. If there exists guidance for what
constitutes a false positive, it would be great if someone could point it to
me. I am running scan-build against libc++ and do not want to spam the bug
database.
Anyway, scan-build flags this:
libcxx/include/memory:2622:9: warning: Use of memory after it is freed
return __t;
^~~~~~~~~~
The code looks like this:
_LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
{
pointer __t = __ptr_.first();
__ptr_.first() = pointer();
return __t;
}
It is a reasonable pattern, MSVC STL does basically the same thing. The
standard says this:
20.8.1.2.5 N3797 [unique.ptr.single.modifiers]
pointer release() noexcept;
1 Postcondition: get() == nullptr.
2 Returns: The value get() had at the start of the call to release.
My env:
clang version 3.6.0 (trunk 217475)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>