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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Husemann from comment #2)
> Is the alignment expected from malloc() configurable in gcc and/or different
> from the standard stack alignment?

Yes MALLOC_ABI_ALIGNMENT:
@defmac MALLOC_ABI_ALIGNMENT
Alignment, in bits, a C conformant malloc implementation has to
provide.  If not defined, the default value is @code{BITS_PER_WORD}.
@end defmac




> 
> A small test program along the lines of
> 
>   if ((uintptr_t)malloc(1) & mask) printf("yes\n") else printf("no\n");
> 
> and checking what gcc -O2 optimizes away for different masks seems to show
> that on alpha & 7 is optimized, while & 15 is not. This sounds good for
> alpha.
> 
> However, I get the same results for amd64 - where I would have expected the
> required alignement to be 16 byte. Is this a bug in our amd64 target
> configuration, or am I misundertanding something?

misunderstanding the default and most likely the history of this macro.

Reply via email to