Bug 231462 - GCC 4.1.1 --coverage (gcov) broken
GCC 4.1.1 --coverage (gcov) broken
Product: Fedora
Classification: Fedora
Component: ccache (Show other bugs)
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2007-03-08 10:34 EST by Matt Fago
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 2.4-8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-03-19 14:10:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
ccache patch (488 bytes, patch)
2007-03-14 13:53 EDT, Matt Fago
no flags Details | Diff
ccache patch from cvs revision 1.100 (326 bytes, patch)
2007-03-14 20:39 EDT, Matt Fago
no flags Details | Diff

  None (edit)
Description Matt Fago 2007-03-08 10:34:45 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv: Gecko/20070220 Firefox/

Description of problem:
I'm trying to use gcov with gcc 4.1.1 as installed in Fedora Core 6

This works fine:
  gcc --coverage -o hello hello.c
This does not:
  gcc --coverage -o hello.o -c hello.c
  gcc --coverage -o hello hello.o

Both work as expected with Apple's gcc 4.0.4 (with explicit
-fprofile-arcs -ftest-coverage) and FSF gcc 4.1.2 on powerpc or gcc
trunk on x86_64.

I thought I'd heard of this on gcc@gcc.gnu.org, but I've looked in
Bugzilla and cannot find it. I've asked on gcc-help@gcc.gnu.org, but no luck. 

Perhaps it is an x86_64 issue only.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Make a simple 'hello world' c-source.
2. Compile via:
  gcc --coverage -o hello.o -c hello.c
  gcc --coverage -o hello hello.o

3. Run the application: ./hello
4. Run gcov hello.c

Actual Results:
Do not get *.gcno *.gcda files with coverage information for processing with gcov (one should be made during compile, one at runtime). Because of this gcov cannot be used.

Expected Results:
Should get *.gcno *.gcda files to be processed with gcov.

Additional info:
Comment 1 Jakub Jelinek 2007-03-12 10:37:01 EDT
Works just fine even with gcc-4.1.1-51.fc6.x86_64.rpm here, both hello.gcno
and hello.gcda are created.
Comment 2 Matt Fago 2007-03-14 11:06:24 EDT
I'm not going to reopen this yet, but I've confirmed that it is related to
ccache, not gcc itself.

In the test case, using /usr/bin/gcc works, but using gcc (a symlink to ccache)
still does _not_ work for me.

I know very little about ccache, but perhaps it needs to be updated to handle
the new --coverage option? Perhaps clearing my cache would work, but I'm wary of
doing so as I currently can reproduce this issue and would rather help fix it.

Comment 3 Matt Fago 2007-03-14 13:53:09 EDT
Created attachment 150070 [details]
ccache patch

Patch for ccache to bypass the cache for coverage and profile builds
Comment 4 Matt Fago 2007-03-14 13:56:50 EDT
I'm reopening this bug. It makes more sense for the 'component' to be ccache,
but that does not appear to be an option.

Evidently this is a known issue with ccache. I've attached a VERY simple patch
for ccache that simply turns off the cache with -fprofile-arcs or
-ftest-coverage. I've submitted it to ccache@lists.samba.org. It is currently
against 2.4 sources, and is untested (I'm waiting to get the CVS sources from
home, if necessary).

If it works, perhaps we can get it into FC etc?

Comment 5 Ville Skyttä 2007-03-14 15:04:00 EDT
A bit of Googling reveals that others have suggested similar changes as your
patch to upstream, and in fact two weeks ago a similar change was committed to
CVS.  The upstream change makes ccache skip things when -coverage (only with one
dash, a typo?) or -ftest-coverage are found on the command line, but based on
the gcc man page -fprofile-arcs looks like a good addition to me too.
Comment 6 Matt Fago 2007-03-14 20:18:05 EDT
Ah -- you had more luck with google than I. Do you have a link? 

Yes, it should skip the cache with --coverage (two dashes), -fprofile-arcs, or -ftest-coverage.

Will you be able to re-spin ccache with the (corrected?) upstream change?

Comment 7 Matt Fago 2007-03-14 20:39:41 EDT
Created attachment 150105 [details]
ccache patch from cvs revision 1.100

New patch from cvs sources that fixes typo and adds missing flag.
Comment 8 Matt Fago 2007-03-14 20:49:59 EDT
FWIW, patched CVS sources compiles and passes 'make check'.

I've posted it to ccache@lists.samba.org. Not sure where you saw the previous commit?
Comment 9 Ville Skyttä 2007-03-15 06:45:59 EDT
> Ah -- you had more luck with google than I. Do you have a link?

Googled for "ccache profile" and "ccache coverage", eg. first hit for the former:

> Not sure where you saw the previous commit?

Just skimmed cvsps output for upstream CVS.

2.4-8 which includes the fix is currently building for F7 devel, will push to
FE-6 later this week too unless problems are found.
Comment 10 Ville Skyttä 2007-03-19 14:10:16 EDT

Note You need to log in before you can comment on or make changes to this bug.