[PATCH] D139741: [clang][CodeGen] Use base subobject type layout for potentially-overlapping fields

Vladislav Dzhidzhoev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 9 13:11:22 PST 2022


dzhidzhoev created this revision.
dzhidzhoev added reviewers: kjdyck, rjmccall, efriedma, majnemer, aaron.ballman, rsmith.
Herald added a project: All.
dzhidzhoev requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

RecordLayoutBuilder assumes the size of a potentially-overlapping field
with non-zero size as the size of the base subobject type corresponding
to the field type.
Make RecordLayoutBuilder to acknowledge that in order to avoid incorrect
padding insertion.

Without this patch, test fails on assertion

  Assertion failed: (Offset >= Size), function insertPadding, file CGRecordLayoutBuilder.cpp, line 802.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139741

Files:
  clang/include/clang/AST/Decl.h
  clang/lib/AST/Decl.cpp
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
  clang/test/CodeGenCXX/no-unique-address-3.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139741.481736.patch
Type: text/x-patch
Size: 5985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221209/194fcd36/attachment.bin>


More information about the cfe-commits mailing list