https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99049
Bug ID: 99049
Summary: _Alignof ignores requested alignment of bit-field
types in ms_struct struct
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ju.orth at gmail dot com
Target Milestone: ---
Consider
typedef int Int __attribute__((aligned(128)));
struct __attribute__((ms_struct)) X {
Int i:1;
};
struct Y {
char c;
struct X x;
};
int f(void) {
return _Alignof(struct X);
}
int g(void) {
return __builtin_offsetof(struct Y, x);
}
When compiling this on x86_64-unknown-linux-gnu, f returns 16 but g returns
128. I believe that _Alignof and __builtin_offsetof as above should always
return the same value.