Hi. >From what I could tell, I dont think it is a bug. GCOV just gives different metrics than statement or decision or MC/DC. It gives line, branches checked and which branches have been taken. However, I do agree that if you look at the .gcov files you can see if you have statement, decision or MC/DC. However, if have to check by "eye". Guess that the statement decision and MC/DC metrics would be very to implement on GCOV :). Kind regards Manuel Coutinho. > -----Original Message----- > From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On > Behalf Of Frodak Baksik > Sent: Thursday, November 12, 2009 5:28 AM > To: gcc-help@xxxxxxxxxxx > Subject: RE: GCOV type of coverage > > I have been looking into gcov and the type of coverage it calculates. > > Based on your example and another simple example of my own gcov can > track statement, decision, and MC/DC statistics. > However, what it reports is not correct. > > If you try the example in man gcov you wont get the results documented > in the manual. > > $ cat tmp.c > #include <stdio.h> > > int main (void) > { > int i, total; > > total = 0; > > for (i = 0; i < 10; i++) > total += i; > > if (total != 45) > printf ("Failure\n"); > else > printf ("Success\n"); > return 0; > } > > $ gcov -b tmp.c > File `tmp.c' > Lines executed:88.89% of 9 > Branches executed:100.00% of 4 > Taken at least once:75.00% of 4 > Calls executed:66.67% of 3 > tmp.c:creating `tmp.c.gcov' > > $ cat tmp.c.gcov > -: 0:Source:tmp.c > -: 0:Graph:tmp.gcno > -: 0:Data:tmp.gcda > -: 0:Runs:1 > -: 0:Programs:1 > -: 1:#include <stdio.h> > -: 2: > -: 3:int main (void) > function main called 1 returned 100% blocks executed 78% > 1: 4:{ > call 0 returned 100% > 1: 5: int i, total; > -: 6: > 1: 7: total = 0; > -: 8: > 11: 9: for (i = 0; i < 10; i++) > branch 0 taken 91% (fallthrough) > branch 1 taken 9% > 10: 10: total += i; > -: 11: > 1: 12: if (total != 45) > branch 0 taken 0% (fallthrough) > branch 1 taken 100% > #####: 13: printf ("Failure\n"); > call 0 never executed > -: 14: else > 1: 15: printf ("Success\n"); > call 0 returned 100% > 1: 16: return 0; > -: 17:} > > You will notice that tmp.c.gcov is essentialy the same as the expected > output but the reported statistics is incorrect. I have gone ahead > and reported it as a bug. > > -- > Frodak