http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56726
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hjl.tools at gmail dot com --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2013-03-25 20:04:44 UTC --- (In reply to comment #0) > Observed malloc alignment for the i386 ABI is double POINTER_SIZE. > BITS_PER_WORD, the current default, is usually too small. (It's right only on > X32.) > > Proposed patch: > > --- gcc/config/i386/i386.h (revision 197055) > +++ gcc/config/i386/i386.h (working copy) > @@ -815,6 +815,14 @@ > x86_field_alignment (FIELD, COMPUTED) > #endif > > +/* The maximum alignment 'malloc' honors. > + > + This value is taken from glibc documentation for memalign(). It may > + be up to double the very conservative GCC default. This should be safe, > + since even the GCC 4.8 default of BIGGEST_ALIGNMENT usually worked. */ > + > +#define MALLOC_ABI_ALIGNMENT (POINTER_SIZE * 2) > + This isn't correct for x32, whose pointer size is 4 bytes with malloc aligned to 16 bytes.