summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pr19430.c
blob: 4d2b4f62cef619be9d37b0b8b9b6ee0b18854677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* { dg-do compile } */
/* { dg-options "-O -Wuninitialized" } */
extern int bar (int);
extern void baz (int *);
int
foo (int i)
{
  int j; /* { dg-warning "'j' may be used uninitialized in this function" "uninitialized" { xfail *-*-* } 8 } */

  if (bar (i)) { 
    baz (&j);
  } else {
  }

  return j;
}



int foo2( void ) {
  int rc;
  return rc;  /* { dg-warning "'rc' is used uninitialized in this function" } */
  *&rc = 0;
}

extern int printf(const char *, ...);
void frob(int *pi);

int main(void)
{
  int i; 
  printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" "" { xfail *-*-* } } */
  frob(&i);

  return 0;
}

void foo3(int*);
void bar3(void) { 
  int x; 
  if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" { xfail *-*-* } } */
    foo3(&x); 
}