summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr65658.c
blob: bb5c37adbe321da1eaa0ebfe92f21de1d7a394e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* { dg-do compile } */
/* { dg-options "-Wuninitialized -O2 -Wno-implicit" } */
/* { dg-require-effective-target ptr32plus } */

extern int optind;
struct undefinfo
{
  unsigned long l1;
  unsigned long l2;
};
struct undeffoo
{
  char a[64];
  long b[4];
  int c[33];
};
struct problem
{
  unsigned long l1;
  unsigned long l2;
  unsigned long l3;
  unsigned long l4;
};
static unsigned int undef1, undef2, undef3, undef4, undef5, undef6;
static void *undefvp1;
extern struct undefinfo undefinfo;
static int
undefinit1 (void)
{
  struct undeffoo foo;
  int i;
  for (i = 0; i < 2000; i++)
    {
      undef6++;
      external_function5 (((void *) 0), 0, (void *) &foo);
    }
}

static int
undefinit2 (void *problemp, unsigned long problem)
{
  int ret, u;
  if (undefinit1 ())
    return 1;
  if (fn10 ())
    return 1;
  for (u = 0; u < undef6; u++)
    {
      ret = external_function1 (3 + u * 10, 10);
      if (ret)
	return ret;
      external_function6 (0, 0, 0, problemp + problem);
      return 1;
    }
}

static int
fn6 (struct undefinfo *uip, struct problem *problem)
{
  unsigned long amt;
  if (external_function3 (((void *) 0), ((void *) 0), &amt, 0, 0))
    return 1;
  problem->l1 = (unsigned long) undefvp1;
  problem->l4 = uip->l1;
  problem->l3 = uip->l2;
  return 0;
}

static int
setup (void)
{
  struct problem problem;
  if (fn6 (&undefinfo, &problem))
    return 1;
  if (fn2 ())
    return 1;
  if (fn4 (101))
    return 1;
  if (undefinit2 ((void *) problem.l1, problem.l3 * 4))  /* { dg-bogus "problem.l3" "uninitialized variable warning" } */ 
    return 1;
}

int
main (int argc, char **argv)
{
  int optc;
  if (external_function (1))
    return 1;
  if (external_function (1))
    return 1;
  if (external_function (1))
    return 1;
  while ((optc =
	  getopt_long (argc, argv, ((void *) 0), ((void *) 0),
		       ((void *) 0))) != -1)
    {
      switch (optc)
	{
	case 0:
	  break;
	case 'F':
	  external_function (1);
	default:
	  return 1;
	}
    }
  if ((optind != 99))
    {
      return 1;
    }
  setup ();
}