Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr108498-1.c

raw
1 /* PR tree-optimization/108498 */
2
3 struct A
4 {
5 signed char a1;
6 int a2;
7 };
8
9 struct B
10 {
11 struct A b1;
12 unsigned char b2:1, b3:1, b4:2, b5:1, b6:1, b7[4];
13 };
14
15 struct C
16 {
17 unsigned char c1;
18 char c2;
19 signed char c3;
20 unsigned char c4, c5[4], c6:1, c7:1, c8:1, c9:3, c10:1;
21 struct A c11;
22 struct B c12[3];
23 };
24
25 static inline struct C
26 foo (unsigned char a, unsigned b, int c, struct A d,
27 unsigned e, struct B f, struct B g, struct B h)
28 {
29 struct C x
30 = { .c1 = b, .c2 = 0, .c3 = c, .c6 = a, .c4 = e, .c7 = 0,
31 .c8 = 0, .c9 = 7, .c10 = 0, .c5 = {0, 1, 2, 3}, .c11 = d,
32 .c12 = {f, g, h} };
33 return x;
34 }
35
36 static inline struct A
37 bar (int a, int b)
38 {
39 struct A x = { .a1 = a, .a2 = b };
40 return x;
41 }
42
43 static inline struct B
44 baz (struct A b1)
45 {
46 struct B x = { .b1 = b1, .b6 = 0, .b5 = 0, .b7 = {0, 1, 2, 3}, .b2 = 0 };
47 return x;
48 }
49
50 struct C
51 qux (void)
52 {
53 const struct B a = baz (bar (0, 0));
54 struct C b;
55 struct B c[2];
56 struct A d = { 0, 1 };
57 c[0].b1.a1 = 0;
58 c[0].b1.a2 = 2;
59 c[1].b1.a1 = 4;
60 c[1].b1.a2 = 8;
61 return foo (0, 2, -1, d, 3, c[0], c[1], a);
62 }
63
64 __attribute__((noipa)) void
65 corge (struct C *x)
66 {
67 char buf[1024];
68 __builtin_memset (buf, 0xaa, sizeof (buf));
69 asm volatile ("" : : "r" (buf));
70 __builtin_memset (x, 0x55, sizeof (struct C));
71 asm volatile ("" : : "r" (x));
72 }
73
74 int
75 main ()
76 {
77 struct C x;
78 corge (&x);
79 x = qux ();
80 if (x.c6 || x.c9 != 7)
81 __builtin_abort ();
82 }