2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr65658.c
blobbb5c37adbe321da1eaa0ebfe92f21de1d7a394e1
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2 -Wno-implicit" } */
3 /* { dg-require-effective-target ptr32plus } */
5 extern int optind;
6 struct undefinfo
8 unsigned long l1;
9 unsigned long l2;
11 struct undeffoo
13 char a[64];
14 long b[4];
15 int c[33];
17 struct problem
19 unsigned long l1;
20 unsigned long l2;
21 unsigned long l3;
22 unsigned long l4;
24 static unsigned int undef1, undef2, undef3, undef4, undef5, undef6;
25 static void *undefvp1;
26 extern struct undefinfo undefinfo;
27 static int
28 undefinit1 (void)
30 struct undeffoo foo;
31 int i;
32 for (i = 0; i < 2000; i++)
34 undef6++;
35 external_function5 (((void *) 0), 0, (void *) &foo);
39 static int
40 undefinit2 (void *problemp, unsigned long problem)
42 int ret, u;
43 if (undefinit1 ())
44 return 1;
45 if (fn10 ())
46 return 1;
47 for (u = 0; u < undef6; u++)
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;
57 static int
58 fn6 (struct undefinfo *uip, struct problem *problem)
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;
69 static int
70 setup (void)
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;
83 int
84 main (int argc, char **argv)
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)
97 switch (optc)
99 case 0:
100 break;
101 case 'F':
102 external_function (1);
103 default:
104 return 1;
107 if ((optind != 99))
109 return 1;
111 setup ();