1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2 -Wno-implicit" } */
3 
4 extern int optind;
5 struct undefinfo
6 {
7   unsigned long l1;
8   unsigned long l2;
9 };
10 struct undeffoo
11 {
12   char a[64];
13   long b[4];
14   int c[33];
15 };
16 struct problem
17 {
18   unsigned long l1;
19   unsigned long l2;
20   unsigned long l3;
21   unsigned long l4;
22 };
23 static unsigned int undef1, undef2, undef3, undef4, undef5, undef6;
24 static void *undefvp1;
25 extern struct undefinfo undefinfo;
26 static int
undefinit1(void)27 undefinit1 (void)
28 {
29   struct undeffoo foo;
30   int i;
31   for (i = 0; i < 2000; i++)
32     {
33       undef6++;
34       external_function5 (((void *) 0), 0, (void *) &foo);
35     }
36 }
37 
38 static int
undefinit2(void * problemp,unsigned long problem)39 undefinit2 (void *problemp, unsigned long problem)
40 {
41   int ret, u;
42   if (undefinit1 ())
43     return 1;
44   if (fn10 ())
45     return 1;
46   for (u = 0; u < undef6; u++)
47     {
48       ret = external_function1 (3 + u * 10, 10);
49       if (ret)
50 	return ret;
51       external_function6 (0, 0, 0, problemp + problem);
52       return 1;
53     }
54 }
55 
56 static int
fn6(struct undefinfo * uip,struct problem * problem)57 fn6 (struct undefinfo *uip, struct problem *problem)
58 {
59   unsigned long amt;
60   if (external_function3 (((void *) 0), ((void *) 0), &amt, 0, 0))
61     return 1;
62   problem->l1 = (unsigned long) undefvp1;
63   problem->l4 = uip->l1;
64   problem->l3 = uip->l2;
65   return 0;
66 }
67 
68 static int
setup(void)69 setup (void)
70 {
71   struct problem problem;
72   if (fn6 (&undefinfo, &problem))
73     return 1;
74   if (fn2 ())
75     return 1;
76   if (fn4 (101))
77     return 1;
78   if (undefinit2 ((void *) problem.l1, problem.l3 * 4))  /* { dg-bogus "problem.l3" "uninitialized variable warning" } */
79     return 1;
80 }
81 
82 int
main(int argc,char ** argv)83 main (int argc, char **argv)
84 {
85   int optc;
86   if (external_function (1))
87     return 1;
88   if (external_function (1))
89     return 1;
90   if (external_function (1))
91     return 1;
92   while ((optc =
93 	  getopt_long (argc, argv, ((void *) 0), ((void *) 0),
94 		       ((void *) 0))) != -1)
95     {
96       switch (optc)
97 	{
98 	case 0:
99 	  break;
100 	case 'F':
101 	  external_function (1);
102 	default:
103 	  return 1;
104 	}
105     }
106   if ((optind != 99))
107     {
108       return 1;
109     }
110   setup ();
111 }
112