[LLVMbugs] [Bug 18282] New: When converting std::bind to a std::function, we enter an infinite loop causing a segmentation fault.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 19 08:01:26 PST 2013


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

            Bug ID: 18282
           Summary: When converting std::bind to a std::function, we enter
                    an infinite loop causing a segmentation fault.
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: william at lynch.us
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code was posted to stackoverflow giving a segmentation fault with
libc++.


    #include <functional>

    int main() {
        std::function<void(int)> function = [](int) {};
        auto binding = std::bind(function, 10);
        std::function<void()> jobFunctor = binding; // crashes here with
EXC_BAD_ACCESS
    }

>From looking at gdb, it appears that the last line causes an infinite loop of
calls within std::bind until we run out of room on the stack, causing the
crash.

-- 
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/20131219/c9f25281/attachment.html>


More information about the llvm-bugs mailing list