Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / torture / pr52402.c
1 /* { dg-do run } */
2 /* { dg-options "-w -Wno-psabi" } */
3 /* { dg-require-effective-target int32plus } */
4
5 typedef int v4si __attribute__((vector_size(16)));
6 struct T { v4si i[2]; int j; } __attribute__((packed));
7
8 static v4si __attribute__((noinline))
9 foo (struct T t)
10 {
11   return t.i[0];
12 }
13
14 static struct T *__attribute__((noinline))
15 init ()
16 {
17   char *p = __builtin_malloc (sizeof (struct T) + 1);
18   p++;
19   __builtin_memset (p, 1, sizeof (struct T));
20   return (struct T *)p;
21 }
22
23 int main()
24 {
25   struct T *p;
26   p = init ();
27   if (foo (*p)[0] != 0x01010101)
28     __builtin_abort ();
29   return 0;
30 }