<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - SEGV when swapping two std:function's at the same location"
href="https://llvm.org/bugs/show_bug.cgi?id=31489">31489</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SEGV when swapping two std:function's at the same location
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zonrxchg@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This can be reproduced easily with the following program and commannds:
$ cat a.cpp
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>
int main() {
std::function<void()> a = []() {};
std::swap(a, a);
return 0;
}
$ clang++ -ggdb -std=c++11 -o a a.cpp
$ ./a
Segmentation fault: 11
$ lldb ./a
(lldb) target create "./a"
Current executable set to './a' (x86_64).
(lldb) r
...
1780 __f_->__clone(__t);
1781 __f_->destroy();
1782 __f_ = 0;
-> 1783 __f.__f_->__clone((__base*)&__buf_);
1784 __f.__f_->destroy();
1785 __f.__f_ = 0;
1786 __f_ = (__base*)&__buf_;
Both Mac (Apple LLVM version 8.0.0) and Linux (LLVM/Clang 3.8.0 release) have
the same problem at the same line.</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>