summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr45083.c
blob: c9a4dbfe19124d8e4d2c6b322e18ea397f8fe9d1 (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
/* PR tree-optimization/45083 */
/* { dg-do compile } */
/* { dg-options "-O2 -Wuninitialized" } */

struct S { char *a; unsigned b; unsigned c; };
extern int foo (const char *);
extern void bar (int, int);

static void
baz (void)
{
  struct S cs[1];	/* { dg-message "was declared here" } */
  switch (cs->b)	/* { dg-warning "cs\[^\n\r\]*\\.b\[^\n\r\]*is used uninitialized" } */
    {
    case 101:
      if (foo (cs->a))	/* { dg-warning "cs\[^\n\r\]*\\.a\[^\n\r\]*may be used uninitialized" } */
	bar (cs->c, cs->b);	/* { dg-warning "cs\[^\n\r\]*\\.c\[^\n\r\]*may be used uninitialized" } */
    }
}

void
test (void)
{
  baz ();
}