This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/56434] document that __attribute__((__malloc__)) assumes returned pointer has BIGGEST_ALIGNMENT


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-25 18:36:49 UTC ---
MALLOC_ABI_ALIGNMENT isn't properly set on most targets though.

E.g. with glibc, the alignment of malloced memory is 2 * sizeof (void *) (right
now, might be bigger in the future), while MALLOC_ABI_ALIGNMENT is still 8
bits.

It is just fine to assume malloced memory must be at aligned enough for any of
the standard C types, so if this is say on x86_64 where long double is 16-byte
aligned, then there is really no reason to bother with aligning to 16-byte
boundaries.  If you have malloc implementation that doesn't align at least that
much, just fix it, or don't use malloc attribute for that.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]