https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116856

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
#include <stdint.h>
typedef uint32_t uuint32_t __attribute__ ((__aligned__(1)))  ;
void f(uint8_t *array)
{
  uuint32_t * ptr  = (uuint32_t *) (array + 1);
  *ptr ^= *(ptr+1);
}
```

Works for me with -mcpu=cortex-m33:

        ldr     r3, [r0, #1]      @ unaligned
        ldr     r2, [r0, #5]      @ unaligned
        eors    r3, r3, r2
        str     r3, [r0, #1]      @ unaligned
        bx      lr

This also works:
```
#include <stdint.h>
typedef uint32_t uuint32_t __attribute__ ((__aligned__(1)))  ;

void g(uint8_t *);

void f()//uint8_t *array)
{
  uint8_t array[100];
  uuint32_t * ptr  = (uuint32_t *) (array + 1);
  *ptr ^= *(ptr+1);
  g(array);
}
```

Giving:
```

        push    {lr}
        sub     sp, sp, #108
        ldr     r3, [sp, #5]      @ unaligned
        ldr     r2, [sp, #9]      @ unaligned
        add     r0, sp, #4
        eors    r3, r3, r2
        str     r3, [sp, #5]      @ unaligned
        bl      g
```

Reply via email to