http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48124
--- Comment #5 from Aldy Hernandez <aldyh at redhat dot com> 2011-03-15
12:42:36 UTC ---
> struct S
> {
> signed a : 26;
> signed b : 16;
> signed c : 10;
> volatile signed d : 14;
> int e;
> } s;
> I think you can't just modify s.e when writing s.d (I think it is fine to
> modify
> adjacent bitfields though, Aldy?).
No, you can't modify s.e when writing to s.d. However, you can modify
adjacent bitfields. All contiguous bitfields can be considered a single
memory location for the purpose of introducing data races. The only
exception is when bitfields are separated by a zero-length bitfield, or
when they happen to be contiguous but occur in different
structures/unions. Those conditions force alignments on those fields.