[gcc r9-8968] gcov: fix streaming of HIST_TYPE_IOR histogram type.

Martin Liska marxin@gcc.gnu.org
Fri Oct 2 10:06:12 GMT 2020


https://gcc.gnu.org/g:7c55364eaaf5f882e80e8943e702081f9648f582

commit r9-8968-g7c55364eaaf5f882e80e8943e702081f9648f582
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Oct 1 21:28:30 2020 +0200

    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)

Diff:
---
 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);


More information about the Gcc-cvs mailing list