https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116856
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|WAITING |RESOLVED --- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Robert Hölzl from comment #9) > I know that this solves the problem (as I wrote in my last comment). > > But why does GCC handle an inline typecast (uint32_t __attribute__ > ((__aligned__(1)))*) different from a typecast to an typedef (u32_u*) when > the typedef is identical to the inline typecast? > > In other words: > > typedef uint32_t __attribute__((aligned(1))) u32_u; > uint32_t x = *(u32_u *) y; > > should be identical to > > uint32_t x = *(uint32_t __attribute__ ((__aligned__(1)) *) y; > > right? > > But the latter one is generating wrong code (which contains LDRD) The aligned in `uint32_t __attribute__ ((__aligned__(1)) *` gets attached to the pointer type rather than what it is being pointed to.