gcov 4.0 incorrectly marking lines as executable

Nathan Sidwell nathan@codesourcery.com
Sat Nov 5 19:06:00 GMT 2005


Martin Reddy wrote:
> We are seeing lots of problems with gcov 4.0.1 and were wondering if anyone
> else has seen these and can offer some help. We are seeing cases where lines
> with no executable code on them are being incorrectly marked as executable
> and therefore also marked with zero coverage. For example, a class statement,
> or a closing curly brace, or a line of code that is directly after a simple
> statement that is marked as covered, or a line that is beyond the end of a
> source file. For example, here is a .gcov file snippet (where ##### means the
> line is executable but has not been hit):
> 
>         -:    7:
>     #####:    8:class ClassName {
>         -:    9:
>         -:   10:  public:

The compiler emits certain implicit functions (like implicit 
ctors/dtors/assignment op) with the line number of a class's open {.  You are 
probably encountering these.

> 
> or this case where the return statement directly after the for loop is marked
> as not being covered:
> 
>        18:  507:  for (int i = 0; i < 8; i++)
>        16:  508:     corners[i] = m.transform(corners[i]);
>         -:  509:
>     #####:  510:  return corners;

I cannot tell off hand what is going on here.  Please file a bug report.

> or the following, where "/*EOF*/" is not in the source file and is added by 
> gcov to indicate that the line is beyond the end of the file:
> 
>     #####: /*EOF*/

Various intialization functions have line numbers beyond the end of the file (so 
you don't confuse their counts with other user-written functions).

Have you tried using the -f option to output function summaries?  That might 
help you disambiguate things.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc-help mailing list