> So my bet is that before the patch we had a bogus code. We detected invalid > stated with hiving first counter value == -1. Which could be also reached > with decrement of all values (0 - 1 == -1). > > Maybe we would be interested in usage of a huge negative number to reflect > invalid state?
As discusse dover lunch, use of -1 should be safe because it matters only in the on-disk counters which are prunned first and all -1 which are result of actual time profiling should disappear. However looking at the code there seems bug: diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index cdb611de2a2..e5f93943c87 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -219,9 +219,6 @@ static struct gcov_fn_buffer *fn_buffer; static void prune_topn_counter (gcov_type *counters, gcov_type all) { - if (counters[1] == -1) - return; - for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++) { if (counters[2 * i + 1] < all) Does this make sense and help something? :) Honza