This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa][mainline] Fix counting of line executions in gcov
- From: law at redhat dot com
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, nathan at codesourcery dot com
- Date: Wed, 27 Aug 2003 14:15:39 -0600
- Subject: Re: [tree-ssa][mainline] Fix counting of line executions in gcov
- Reply-to: law at redhat dot com
In message <20030826174533.GA1127@atrey.karlin.mff.cuni.cz>, Zdenek Dvorak writ
es:
>Hello,
>
>the following problem showed up with tree-ssa-branch + LOOP_EXPR
>lowering patch; since gcov is unchanged there, it also applies for
>mainline.
>
>As far as I understand the code in accumulate_line_counts to determine
>number of executions of a line that contains several basic blocks, it
>tries to split the graph into elementary cycles. The problem is that
>there are a few bugs in the algorithm; when the cycle is found, it
>should be removed by decreasing counts of all edges it belong to it,
>this is not done. Instead the markers of the path are left in the
>graph, which does not work -- consider
>
> - 10 <---------
> / \
> / \
>A C -5-> D -5-> E --10--> B
> \ \ / /
> \ -5->-- /
> ->-- 1 -----------
>
>With current algorithm, a cycle B - C - D - E is found, contributing 5.
>E is left marked as a part of the path, so it does not find any
>other cycles, giving total result of 6 (with 1 from entry edge),
>instead of 11 we want.
>
>Zdenek
>
> * gcov.c (typedef struct arc_info): New field cs_count.
> (accumulate_line_counts): Find cycles correctly.
This is fine if you install a testcase with the patch. It would seem
to me the easiest way to get a testcase is to reformulate the original
failing test's loop using gotos and use the result as your new testcase.
jeff