2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-11-O0.c
blob23af4f69aa06c61f140e3ab4d3924199e1bbd7e5
1 /* Positive test for uninitialized variables. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wuninitialized" } */
5 int sink;
7 void f1(int parm) /* { dg-bogus "uninitialized" "parameter" } */
9 sink = parm; /* { dg-bogus "uninitialized" "parameter" } */
12 void f2(void)
14 int x;
15 sink = x; /* { dg-warning "is used" "unconditional" } */
18 void f3(int p)
20 int x; /* { dg-warning "may be used" "conditional" { xfail *-*-* } } */
21 if (p)
22 x = p;
23 sink = x;
26 void f4(int p)
28 int x; /* { dg-bogus "uninitialized" "easy if" } */
29 if (p)
30 x = 1;
31 else
32 x = 2;
33 sink = x;
36 void f5(void)
38 int x, i; /* { dg-bogus "uninitialized" "easy loop" } */
39 for (i = 0; i < 10; ++i)
40 x = 1;
41 sink = x;