[llvm-bugs] [Bug 31489] New: SEGV when swapping two std:function's at the same location

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 28 10:11:50 PST 2016


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

            Bug ID: 31489
           Summary: SEGV when swapping two std:function's at the same
                    location
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zonrxchg at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

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.

-- 
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/20161228/f3f8d692/attachment.html>


More information about the llvm-bugs mailing list