[LLVMbugs] [Bug 19052] New: clang 3.4 and trunk segfaults on lambda which uses static object of sorrounding function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 4 22:39:50 PST 2014


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

            Bug ID: 19052
           Summary: clang 3.4 and trunk segfaults on lambda which uses
                    static object of sorrounding function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++1y
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michael.haidl at uni-muenster.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12191
  --> http://llvm.org/bugs/attachment.cgi?id=12191&action=edit
source that crashes clang

When a lambda is returned from a function which includes a static object, and
the lambda is using this static object clang 3.4 final and 3.5 trunk segfault.
Files are attached. 

clang: CGExpr.cpp:1795: clang::CodeGen::LValue
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr *):
Assertion `isa<BlockDecl>(CurCodeDecl) && E->refersToEnclosingLocal()' failed.
0  clang           0x0000000002366835 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x0000000002367023
2  libpthread.so.0 0x00007fb3163cfcb0
3  libc.so.6       0x00007fb3151f1425 gsignal + 53
4  libc.so.6       0x00007fb3151f4b8b abort + 379
5  libc.so.6       0x00007fb3151ea0ee
6  libc.so.6       0x00007fb3151ea192
7  clang           0x000000000095d1c9
8  clang           0x0000000000954b82
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 706
9  clang           0x000000000095afbc
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind) + 108
10 clang           0x000000000098bfc2
11 clang           0x000000000098ffda
12 clang           0x00000000009887bd
13 clang           0x0000000000991af8
14 clang           0x0000000000989044
15 clang           0x0000000000980140
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 96
16 clang           0x00000000008a41ba
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) + 922
17 clang           0x00000000008a1d91
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 865
18 clang           0x00000000008a942b
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 91
19 clang           0x00000000008b6bed
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 93
20 clang           0x00000000008b7038
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1032
21 clang           0x00000000008c325c
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 828
22 clang           0x00000000008c07e6
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 310
23 clang           0x00000000008bd34e
clang::CodeGen::CodeGenModule::EmitDeferred() + 46
24 clang           0x00000000008bd16d clang::CodeGen::CodeGenModule::Release()
+ 13
25 clang           0x0000000000871940
26 clang           0x00000000009ff0f3 clang::ParseAST(clang::Sema&, bool, bool)
+ 515
27 clang           0x00000000008709be clang::CodeGenAction::ExecuteAction() +
142
28 clang           0x00000000006cf9a0 clang::FrontendAction::Execute() + 112
29 clang           0x00000000006ac35d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 925
30 clang           0x00000000006929e0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2896
31 clang           0x000000000068a5b4 cc1_main(char const**, char const**, char
const*, void*) + 692
32 clang           0x000000000068f177 main + 3431
33 libc.so.6       0x00007fb3151dc76d __libc_start_main + 237
34 clang           0x000000000068a21d
Stack dump:
0.      Program arguments: /data/home/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
lambda.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.22 -resource-dir
/data/home/local/bin/../lib/clang/3.5 -internal-isystem
/home/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include/c++/4.8.2
-internal-isystem
/home/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include/c++/4.8.2/x86_64-unknown-linux-gnu
-internal-isystem
/home/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include/c++/4.8.2/backward
-internal-isystem
/home/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include/x86_64-unknown-linux-gnu/c++/4.8.2
-internal-isystem /usr/local/include -internal-isystem
/data/home/local/bin/../lib/clang/3.5/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++1y -fdeprecated-macro
-fdebug-compilation-dir /home/-ferror-limit 19 -fmessage-length 132
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o
/tmp/lambda-0d6170.o -x c++ /home/lambda.cpp
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      /home/lambda.cpp:4:9: Generating code for declaration
'foo()::<anonymous class>::operator()'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5 (200834)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ 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/lambda-fb2982.cpp
clang: note: diagnostic msg: /tmp/lambda-fb2982.sh
clang: note: diagnostic msg:

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


0  clang           0x0000000001d8b7f5 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x0000000001d8bc33
2  libpthread.so.0 0x00007fe162c6ccb0
3  clang           0x000000000089b911
clang::CodeGen::CodeGenFunction::GetAddrOfBlockDecl(clang::VarDecl const*,
bool) + 33
4  clang           0x00000000008d2cc1
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
2353
5  clang           0x00000000008cbb09
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 441
6  clang           0x00000000008d0cd0
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind) + 96
7  clang           0x00000000008fbcf1
8  clang           0x00000000008fd14a
9  clang           0x00000000008f5d0a
10 clang           0x00000000008f640b
11 clang           0x00000000008eeed9
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 73
12 clang           0x0000000000840869
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) +
1065
13 clang           0x000000000083eab1
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 481
14 clang           0x0000000000844f9b
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 91
15 clang           0x000000000084efe5
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 933
16 clang           0x0000000000858925
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 613
17 clang           0x00000000008562c4
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 324
18 clang           0x00000000008530db
clang::CodeGen::CodeGenModule::EmitDeferred() + 27
19 clang           0x0000000000852f0d clang::CodeGen::CodeGenModule::Release()
+ 13
20 clang           0x000000000081a08d
21 clang           0x00000000009669e3 clang::ParseAST(clang::Sema&, bool, bool)
+ 515
22 clang           0x0000000000819509 clang::CodeGenAction::ExecuteAction() +
73
23 clang           0x00000000006b0b61 clang::FrontendAction::Execute() + 81
24 clang           0x000000000068fa5d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 797
25 clang           0x000000000067a06d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2877
26 clang           0x0000000000672c9e cc1_main(char const**, char const**, char
const*, void*) + 654
27 clang           0x000000000067857a main + 8314
28 libc.so.6       0x00007fe161a7976d __libc_start_main + 237
29 clang           0x000000000067294d
Stack dump:
0.      Program arguments: /data/home/clang34/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name lambda.cpp -mrelocation-model static
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.22 -resource-dir
/data/home/clang34/bin/../lib/clang/3.4 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
/data/home/clang34/bin/../lib/clang/3.4/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++1y -fdeprecated-macro
-fdebug-compilation-dir /home -ferror-limit 19 -fmessage-length 132
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o
/tmp/lambda-67c6dc.o -x c++ /home/lambda.cpp
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      /home/the_user/lambda.cpp:4:9: Generating code for declaration
'foo()::<anonymous class>::operator()'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ 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/lambda-6ce57f.cpp
clang: note: diagnostic msg: /tmp/lambda-6ce57f.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/20140305/822e5986/attachment.html>


More information about the llvm-bugs mailing list