From: "Martin Liška" <mliska@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: GCC 9 backports
Date: Fri, 2 Oct 2020 12:05:09 +0200 [thread overview]
Message-ID: <fba6356a-f509-f08e-64d2-3411e284c83d@suse.cz> (raw)
In-Reply-To: <44e220f1-893a-8416-644c-f042320af933@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 43 bytes --]
There are 2 more I've just tested.
Martin
[-- Attachment #2: 0001-gcov-fix-streaming-of-HIST_TYPE_IOR-histogram-type.patch --]
[-- Type: text/x-patch, Size: 1210 bytes --]
From f070a482cf7b51716a9933302be246831ef0c236 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 1 Oct 2020 21:28:30 +0200
Subject: [PATCH] gcov: fix streaming of HIST_TYPE_IOR histogram type.
gcc/ChangeLog:
PR gcov-profile/64636
* value-prof.c (stream_out_histogram_value): Allow negative
values for HIST_TYPE_IOR.
(cherry picked from commit 1921ebcaf6467996aede69e1bbe32400d8a20fe7)
---
gcc/value-prof.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 5013956cf86..b8ce4bd82ce 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -363,7 +363,10 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist)
/* When user uses an unsigned type with a big value, constant converted
to gcov_type (a signed type) can be negative. */
gcov_type value = hist->hvalue.counters[i];
- if (hist->type == HIST_TYPE_SINGLE_VALUE && i == 0)
+ if ((hist->type == HIST_TYPE_SINGLE_VALUE && i == 0)
+ || hist->type == HIST_TYPE_IOR)
+ /* Note that the IOR counter tracks pointer values and these can have
+ sign bit set. */
;
else
gcc_assert (value >= 0);
--
2.28.0
[-- Attachment #3: 0001-gcov-fix-streaming-corruption.patch --]
[-- Type: text/x-patch, Size: 2339 bytes --]
From fe9d9fcd2a643da4ec2c68525a551e074d9e11b6 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 21 Sep 2020 16:26:10 +0200
Subject: [PATCH] gcov: fix streaming corruption
gcc/ChangeLog:
PR gcov-profile/97069
* profile.c (branch_prob): Line number must be at least 1.
gcc/testsuite/ChangeLog:
PR gcov-profile/97069
* g++.dg/gcov/pr97069.C: New test.
(cherry picked from commit 6b4e8bf88f1172ce8561f57b12fb81063b21a78f)
---
gcc/profile.c | 6 +++---
gcc/testsuite/g++.dg/gcov/pr97069.C | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/gcov/pr97069.C
diff --git a/gcc/profile.c b/gcc/profile.c
index a1dba1ac8fb..9ac3a7e93fe 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1293,7 +1293,7 @@ branch_prob (bool thunk)
seen_locations.add (loc);
expanded_location curr_location = expand_location (loc);
output_location (&streamed_locations, curr_location.file,
- curr_location.line, &offset, bb);
+ MAX (1, curr_location.line), &offset, bb);
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1304,7 +1304,7 @@ branch_prob (bool thunk)
{
seen_locations.add (loc);
output_location (&streamed_locations, gimple_filename (stmt),
- gimple_lineno (stmt), &offset, bb);
+ MAX (1, gimple_lineno (stmt)), &offset, bb);
}
}
@@ -1319,7 +1319,7 @@ branch_prob (bool thunk)
{
expanded_location curr_location = expand_location (loc);
output_location (&streamed_locations, curr_location.file,
- curr_location.line, &offset, bb);
+ MAX (1, curr_location.line), &offset, bb);
}
if (offset)
diff --git a/gcc/testsuite/g++.dg/gcov/pr97069.C b/gcc/testsuite/g++.dg/gcov/pr97069.C
new file mode 100644
index 00000000000..040e336662a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/pr97069.C
@@ -0,0 +1,20 @@
+// PR gcov-profile/97069
+// { dg-options "--coverage" }
+// { dg-do run { target native } }
+
+# 0 "pr97069.C"
+# 0 "<built-in>"
+# 0 "<command-line>"
+# 1 "/usr/include/stdc-predef.h" 1 3 4
+# 0 "<command-line>" 2
+# 1 "pr97069.C"
+int main()
+{
+ return 0;
+}
+# 0 "pr97069.C"
+void zero_line_directive()
+{
+}
+
+// { dg-final { run-gcov pr97069.C } }
--
2.28.0
next prev parent reply other threads:[~2020-10-02 10:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 8:45 Martin Liška
2019-05-14 8:47 ` Martin Liška
2019-05-24 7:43 ` Martin Liška
2019-07-04 9:23 ` Martin Liška
2019-07-22 9:36 ` Martin Liška
2019-08-23 11:56 ` Martin Liška
2019-09-02 8:56 ` Martin Liška
2019-10-23 12:12 ` Martin Liška
2020-02-28 17:51 ` Martin Liška
2020-03-10 10:09 ` Martin Liška
2020-04-03 10:32 ` Martin Liška
2020-04-20 9:25 ` Martin Liška
2020-10-02 10:05 ` Martin Liška [this message]
2020-10-02 11:15 ` Martin Liška
2020-10-15 9:07 ` Martin Liška
2020-10-16 8:51 ` Martin Liška
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=fba6356a-f509-f08e-64d2-3411e284c83d@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@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: link
Be 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).