1 /* { dg-do compile } */
2 /* { dg-options "-O -Wmaybe-uninitialized" } */
3
4 extern unsigned bar (void);
5 extern void quux (void);
6
foo(unsigned v)7 unsigned foo (unsigned v)
8 {
9 unsigned u;
10 if (v != 1)
11 u = bar ();
12
13 // Prevent the "dom" pass from changing the CFG layout based on the inference
14 // 'if (v != 1) is false then (v != 2) is true'. (Now it would have to
15 // duplicate the loop in order to do so, which is deemed expensive.)
16 for (int i = 0; i < 10; i++)
17 quux ();
18
19 if (v != 2)
20 return u; /* { dg-warning "may be used uninitialized" } */
21
22 return 0;
23 }
24