| 1 |
/* PR tree-optimization/61869 - Spurious uninitialized warning (lim1 pass, |
| 2 |
pretty-printed internal var |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
typedef struct data { |
| 7 |
struct data *next; |
| 8 |
} data; |
| 9 |
|
| 10 |
typedef struct list { |
| 11 |
unsigned dummy; |
| 12 |
struct list *next; |
| 13 |
data *start; |
| 14 |
int flags; |
| 15 |
} list; |
| 16 |
|
| 17 |
typedef struct iterator { |
| 18 |
struct data *ptr; |
| 19 |
unsigned dummy; |
| 20 |
} iterator; |
| 21 |
|
| 22 |
iterator start (list *a) { |
| 23 |
iterator i = { |
| 24 |
*(a->flags ? &a->start : 0), |
| 25 |
0 |
| 26 |
}; |
| 27 |
return i; |
| 28 |
} |
| 29 |
|
| 30 |
void g (iterator *i); |
| 31 |
|
| 32 |
void f (list *b) |
| 33 |
{ |
| 34 |
list *a; |
| 35 |
iterator i; // { dg-bogus "-Wmaybe-uninitialized" } |
| 36 |
|
| 37 |
for (a = b; a; a = a->next) |
| 38 |
for (i = start (a); i.ptr; i.ptr = i.ptr->next) |
| 39 |
{ |
| 40 |
if (i.ptr) |
| 41 |
return; |
| 42 |
} |
| 43 |
|
| 44 |
for (a = b; a; a = a->next) |
| 45 |
for (i = start (a); i.ptr; i.ptr = i.ptr->next) |
| 46 |
g(&i); |
| 47 |
} |