[Pixman] [PATCH] test/utils.c: Make the stack unaligned only on 32 bit Windows

Matt Turner mattst88 at gmail.com
Sat Nov 16 17:30:29 PST 2013


On Sat, Nov 16, 2013 at 4:27 PM, Søren Sandmann <sandmann at cs.au.dk> wrote:
> The call_test_function() contains some assembly that deliberately
> causes the stack to be aligned to 32 bits rather than 128 bits on
> x86-32. The intention is to catch bugs that surface when pixman is
> called from code that only uses a 32 bit alignment.
>
> However, recent versions of GCC apparently make the assumption (either
> accidentally or deliberately) that that the incoming stack is aligned
> to 128 bits, where older versions only seemed to make this assumption
> when compiling with -msse2. This causes the vector code in the PRNG to
> now segfault when called from call_test_function() on x86-32.
>
> This patch fixes that by only making the stack unaligned on 32 bit
> Windows, where it would definitely be incorrect for GCC to assume that
> the incoming stack is aligned to 128 bits.
> ---
>  test/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/utils.c b/test/utils.c
> index 281f6b4..f3c1b31 100644
> --- a/test/utils.c
> +++ b/test/utils.c
> @@ -648,7 +648,7 @@ call_test_function (uint32_t    (*test_function)(int testnum, int verbose),
>  {
>      uint32_t retval;
>
> -#if defined (__GNUC__) && (defined (__i386) || defined (__i386__))
> +#if __GNUC__ && defined (_WIN32) && (defined (__i386) || defined (__i386__))
>      __asm__ (
>         /* Deliberately avoid aligning the stack to 16 bytes */
>         "pushl  %1\n\t"
> --
> 1.8.3.1

Tested-by: Matt Turner <mattst88 at gmail.com>

Could we do a 0.32.4 release with this and the SSSE3 detection fix?


More information about the Pixman mailing list