summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr94963.c
blob: aca9e16130182384997e1b984cffd003cfe38c41 (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
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */

typedef struct
{
  int p1;
  int p2;
  int p3;
} P;
struct S
{
  int field;
};
extern int v2;
extern void foo (struct S *map);
static struct S var;
const P *pv;
int ps;
void
f (void)
{
  if (pv != 0)
    for (const P *ph = pv; ph < &pv[ps]; ++ph)
      switch (ph->p1)
	{
	case 1:
	v2 = ph->p2;
	break;
	case 2:
	var.field = ph->p3;
	break;
	}
  if (var.field != 0) /* { dg-bogus "uninitialized" } */
    foo (&var);
}