Bug#755211: clang-3.4: clang parser segfaults with `thread_local std::unique_ptr' (C++11)

Jason Rhinelander jagerman at jagerman.com
Fri Jul 18 20:01:00 UTC 2014


Package: clang-3.4
Version: 1:3.4.2-4
Severity: normal

Dear Maintainer,

I encountered a segfault during compilation in my C++11 code and narrowed it
down to a combination of thread_local and std::unique_ptr.  The following
triggers the segfault (tested on current sid versions of clang-3.3, clang-3.4,
and clang-3.5):


#include <memory>
thread_local std::unique_ptr<int> p;
int main() {
    p = std::unique_ptr<int>(new int(42));
}


(Compile with -std=c++11).

I've tried changing the std::unique_ptr to a std::shared_ptr (or various other
types) and the segfault goes away.  Likewise, removing the thread_local also
avoids the segfault.

As requested in crash output, the output with backtrace, preprocessed source,
and associated run script are attached.


Jason Rhinelander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash.txt
Type: text/x-c
Size: 5375 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20140718/f714ff3a/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a-5fa414.cpp
Type: text/x-c
Size: 1719595 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20140718/f714ff3a/attachment-0003.bin>
-------------- next part --------------
 "/usr/lib/llvm-3.4/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name a.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24.51.20140604 -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-slp -x c++ a-5fa414.cpp


More information about the Pkg-llvm-team mailing list