Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / pr54921.c
1 /* PR rtl-optimization/54921 */
2 /* { dg-do run } */
3 /* { dg-options "-Os -fno-omit-frame-pointer -fsched2-use-superblocks -ftree-slp-vectorize" } */
4 /* { dg-additional-options "-fstack-protector" { target fstack_protector } } */
5
6 struct A
7 {
8   int a;
9   char b[32];
10 } a, b;
11
12 __attribute__((noinline, noclone))
13 struct A
14 bar (int x)
15 {
16   struct A r;
17   static int n;
18   r.a = ++n;
19   __builtin_memset (r.b, 0, sizeof (r.b));
20   r.b[0] = x;
21   return r;
22 }
23
24 int
25 main ()
26 {
27   a = bar (3);
28   b = bar (4);
29   if (a.a != 1 || a.b[0] != 3 || b.a != 2 || b.b[0] != 4)
30     __builtin_abort ();
31   return 0;
32 }