PR sanitizer/85029
[official-gcc.git] / gcc / testsuite / gcc.misc-tests / gcov-6.c
blobaefab3ed33a79dc53b534b455510b1e1ea10f500
1 /* Check that call return percentages are reported correctly by gcov,
2 along with line counts and branch percentages. This test case is
3 meant to be simple, as it was added at the same time that checking
4 for call return percentages was added. */
6 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
7 /* { dg-do run { target native } } */
9 extern void exit (int);
11 int val;
13 void
14 foo (int i)
16 /* branch(80) */
17 if (i < 0) /* count(5) */
18 /* branch(end) */
19 /* returns(0) */
20 exit (0); /* count(1) */
21 /* returns(end) */
22 val += i; /* count(4) */
25 int
26 main()
28 int i;
30 /* returns(100) */
31 foo (100); /* count(1) */
32 /* returns(end) */
33 for (i = 2; i > -10; i--)
34 /* returns(75) */
35 foo (i); /* count(4) */
36 /* returns(end) */
39 /* { dg-final { run-gcov branches calls { -b gcov-6.c } } } */