libgcov: improve profile reproducibility
libgcc/ChangeLog: PR gcov-profile/98739 * libgcov.h (gcov_topn_add_value): Do not train when we have a merged profile with a negative number of total value.
This commit is contained in:
parent
80198c701a
commit
d40b21eebc
|
@ -443,7 +443,13 @@ gcov_topn_add_value (gcov_type *counters, gcov_type value, gcov_type count,
|
||||||
int use_atomic, int increment_total)
|
int use_atomic, int increment_total)
|
||||||
{
|
{
|
||||||
if (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 *prev_node = NULL;
|
||||||
struct gcov_kvp *minimal_node = NULL;
|
struct gcov_kvp *minimal_node = NULL;
|
||||||
|
|
Loading…
Reference in New Issue