Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / uninit-pred-5_b.c
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -Wno-attributes -O2" } */
3
4 int g;
5 int bar();
6 int blah(int);
7 void t(int);
8
9 static int
10 __attribute__((always_inline)) 
11 foo (int n, int* v, int r)
12 {
13   int flag = 0;
14   if (r > n)
15     {
16       *v = bar();
17       flag = 1;
18     }
19
20   if (n > g)
21     g++;
22   else 
23     bar();
24
25   return flag;
26 }
27
28 int a[100];
29 int b[100];
30 int blah(int n)
31 {
32   int i;
33    for (i = 0 ; i < n; i++)
34      {
35        int v;
36        if (foo (n, &v, b[i]))
37          return 0;
38        t (v); /* { dg-warning "uninitialized" "real warning" } */
39      }
40    return 1;
41 }
42