1 /* PR tree-optimization/57149 */
2 /* { dg-do compile } */
3 /* { dg-options "-Os -Wuninitialized" } */
4 
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]; };
9 
10 extern int fn0 (void);
11 extern int fn1 (struct E *, struct D *);
12 
13 static inline __attribute__ ((always_inline)) int
fn2(const struct A * x)14 fn2 (const struct A *x)
15 {
16   return x->a == x;
17 }
18 
19 static int
fn3(struct E * x)20 fn3 (struct E *x)
21 {
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;
31 }
32 
33 void
fn4(struct F * x,unsigned k)34 fn4 (struct F *x, unsigned k)
35 {
36   unsigned i;
37   for (i = 0; i < k; i++)
38     {
39       struct E *y = &x->i[i];
40       int err = -22;
41       err = fn3 (y);
42       if (y->f == 0)
43 	{
44 	  if (err > 0)
45 	    err = fn0 ();
46 	  if (err < 0)	/* { dg-bogus "may be used uninitialized in this function" } */
47 	    fn0 ();
48 	}
49     }
50 }
51