[llvm-bugs] [Bug 38347] New: Crash with dependent type in template

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 28 01:29:49 PDT 2018


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

            Bug ID: 38347
           Summary: Crash with dependent type in template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: v.reichelt at netcologne.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Clang crashes on the following valid code snippet:

====================================
template<typename> struct A
{
  struct B { typedef A X; };
};

template<typename T> struct C
{
  struct A<T>::B::X x;
};

C<int> c;
====================================

clang-7: /tmp/LLVM/llvm/tools/clang/include/clang/AST/TypeNodes.def:106:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const:
Assertion `!T->isDependentType() && "should not see dependent types here"'
failed.

Stack dump:
1.      <eof> parser at end of file
2.      fPR34487A.cc:17:8: LLVM IR generation of declaration 'c'
3.      fPR34487A.cc:17:8: Generating code for declaration 'c'

#8 0x0000000003c2a339 clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (LLVM/bin/clang-7+0x3c2a339)
#9 0x0000000003c26037 clang::ASTContext::getTypeInfo(clang::Type const*) const
(LLVM/bin/clang-7+0x3c26037)
#10 0x0000000003c29475 clang::ASTContext::getTypeInfoInChars(clang::Type
const*) const (LLVM/bin/clang-7+0x3c29475)
#11 0x0000000003c29502 clang::ASTContext::getTypeInfoInChars(clang::QualType)
const (LLVM/bin/clang-7+0x3c29502)
#12 0x0000000003dd6a31 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*,
bool) (LLVM/bin/clang-7+0x3dd6a31)
#13 0x0000000003dd7546 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*)
(LLVM/bin/clang-7+0x3dd7546)
#14 0x0000000003dd2713 clang::ASTContext::getASTRecordLayout(clang::RecordDecl
const*) const (LLVM/bin/clang-7+0x3dd2713)
#15 0x00000000025e26f0 (anonymous
namespace)::CGRecordLowering::CGRecordLowering(clang::CodeGen::CodeGenTypes&,
clang::RecordDecl const*, bool) (LLVM/bin/clang-7+0x25e26f0)
#16 0x00000000025e7c7f
clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
llvm::StructType*) (LLVM/bin/clang-7+0x25e7c7f)
#17 0x00000000026960e6
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*)
(LLVM/bin/clang-7+0x26960e6)
#18 0x000000000269742b
clang::CodeGen::CodeGenTypes::getCGRecordLayout(clang::RecordDecl const*)
(LLVM/bin/clang-7+0x269742b)
#19 0x00000000026974c9
clang::CodeGen::CodeGenTypes::isZeroInitializable(clang::RecordDecl const*)
(LLVM/bin/clang-7+0x26974c9)
#20 0x00000000025d8472
clang::CodeGen::CodeGenModule::EmitNullConstant(clang::QualType)
(LLVM/bin/clang-7+0x25d8472)
#21 0x00000000025deeb3
clang::CodeGen::ConstantEmitter::tryEmitPrivateForVarInit(clang::VarDecl
const&) (LLVM/bin/clang-7+0x25deeb3)
#22 0x00000000025df088
clang::CodeGen::ConstantEmitter::tryEmitForInitializer(clang::VarDecl const&)
(LLVM/bin/clang-7+0x25df088)
#23 0x000000000265c523
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*,
bool) (LLVM/bin/clang-7+0x265c523)
#24 0x00000000026755e1
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (LLVM/bin/clang-7+0x26755e1)
#25 0x0000000002676750
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(LLVM/bin/clang-7+0x2676750)
#26 0x0000000002676cec
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.6636)
(LLVM/bin/clang-7+0x2676cec)
#27 0x0000000002d11243 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(LLVM/bin/clang-7+0x2d11243)
#28 0x0000000002d0b75d
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(LLVM/bin/clang-7+0x2d0b75d)
#29 0x000000000343bcc6 clang::ParseAST(clang::Sema&, bool, bool)
(LLVM/bin/clang-7+0x343bcc6)
#30 0x0000000002d0f5cf clang::CodeGenAction::ExecuteAction()
(LLVM/bin/clang-7+0x2d0f5cf)
#31 0x00000000029c1b96 clang::FrontendAction::Execute()
(LLVM/bin/clang-7+0x29c1b96)
#32 0x000000000299682e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(LLVM/bin/clang-7+0x299682e)
#33 0x0000000002a5e582
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(LLVM/bin/clang-7+0x2a5e582)

clang version 7.0.0 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /LLVM/bin

-- 
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/20180728/bcadea62/attachment-0001.html>


More information about the llvm-bugs mailing list