[LLVMbugs] [Bug 18635] New: clang crashes in llvm::Module::getNamedValue on thread_local std::unique_ptr<int>

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 27 13:05:25 PST 2014


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

            Bug ID: 18635
           Summary: clang crashes in llvm::Module::getNamedValue on
                    thread_local std::unique_ptr<int>
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: robert at debian.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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
http://bugs.debian.org/ 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: 

********************

-- 
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/20140127/6ed6c042/attachment.html>


More information about the llvm-bugs mailing list