------- Comment #12 from yotambarnoy at gmail dot com  2010-09-01 18:35 -------
Right. Unfortunately 
> typedef my_unaligned_aliasing_uint32 uint32
> __attribute__((aligned(1),may_alias));
> 
> inline __attribute__((__always_inline__)) uint32 READ_UINT32(const void *ptr)
> {
>   return *(const my_unaligned_aliasing_uint32 *)ptr;
> }

doesn't work and doesn't align. I kept the struct method and added the
__may_alias__ attribute to fix the problem on my end. I'm glad to see gcc has
these attributes after all.

Regarding memcpy, I can't get gcc to optimize it for me at all, probably
because the PSP toolchain adds -fno-builtin to newlib. If I use
-Wl,--wrap,memcpy can I then create a __builtin_memcpy and have gcc optimize
using it?

Thanks for all your feedback guys. You've been a huge help.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45462

Reply via email to