[llvm-bugs] [Bug 27998] New: clang crashes on valid C++11 code with lambda expression

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 3 17:43:03 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27998

            Bug ID: 27998
           Summary: clang crashes on valid C++11 code with lambda
                    expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following valid C++11 test
case on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from 3.8.x.


$ clang++ -v
clang version 3.9.0 (trunk 271236)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang++-3.8 -std=c++11 -c small.cpp 
$ g++-6.1 -std=c++11 -c small.cpp
$ 
$ clang++ -std=c++11 -c small.cpp
DeclRefExpr for Decl not entered in LocalDeclMap?
UNREACHABLE executed at
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/CodeGen/CGExpr.cpp:2146!
#0 0x0000000001dfd8b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1dfd8b5)
#1 0x0000000001dfb846 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1dfb846)
#2 0x0000000001dfba64 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1dfba64)
#3 0x00007f1969ec8340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f19690e6cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f19690ea0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x0000000001db072a (/usr/local/clang-trunk/bin/clang-3.9+0x1db072a)
#7 0x00000000020d750e
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x20d750e)
#8 0x00000000020de7a6 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/usr/local/clang-trunk/bin/clang-3.9+0x20de7a6)
#9 0x00000000020e1a55
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind)
(/usr/local/clang-trunk/bin/clang-3.9+0x20e1a55)
#10 0x000000000210564c (anonymous
namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x210564c)
#11 0x00000000021047d0 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x21047d0)
#12 0x0000000000885a24 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x885a24)
#13 0x0000000002104855 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2104855)
#14 0x000000000210598b (anonymous
namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x210598b)
#15 0x0000000002103b7e (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2103b7e)
#16 0x00000000021050a3
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x21050a3)
#17 0x00000000020b5f6c
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x20b5f6c)
#18 0x00000000020b6b73
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x20b6b73)
#19 0x00000000020b7b51
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) (/usr/local/clang-trunk/bin/clang-3.9+0x20b7b51)
#20 0x00000000020bcef2
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x20bcef2)
#21 0x0000000001f7febf
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f7febf)
#22 0x0000000001f8c022
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f8c022)
#23 0x0000000001f883e8 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-3.9+0x1f883e8)
#24 0x0000000001f8aa01
clang::CodeGen::CodeGenFunction::EmitCXXForRangeStmt(clang::CXXForRangeStmt
const&, llvm::ArrayRef<clang::Attr const*>)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f8aa01)
#25 0x0000000001f887f9 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-3.9+0x1f887f9)
#26 0x0000000001f8912f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f8912f)
#27 0x0000000001faeff2
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/usr/local/clang-trunk/bin/clang-3.9+0x1faeff2)
#28 0x0000000001fb977e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1fb977e)
#29 0x0000000001fda761
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-3.9+0x1fda761)
#30 0x0000000001fec0a1
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-3.9+0x1fec0a1)
#31 0x0000000001fec265 clang::CodeGen::CodeGenModule::EmitDeferred()
(/usr/local/clang-trunk/bin/clang-3.9+0x1fec265)
#32 0x0000000001fec3d4 clang::CodeGen::CodeGenModule::Release()
(/usr/local/clang-trunk/bin/clang-3.9+0x1fec3d4)
#33 0x00000000025981a7 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x25981a7)
#34 0x00000000025937e2
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x25937e2)
#35 0x00000000028f27dd clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x28f27dd)
#36 0x0000000002593d0e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x2593d0e)
#37 0x0000000002271c5e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x2271c5e)
#38 0x0000000002247ba6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2247ba6)
#39 0x00000000022feb72
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x22feb72)
#40 0x0000000000ae2fc8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xae2fc8)
#41 0x0000000000a9c8ae main (/usr/local/clang-trunk/bin/clang-3.9+0xa9c8ae)
#42 0x00007f19690d1ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#43 0x0000000000adf034 _start (/usr/local/clang-trunk/bin/clang-3.9+0xadf034)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-coverage-file /data2/small.cpp -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/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 /data2 -ferror-limit 19 -fmessage-length 201
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    small.cpp:4:3: Generating code for declaration 'fn1()::(anonymous
class)::operator()'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 271236)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-3.9: 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-3.9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-31210c.cpp
clang-3.9: note: diagnostic msg: /tmp/small-31210c.sh
clang-3.9: note: diagnostic msg: 

********************
$ 


------------------------------


void fn1 ()
{
  int i = 0, a[i];
  [&] 
  {
    for (int x : a)
      ; 
  } ();
}

-- 
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/20160604/c2279001/attachment.html>


More information about the llvm-bugs mailing list