This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem using gcov
- From: Alexander Fichtinger <alexander dot fichtinger at logicals dot com>
- To: gcc at gcc dot gnu dot org <gcc at gcc dot gnu dot org>
- Date: Wed, 21 Feb 2018 14:33:12 +0100
- Subject: Problem using gcov
- Authentication-results: sourceware.org; auth=none
Hi guys,
we have faced an error while using the gcov tool.
We have the following C-code:
LC_TD_DINT caseSelector;
caseSelector = LC_this->LC_VD_X;
if ((caseSelector==(LC_TD_DINT)1L)||(caseSelector==(LC_TD_DINT)2L)||((caseSelector>=(LC_TD_DINT)33L) && (caseSelector<=(LC_TD_DINT)44L)))
{
LC_this->LC_VD_X = (LC_TD_INT)3;
if ((LC_TD_BOOL)(LC_this->LC_VD_INPUT_VAR == (LC_TD_INT)2))
{
LC_this->LC_VD_Y = (LC_TD_INT)666;
}
}
else
{
LC_this->LC_VD_X = (LC_TD_INT)4;
}
When we use gcov (with options –bcfu) we got the following result (in the c.gcov file):
-: 19: LC_TD_DINT caseSelector;
1: 20: caseSelector = LC_this->LC_VD_X;
1: 21: if ((caseSelector==(LC_TD_DINT)1L)||(caseSelector==(LC_TD_DINT)2L)||((caseSelector>=(LC_TD_DINT)33L) && (caseSelector<=(LC_TD_DINT)44L)))
branch 0 taken 1 (fallthrough)
branch 1 taken 0
branch 2 taken 0 (fallthrough)
branch 3 taken 1
branch 4 never executed
branch 5 never executed
branch 6 never executed
branch 7 never executed
-: 22: {
1: 23: LC_this->LC_VD_X = (LC_TD_INT)3;
2: 24: if ((LC_TD_BOOL)(LC_this->LC_VD_INPUT_VAR == (LC_TD_INT)2))
branch 0 taken 1 (fallthrough)
branch 1 taken 0
unconditional 2 taken 1
-: 25: {
1: 26: LC_this->LC_VD_Y = (LC_TD_INT)666;
unconditional 0 taken 1
-: 27: }
-: 28: }
-: 29: else
-: 30: {
#####: 31: LC_this->LC_VD_X = (LC_TD_INT)4;
unconditional 0 never executed
-: 32: }
When you look at line 23 it is called 1 time. Line 24 is called 2 times (the bold one).
We already looked in the disassembly but did not see a reason why the line should be executed 2 times.
Can anyone help here, please?
Kind regards,
Alex