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

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

__attribute__((always_inline)) 
int 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;
}