summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pred-5_b.c
blob: e8da2565698b8cb71e34884d339982b74d93a9a3 (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
/* { dg-do compile } */
/* { dg-options "-Wuninitialized -Wno-attributes -O2" } */

int g;
int bar();
int blah(int);
void t(int);

static int
__attribute__((always_inline)) 
foo (int n, int* v, int r)
{
  int flag = 0;
  if (r > n)
    {
      *v = bar();
      flag = 1;
    }

  if (n > g)
    g++;
  else 
    bar();

  return flag;
}

int a[100];
int b[100];
int blah(int n)
{
  int i;
   for (i = 0 ; i < n; i++)
     {
       int v;
       if (foo (n, &v, b[i]))
         return 0;
       t (v); /* { dg-warning "uninitialized" "real warning" } */
     }
   return 1;
}