| 1 |
/* PR tree-optimization/45083 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -Wuninitialized" } */ |
| 4 |
|
| 5 |
struct S { char *a; unsigned b; unsigned c; }; |
| 6 |
extern int foo (const char *); |
| 7 |
extern void bar (int, int); |
| 8 |
|
| 9 |
static void |
| 10 |
baz (void) |
| 11 |
{ |
| 12 |
struct S cs[1]; /* { dg-message "was declared here" } */ |
| 13 |
switch (cs->b) /* { dg-warning "cs\[^\n\r\]*\\.b\[^\n\r\]*is used uninitialized" } */ |
| 14 |
{ |
| 15 |
case 101: |
| 16 |
if (foo (cs->a)) /* { dg-warning "cs\[^\n\r\]*\\.a\[^\n\r\]*may be used uninitialized" } */ |
| 17 |
bar (cs->c, cs->b); /* { dg-warning "cs\[^\n\r\]*\\.c\[^\n\r\]*may be used uninitialized" } */ |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
test (void) |
| 23 |
{ |
| 24 |
baz (); |
| 25 |
} |