1 /* Test gcov block mode.  Compiler generates following CFG:
2 
3   <bb 3>:
4   if (false_var_4 != 0)
5     goto <bb 4>;
6   else
7     goto <bb 5>;
8 
9   <bb 4>:
10   ret_6 = 111;
11   PROF_edge_counter_10 = __gcov0.UuT[0];
12   PROF_edge_counter_11 = PROF_edge_counter_10 + 1;
13   __gcov0.UuT[0] = PROF_edge_counter_11;
14 
15   <bb 5>:
16   # ret_1 = PHI <ret_5(3), ret_6(4)>
17   goto <bb 7>;
18 
19 It's important not to include <bb 5> to any line as it's actually shared
20 by both branches of the condition in <bb 3>.
21 
22 */
23 
24 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
25 /* { dg-do run { target native } } */
26 
27 unsigned int
UuT(void)28 UuT (void)
29 {
30   unsigned int true_var = 1;
31   unsigned int false_var = 0;
32   unsigned int ret = 0;
33 
34   if (true_var) /* count(1) */
35     {
36       if (false_var) /* count(1) */
37 	ret = 111; /* count(#####) */
38     }
39   else
40     ret = 999; /* count(#####) */
41   return ret;
42 }
43 
44 int
main(int argc,char ** argv)45 main (int argc, char **argv)
46 {
47   UuT ();
48   return 0;
49 }
50 
51 /* { dg-final { run-gcov { -a gcov-17.c } } } */
52