[llvm-bugs] [Bug 39378] New: msan false positive on std::set destructor

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 22 06:57:12 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39378

            Bug ID: 39378
           Summary: msan false positive on std::set destructor
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: skvadrik at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 21024
  --> https://bugs.llvm.org/attachment.cgi?id=21024&action=edit
full preprocessed file that triggers msan error

Consider the following harmless code:


$ cat a.cpp
#include <set>

int main()
{
    std::set<int> s;
    s.insert (0);
    return 0;
}


Memory sanitizer emits an error on it:


$ clang++ -Wall -fsanitize=memory a.cpp -o a -g && ./a
==24666==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x494e6b in std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>,
std::allocator<int> >::_M_erase(std::_Rb_tree_node<int>*)
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_tree.h:1870:7
    #1 0x494eff in std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>,
std::allocator<int> >::_M_erase(std::_Rb_tree_node<int>*)
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_tree.h:1872:4
    #2 0x494c64 in std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>,
std::allocator<int> >::~_Rb_tree()
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_tree.h:965:9
    #3 0x494721 in std::set<int, std::less<int>, std::allocator<int> >::~set()
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_set.h:281:22
    #4 0x49445b in main /home/ulya/a.cpp:8:1
    #5 0x7f7781dcef09 in __libc_start_main
/usr/src/debug/sys-libs/glibc-2.26-r7/glibc-2.26/csu/../csu/libc-start.c:308
    #6 0x41b679 in _start (/home/ulya/a+0x41b679)

SUMMARY: MemorySanitizer: use-of-uninitialized-value
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_tree.h:1870:7 in
std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>,
std::allocator<int> >::_M_erase(std::_Rb_tree_node<int>*)
Exiting


I'm attaching the preprocessed version of the file (it triggers the same error)
with the inlined header for std::set (it comes from GCC, as the paths show).

-- 
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/20181022/6a1624a1/attachment.html>


More information about the llvm-bugs mailing list