https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71694
Bug ID: 71694 Summary: store-data race with bitfields and tail-padding in C++ Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- struct B { B() {} int x; int a : 6; int b : 6; int c : 6; }; struct C : B { char d; }; C c; int main() { c.c = 1; c.d = 2; } produces on x86_64 main: .LFB6: .cfi_startproc movl c+4(%rip), %eax andl $-258049, %eax orb $16, %ah movl %eax, c+4(%rip) movb $2, c+7(%rip) xorl %eax, %eax ret as you can see the store to c.c races with another thread accessing c.d.