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

--- Comment #1 from Joshua Cranmer <Pidgeot18 at gmail dot com> ---
Created attachment 36531
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36531&action=edit
Implementation of Hawick's algorithm in C++

This is test code I wrote to figure out why I couldn't reproduce the output of
gcov correctly (which eventually led me to discovering bug 67937). It's an
ersatz variant of gcov (whose code is not included), except the latter half of
processing was replaced with my own code. So there's a mixture of use of both
gcov's arc_t, block_t, etc. structures with my own C++ classes Arc/Block/etc. I
also ripped out the code that supported options I didn't need to use (I
effectively only do gcov -a -b -p).

The main code in question is getCycleCounts (on line 494) and the cycle
detection code that comprises the prior 100 lines of code. The
has_negate/rerunning findCycles trick is needed because of bug 67937. This
roughly replaces the main Tiernan's algorithm loop of accumulate_line_counts
(about line 2200 of gcov.c) (the rest of the function is more fully captured by
LineInfo::computeCounts/CoverageMap::computeLineCounts).

I'd do a patch myself, but, honestly, the C code of gcov is painful for me to
follow, and I've never set myself up to do gcc development.

Reply via email to