diff options
author | Martin Liska <mliska@suse.cz> | 2017-02-22 10:45:42 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-02-22 09:45:42 +0000 |
commit | 8f4f841a3e443d7de88fcb76075eb3003f280bd7 (patch) | |
tree | a8803c5b92290a769e7f66b6b708020cbf81bcd4 /gcc/value-prof.c | |
parent | bac4371a6ac451bd5f8b305610eb47fcb9bda3a9 (diff) | |
download | gcc-8f4f841a3e443d7de88fcb76075eb3003f280bd7.zip gcc-8f4f841a3e443d7de88fcb76075eb3003f280bd7.tar.gz gcc-8f4f841a3e443d7de88fcb76075eb3003f280bd7.tar.bz2 |
Remove wrong assert about gcov_type (PR lto/79587).
2017-02-22 Martin Liska <mliska@suse.cz>
PR lto/79587
* data-streamer-in.c (streamer_read_gcov_count): Remove assert.
* data-streamer-out.c (streamer_write_gcov_count_stream):
Likewise.
* value-prof.c (stream_out_histogram_value): Make assert more
precise based on type of counter.
2017-02-22 Martin Liska <mliska@suse.cz>
PR lto/79587
* gcc.dg/tree-prof/pr79587.c: New test.
From-SVN: r245647
Diffstat (limited to 'gcc/value-prof.c')
-rw-r--r-- | gcc/value-prof.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 097e409..22dc2c9 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -365,7 +365,17 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist) break; } for (i = 0; i < hist->n_counters; i++) - streamer_write_gcov_count (ob, hist->hvalue.counters[i]); + { + /* 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) + ; + else + gcc_assert (value >= 0); + + streamer_write_gcov_count (ob, value); + } if (hist->hvalue.next) stream_out_histogram_value (ob, hist->hvalue.next); } |