2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-pr19430.c
blob361293148724f50f2a43d2da8d763300407f29b0
1 /* { dg-do compile } */
2 /* { dg-options "-O -Wuninitialized" } */
3 extern int bar (int);
4 extern void baz (int *);
5 int
6 foo (int i)
8 int j; /* { dg-warning "'j' may be used uninitialized in this function" "uninitialized" { xfail *-*-* } 8 } */
10 if (bar (i)) {
11 baz (&j);
12 } else {
15 return j;
20 int foo2( void ) {
21 int rc;
22 return rc; /* { dg-warning "'rc' is used uninitialized in this function" } */
23 *&rc = 0;
26 extern int printf(const char *, ...);
27 void frob(int *pi);
29 int main(void)
31 int i;
32 printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" "" } */
33 frob(&i);
35 return 0;
38 void foo3(int*);
39 void bar3(void) {
40 int x;
41 if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" } */
42 foo3(&x);