2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr57149.c
blobab4d5e40899b29f6f643a9894f96ae986481d1ad
1 /* PR tree-optimization/57149 */
2 /* { dg-do compile } */
3 /* { dg-options "-Os -Wuninitialized" } */
5 struct A { struct A *a, *b; };
6 struct D { struct A e; };
7 struct E { unsigned char f; struct { struct A e; } g; };
8 struct F { struct E i[32]; };
10 extern int fn0 (void);
11 extern int fn1 (struct E *, struct D *);
13 static inline __attribute__ ((always_inline)) int
14 fn2 (const struct A *x)
16 return x->a == x;
19 static int
20 fn3 (struct E *x)
22 struct D *l, *m;
23 int retval = retval;
24 if (fn2 (&x->g.e))
25 return 0;
26 for (l = (struct D *) x->g.e.a, m = (struct D *) l->e.a;
27 &l->e != &x->g.e;
28 l = m, m = (struct D *) m->e.a)
29 retval = fn1 (x, l);
30 return retval;
33 void
34 fn4 (struct F *x, unsigned k)
36 unsigned i;
37 for (i = 0; i < k; i++)
39 struct E *y = &x->i[i];
40 int err = -22;
41 err = fn3 (y);
42 if (y->f == 0)
44 if (err > 0)
45 err = fn0 ();
46 if (err < 0) /* { dg-bogus "may be used uninitialized in this function" } */
47 fn0 ();