http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50521
--- Comment #3 from Tomohiro Kashiwada <kikairoya at gmail dot com> 2011-09-27 04:15:19 UTC --- Other test case (gcc generates wrong code): volatile union { // add volatiles tenaciously, but... volatile unsigned int all; volatile struct { volatile unsigned int a: 8; volatile unsigned int : 7; volatile unsigned int b: 1; volatile unsigned int : 8; volatile unsigned int c: 8; } bits; } bitfield; int main() { bitfield.bits.a = 1; bitfield.bits.b = 1; bitfield.bits.c = 1; return 0; } $ gcc -S -O -o - btf.c -fstrict-volatile-bitfields .file "btf.c" .text .globl main .type main, @function main: .LFB0: .cfi_startproc movl $1, bitfield(%rip) ; **** breaks other area! **** movl bitfield(%rip), %eax orb $128, %ah movl %eax, bitfield(%rip) movl $1, bitfield+3(%rip) ; **** unaligned, and breaks other area! **** movl $0, %eax ret .cfi_endproc .LFE0: .size main, .-main .comm bitfield,4,4 .ident "GCC: (Debian 4.6.1-3) 4.6.1" .section .note.GNU-stack,"",@progbits $ rx-elf-gcc -S -O -o - btf.c -fstrict-volatile-bitfields .file "btf.c" .section P,"ax" .global _main .type _main, @function _main: mov.L #_bitfield, r14 mov.L #1, [r14] ; **** breaks other area! **** mov.L [r14], r4 bset #15, r4 mov.L r4, [r14] mov.L [r14], r4 and #0xffffff, r4 or #0x1000000, r4 mov.L r4, [r14] ; ok, aligned (my misunderstanding). mov.L #0, r1 rts .size _main, .-_main .comm _bitfield,4,4 .ident "GCC: (GNU) 4.6.1"