1

My project consists of multiple hierarchical structs and classes, the maximum hierarchy of some being around 900. Clang seems to not take this well and crashes. Upon re-compiling, it continues compilation but crashes again with a similar output.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   clang                           0x0000000107e52305 clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(clang::CodeGen::Address, clang::CXXRecordDecl const*, clang::CXXBaseSpecifier const* const*, clang::CXXBaseSpecifier const* const*, bool, clang::SourceLocation) + 117
1   clang                           0x000000010706afc1 clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*) + 929
2   clang                           0x000000010704e3cf (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) + 1103
3   clang                           0x000000010704703e clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 494
4   clang                           0x0000000107046c4a clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 186
5   clang                           0x0000000107e4fb1b clang::CodeGen::CodeGenFunction::EmitInitializerForField(clang::FieldDecl*, clang::CodeGen::LValue, clang::Expr*) + 139
6   clang                           0x0000000107e4f333 EmitMemberInitializer(clang::CodeGen::CodeGenFunction&, clang::CXXRecordDecl const*, clang::CXXCtorInitializer*, clang::CXXConstructorDecl const*, clang::CodeGen::FunctionArgList&) + 451
7   clang                           0x0000000107e4e7ba clang::CodeGen::CodeGenFunction::EmitCtorPrologue(clang::CXXConstructorDecl const*, clang::CXXCtorType, clang::CodeGen::FunctionArgList&) + 2762
8   clang                           0x0000000107e4d248 clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&) + 264
9   clang                           0x0000000107015e6e clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 734
10  clang                           0x0000000107e4cf86 clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::CXXMethodDecl const*, clang::CodeGen::StructorType) + 374
11  clang                           0x0000000107e4cb77 (anonymous namespace)::ItaniumCXXABI::emitCXXStructor(clang::CXXMethodDecl const*, clang::CodeGen::StructorType) + 807
12  clang                           0x0000000106ff88e2 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 258
13  clang                           0x00000001070c08c7 clang::CodeGen::CodeGenModule::EmitDeferred() + 183
14  clang                           0x00000001070c08ef clang::CodeGen::CodeGenModule::EmitDeferred() + 223
15  clang                           0x00000001070bd24c clang::CodeGen::CodeGenModule::Release() + 28
16  clang                           0x00000001070bd1d8 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) + 40
17  clang                           0x00000001070bcabb clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 59
18  clang                           0x0000000106e29e79 clang::ParseAST(clang::Sema&, bool, bool) + 249
19  clang                           0x0000000106e2733a clang::FrontendAction::Execute() + 42
20  clang                           0x0000000106dec9fc clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 524
21  clang                           0x0000000106dea58e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2974
22  clang                           0x0000000106dc3b47 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1591
23  clang                           0x0000000106dbed86 main + 5638
24  libdyld.dylib                   0x00007fff60a22085 start + 1

From what I've read, the language allows up to 16,384 direct and indirect base classes mentioned here - https://stackoverflow.com/a/20405380/1514605

Is this a clang or design problem?

SagunKho
  • 985
  • 10
  • 26
  • 4
    The first sentence in the answer literally said *"It's implementation defined."* – Passer By Feb 04 '19 at 07:13
  • 1
    Possible duplicate of [Limit of multiple inheritance in C++](https://stackoverflow.com/questions/20405321/limit-of-multiple-inheritance-in-c) –  Feb 04 '19 at 07:18
  • @PasserBy well then how does one define the limit of multiple inheritance in c++? – SagunKho Feb 04 '19 at 07:22

0 Answers0