]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/uninit-5.c
ac760d69e034523339c5235bdcfec408b19e4c9e
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / uninit-5.c
1 /* Spurious uninitialized-variable warnings.
2 These cases are documented as not working in the gcc manual. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O -Wuninitialized" } */
6
7 extern void use(int);
8 extern void foo(void);
9
10 void
11 func1(int cond)
12 {
13 int x; /* { dg-bogus "x" "uninitialized variable warning" { xfail *-*-* } } */
14
15 if(cond)
16 x = 1;
17
18 foo();
19
20 if(cond)
21 use(x);
22 }
23
24 void
25 func2 (int cond)
26 {
27 int x; /* { dg-bogus "x" "uninitialized variable warning" { xfail *-*-* } } */
28 int flag = 0;
29
30 if(cond)
31 {
32 x = 1;
33 flag = 1;
34 }
35
36 foo();
37
38 if(flag)
39 use(x);
40 }