[Bug target/56726] i386: MALLOC_ABI_ALIGNMENT is too small (usually)

chip at pobox dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 25 22:36:00 GMT 2013


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

--- Comment #4 from Chip Salzenberg <chip at pobox dot com> 2013-03-25 22:35:57 UTC ---
If I'm reading that correctly, it seems to agree with my patch.

It looks like MALLOC_ABI_ALIGNMENT of POINTER_SIZE*2 is always either correct
or smaller than necessary, but never too large.  If MALLOC_ABI_ALIGNMENT is
smaller than necessary then optimizations may be missed (depending on the
values).  But if it is too large then performance *will* suffer.  It might even
cause exceptions from unaligned accesses, but i386 is very forgiving, so it'll
just be slower for no apparent reason.

Perhaps the glibc version differences in malloc should be advertised with
__attribute__ on the malloc declarations.  Perhaps a new pragma or attribute is
required to do this 100% right.  But in the meantime I like POINTER_SIZE*2.



More information about the Gcc-bugs mailing list