public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9896] gcov-profile: Allow negative counts of indirect calls [PR105282] Date: Thu, 21 Apr 2022 09:27:44 +0000 (GMT) [thread overview] Message-ID: <20220421092744.CB8293838016@sourceware.org> (raw) https://gcc.gnu.org/g:7b879564ec2bda6b5441fbaf231d70ec6359db01 commit r11-9896-g7b879564ec2bda6b5441fbaf231d70ec6359db01 Author: Sergei Trofimovich <siarheit@google.com> Date: Fri Apr 15 08:35:27 2022 +0100 gcov-profile: Allow negative counts of indirect calls [PR105282] TOPN metrics are histograms that contain overall count and per-bucket count. Overall count can be negative when two profiles merge and some of per-bucket metrics are disacarded. Noticed as an ICE on python PGO build where gcc crashes as: during IPA pass: modref a.c:36:1: ICE: in stream_out_histogram_value, at value-prof.cc:340 36 | } | ^ stream_out_histogram_value(output_block*, histogram_value_t*) gcc/value-prof.c:340 gcc/ChangeLog: PR gcov-profile/105282 * value-prof.c (stream_out_histogram_value): Allow negative counts on HIST_TYPE_INDIR_CALL. (cherry picked from commit 90a29845bfe7d6002e6c2fd49a97820b00fbc4a3) Diff: --- gcc/value-prof.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 42748771192..688089b04d2 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -336,6 +336,10 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist) /* Note that the IOR counter tracks pointer values and these can have sign bit set. */ ; + else if (hist->type == HIST_TYPE_INDIR_CALL && i == 0) + /* 'all' counter overflow is stored as a negative value. Individual + counters and values are expected to be non-negative. */ + ; else gcc_assert (value >= 0);
reply other threads:[~2022-04-21 9:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220421092744.CB8293838016@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).