diff options
author | OCHyams <orlando.hyams@sony.com> | 2022-01-21 10:54:53 +0000 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2022-01-21 11:37:49 +0000 |
commit | b6a41fddcfd375ce30487ef87ca2cd65a6be0bcc (patch) | |
tree | c48a6d34d62dac8ce059068964b04aabb8f627b3 /llvm/lib | |
parent | 597eae998a874a872b67d1a22a04d7c45d2ef94b (diff) | |
download | llvm-b6a41fddcfd375ce30487ef87ca2cd65a6be0bcc.zip llvm-b6a41fddcfd375ce30487ef87ca2cd65a6be0bcc.tar.gz llvm-b6a41fddcfd375ce30487ef87ca2cd65a6be0bcc.tar.bz2 |
[DWARF][DebugInfo] Fix off-by-one error in size of DW_TAG_base_type types
Fix PR53163 by rounding the byte size of DW_TAG_base_type types up. Without
this fix we risk emitting types with a truncated size (including rounding
less-than-byte-sized types' sizes down to zero).
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D117124
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 3ab73d1..ab3c9f4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -1581,7 +1581,8 @@ void DwarfCompileUnit::createBaseTypeDIEs() { Twine(dwarf::AttributeEncodingString(Btr.Encoding) + "_" + Twine(Btr.BitSize)).toStringRef(Str)); addUInt(Die, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Btr.Encoding); - addUInt(Die, dwarf::DW_AT_byte_size, None, Btr.BitSize / 8); + // Round up to smallest number of bytes that contains this number of bits. + addUInt(Die, dwarf::DW_AT_byte_size, None, divideCeil(Btr.BitSize, 8)); Btr.Die = &Die; } |