<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 - SmallVector use-after-dtor"
href="https://bugs.llvm.org/show_bug.cgi?id=34595">34595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SmallVector use-after-dtor
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Support Libraries
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mascasa@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Use-after-dtor occurs for SmallVectors with more than one inline element.
While the first inline element is stored in SmallVectorTemplateCommon::FirstEl,
subsequent inline elements are stored in SmallVector::Storage.
When using -fsanitize-use-after-dtor, calling ~SmallVector() results in
SmallVector::Storage being poisoned and ~SmallVectorImpl() being called. But
~SmallVectorImpl() then calls destroy_range(), which attempts to call the
destructors of the elements in SmallVector::Storage. Those destructors then
trigger use-after-dtor reports.
Simple example:
SmallVector<std::string, 4u> vec;
vec.push_back("a");
vec.push_back("b");
vec.push_back("c");
~SmallVector(); // use-after-dtor triggered in ~string()
If we want to enable -fsanitize-use-after-dtor as a part of MSan, we will need
to either annotate ~SmallVector() to disable MSan checking or fix the
implementation of SmallVector.</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>