OSDN Git Service

Fix malloc alignment
authorBernd Schmidt <bernds@codesourcery.com>
Mon, 11 Apr 2011 11:19:05 +0000 (13:19 +0200)
committerBernd Schmidt <bernds@codesourcery.com>
Mon, 11 Apr 2011 11:26:56 +0000 (13:26 +0200)
commiteff2d0ba5890b517ef5bc9d0269d6149556c12c8
tree46eb9f209a53ca39b31eeb80ed797f4c50dca105
parent56ea76b6bf190bffdc07aba90e4b25dfc096027b
Fix malloc alignment

In commit 3e0a1f388, Richard tried to fix malloc alignments by using
 alignof (double __attribute_aligned__(sizeof (size_t))).
This doesn't work, since attribute_aligned overrides the alignment
rather than providing a minimum. On C6X, malloc returns four-byte
aligned values rather than the necessary eight-byte alignment.

It's simpler to use a comparison and pick the bigger of the two values,
so that's what I've done.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
libc/stdlib/malloc/heap.h
libc/stdlib/malloc/malloc.h