annotate gcc/testsuite/gcc.dg/uninit-20.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Spurious uninitialized variable warnings, from gdb */
kono
parents:
diff changeset
2 /* { dg-do compile } */
kono
parents:
diff changeset
3 /* { dg-options "-O2 -Wuninitialized" } */
kono
parents:
diff changeset
4 struct os { struct o *o; };
kono
parents:
diff changeset
5 struct o { struct o *next; struct os *se; };
kono
parents:
diff changeset
6 void f(struct o *o){
kono
parents:
diff changeset
7 struct os *s;
kono
parents:
diff changeset
8 if(o) s = o->se;
kono
parents:
diff changeset
9 while(o && s == o->se){
kono
parents:
diff changeset
10 s++; // here `o' is non-zero and thus s is initialized
kono
parents:
diff changeset
11 s == o->se // `?' is essential, `if' does not trigger the warning
kono
parents:
diff changeset
12 ? (o = o->next, o ? s = o->se : 0)
kono
parents:
diff changeset
13 : 0;
kono
parents:
diff changeset
14 }
kono
parents:
diff changeset
15 }
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18