From: Linus Torvalds > Sent: Thursday, August 17, 2023 4:31 PM ... > movzwl .LC1(%rip), %eax > testl %esi, %esi > movb $0, (%rdi) > movb $1, 4(%rdi) > movw %ax, 1(%rdi) > movq $0, 8(%rdi) > movq %rdx, 16(%rdi) > movq %r8, 24(%rdi) > movq %rcx, 32(%rdi) > setne 3(%rdi) > > which is that disgusting "move two bytes from memory", and makes > absolutely no sense as a way to "write 2 zero bytes": > > .LC1: > .byte 0 > .byte 0 > > I think that's some odd gcc bug, actually. I get that with some code, but not others. Seems to depend on random other stuff. Happens for: struct { unsigned char x:7, y:1; }; but not if I add anything after if (that gets zeroed). Which seems to be the opposite of what you see. If I use explicit assignments (rather than an initialiser) I still get merged writes (even if not a bitfield) but also lose the memory access. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)