[llvm-bugs] [Bug 28469] New: Segfault when assigning map of default-ctr'ed (int, function)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 8 08:41:09 PDT 2016


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

            Bug ID: 28469
           Summary: Segfault when assigning map of default-ctr'ed (int,
                    function)
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bbannier at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Assigning a non-empty map of (int, function) segfaults for me with
optimizations.

Reproducer:

    #include <functional>
    #include <map>

    struct F {
      std::map<int, std::function<void()>> m;
      F() { m[42] = []() {}; }
    };

    int main() {
      F f;
      f = F{};
    }

Gives:

    % clang++  -O2 --std=c++11 f.cpp && ./a.out
    [1]    12965 segmentation fault  ./a.out`

I would have expected this program to run to termination successfully.

I am using clang and libcxx tracking HEAD pretty closely,

    % clang++ --version
    clang version 3.9.0 (http://llvm.org/git/clang
8dd4631f9110e39089b89284ce3ddc476f75820e) (http://llvm.org/git/llvm
baa0bfe5d8f558f0785bd9e07d29d660461e291f)
    Target: x86_64-apple-darwin14.5.0
    Thread model: posix

My HEAD of libcxx is

    git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273840
91177308-0d34-0410-b5e6-96231b3b80d8

This program appears to terminate successfully with the following builds from
homebrew,

    % clang++-3.4 --version
    clang version 3.4.2 (tags/RELEASE_34/dot2-final)
    Target: x86_64-apple-darwin16.0.0
    Thread model: posix

    % clang++-3.6 --version
    clang version 3.6.2 (tags/RELEASE_362/final)
    Target: x86_64-apple-darwin16.0.0
    Thread model: posix

-- 
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/20160708/21082a7c/attachment.html>


More information about the llvm-bugs mailing list