public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem using gcov
@ 2018-02-21 13:33 Alexander Fichtinger
  2018-02-22  9:43 ` Martin Liška
  0 siblings, 1 reply; 11+ messages in thread
From: Alexander Fichtinger @ 2018-02-21 13:33 UTC (permalink / raw)
  To: gcc

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



 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-02-27 12:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21 13:33 Problem using gcov Alexander Fichtinger
2018-02-22  9:43 ` Martin Liška
     [not found]   ` <kcim.5a93e1c0.2b51.26a60a650176b62e@v-srvkopano.ow.ks>
2018-02-26 13:57     ` AW: " Martin Liška
2018-02-26 14:03       ` AW: " Alexander Fichtinger
2018-02-26 14:27         ` Jonathan Wakely
2018-02-26 14:35         ` AW: " Martin Liška
2018-02-26 14:41           ` AW: " Alexander Fichtinger
2018-02-27  8:13             ` Martin Liška
2018-02-27 10:01               ` AW: " Alexander Fichtinger
2018-02-27 12:43                 ` Martin Liška
2018-02-27 12:53                   ` AW: " Alexander Fichtinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).