diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 23752c4ba842..674304e7b361 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1138,7 +1138,9 @@ DIE *DwarfDebug::CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT){ AddSourceLine(MemberDie, &DT); uint64_t Size = DT.getSizeInBits(); - uint64_t FieldSize = DT.getOriginalTypeSize(); + uint64_t FieldSize = Size; + if (DT.getTypeDerivedFrom().getTag() != dwarf::DW_TAG_array_type) + FieldSize = DT.getOriginalTypeSize(); if (Size != FieldSize) { // Handle bitfield.