gcc/testsuite/gcc.dg/uninit-20.c
raw| 1 | /* Spurious uninitialized variable warnings, from gdb */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-O2 -Wuninitialized" } */ |
| 4 | struct os { struct o *o; }; |
| 5 | struct o { struct o *next; struct os *se; }; |
| 6 | void f(struct o *o){ |
| 7 | struct os *s; |
| 8 | if(o) s = o->se; |
| 9 | while(o && s == o->se){ |
| 10 | s++; // here `o' is non-zero and thus s is initialized |
| 11 | s == o->se // `?' is essential, `if' does not trigger the warning |
| 12 | ? (o = o->next, o ? s = o->se : 0) |
| 13 | : 0; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | |
| 18 |