2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-pred-4_b.c
blob3766395889db4630218d6ea83336e71ca17aeb7f
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2" } */
4 int g;
5 void bar();
6 void blah(int);
7 int foo (int n, int m, int r, int t)
9 int flag = 0;
10 int v;
12 if (t)
14 if (n)
16 v = r; /* init path 1 */
17 flag = 1;
20 if (m) g++;
21 else bar();
23 if (flag) /* properly guarded */
24 blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */
26 else
28 v = r+1; /* init path 2 */
29 flag = 2;
32 if (m) g++;
33 else bar();
35 if (g) /* guard can not be determined statically to be safe */
36 blah(v); /* { dg-warning "uninitialized" "real warning" } */
38 return 0;