This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/56434] document that __attribute__((__malloc__)) assumes returned pointer has BIGGEST_ALIGNMENT
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Feb 2013 18:36:49 +0000
- Subject: [Bug rtl-optimization/56434] document that __attribute__((__malloc__)) assumes returned pointer has BIGGEST_ALIGNMENT
- Auto-submitted: auto-generated
- References: <bug-56434-4@http.gcc.gnu.org/bugzilla/>
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.