[Mesa-dev] [PATCH] ralloc: don't leave out the alignment factor

Mike Lothian mike at fireburn.co.uk
Sat Mar 4 03:00:38 UTC 2017


I've spent the whole night tracking down this bug

I thought it was an issue with a recent upgrade of binutils

Please add my:

Tested by: Mike Lothian <mike at fireburn.co.uk>

On Sat, 4 Mar 2017 at 00:49 Grazvydas Ignotas <notasas at gmail.com> wrote:

> 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 at 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 at gmail.com>
> ---
> no commit access
>
>  src/util/ralloc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/ralloc.c b/src/util/ralloc.c
> index 03283de..7bf192e 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
>  {
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170304/96b8dedc/attachment.html>


More information about the mesa-dev mailing list