[Bug gcov-profile/42015] gcov reports incorrect branches executed

2016-09-26 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42015

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Martin Liška  ---
Ok, after code inspection, I came to observation that the output is correct.
Let's assume following example:

$ cat pr42015.c.gcov
-:0:Source:pr42015.c
-:0:Graph:pr42015.gcno
-:0:Data:pr42015.gcda
-:0:Runs:1
-:0:Programs:1
-:1:#include 
-:2:
1:3:int main (void)
-:4:{
-:5:  int i, total;
-:6:
1:7:  total = 0;
-:8:
   11:9:  for (i = 0; i < 10; i++)
   10:   10:total += i;
-:   11:
1:   12:  if (total != )
1:   13:return 0;
-:   14:
#:   15:  if (total != 45)
#:   16:printf ("Failure\n");
-:   17:  else
#:   18:printf ("Success\n");
#:   19:  return 0;
-:   20:}

$ gcov pr42015.c -b
File 'pr42015.c'
Lines executed:60.00% of 10
Branches executed:66.67% of 6
Taken at least once:50.00% of 6
Calls executed:0.00% of 2
Creating 'pr42015.c.gcov'

'Branches executed' means a number of branches whose condition was at least
once evaluated (and obviously one branch is taken).
Thus, as the condition on line 15 is never executed we have 2 branches that
were not executed. On the other hand, 'Taken at least once'
equal to 3 means execution of both branches of 'for' statement and 1 for 'if'
on the line 12.

Hope it's now clear, closing the PR as invalid.

[Bug gcov-profile/42015] gcov reports incorrect branches executed

2016-08-09 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42015

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-08-09
 CC||marxin at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Liška  ---
(In reply to Frodak Baksik from comment #1)
> I would have expected the output to report:
> Branches executed:75.00% of 4
> and not
> Branches executed:100.00% of 4

You're right, it's confusing, I'm going to discuss that with Honza in order to
many it clear.

[Bug gcov-profile/42015] gcov reports incorrect branches executed

2009-11-12 Thread frodak17 at gmail dot com


--- Comment #1 from frodak17 at gmail dot com  2009-11-12 17:21 ---
I would have expected the output to report:
Branches executed:75.00% of 4
and not
Branches executed:100.00% of 4


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42015