summaryrefslogtreecommitdiffstats
path: root/src/util/ralloc.c
diff options
context:
space:
mode:
authorGrazvydas Ignotas <[email protected]>2017-03-04 02:49:18 +0200
committerEric Anholt <[email protected]>2017-03-06 11:28:48 -0800
commitff494fe999510ea40e3ed5827e7818550b6de126 (patch)
tree08883aec67f6d137d306956b1fae1fee9cdfa998 /src/util/ralloc.c
parentb384c23b9e804916f125354e06c735bd3bb22811 (diff)
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 <[email protected]> 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 <[email protected]> Tested by: Mike Lothian <[email protected]> Tested by: Jonas Pfeil <[email protected]>
Diffstat (limited to 'src/util/ralloc.c')
-rw-r--r--src/util/ralloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/ralloc.c b/src/util/ralloc.c
index 03283de7180..7bf192e0db7 100644
--- a/src/util/ralloc.c
+++ b/src/util/ralloc.c
@@ -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
{