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



--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-26 
10:03:46 UTC ---

(In reply to comment #4)

> 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.



True, but:



config/i386/i386.h:#define BIGGEST_ALIGNMENT (TARGET_AVX ? 256 : 128)



I don't think glibc aligns to 32 bytes currently, so the mark_reg_pointer

is definitely wrong (with -mavx).  Or BIGGEST_ALIGNMENT is wrong ;)



MALLOC_ABI_ALIGNMENT default was set very conservatively (because we use it

to derive information about pointer values).  I didn't realize we already

do that via the calls.c code (and even wrong ...).



Feel free to implement a better default setting for MALLOC_ABI_ALIGNMENT.



> Indeed.  So MALLOC_ABI_ALIGNMENT should perhaps default to the largest

> alignment of all the C89 types, with platform overrides as needed?



But this information is not readily accessible (it was supposed to be

BIGGEST_ALIGNMENT, but -mavx changed this - not sure what the psABI

says and whether this makes current glibc non-conforming to the psABI).

Reply via email to