[PATCH] Fix PR52402

Jakub Jelinek jakub@redhat.com
Tue Feb 28 20:54:00 GMT 2012


On Mon, Feb 27, 2012 at 04:38:01PM +0100, Richard Guenther wrote:
> This fixes PR52402 in a similar way as PR50444.  IPA SRA needs to be
> careful about alignment when constructing accesses.
> 
> Bootstrap and regtest pending on x86_64, any comments?

The test fails on i386-linux, adding "-w -Wno-psabi" to options
disables the
/usr/src/gcc/gcc/testsuite/gcc.dg/torture/pr52402.c: In function ‘foo.isra.0’:
/usr/src/gcc/gcc/testsuite/gcc.dg/torture/pr52402.c:7:1: note: The ABI for passing parameters with 16-byte alignment has changed in GCC 4.6
/usr/src/gcc/gcc/testsuite/gcc.dg/torture/pr52402.c:7:1: warning: SSE vector argument without SSE enabled changes the ABI [enabled by default]
warnings it otherwise prints.

> *** gcc/testsuite/gcc.dg/torture/pr52402.c	(revision 0)
> --- gcc/testsuite/gcc.dg/torture/pr52402.c	(revision 0)
> ***************
> *** 0 ****
> --- 1,28 ----
> + /* { dg-do run } */
> + 
> + typedef int v4si __attribute__((vector_size(16)));
> + struct T { v4si i[2]; int j; } __attribute__((packed));
> + 
> + static v4si __attribute__((noinline))
> + foo (struct T t)
> + {
> +   return t.i[0];
> + }
> + 
> + static struct T *__attribute__((noinline))
> + init ()
> + {
> +   char *p = __builtin_malloc (sizeof (struct T) + 1);
> +   p++;
> +   __builtin_memset (p, 1, sizeof (struct T));
> +   return (struct T *)p;
> + }
> + 
> + int main()
> + {
> +   struct T *p;
> +   p = init ();
> +   if (foo (*p)[0] != 0x01010101)
> +     __builtin_abort ();
> +   return 0;
> + }

	Jakub



More information about the Gcc-patches mailing list