<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 "use of memory after it is freed" involving boost::shared_ptr, libstdc++"
href="http://llvm.org/bugs/show_bug.cgi?id=15987">15987</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>False positive "use of memory after it is freed" involving boost::shared_ptr, libstdc++
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>bugzilla@jwwalker.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>Overview:
The static analyzer claims that memory is used after it is freed when I create
a shared_ptr on the stack and push it onto a vector. This happens when using
libstdc++, not when using libc++.
Steps to reproduce:
Use the static analyzer on the following code, using libstdc++.
-------------------------------
#include <vector>
#include <boost/smart_ptr.hpp>
typedef boost::shared_ptr<int> sharedData;
typedef std::vector< sharedData > DataVec;
class SomeImp
{
public:
SomeImp() {}
~SomeImp() {}
private:
void Build();
DataVec mData;
};
void SomeImp::Build()
{
sharedData meshData( new int );
mData.push_back( meshData );
}
-------------------------------
Actual results:
warning: Use of memory after it is freed
Expected results:
No warning.
Build date:
clang version 3.4 (trunk 181711)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
Additional information:
I'm using Boost 1.51.0, if that matters. The whole command line looks like
this:
/opt/bin/clang -x c++ -arch i386 -stdlib=libstdc++ -isysroot
/Applications/Xcode_4.6.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-mmacosx-version-min=10.7 -I/Volumes/Home/Mercurial/boost_1_51_0 --analyze
/Volumes/Attic/Dependency/Testapp/Testapp/SharedPtr.cpp</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>