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



--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-09 
13:38:12 UTC ---

(In reply to comment #3)

> (In reply to comment #2)

> > (In reply to comment #1)

> > > posix_memalign unfortunately has a weird enough interface that we can't

> > > easily extract alignment for the pointer.

> > 

> > Is it just because it outputs through a pointer? Are aligned_alloc, 
> > memalign 

> > and others easier then?

> 

> Yes.



We can of course apply the same trick as we do for sincos - transform it to



({ void *tem; int ret;

   tem = __builtin_gcc_posix_memalign (&res, alignment, size);

   *memptr = tem;

   ret; })



and then expand it to RTL as posix_memalign using another memory temporary ...



The issue with such return is that we cannot see all possible uses of the

return-by-reference value which is easy to do if it is the actual return

value.



Possibly an alloc_align attribute would be useful as well.

Reply via email to