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:
Works just fine even with gcc-4.1.1-51.fc6.x86_64.rpm here, both hello.gcno and hello.gcda are created.
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
Created attachment 150070 [details] ccache patch Patch for ccache to bypass the cache for coverage and profile builds
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
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.
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!
Created attachment 150105 [details] ccache patch from cvs revision 1.100 New patch from cvs sources that fixes typo and adds missing flag.
FWIW, patched CVS sources compiles and passes 'make check'. I've posted it to ccache.org. Not sure where you saw the previous commit?
> 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.
Done.