* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Don't
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr51877.c
bloba2d65cfd9d830108dab0d8e689688ae7671c1058
1 /* PR tree-optimization/51877 */
3 extern void abort (void);
4 struct A { int a; char b[32]; } a, b;
6 __attribute__((noinline, noclone))
7 struct A
8 bar (int x)
10 struct A r;
11 static int n;
12 r.a = ++n;
13 __builtin_memset (r.b, 0, sizeof (r.b));
14 r.b[0] = x;
15 return r;
18 __attribute__((noinline, noclone))
19 void
20 baz (void)
22 asm volatile ("" : : : "memory");
25 __attribute__((noinline, noclone))
26 void
27 foo (struct A *x, int y)
29 if (y == 6)
30 a = bar (7);
31 else
32 *x = bar (7);
33 baz ();
36 int
37 main ()
39 a = bar (3);
40 b = bar (4);
41 if (a.a != 1 || a.b[0] != 3 || b.a != 2 || b.b[0] != 4)
42 abort ();
43 foo (&b, 0);
44 if (a.a != 1 || a.b[0] != 3 || b.a != 3 || b.b[0] != 7)
45 abort ();
46 foo (&b, 6);
47 if (a.a != 4 || a.b[0] != 7 || b.a != 3 || b.b[0] != 7)
48 abort ();
49 return 0;