[Bug middle-end/63991] redundant read when write to volatile member of packed structure
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 20 12:06:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63991
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |arm-none-eabi
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-11-20
CC| |ebotcazou at gcc dot gnu.org
Component|c |middle-end
Ever confirmed|0 |1
Known to fail| |5.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
That's indeed a bug as if the structure is unaligned (which is what happens
with -fpack-struct). Correct code looks like
mov r2, #32
mov r3, #0
ldrb r1, [r0, #20] @ zero_extendqisi2
strb r2, [r0, #20]
ldrb r2, [r0, #21] @ zero_extendqisi2
strb r3, [r0, #21]
ldrb r2, [r0, #22] @ zero_extendqisi2
strb r3, [r0, #22]
ldrb r2, [r0, #23] @ zero_extendqisi2
strb r3, [r0, #23]
but still for some reason we create volatile unused loads at expansion time
(and those prevail and don't get DCEd, obviously).
Probably happens on all strict-alignment targets.
More information about the Gcc-bugs
mailing list