summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/uninit-pred-loop-1_c.cc
blob: 7f6b41d31ff371e072c997eb9f87b37936e6dabb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do compile } */
/* { dg-options "-Wuninitialized -O2" } */

extern int bar();
int foo(int n, int m)
{
 for (;;) {
   int err = ({int _err; 
     for (int i = 0; i < 16; ++i) {
       if (m+i > n)
          break;
       _err = 17;
       _err = bar();
     }
     _err; 
   }); 

   if (err == 0) return 17; }); /* { dg-warning "uninitialized" "warn on _err" } */
 }

 return 18;
}