public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6910] libgcov: improve profile reproducibility
@ 2021-01-26 11:47 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-01-26 11:47 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d40b21eebc9d41c3cb9ccbdf6338968436550621
commit r11-6910-gd40b21eebc9d41c3cb9ccbdf6338968436550621
Author: Martin Liska <mliska@suse.cz>
Date: Tue Jan 26 12:44:34 2021 +0100
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.
Diff:
---
libgcc/libgcov.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-26 11:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 11:47 [gcc r11-6910] libgcov: improve profile reproducibility Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).