| 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. */ |
| 5 |
|
| 6 |
/* { dg-options "-fprofile-arcs -ftest-coverage" } */ |
| 7 |
/* { dg-do run { target native } } */ |
| 8 |
|
| 9 |
extern void exit (int); |
| 10 |
|
| 11 |
int val; |
| 12 |
|
| 13 |
void |
| 14 |
foo (int i) |
| 15 |
{ |
| 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) */ |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
main() |
| 27 |
{ |
| 28 |
int i; |
| 29 |
|
| 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) */ |
| 37 |
} |
| 38 |
|
| 39 |
/* { dg-final { run-gcov branches calls { -b gcov-6.c } } } */ |