[Bug target/59958] alpha does not deal with non-aligned returns from malloc() when doing byte wise access
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 29 00:45:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list