[LLVMbugs] [Bug 16704] New: False positive for Logic Error on std::set_difference when using std::insert(std::set<>, std::set<>::iterator)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jul 25 02:22:22 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16704
Bug ID: 16704
Summary: False positive for Logic Error on std::set_difference
when using std::insert(std::set<>,
std::set<>::iterator)
Product: clang
Version: unspecified
Hardware: Macintosh
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: clang-bugzilla at cabbits.net
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Seen on XCode 4.6,
Apple clang version 4.0 (tags/Apple/clang-421.10.60) (based on LLVM 3.1svn)
The following code compiled in obj-c++ in a new XCode project OSX C++ Library
template (but seen using other templates as well):
std::set<int> set1 = {1, 2, 5, 7, 9};
std::set<int> set2 = {2, 3, 5, 8, 10};
std::set<int> set3;
std::set_difference(set1.begin(), set1.end(),
set2.begin(), set2.end(),
std::inserter(set3, set3.begin()));
Produces a logic error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:253:30:
Access to field '__is_black_' results in a dereference of a null pointer
(loaded from field '__parent_')
Trace:
/Users/nall/Desktop/TestLibrary/DemoClass.mm:21:3: Calling 'set_difference'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5209:1:
Entered call from 'TestSet'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5214:12:
Calling 'set_difference'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5193:1:
Entered call from 'set_difference'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5204:12:
Calling '__set_difference'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5168:1:
Entered call from 'set_difference'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5172:5:
Looping back to the head of the loop
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5172:5:
Looping back to the head of the loop
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5172:5:
Looping back to the head of the loop
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm:5178:13:
Calling 'operator='
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iterator:701:5:
Entered call from '__set_difference'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iterator:702:17:
Calling 'insert'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/set:533:5:
Entered call from 'operator='
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/set:535:17:
Calling '__insert_unique'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:1865:1:
Entered call from 'insert'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:1874:9:
Calling '__insert_node_at'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:1690:1:
Entered call from '__insert_unique'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:1701:5:
Calling '__tree_balance_after_insert'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:249:1:
Entered call from '__insert_node_at'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__tree:253:30:
Access to field '__is_black_' results in a dereference of a null pointer
(loaded from field '__parent_')
This does not occur when a std::vector<> or other containers are used with
std::inserter(). This appears to be a spurious warning, but I am not sure of
the proper resolution.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130725/7268b0f8/attachment.html>
More information about the llvm-bugs
mailing list