public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/65831] New: gcov does not output 0% coverage files
@ 2015-04-21 13:34 afineman at afineman dot com
  2015-08-04 23:06 ` [Bug gcov-profile/65831] " mdennis at merfer dot net
  0 siblings, 1 reply; 2+ messages in thread
From: afineman at afineman dot com @ 2015-04-21 13:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65831

            Bug ID: 65831
           Summary: gcov does not output 0% coverage files
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: afineman at afineman dot com

Created attachment 35378
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35378&action=edit
Always create .gcov file if there is no .gcda file.

When running gcov against a file that was not covered at all (i.e., has no
corresponding .gcda file), gcov 4.6 would correctly output a .gcov file that
indicates 0% coverage.  gcov 4.8 does not output any .gcov file in this case,
which I believe is a regression.

=====================

afineman@hotdog:/tmp$ diff test6.c test8.c
afineman@hotdog:/tmp$ cat test6.c
int
main()
{
    return 0;
}
afineman@hotdog:/tmp$ gcc-4.6 --version
gcc-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

afineman@hotdog:/tmp$ gcov-4.6 --version
gcov (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.

afineman@hotdog:/tmp$ gcov-4.8 --version
gcov (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.

afineman@hotdog:/tmp$ gcc-4.8 --version
gcc-4.8 (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

afineman@hotdog:/tmp$ gcc-4.6 --coverage test6.c -o test6
afineman@hotdog:/tmp$ gcc-4.8 --coverage test8.c -o test8
afineman@hotdog:/tmp$ gcov-4.6 test6.c
test6.gcda:cannot open data file, assuming not executed
File 'test6.c'
Lines executed:0.00% of 2
test6.c:creating 'test6.c.gcov'

afineman@hotdog:/tmp$ cat test6.c.gcov 
        -:    0:Source:test6.c
        -:    0:Graph:test6.gcno
        -:    0:Data:-
        -:    0:Runs:0
        -:    0:Programs:0
        -:    1:int
    #####:    2:main()
        -:    3:{
    #####:    4:    return 0;
        -:    5:}
afineman@hotdog:/tmp$ gcov-4.8 test8.c
test8.gcda:cannot open data file, assuming not executed
File 'test8.c'
No executable lines
Removing 'test8.c.gcov'

afineman@hotdog:/tmp$ 

=====================

I believe that this is not a duplicate of Bug 35568.  Or, at least, in 35568
there seem to be tests involving missing graph files along with missing data
files.  This bug is only about (correctly) missing data files due to 0%
coverage, but failing to produce a .gcov file that indicates 0% coverage.

=====================

I've attached a patch that fixes the problem in my case, but I don't know if my
solution is the correct approach.

Also, I would like to have included something in the testsuite to avoid this in
the future, but I don't have the time right now.  If the maintainers want such
a test, I volunteer to write one. (I've never contributed to this project
before, and can't promise when I'll get to it.)

======================

Results from running gcov after applying the attached patch:


afineman@hotdog:/tmp$ ./build-gcc/gcc/gcov test8.c
test8.gcda:cannot open data file, assuming not executed
File 'test8.c'
Lines executed:0.00% of 2
Creating 'test8.c.gcov'

afineman@hotdog:/tmp$ cat test8.c.gcov 
        -:    0:Source:test8.c
        -:    0:Graph:test8.gcno
        -:    0:Data:-
        -:    0:Runs:0
        -:    0:Programs:0
        -:    1:int
    #####:    2:main()
        -:    3:{
    #####:    4:    return 0;
        -:    5:}
afineman@hotdog:/tmp$


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

* [Bug gcov-profile/65831] gcov does not output 0% coverage files
  2015-04-21 13:34 [Bug gcov-profile/65831] New: gcov does not output 0% coverage files afineman at afineman dot com
@ 2015-08-04 23:06 ` mdennis at merfer dot net
  0 siblings, 0 replies; 2+ messages in thread
From: mdennis at merfer dot net @ 2015-08-04 23:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65831

Matthew Dennis <mdennis at merfer dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mdennis at merfer dot net

--- Comment #1 from Matthew Dennis <mdennis at merfer dot net> ---
I've got the same problem

user@host:~$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

user@host:~$ gcov --version
gcov (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.

because there is no .gcov file produced, tools like gcovr don't produce any
output indicating that some files have zero coverage.


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

end of thread, other threads:[~2015-08-04 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-21 13:34 [Bug gcov-profile/65831] New: gcov does not output 0% coverage files afineman at afineman dot com
2015-08-04 23:06 ` [Bug gcov-profile/65831] " mdennis at merfer dot net

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).