[LLVMbugs] [Bug 14773] New: segmentation fault with C++11 by use of local-static array in lambda (3.3 trunk 171341)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 1 14:21:33 PST 2013


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

             Bug #: 14773
           Summary: segmentation fault with C++11 by use of local-static
                    array in lambda (3.3 trunk 171341)
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: td2sk.develop at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9789
  --> http://llvm.org/bugs/attachment.cgi?id=9789
plain and processed sources

Use of local-static array in lambda causes abort.


#include <functional>

int main(){
  static int array[] = {};

  std::function<void()> func;
  func = [](){
    for(auto i : array){
    }
  };
  return 0;
}


0  clang           0x0000000001af1f6f
1  clang           0x0000000001af22d9
2  libpthread.so.0 0x00007fbbc446bcb0
3  clang           0x0000000001a10074
llvm::ConstantExpr::getBitCast(llvm::Constant*, llvm::Type*) + 36
4  clang           0x00000000008ce646
clang::CodeGen::CodeGenModule::EmitConstantValue(clang::APValue const&,
clang::QualType, clang::CodeGen::CodeGenFunction*) + 1894
5  clang           0x00000000008aac15
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
613
6  clang           0x00000000008ab2d9
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 441
7  clang           0x000000000061061c
8  clang           0x00000000008dc166
9  clang           0x00000000008de33d
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 61
10 clang           0x000000000088db37
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 823
11 clang           0x000000000088fd03
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) + 435
12 clang           0x0000000000890cc1
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) + 33
13 clang           0x0000000000932af7
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 87
14 clang           0x00000000009390a5
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 245
15 clang           0x00000000009361d3
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 35
16 clang           0x000000000093782d
clang::CodeGen::CodeGenFunction::EmitCXXForRangeStmt(clang::CXXForRangeStmt
const&) + 269
17 clang           0x00000000009362ab
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 251
18 clang           0x00000000009364b7
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 247
19 clang           0x0000000000939082
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 210
20 clang           0x00000000009361d3
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 35
21 clang           0x00000000009482cc
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 572
22 clang           0x0000000000836880
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 336
23 clang           0x0000000000836c03
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 195
24 clang           0x00000000008384a0
clang::CodeGen::CodeGenModule::EmitDeferred() + 208
25 clang           0x00000000008384b9 clang::CodeGen::CodeGenModule::Release()
+ 9
26 clang           0x00000000008208bb
27 clang           0x0000000000965b3a clang::ParseAST(clang::Sema&, bool, bool)
+ 538
28 clang           0x00000000006df3f1 clang::FrontendAction::Execute() + 97
29 clang           0x00000000006c43c5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 293
30 clang           0x00000000006ae052
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1378
31 clang           0x00000000006a9308 cc1_main(char const**, char const**, char
const*, void*) + 920
32 clang           0x000000000069c21d main + 7965
33 libc.so.6       0x00007fbbc36a576d __libc_start_main + 237
34 clang           0x00000000006a850d
Stack dump:
0.    Program arguments: /usr/local/app/clang-3.3/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name crash_clang.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.90.20120924 -momit-leaf-frame-pointer -resource-dir
/usr/local/app/clang-3.3/bin/../lib/clang/3.3 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/app/clang-3.3/bin/../lib/clang/3.3/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/note/Desktop/bug -ferror-limit 19
-fmessage-length 124 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -backend-option
-vectorize-loops -o /tmp/crash_clang-zl51JZ.o -x c++ crash_clang.cpp 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    crash_clang.cpp:7:10: Generating code for declaration 'main()::<anonymous
class>::operator()'
4.    crash_clang.cpp:7:14: LLVM IR generation of compound statement ('{}')
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.3 (trunk 171341)
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/crash_clang-ffMyrI.cpp
clang: note: diagnostic msg: /tmp/crash_clang-ffMyrI.sh
clang: note: diagnostic msg: 

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

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list