[llvm-bugs] [Bug 30440] New: crash on valid c++ code on x86_64-linux-gnu with -std=c++14 (void {anonymous}::CXXNameMangler::mangleFunctionParam(const clang::ParmVarDecl*): Assertion `parmDepth < FunctionTypeDepth.getDepth()' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 19 00:36:22 PDT 2016


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

            Bug ID: 30440
           Summary: crash on valid c++ code on x86_64-linux-gnu with
                    -std=c++14 (void
                    {anonymous}::CXXNameMangler::mangleFunctionParam(const
                    clang::ParmVarDecl*): Assertion `parmDepth <
                    FunctionTypeDepth.getDepth()' failed.)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This should be a recent regress. clang-3.8 does not crash.


$ clang-trunk -v
clang version 4.0.0 (trunk 281853)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.0
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.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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-trunk -std=c++14 small.C
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AST/ItaniumMangle.cpp:3996:
void {anonymous}::CXXNameMangler::mangleFunctionParam(const
clang::ParmVarDecl*): Assertion `parmDepth < FunctionTypeDepth.getDepth()'
failed.
#0 0x0000000001c9ce15 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c9ce15)
#1 0x0000000001c9adbe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1c9adbe)
#2 0x0000000001c9af22 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c9af22)
#3 0x00007face9e99340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007face8c8acc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007face8c8e0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007face8c83b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007face8c83c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x000000000325cab4 (anonymous
namespace)::CXXNameMangler::mangleFunctionParam(clang::ParmVarDecl const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x325cab4)
#9 0x0000000003267592 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x3267592)
#10 0x0000000003266f71 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x3266f71)
#11 0x00000000032660a1 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x32660a1)
#12 0x0000000003266f71 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x3266f71)
#13 0x000000000325ec75 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/usr/local/clang-trunk/bin/clang-4.0+0x325ec75)
#14 0x0000000003263fd7 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x3263fd7)
#15 0x0000000003263b59 (anonymous
namespace)::CXXNameMangler::mangleLocalName(clang::Decl const*,
llvm::SmallVector<llvm::StringRef, 4u> const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x3263b59)
#16 0x0000000003263bf5 (anonymous
namespace)::CXXNameMangler::mangleNameWithAbiTags(clang::NamedDecl const*,
llvm::SmallVector<llvm::StringRef, 4u> const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x3263bf5)
#17 0x0000000003260945 (anonymous
namespace)::CXXNameMangler::mangleName(clang::NamedDecl const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x3260945)
#18 0x000000000326147e (anonymous
namespace)::CXXNameMangler::mangleTemplateArg(clang::TemplateArgument)
(/usr/local/clang-trunk/bin/clang-4.0+0x326147e)
#19 0x00000000032621e5 (anonymous
namespace)::CXXNameMangler::mangleTemplateArgs(clang::TemplateArgumentLoc
const*, unsigned int) (/usr/local/clang-trunk/bin/clang-4.0+0x32621e5)
#20 0x00000000032670a4 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x32670a4)
#21 0x0000000003266f35 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x3266f35)
#22 0x00000000032660a1 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x32660a1)
#23 0x0000000003266f71 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x3266f71)
#24 0x000000000325ec75 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/usr/local/clang-trunk/bin/clang-4.0+0x325ec75)
#25 0x00000000032600aa (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType
const*, bool, clang::FunctionDecl const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x32600aa)
#26 0x0000000003263de2 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x3263de2)
#27 0x000000000326586b (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::NamedDecl const*,
llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-4.0+0x326586b)
#28 0x0000000001e7a188
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e7a188)
#29 0x0000000001e7e468
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, bool) (/usr/local/clang-trunk/bin/clang-4.0+0x1e7e468)
#30 0x0000000001f75bfb EmitFunctionDeclLValue(clang::CodeGen::CodeGenFunction&,
clang::Expr const*, clang::FunctionDecl const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f75bfb)
#31 0x0000000001f832f1
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f832f1)
#32 0x0000000001f827d6 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/usr/local/clang-trunk/bin/clang-4.0+0x1f827d6)
#33 0x000000000086ccea (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x86ccea)
#34 0x0000000001fa8c15 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1fa8c15)
#35 0x0000000001fa9aa3
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1fa9aa3)
#36 0x0000000001f84735
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f84735)
#37 0x000000000086b3d2 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x86b3d2)
#38 0x0000000001fa8cf9 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1fa8cf9)
#39 0x0000000001fa9aa3
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1fa9aa3)
#40 0x0000000001f71d07 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f71d07)
#41 0x0000000001f82a1b
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f82a1b)
#42 0x0000000001e337c9 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-4.0+0x1e337c9)
#43 0x0000000001e34617
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e34617)
#44 0x0000000001e5b234
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/usr/local/clang-trunk/bin/clang-4.0+0x1e5b234)
#45 0x0000000001e655ee
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e655ee)
#46 0x0000000001e85f3b
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-4.0+0x1e85f3b)
#47 0x0000000001e99031
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-4.0+0x1e99031)
#48 0x0000000001e9a410
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e9a410)
#49 0x0000000001e9ab51
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.5735] (/usr/local/clang-trunk/bin/clang-4.0+0x1e9ab51)
#50 0x00000000024011a3 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-4.0+0x24011a3)
#51 0x00000000023fb23d
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-4.0+0x23fb23d)
#52 0x00000000027d2bd6 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x27d2bd6)
#53 0x00000000023fbeee clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x23fbeee)
#54 0x000000000210f5b6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x210f5b6)
#55 0x00000000020e9cbe
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x20e9cbe)
#56 0x00000000021971a6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x21971a6)
#57 0x0000000000a8c6e8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xa8c6e8)
#58 0x0000000000a35181 main (/usr/local/clang-trunk/bin/clang-4.0+0xa35181)
#59 0x00007face8c75ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#60 0x0000000000a8870e _start (/usr/local/clang-trunk/bin/clang-4.0+0xa8870e)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.C -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/4.0.0 -c-isystem .
-c-isystem /usr/local/include/csmith -c-isystem /usr/local/include/csmith
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/bin/../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/4.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro
-fdebug-compilation-dir
/home/cnsun/workspace/meta-compiler/error-fuzzer/exp-runs/crash/RandomTokenManipulationFuzzingEngine/20160915-clang++-trunk--Weverything-O3-c-std=c++14-build-022019
-ferror-limit 19 -fmessage-length 209 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/small-fc6b57.o -x c++ small.C 
1.      <eof> parser at end of file
2.      small.C:6:5: LLVM IR generation of declaration 'main'
3.      small.C:6:5: Generating code for declaration 'main'
4.      small.C:2:31: Mangling declaration 'h'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 281853)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-bd96db.cpp
clang-4.0: note: diagnostic msg: /tmp/small-bd96db.sh
clang-4.0: note: diagnostic msg: 

********************
$ 
$ cat small.C
template < class F > void g (F);
template < class ... A > auto h (A ... a)->decltype (g (0, g < a > (a) ...))
{
}

int main ()
{
  h ();
  return 0;
}
$ 
$ clang-3.8 -std=c++14 small.C
$

-- 
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/20160919/1f81404a/attachment-0001.html>


More information about the llvm-bugs mailing list