Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr93908.c

raw
1 /* PR rtl-optimization/93908 */
2
3 struct T
4 {
5 int b;
6 int c;
7 unsigned short d;
8 unsigned e:1, f:1, g:1, h:2, i:1, j:1;
9 signed int k:2;
10 };
11
12 struct S
13 {
14 struct T s;
15 char c[64];
16 } buf[2];
17
18 __attribute__ ((noipa)) void *
19 baz (void)
20 {
21 static int cnt;
22 return (void *) &buf[cnt++];
23 }
24
25 static inline __attribute__ ((always_inline)) struct T *
26 bar (const char *a)
27 {
28 struct T *s;
29 s = baz ();
30 s->b = 1;
31 s->k = -1;
32 return s;
33 }
34
35 __attribute__ ((noipa)) void
36 foo (const char *x, struct T **y)
37 {
38 struct T *l = bar (x);
39 struct T *m = bar (x);
40 y[0] = l;
41 y[1] = m;
42 }
43
44 int
45 main ()
46 {
47 struct T *r[2];
48 foo ("foo", r);
49 if (r[0]->e || r[0]->f || r[0]->g || r[0]->h || r[0]->i || r[0]->j || r[0]->k != -1)
50 __builtin_abort ();
51 if (r[1]->e || r[1]->f || r[1]->g || r[1]->h || r[1]->i || r[1]->j || r[1]->k != -1)
52 __builtin_abort ();
53 return 0;
54 }