From eff2d0ba5890b517ef5bc9d0269d6149556c12c8 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 11 Apr 2011 13:19:05 +0200 Subject: 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 --- libc/stdlib/malloc/malloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc/stdlib/malloc/malloc.h') diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 0a4b43b86..25f7409bf 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -17,7 +17,7 @@ alignment can be a significant win on targets like m68k and Coldfire, where __alignof__(double) == 2. */ #define MALLOC_ALIGNMENT \ - __alignof__ (double __attribute_aligned__ (sizeof (size_t))) + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) /* The system pagesize... */ extern size_t __pagesize; -- cgit v1.2.3