[LLVMbugs] [Bug 7446] New: clang asserts while casting a TemplateTemplateParmDecl to a TagDecl in the name mangler

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 21 18:18:58 PDT 2010


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

           Summary: clang asserts while casting a TemplateTemplateParmDecl
                    to a TagDecl in the name mangler
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: reid.kleckner at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=5085)
 --> (http://llvm.org/bugs/attachment.cgi?id=5085)
reduced test case

Here is a stack trace and reduced test case.  I think this was introduced in
r106147, but I'm just guessing.


clang: /home/rnk/llvm/include/llvm/Support/Casting.h:202: typename
llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
clang::TagDecl, Y = const clang::NamedDecl*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff4e7b095 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff4e7b095 in raise () from /lib/libc.so.6
#1  0x00007ffff4e7caf0 in abort () from /lib/libc.so.6
#2  0x00007ffff4e742df in __assert_fail () from /lib/libc.so.6
#3  0x00000000005d1be4 in llvm::cast<clang::TagDecl, clang::NamedDecl const*>
(Val=@0x7fffffffada0)
    at /home/rnk/llvm/include/llvm/Support/Casting.h:202
#4  0x00000000005cc272 in mangleUnqualifiedName (this=0x7fffffffb340,
ND=0x133d970, Name=..., KnownArity=4294967295)
    at Mangle.cpp:678
#5  0x00000000005cc66c in mangleUnqualifiedName (this=0x7fffffffb340,
ND=0x133d970) at Mangle.cpp:194
#6  0x00000000005cc914 in mangleUnscopedName (this=0x7fffffffb340,
ND=0x133d970) at Mangle.cpp:474
#7  0x00000000005c9851 in mangleName (this=0x7fffffffb340, ND=0x133d970) at
Mangle.cpp:443
#8  0x00000000005cb449 in mangleTemplateArg (this=0x7fffffffb340, P=0x133d2f0,
A=...) at Mangle.cpp:1861
#9  0x00000000005cb6aa in mangleTemplateArgs (this=0x7fffffffb340, PL=...,
TemplateArgs=0x133da50, NumTemplateArgs=2)
    at Mangle.cpp:1841
#10 0x00000000005ccb30 in mangleName (this=0x7fffffffb340, TD=0x133d440,
TemplateArgs=0x133da50, NumTemplateArgs=2)
    at Mangle.cpp:462
#11 0x00000000005ccf3c in mangleType (this=0x7fffffffb340, T=0x133da20) at
Mangle.cpp:1366
#12 0x00000000005cb0c9 in mangleType (this=0x7fffffffb340, T=...)
    at
/home/rnk/llvm/tools/clang/lib/CodeGen/../../include/clang/AST/TypeNodes.def:92
#13 0x00000000005cadce in mangleType (this=0x7fffffffb340, T=...) at
Mangle.cpp:1086
#14 0x00000000005cba23 in mangleType (this=0x7fffffffb340, T=0x133f550) at
Mangle.cpp:1309
#15 0x00000000005cae93 in mangleType (this=0x7fffffffb340, T=...)
    at
/home/rnk/llvm/tools/clang/lib/CodeGen/../../include/clang/AST/TypeNodes.def:67
#16 0x00000000005cbc51 in mangleBareFunctionType (this=0x7fffffffb340,
T=0x133f630, MangleReturnType=true)
    at Mangle.cpp:1211
#17 0x00000000005cbe87 in mangleFunctionEncoding (this=0x7fffffffb340,
FD=0x133f6d0) at Mangle.cpp:362
#18 0x00000000005c9bb9 in mangle (this=0x7fffffffb340, D=0x13419c0, Prefix=...)
at Mangle.cpp:316
#19 0x00000000005c9df2 in clang::CodeGen::MangleContext::mangleName
(this=0x1323498, D=0x13419c0, Res=...)
    at Mangle.cpp:2160
#20 0x00000000005aef45 in clang::CodeGen::CodeGenModule::getMangledName
(this=0x1322e10, Buffer=..., GD=...)
    at CodeGenModule.cpp:229
#21 0x00000000005b03c6 in clang::CodeGen::CodeGenModule::EmitGlobal
(this=0x1322e10, GD=...) at CodeGenModule.cpp:776
#22 0x00000000005b05a7 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0x1322e10, D=0x13419c0)
    at CodeGenModule.cpp:1928
#23 0x00000000005a7b9e in HandleTopLevelDecl (this=0x130f240, DG=...) at
ModuleBuilder.cpp:65
#24 0x00000000005a5f04 in HandleTopLevelDecl (this=0x130f1e0, D=...) at
CodeGenAction.cpp:81
#25 0x000000000086b6b7 in clang::Sema::InstantiateFunctionDefinition
(this=0x7fffffffc5b0, PointOfInstantiation=..., 
    Function=0x13419c0, Recursive=true, DefinitionRequired=false) at
SemaTemplateInstantiateDecl.cpp:2130
#26 0x000000000086aefc in clang::Sema::PerformPendingImplicitInstantiations
(this=0x7fffffffc5b0, LocalOnly=false)
    at SemaTemplateInstantiateDecl.cpp:2727
#27 0x00000000006cce62 in clang::Sema::ActOnEndOfTranslationUnit
(this=0x7fffffffc5b0) at Sema.cpp:217
#28 0x0000000000ab6407 in clang::Parser::ParseTopLevelDecl
(this=0x7fffffffd280, Result=...) at Parser.cpp:364
#29 0x00000000006cc12c in clang::ParseAST (PP=..., Consumer=0x130f1e0, Ctx=...,
PrintStats=false, 
    CompleteTranslationUnit=true, CompletionConsumer=0x0, ShowTimers=false) at
ParseAST.cpp:96
#30 0x00000000004b9641 in clang::ASTFrontendAction::ExecuteAction
(this=0x12f9b90) at FrontendAction.cpp:252
#31 0x00000000005a645a in clang::CodeGenAction::ExecuteAction (this=0x12f9b90)
at CodeGenAction.cpp:320
#32 0x00000000004b973f in clang::FrontendAction::Execute (this=0x12f9b90) at
FrontendAction.cpp:177
#33 0x00000000004a5fd4 in clang::CompilerInstance::ExecuteAction
(this=0x12f3c50, Act=...) at CompilerInstance.cpp:497
#34 0x00000000004760c6 in cc1_main (ArgBegin=0x7fffffffe4d8,
ArgEnd=0x7fffffffe4f8, 
    Argv0=0x7fffffffe811 "/home/rnk/llvm/Debug/bin/clang", MainAddr=0x47e89a)
at cc1_main.cpp:282
#35 0x000000000047ea52 in main (argc=6, argv=0x7fffffffe4c8) at driver.cpp:186

-- 
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