[PATCH] D14980: PR18513: make gcc compatible layout for bit-fields with explicit aligned attribute
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 30 11:24:31 PST 2015
rsmith added a subscriber: rsmith.
rsmith added a comment.
GCC's behavior (`aligned` on a field specifies the alignment of the start of that field) makes a little more sense to me than Clang's behavior (the type and alignment of a field specify a flavour of storage unit, and the field goes in the next such storage unit that it fits into), but both seem defensible.
John, are we intentionally deviating from GCC's behaviour here?
================
Comment at: lib/AST/RecordLayoutBuilder.cpp:1606
@@ -1605,1 +1605,3 @@
+ } else if (ExplicitFieldAlign)
+ FieldOffset = llvm::RoundUpToAlignment(FieldOffset, ExplicitFieldAlign);
----------------
You should round up to `FieldAlign` here.
http://reviews.llvm.org/D14980
More information about the cfe-commits
mailing list