In gcc/testsuite/: 2011-03-04 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-pred-2_c.c
blob941f6328d0f0b8dca383ef7e888f62fa1bc500c3
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2" } */
4 int g;
5 void bar (void);
6 void blah (int);
8 int foo (int n, int m, int r)
10 int flag = 0;
11 int v;
13 if (n)
15 v = r;
16 flag = 1;
19 if (m) g++;
20 else bar();
22 if (flag)
23 blah(v); /* { dg-bogus "uninitialized" "bogus uninitialized var warning" } */
25 return 0;
28 int foo_2 (int n, int m, int r)
30 int flag = 0;
31 int v;
33 if (n)
35 v = r;
36 flag = 1;
39 if (m) g++;
40 else bar();
42 if (flag)
43 blah(v); /* { dg-bogus "uninitialized" "bogus uninitialized var warning" } */
44 else
45 blah(v); /* { dg-warning "uninitialized" "real uninitialized var warning" } */
47 return 0;