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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|WAITING                     |RESOLVED

--- Comment #7 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
        *(uint32_t __attribute__ ((__aligned__(1)))*) &array[i + 4] ^=
                                *(uint32_t __attribute__ ((__aligned__(1)))*)
&array[i];

By casting an address to uint32_t you are asserting to the compiler that the
address is 32-bit aligned.  LDRD does two 32-bit aligned loads (see the Arm ARM
DDI0553B).  So this code is safe iff your address calculations produce 32-bit
aligned values.  If they don't then that's a bug in your code, not the
compiler.

Reply via email to