Debian Codegraph @

gcc/testsuite/gcc.dg/uninit-pred-11.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O -Wmaybe-uninitialized" } */
3
4 extern unsigned bar (void);
5 extern void quux (void);
6 int z;
7 unsigned foo (unsigned v, int y)
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 // This variation from uninit-25.c causes compute_control_dep_chain
20 // to run into a defect but simple_control_dep_chain saves us here
21 if (y)
22 z = 1;
23 if (v != 1)
24 return u; /* { dg-bogus "may be used uninitialized" } */
25
26 return 0;
27 }