<div dir="ltr">I've spent the whole night tracking down this bug<div><br></div><div>I thought it was an issue with a recent upgrade of binutils</div><div><br></div><div>Please add my:</div><div><br></div><div>Tested by: Mike Lothian <<a href="mailto:mike@fireburn.co.uk">mike@fireburn.co.uk</a>></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, 4 Mar 2017 at 00:49 Grazvydas Ignotas <<a href="mailto:notasas@gmail.com">notasas@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Experimentation shows that without alignment factor gcc and clang choose<br class="gmail_msg">
a factor of 16 even on IA-32, which doesn't match what malloc() uses (8).<br class="gmail_msg">
The problem is it makes gcc assume the pointer is 16 byte aligned, so<br class="gmail_msg">
with -O3 it starts using aligned SSE instructions that later fault,<br class="gmail_msg">
so always specify a suitable alignment factor.<br class="gmail_msg">
<br class="gmail_msg">
Cc: Jonas Pfeil <<a href="mailto:pfeiljonas@gmx.de" class="gmail_msg" target="_blank">pfeiljonas@gmx.de</a>><br class="gmail_msg">
Fixes: cd2b55e5 "ralloc: Make sure ralloc() allocations match malloc()'s alignment."<br class="gmail_msg">
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=100049" rel="noreferrer" class="gmail_msg" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=100049</a><br class="gmail_msg">
Signed-off-by: Grazvydas Ignotas <<a href="mailto:notasas@gmail.com" class="gmail_msg" target="_blank">notasas@gmail.com</a>><br class="gmail_msg">
---<br class="gmail_msg">
no commit access<br class="gmail_msg">
<br class="gmail_msg">
 src/util/ralloc.c | 4 +++-<br class="gmail_msg">
 1 file changed, 3 insertions(+), 1 deletion(-)<br class="gmail_msg">
<br class="gmail_msg">
diff --git a/src/util/ralloc.c b/src/util/ralloc.c<br class="gmail_msg">
index 03283de..7bf192e 100644<br class="gmail_msg">
--- a/src/util/ralloc.c<br class="gmail_msg">
+++ b/src/util/ralloc.c<br class="gmail_msg">
@@ -59,8 +59,10 @@ _CRTIMP int _vscprintf(const char *format, va_list argptr);<br class="gmail_msg">
 struct<br class="gmail_msg">
 #ifdef _MSC_VER<br class="gmail_msg">
 __declspec(align(8))<br class="gmail_msg">
+#elif defined(__LP64__)<br class="gmail_msg">
+ __attribute__((aligned(16)))<br class="gmail_msg">
 #else<br class="gmail_msg">
- __attribute__((aligned))<br class="gmail_msg">
+ __attribute__((aligned(8)))<br class="gmail_msg">
 #endif<br class="gmail_msg">
  ralloc_header<br class="gmail_msg">
 {<br class="gmail_msg">
--<br class="gmail_msg">
2.7.4<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
mesa-dev mailing list<br class="gmail_msg">
<a href="mailto:mesa-dev@lists.freedesktop.org" class="gmail_msg" target="_blank">mesa-dev@lists.freedesktop.org</a><br class="gmail_msg">
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br class="gmail_msg">
</blockquote></div>