[LLVMbugs] [Bug 9600] New: crash generating debug info due to array of forward-declared template type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 31 16:23:14 PDT 2011


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

           Summary: crash generating debug info due to array of
                    forward-declared template type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: dpatel at apple.com, llvmbugs at cs.uiuc.edu


This testcase crashes:

  template<typename T> class vector {};
  class Foo;
  typedef vector<Foo*> FooVector[3];

  struct Test {
    virtual void foo(FooVector *);
  };

  static Test test;

under "clang -cc1 -g -w -emit-llvm-only -x c++ x.cc" with the following stack
trace:

clang: RecordLayoutBuilder.cpp:1689: const clang::ASTRecordLayout&
clang::ASTContext::getASTRecordLayout(const clang::RecordDecl*) const:
Assertion `D && "Cannot get layout of forward declarations!"' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff6ebea75 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
        in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
#0  0x00007ffff6ebea75 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff6ec25c0 in abort () at abort.c:92
#2  0x00007ffff6eb7941 in __assert_fail (assertion=0x2747c08 "D && \"Cannot get
layout of forward declarations!\"", file=<value optimized out>, line=1689,
function=0x2749e40 "const clang::ASTRecordLayout&
clang::ASTContext::getASTRecordLayout(const clang::RecordDecl*) const") at
assert.c:81
#3  0x0000000001825b87 in clang::ASTContext::getASTRecordLayout
(this=0x353c170, D=0x0) at RecordLayoutBuilder.cpp:1689
#4  0x000000000174ef92 in clang::ASTContext::getTypeInfo (this=0x353c170,
T=0x3578af0) at ASTContext.cpp:887
#5  0x000000000174f4df in clang::ASTContext::getTypeInfo (this=0x353c170,
T=0x3578b10) at ASTContext.cpp:945
#6  0x0000000001150e3c in clang::ASTContext::getTypeInfo (this=0x353c170,
T=...) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/CodeGen/../../include/clang/AST/ASTContext.h:1009
#7  0x000000000174e628 in clang::ASTContext::getTypeInfo (this=0x353c170,
T=0x3578c00) at ASTContext.cpp:718
#8  0x000000000117c9c5 in clang::ASTContext::getTypeSize (this=0x353c170,
T=0x3578c00) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/CodeGen/../../include/clang/AST/ASTContext.h:1018
#9  0x00000000011a594d in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578c00, Unit=...) at CGDebugInfo.cpp:1231
#10 0x00000000011a6c3f in clang::CodeGen::CGDebugInfo::CreateTypeNode
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1462
#11 0x00000000011a6750 in clang::CodeGen::CGDebugInfo::getOrCreateType
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1410
#12 0x00000000011a150f in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578ec0, Unit=...) at CGDebugInfo.cpp:540
#13 0x00000000011a6b5d in clang::CodeGen::CGDebugInfo::CreateTypeNode
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1452
#14 0x00000000011a6750 in clang::CodeGen::CGDebugInfo::getOrCreateType
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1410
#15 0x00000000011a025d in clang::CodeGen::CGDebugInfo::CreatePointeeType
(this=0x356ac40, PointeeTy=..., Unit=...) at CGDebugInfo.cpp:426
#16 0x00000000011a082f in clang::CodeGen::CGDebugInfo::CreatePointerLikeType
(this=0x356ac40, Tag=15, Ty=0x3578f10, PointeeTy=..., Unit=...) at
CGDebugInfo.cpp:470
#17 0x00000000011a01c4 in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578f10, Unit=...) at CGDebugInfo.cpp:418
#18 0x00000000011a6aaa in clang::CodeGen::CGDebugInfo::CreateTypeNode
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1449
#19 0x00000000011a6750 in clang::CodeGen::CGDebugInfo::getOrCreateType
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1410
#20 0x00000000011a17e0 in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578ff0, Unit=...) at CGDebugInfo.cpp:564
#21 0x00000000011a6be4 in clang::CodeGen::CGDebugInfo::CreateTypeNode
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1458
#22 0x00000000011a6750 in clang::CodeGen::CGDebugInfo::getOrCreateType
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1410
#23 0x00000000011a1e96 in clang::CodeGen::CGDebugInfo::getOrCreateMethodType
(this=0x356ac40, Method=0x3579050, Unit=...) at CGDebugInfo.cpp:643
#24 0x00000000011a235f in clang::CodeGen::CGDebugInfo::CreateCXXMemberFunction
(this=0x356ac40, Method=0x3579050, Unit=..., RecordTy=...) at
CGDebugInfo.cpp:699
#25 0x00000000011a28de in
clang::CodeGen::CGDebugInfo::CollectCXXMemberFunctions (this=0x356ac40,
RD=0x3578cd0, Unit=..., EltTys=..., RecordTy=...) at CGDebugInfo.cpp:778
#26 0x00000000011a3c65 in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578d60) at CGDebugInfo.cpp:976
#27 0x00000000011a563f in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578d60) at CGDebugInfo.cpp:1191
#28 0x00000000011a6b98 in clang::CodeGen::CGDebugInfo::CreateTypeNode
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1455
#29 0x00000000011a6750 in clang::CodeGen::CGDebugInfo::getOrCreateType
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1410
#30 0x00000000011ab383 in clang::CodeGen::CGDebugInfo::EmitGlobalVariable
(this=0x356ac40, Var=0x357f128, D=0x3579410) at CGDebugInfo.cpp:2141
#31 0x000000000114c933 in
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition (this=0x356a3b0,
D=0x3579410) at CodeGenModule.cpp:1291
#32 0x000000000114b01c in clang::CodeGen::CodeGenModule::EmitGlobalDefinition
(this=0x356a3b0, GD=...) at CodeGenModule.cpp:797
#33 0x000000000114ac7b in clang::CodeGen::CodeGenModule::EmitGlobal
(this=0x356a3b0, GD=...) at CodeGenModule.cpp:741
#34 0x000000000114f944 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0x356a3b0, D=0x3579410) at CodeGenModule.cpp:2027
#35 0x00000000011448cd in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl (this=0x3541830, DG=...) at
ModuleBuilder.cpp:65
#36 0x0000000001143b8f in clang::BackendConsumer::HandleTopLevelDecl
(this=0x3534230, D=...) at CodeGenAction.cpp:86
#37 0x00000000012a3485 in clang::ParseAST (S=..., PrintStats=false) at
ParseAST.cpp:85
#38 0x0000000001007f53 in clang::ASTFrontendAction::ExecuteAction
(this=0x3532e20) at FrontendAction.cpp:376
#39 0x00000000011430c7 in clang::CodeGenAction::ExecuteAction (this=0x3532e20)
at CodeGenAction.cpp:341
#40 0x0000000001007ba4 in clang::FrontendAction::Execute (this=0x3532e20) at
FrontendAction.cpp:296
#41 0x0000000000ff01b5 in clang::CompilerInstance::ExecuteAction
(this=0x35317e0, Act=...) at CompilerInstance.cpp:562
#42 0x0000000000f96f43 in clang::ExecuteCompilerInvocation (Clang=0x35317e0) at
ExecuteCompilerInvocation.cpp:153
#43 0x0000000000f88c67 in cc1_main (ArgBegin=0x7fffffffd390,
ArgEnd=0x7fffffffd3c0, Argv0=0x3528918
"/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang",
MainAddr=0xf90f14) at cc1_main.cpp:158
#44 0x0000000000f926dd in main (argc_=8, argv_=0x7fffffffe3d8) at
driver.cpp:352

(gdb) up 9
#9  0x00000000011a594d in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578c00, Unit=...) at CGDebugInfo.cpp:1231
1231        Size = CGM.getContext().getTypeSize(Ty);
(gdb) p Ty->dump()
: vector<class Foo *> identifier[3]
$1 = void
(gdb) up
#10 0x00000000011a6c3f in clang::CodeGen::CGDebugInfo::CreateTypeNode
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1462
1462        return CreateType(cast<ArrayType>(Ty), Unit);
(gdb) 
#11 0x00000000011a6750 in clang::CodeGen::CGDebugInfo::getOrCreateType
(this=0x356ac40, Ty=..., Unit=...) at CGDebugInfo.cpp:1410
1410      llvm::DIType Res = CreateTypeNode(Ty, Unit);
(gdb) 
#12 0x00000000011a150f in clang::CodeGen::CGDebugInfo::CreateType
(this=0x356ac40, Ty=0x3578ec0, Unit=...) at CGDebugInfo.cpp:540
540       llvm::DIType Src =
getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit);
(gdb) p Ty->dump()
: FooVector identifier
$2 = void

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