<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - msan false positive on std::set destructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=39378">39378</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>msan false positive on std::set destructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </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>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>skvadrik@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21024" name="attach_21024" title="full preprocessed file that triggers msan error">attachment 21024</a> <a href="attachment.cgi?id=21024&action=edit" title="full preprocessed file that triggers msan error">[details]</a></span>
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).</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>