[llvm-bugs] [Bug 28045] New: clang crashes on valid C++ code: UNREACHABLE executed at /tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AST/ItaniumMangle.cpp:2091!

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 7 15:56:00 PDT 2016


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

            Bug ID: 28045
           Summary: clang crashes on valid C++ code: UNREACHABLE executed
                    at
                    /tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AS
                    T/ItaniumMangle.cpp:2091!
           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++ 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 271994)
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 small.cpp
$
$ clang++ small.cpp
mangling a placeholder type
UNREACHABLE executed at
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AST/ItaniumMangle.cpp:2091!
#0 0x0000000001e1b305 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e1b305)
#1 0x0000000001e19296 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1e19296)
#2 0x0000000001e194b4 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e194b4)
#3 0x00007f5de1729340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f5de0947cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f5de094b0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x0000000001dce41a (/usr/local/clang-trunk/bin/clang-3.9+0x1dce41a)
#7 0x000000000345de71 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/usr/local/clang-trunk/bin/clang-3.9+0x345de71)
#8 0x000000000345cc44 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/usr/local/clang-trunk/bin/clang-3.9+0x345cc44)
#9 0x000000000345e499 (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType
const*, bool, clang::FunctionDecl const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x345e499)
#10 0x00000000034613fe (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::NamedDecl const*,
llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-3.9+0x34613fe)
#11 0x0000000001fec026
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/usr/local/clang-trunk/bin/clang-3.9+0x1fec026)
#12 0x0000000001ff7767
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x1ff7767)
#13 0x00000000020ed9fb EmitFunctionDeclLValue(clang::CodeGen::CodeGenFunction&,
clang::Expr const*, clang::FunctionDecl const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x20ed9fb)
#14 0x00000000020f38d8
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x20f38d8)
#15 0x00000000020fb726 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/usr/local/clang-trunk/bin/clang-3.9+0x20fb726)
#16 0x000000000088984a (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x88984a)
#17 0x0000000002121925 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2121925)
#18 0x0000000002122173
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2122173)
#19 0x00000000020fb0da
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
(/usr/local/clang-trunk/bin/clang-3.9+0x20fb0da)
#20 0x0000000000887c38 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x887c38)
#21 0x0000000002121a09 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2121a09)
#22 0x0000000002122173
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2122173)
#23 0x00000000020ea30f clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x20ea30f)
#24 0x00000000020fba7d
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x20fba7d)
#25 0x0000000001fa563c clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-3.9+0x1fa563c)
#26 0x0000000001fa632f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/clang-trunk/bin/clang-3.9+0x1fa632f)
#27 0x0000000001fcc1f2
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/usr/local/clang-trunk/bin/clang-3.9+0x1fcc1f2)
#28 0x0000000001fd697e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1fd697e)
#29 0x0000000001ff7b91
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-3.9+0x1ff7b91)
#30 0x0000000002008f71
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-3.9+0x2008f71)
#31 0x0000000002009e89
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/usr/local/clang-trunk/bin/clang-3.9+0x2009e89)
#32 0x000000000200a55d
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.6208] (/usr/local/clang-trunk/bin/clang-3.9+0x200a55d)
#33 0x00000000025c8ddb (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-3.9+0x25c8ddb)
#34 0x00000000025c36ec
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-3.9+0x25c36ec)
#35 0x0000000002924fe6 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2924fe6)
#36 0x00000000025c419e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x25c419e)
#37 0x00000000022907be clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x22907be)
#38 0x0000000002266226
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2266226)
#39 0x000000000231d922
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x231d922)
#40 0x0000000000aed198 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaed198)
#41 0x0000000000aa197e main (/usr/local/clang-trunk/bin/clang-3.9+0xaa197e)
#42 0x00007f5de0932ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#43 0x0000000000ae9204 _start (/usr/local/clang-trunk/bin/clang-3.9+0xae9204)
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
-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 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 247
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/small-d3258f.o -x c++ small.cpp
1.      <eof> parser at end of file
2.      small.cpp:7:1: LLVM IR generation of declaration 'main'
3.      small.cpp:7:1: Generating code for declaration 'main'
4.      small.cpp:4:6: Mangling declaration 'test'
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 271994)
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-a62de5.cpp
clang-3.9: note: diagnostic msg: /tmp/small-a62de5.sh
clang-3.9: note: diagnostic msg:

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


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


enum Color { R, G, B };

template < typename T >
void test (T, __underlying_type (T)) {}

int
main ()
{ 
  Color c = R;
  test (c, c);
  return 0;
}

-- 
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/20160607/5e6c3482/attachment.html>


More information about the llvm-bugs mailing list