OSDN Git Service

2011-10-18 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.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 __attribute__((always_inline)) 
10 int foo (int n, int* v, int r)
11 {
12   int flag = 0;
13   if (r > n)
14     {
15       *v = bar();
16       flag = 1;
17     }
18
19   if (n > g)
20     g++;
21   else 
22     bar();
23
24   return flag;
25 }
26
27 int a[100];
28 int b[100];
29 int blah(int n)
30 {
31   int i;
32    for (i = 0 ; i < n; i++)
33      {
34        int v;
35        if (foo (n, &v, b[i]))
36          return 0;
37        t (v); /* { dg-warning "uninitialized" "real warning" } */
38      }
39    return 1;
40 }
41