[Bug c/50521] -fstrict-volatile-bitfields is not strict

henrik at henriknordstrom dot net gcc-bugzilla@gcc.gnu.org
Fri Oct 28 17:46:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50521

--- Comment #12 from Henrik Nordström <henrik at henriknordstrom dot net> 2011-10-28 17:46:15 UTC ---
Regarding the double load. In a statement like a = b, both a & be should be
individually accessed even if they refer to the same storage. So  
bitfield.bits.a = bitfield.bits.c should load the bitfield variable twice, once
for reading the rvalue and once for masking the lvalue assignment.

See 7.1.7.5 second and third paragraph and the note just after.


Regarding STRICT_ALIGNMENT, not strictly needed on ARM i think. Smaller
accesses than the base type is acceptable, as long as it's aligned to the
matching access size (8/16/32/64 bit) and on ARMv7 unaligned access is allowed,
but at a performance penalty. And this change is technically unrelated to
strict-volatile-bitfields even if there is overlap.



More information about the Gcc-bugs mailing list