[PATCH] D77048: [Clang][CodeGen] Fixing mismatch between memory layout and const expressions for oversized bitfields

Lucas Prates via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 03:45:01 PDT 2020


pratlucas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The construction of constants for structs/unions was conflicting the
expected memory layout for over-sized bit-fields. When building the
necessary bits for those fields, clang was ignoring the size information
computed for the struct/union memory layout and using the original data
from the AST's FieldDecl information. This caused an issue in big-endian
targets, where the field's contant was incorrectly misplaced due to
endian calculations.

This patch aims to separate the constant value from the necessary
padding bits, using the proper size information for each one of them.
With this, the layout of constants for over-sized bit-fields matches the
ABI requirements.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77048

Files:
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/test/CodeGenCXX/bitfield-layout.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77048.253544.patch
Type: text/x-patch
Size: 4317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200330/d886e8dd/attachment-0001.bin>


More information about the cfe-commits mailing list