[llvm-bugs] [Bug 36967] New: Clang segfaults on brace-init of struct containing a struct with shared-ptr and a struct with implict ctor and C-Array

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 31 11:28:12 PDT 2018


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

            Bug ID: 36967
           Summary: Clang segfaults on brace-init of struct containing a
                    struct with shared-ptr and a struct with implict ctor
                    and C-Array
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oss at florianjw.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following code causes clang to crash on my system:


#include <memory>

struct a {
        std::shared_ptr<int> ptr;
};

struct b {
        b (int) {}
        int data[1];
};

struct c {
        a pk;
        b sk;
};

c fun(a x) { return {x, 0}; }

the stdlib I am using is libstdc++ 7.3.1 on arch-linux. I don't use any special
commandline-parameters, `clang++ -c main.cpp` is enough (maybe add `-std=c++11`
for `std::shared_ptr` though)

I skimmed over the open bugs with “segfault” in their description, but didn't
see anything that clearly makes this a duplicate.

I tried to remove the dependency to `std::shared_ptr` but at some point I lost
the nerve and decided getting rid of gmpxx was enough.

-- 
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/20180331/2fdc8327/attachment.html>


More information about the llvm-bugs mailing list