http://llvm.org/bugs/show_bug.cgi?id=15987
Bug ID: 15987
Summary: False positive "use of memory after it is freed"
involving boost::shared_ptr, libstdc++
Product: clang
Version: trunk
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs