[llvm-bugs] [Bug 32933] New: clang crashes on valid C++11 code: UNREACHABLE executed

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 5 00:18:19 PDT 2017


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

            Bug ID: 32933
           Summary: clang crashes on valid C++11 code: UNREACHABLE
                    executed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

It seems to be a recent regression as it doesn't crash 4.0.0. 

$ clang++ -v
clang version 5.0.0 (trunk 302200)
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.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
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.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.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++-4.0.0 -std=c++11 -c -w small.cpp
$ g++-6.2 -c -w small.cpp
$
$ clang++ -std=c++11 -c -w small.cpp
DeclRefExpr for Decl not entered in LocalDeclMap?
UNREACHABLE executed at
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/CodeGen/CGExpr.cpp:2280!
#0 0x000000000223769a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x223769a)
#1 0x00000000022357be llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x22357be)
#2 0x0000000002235920 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x2235920)
#3 0x00007f5ab596f330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f5ab4758c37 gsignal
/build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f5ab475c028 abort
/build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00000000021e31ca (/usr/local/clang-trunk/bin/clang-5.0+0x21e31ca)
#7 0x0000000002584f80
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2584f80)
#8 0x000000000258359e clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/usr/local/clang-trunk/bin/clang-5.0+0x258359e)
#9 0x00000000025882e5
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind)
(/usr/local/clang-trunk/bin/clang-5.0+0x25882e5)
#10 0x00000000025b00ac (anonymous
namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*)
(/usr/local/clang-trunk/bin/clang-5.0+0x25b00ac)
#11 0x00000000025af357 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-5.0+0x25af357)
#12 0x0000000000a3e585 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/usr/local/clang-trunk/bin/clang-5.0+0xa3e585)
#13 0x00000000025af43c (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-5.0+0x25af43c)
#14 0x00000000025b03dd (anonymous
namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*)
(/usr/local/clang-trunk/bin/clang-5.0+0x25b03dd)
#15 0x00000000025adac6 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-5.0+0x25adac6)
#16 0x00000000025afaf3
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x25afaf3)
#17 0x000000000255a413
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x255a413)
#18 0x000000000255b133
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x255b133)
#19 0x000000000255bd41
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) (/usr/local/clang-trunk/bin/clang-5.0+0x255bd41)
#20 0x0000000002561392
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2561392)
#21 0x0000000002561852 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&) (/usr/local/clang-trunk/bin/clang-5.0+0x2561852)
#22 0x000000000240606f
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(/usr/local/clang-trunk/bin/clang-5.0+0x240606f)
#23 0x0000000002412522
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2412522)
#24 0x000000000240e488 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-5.0+0x240e488)
#25 0x0000000002410f2e
clang::CodeGen::CodeGenFunction::EmitCXXForRangeStmt(clang::CXXForRangeStmt
const&, llvm::ArrayRef<clang::Attr const*>)
(/usr/local/clang-trunk/bin/clang-5.0+0x2410f2e)
#26 0x000000000240e812 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-5.0+0x240e812)
#27 0x000000000240f54f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/clang-trunk/bin/clang-5.0+0x240f54f)
#28 0x0000000002441951
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/usr/local/clang-trunk/bin/clang-5.0+0x2441951)
#29 0x000000000244cb7b
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/clang-trunk/bin/clang-5.0+0x244cb7b)
#30 0x000000000246e301
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-5.0+0x246e301)
#31 0x000000000247ade1
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-5.0+0x247ade1)
#32 0x000000000247af7f clang::CodeGen::CodeGenModule::EmitDeferred()
(/usr/local/clang-trunk/bin/clang-5.0+0x247af7f)
#33 0x000000000247b074 clang::CodeGen::CodeGenModule::Release()
(/usr/local/clang-trunk/bin/clang-5.0+0x247b074)
#34 0x0000000002ab1d57 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2ab1d57)
#35 0x0000000002ab0904
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2ab0904)
#36 0x0000000002eaa1fc clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2eaa1fc)
#37 0x0000000002ab00b0 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x2ab00b0)
#38 0x000000000276317e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x276317e)
#39 0x000000000273928e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x273928e)
#40 0x00000000027fbb62
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x27fbb62)
#41 0x0000000000d24be8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xd24be8)
#42 0x0000000000cc4342 main (/usr/local/clang-trunk/bin/clang-5.0+0xcc4342)
#43 0x00007f5ab4743f45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#44 0x0000000000d20839 _start (/usr/local/clang-trunk/bin/clang-5.0+0xd20839)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -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-notes-file /data2/small.gcno -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.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/lib/clang/5.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -w -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 120
-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:5:3: Generating code for declaration 'foo()::(anonymous
class)::operator()'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 302200)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-5.0: 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-5.0: note: diagnostic msg:
********************

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

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


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


void foo ()
{ 
  int b = 1, a[b];
  a[0] = 0;
  [&] { for (int c : 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/20170505/bd3d0ce8/attachment-0001.html>


More information about the llvm-bugs mailing list