On 1/25/21 3:55 PM, Jan Hubicka wrote:
I've just installed the patch.
About the negative total value. Something similar can handle it:
diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h
index df08e882dd7..ddc688509bd 100644
--- a/libgcc/libgcov.h
+++ b/libgcc/libgcov.h
@@ -443,7 +443,13 @@ gcov_topn_add_value (gcov_type *counters, gcov_type value,
gcov_type count,
int use_atomic, int increment_total)
{
if (increment_total)
- gcov_counter_add (&counters[0], 1, use_atomic);
+ {
+ /* In the multi-threaded mode, we can have an already merged profile
+ with a negative total value. In that case, we should bail out. */
+ if (counters[0] < 0)
+ return 0;
+ gcov_counter_add (&counters[0], 1, use_atomic);
+ }
struct gcov_kvp *prev_node = NULL;
struct gcov_kvp *minimal_node = NULL;
What do you think?
Looks good to me, modlo the obvious race condition of concurent upate
between if and gcov, but that makes the chance significantly smaller
than before (between merging and stream-out). So I think it makes sense
to do it.
All right, I've just installed the patch.
Thanks,
Martin
Thanks,
Honza