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