On Tue, May 28, 2013 at 12:15:58PM +0300, Anton Titov wrote: > Hello everybody, > > (I'm not a member, CC me in replies) > > I'm trying to force gcc to trust me that my memory allocation > function is returning aligned memory. So far I tried everything I > found with no luck. What I have is: > snip > alignedvoid *aptr__=_mp_malloc(pool, asize__);\ > memset(aptr__, 0, asize__);\ snip > to produce assembly code that calls _mp_malloc and afterwards > assumes that the returned value is properly aligned for fast store > and hopefully makes use of the fact that size is also rounded > properly so no code for filling the trailing odd bytes is generated. > Did you tried if following gets optimized out?
(((long)atpr)%16 != 0) abort(); Code generated by memset is quite suboptimal, I do not know if this is caused by gcc not handling what memset generates or because expansion happens after analysis that uses alignment.