<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang crashes in llvm::Module::getNamedValue on thread_local std::unique_ptr<int>"
   href="http://llvm.org/bugs/show_bug.cgi?id=18635">18635</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes in llvm::Module::getNamedValue on thread_local std::unique_ptr<int>
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>robert@debian.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code:
 #include <memory>

 thread_local std::unique_ptr<int> x;
 void test()
 {
   x = std::unique_ptr<int>(new int(5));
 }

causes `clang++ -c --std=c11' to crash with:

0  libLLVM-3.4.so.1 0xb6d1d2ef llvm::sys::PrintStackTrace(_IO_FILE*) + 47
1  libLLVM-3.4.so.1 0xb6d1d54f
2  libLLVM-3.4.so.1 0xb6d1d0ce
3  linux-gate.so.1  0xb77ba400 __kernel_sigreturn + 0
4  libLLVM-3.4.so.1 0xb66263f4 llvm::Module::getNamedValue(llvm::StringRef)
const + 20
5  clang            0x08493d3d
6  clang            0x08493ec1
7  clang            0x0850d998
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
1368
8  clang            0x08511d78
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 376
9  clang            0x085257a3
clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(clang::CXXOperatorCallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot) + 67
10 clang            0x08515845
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) + 613
11 clang            0x08515aab
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*) +
59
12 clang            0x08511dc0
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 448
13 clang            0x08511d52
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 338
14 clang            0x085125a2
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 50
15 clang            0x08457f1f
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 95
16 clang            0x084581c2
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 82
17 clang            0x08463308
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 104
18 clang            0x08468273
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 499
19 clang            0x08476340
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 464
20 clang            0x08476e80
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 304
21 clang            0x08479b77
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1351
22 clang            0x0847a424
23 clang            0x0841b60f
24 clang            0x0841aab3
25 clang            0x085ab514 clang::ParseAST(clang::Sema&, bool, bool) + 340
26 clang            0x0829eb0f clang::ASTFrontendAction::ExecuteAction() + 127
27 clang            0x08419ba1 clang::CodeGenAction::ExecuteAction() + 33
28 clang            0x0829f25a clang::FrontendAction::Execute() + 170
29 clang            0x0827975a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 266
30 clang            0x08262fd6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1606
31 clang            0x0825e656 cc1_main(char const**, char const**, char
const*, void*) + 1222
32 clang            0x0825cb60 main + 7856
33 libc.so.6        0xb5ab58c5 __libc_start_main + 245
34 clang            0x0825d5b1
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple i386-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
test.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.24 -coverage-file /tmp/test.o -resource-dir
/usr/bin/../lib/clang/3.4 -internal-isystem /usr/include//c++/4.8
-internal-isystem /usr/include//c++/4.8/i386-linux-gnu -internal-isystem
/usr/include//c++/4.8/backward -internal-isystem
/usr/include//i386-linux-gnu/c++/4.8 -internal-isystem
/usr/bin/../lib/gcc/i486-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/i486-linux-gnu/4.8/../../../../include/c++/4.8/i486-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/i486-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/i486-linux-gnu/4.8/../../../../include/i486-linux-gnu/c++/4.8
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.4/include -internal-externc-isystem
/usr/bin/../lib/gcc/i486-linux-gnu/4.8/include -internal-externc-isystem
/usr/include/i386-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include --std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 106
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o test.o -x c++
./test.cpp 
1.    <eof> parser at end of file
2.    ./test.cpp:4:6: LLVM IR generation of declaration 'test'
3.    ./test.cpp:4:6: Generating code for declaration 'test'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Debian clang version 3.4-1 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: i386-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://bugs.debian.org/">http://bugs.debian.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/user/1000/test-3e18f7.cpp
clang: note: diagnostic msg: /tmp/user/1000/test-3e18f7.sh
clang: note: diagnostic msg: 

********************</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>