From 6cf0b1b3da3e8662baf030a2d741e3becaaab2b0 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 14 Apr 2022 13:50:03 -0700 Subject: Comment out assertions about initializer size added in D123649. They're causing failures in LLVM test-suite. Added some regression tests that explain the issue. --- clang/lib/CodeGen/CodeGenModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index dbbbf7fd554b..5184a363f18f 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -4631,12 +4631,17 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, if (getLangOpts().CPlusPlus && !NeedsGlobalDtor) DelayedCXXInitPosition.erase(D); +#if 0 + // FIXME: The following check doesn't handle flexible array members + // inside tail padding (which don't actually increase the size of + // the struct). #ifndef NDEBUG CharUnits VarSize = getContext().getTypeSizeInChars(ASTTy) + InitDecl->getFlexibleArrayInitChars(getContext()); CharUnits CstSize = CharUnits::fromQuantity( getDataLayout().getTypeAllocSize(Init->getType())); assert(VarSize == CstSize && "Emitted constant has unexpected size"); +#endif #endif } } -- cgit v1.2.3