[LLVMbugs] [Bug 17468] New: Segmentation fault while constructing std::function from "bind" object

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 3 11:24:08 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17468

            Bug ID: 17468
           Summary: Segmentation fault while constructing std::function
                    from "bind" object
           Product: new-bugs
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: andrey.goryachev at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This program crashes with segmentation fault on line "std::function<void()>
c3(c2);":
#include <functional>

void
func(int) {
    // pass
}

int
main() {
    std::function<void(int)> c1(&func);
    auto c2 = std::bind(c1, 5);
    std::function<void()> c3(c2);

    return 0;
}

I compile it with command "clang++ -std=c++0x -stdlib=libc++ -o test main.cpp"
and then just run "./test".

I have following software:
1) Mac OS X 10.8.5,
2) Command Line Tools 5.0.0.0.1.1377666378,
3) clang:
   Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
   Target: x86_64-apple-darwin12.5.0
   Thread model: posix

Also i tried to run it under gdb and got following infinite recursion:
...
#6348 0x00000001000043e3 in
_ZNSt3__18functionIFviEEC2INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6349 0x0000000100003a5d in
_ZNSt3__18functionIFviEEC1INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6350 0x00000001000043e3 in
_ZNSt3__18functionIFviEEC2INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6351 0x0000000100003a5d in
_ZNSt3__18functionIFviEEC1INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6352 0x0000000100001ea4 in
_ZNSt3__18functionIFvvEEC2INS_6__bindIRNS0_IFviEEEJiEEEEET_PNS_9enable_ifIXsr10__callableIS9_EE5valueEvE4typeE
()
#6353 0x000000010000145d in
_ZNSt3__18functionIFvvEEC1INS_6__bindIRNS0_IFviEEEJiEEEEET_PNS_9enable_ifIXsr10__callableIS9_EE5valueEvE4typeE
()
#6354 0x000000010000131d in main ()

-- 
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/20131003/0dd6e027/attachment.html>


More information about the llvm-bugs mailing list