[PATCH] D42660: [PR32482] Fix bitfield layout for -mms-bitfield and pragma pack

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 14:20:09 PST 2018


arphaman created this revision.
arphaman added reviewers: ahatanak, rjmccall.
Herald added a subscriber: jkorous-apple.

Clang currently generates wrong record layout for `-mms-bitfield` and `#pragma pack`. https://godbolt.org/g/nQ4rVW shows how MSVC and GCC generate different layout to Clang.

This patch fixes the issue by ensuring that bitfields are not packed, but the record's alignment is still updated. This seems to be in line with logic used by GCC and MSVC.

rdar://36343145


Repository:
  rC Clang

https://reviews.llvm.org/D42660

Files:
  lib/AST/RecordLayoutBuilder.cpp
  test/CodeGen/mms-bitfields.c
  test/Sema/mms-bitfields.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42660.131874.patch
Type: text/x-patch
Size: 3900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180129/c5d6d619/attachment.bin>


More information about the cfe-commits mailing list