https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91131
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |10.0 Known to fail|10.0 | --- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- Fixed on trunk sofar. Note the non-optimal code-gen probably was a side-effect of us making three volatile accesses out of one. On x86 I now see main: .LFB0: .cfi_startproc movl $0, Reg_A(%rip) xorl %eax, %eax movl $8, Reg_B(%rip) movl $255, Reg_C(%rip) movb $0, Reg_D(%rip) movb $-1, Reg_E(%rip) ret as of using a packed structure the reason it might be problematic is that this lowers its alignment to 1 byte. There are architectures that cannot do unaligned accesses so when the bitfield spans more than one byte the access might need to be decomposed. Using an aligned attribute in addition to the packed attribute and aligning the structure appropriately would be a solution to this issue.