https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116856
--- Comment #8 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
BTW, rewriting the code as:
#include <stdint.h>
typedef uint32_t __attribute__((aligned(1))) u32_u;
void f()
{
static uint8_t array[64];
for (uint8_t i = 0; i < sizeof(array); i++)
{
*(u32_u*) &array[i + 4] ^=
*(u32_u*)&array[i];
}
}
Seems to address the problem, giving
f():
ldr r3, .L5
add r0, r3, #64
.L2:
ldr r2, [r3, #-4] @ unaligned
ldr r1, [r3] @ unaligned
eors r2, r2, r1
str r2, [r3], #1 @ unaligned
cmp r0, r3
bne .L2
bx lr