Bug 231462 - GCC 4.1.1 --coverage (gcov) broken
Summary: GCC 4.1.1 --coverage (gcov) broken
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: ccache
Version: 6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-08 15:34 UTC by Matt Fago
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 2.4-8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-19 18:10:16 UTC
Type: ---
Embargoed:


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

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

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

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.org, but I've looked in
Bugzilla and cannot find it. I've asked on gcc-help.org, but no luck. 

Perhaps it is an x86_64 issue only.



Version-Release number of selected component (if applicable):
gcc-4.1.1-51.fc6

How reproducible:
Always


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 14:37:01 UTC
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 15:06:24 UTC
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.

Thanks,
Matt

Comment 3 Matt Fago 2007-03-14 17:53:09 UTC
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 17:56:50 UTC
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.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?

Thanks,
Matt

Comment 5 Ville Skyttä 2007-03-14 19:04:00 UTC
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-15 00:18:05 UTC
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?

Thanks!

Comment 7 Matt Fago 2007-03-15 00:39:41 UTC
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-15 00:49:59 UTC
FWIW, patched CVS sources compiles and passes 'make check'.

I've posted it to ccache.org. Not sure where you saw the previous commit?

Comment 9 Ville Skyttä 2007-03-15 10:45:59 UTC
> 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:
http://lists.samba.org/archive/ccache/2006q1/000216.html

> 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 18:10:16 UTC
Done.


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