ralloc: don't leave out the alignment factor

Experimentation shows that without alignment factor gcc and clang choose
a factor of 16 even on IA-32, which doesn't match what malloc() uses (8).
The problem is it makes gcc assume the pointer is 16 byte aligned, so
with -O3 it starts using aligned SSE instructions that later fault,
so always specify a suitable alignment factor.

Cc: Jonas Pfeil <pfeiljonas@gmx.de>
Fixes: cd2b55e5 "ralloc: Make sure ralloc() allocations match malloc()'s alignment."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100049
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Tested by: Mike Lothian <mike@fireburn.co.uk>
Tested by: Jonas Pfeil <pfeiljonas@gmx.de>
This commit is contained in:
Grazvydas Ignotas 2017-03-04 02:49:18 +02:00 committed by Eric Anholt
parent b384c23b9e
commit ff494fe999
1 changed files with 3 additions and 1 deletions

View File

@ -59,8 +59,10 @@ _CRTIMP int _vscprintf(const char *format, va_list argptr);
struct
#ifdef _MSC_VER
__declspec(align(8))
#elif defined(__LP64__)
__attribute__((aligned(16)))
#else
__attribute__((aligned))
__attribute__((aligned(8)))
#endif
ralloc_header
{