On AIX, char bitfields have the same alignment as unsigned int.
Reference: https://reviews.llvm.org/D87029
Differential D102715
Fix LIT failure on native aix Xiangling_L on May 18 2021, 1:01 PM. Authored by
Details On AIX, char bitfields have the same alignment as unsigned int. Reference: https://reviews.llvm.org/D87029
Diff Detail
Event TimelineComment Actions From the comment, it seems the code as-is fails to test the property intended. It seems we want this: struct packed_chars { char a : 8, b : 8, c : 8, d : 4; char e : 8 __attribute__((packed)); char f : 4, g : 8, h : 8, i : 8; }; extern int o1[sizeof(struct packed_chars) == 8 ? 1 : -1]; extern int o2[__alignof(struct packed_chars) == 4 ? 1 : -1]; Comment Actions This LGTM. I've added additional reviewers based on the history of the file in case they will have comments. Please hold on committing this until tomorrow.
Comment Actions LGTM!
|
We're not really testing the behavior of bool or short anywhere and it'd be nice to verify that. Perhaps instead of modifying an existing test to add more fields, it'd make sense to make a new test structure?
While thinking of other potentially smaller-than-int types, I wondered whether wchar_t has special behavior here as well (I have no idea how that type is defined for AIX, so it's entirely possible it's size and alignment already match int).