http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Well, the problem with doing it this way is that ptr is still considered address taken and the assume aligned then really can result in a noop move. What I meant is expand: ret = posix_memalign (&ptr, align, size); as { void *temp; ret = posix_memalign (&temp, align, size); void *temp2 = __builtin_passthru_attribute_malloc_size (temp, size); ptr = __typeof (ptr) __builtin_assume_aligned (temp2, align); temp ={v}{CLOBBER}; } The advantages of doing it this way would be that (if ptr is not address taken for other reasons) that it would not need to be address taken, escape and all the like, I think posix_memalign is not reading the old content of the pointer nor storing it anywhere, it just fills it in as another result, just by reference. And the optimizers would know it doesn't alias anything, like if it came from malloc (size);, and is aligned to align bytes at least. The disadvantage would be that if ptr is addressable for other reasons, we wouldn't reuse it's address for posix_memalign, but pass address of another temporary and then copied the mem.