diff options
author | Martin Liska <mliska@suse.cz> | 2020-06-02 10:11:07 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-07-02 10:16:02 +0200 |
commit | ece21ff6ea9d969d3b6aae82136622a7126eefc1 (patch) | |
tree | ad2d4be24aa0e4415a1caccbca083eed063194f0 /gcc/coverage.c | |
parent | 8f8ea4a47f3ab0b44b2bbf1c77db6111325d4841 (diff) | |
download | gcc-ece21ff6ea9d969d3b6aae82136622a7126eefc1.zip gcc-ece21ff6ea9d969d3b6aae82136622a7126eefc1.tar.gz gcc-ece21ff6ea9d969d3b6aae82136622a7126eefc1.tar.bz2 |
Do not stream all zeros for gcda files.
gcc/ChangeLog:
PR gcov-profile/95348
* coverage.c (read_counts_file): Read only COUNTERS that are
not all-zero.
* gcov-dump.c (tag_function): Change signature from unsigned to
signed integer.
(tag_blocks): Likewise.
(tag_arcs): Likewise.
(tag_lines): Likewise.
(tag_counters): Likewise.
(tag_summary): Likewise.
* gcov.c (read_count_file): Read all non-zero counters
sensitively.
libgcc/ChangeLog:
PR gcov-profile/95348
* libgcov-driver.c (merge_one_data): Merge only profiles
that are not of non-zero type.
(write_one_data): Write counters only if there's one non-zero
value.
* libgcov-util.c (tag_function): Change signature from unsigned
to int.
(tag_blocks): Likewise.
(tag_arcs): Likewise.
(tag_counters): Likewise.
(tag_summary): Likewise.
(tag_lines): Read only if COUNTERS is non-zero.
(read_gcda_file): Handle negative length for COUNTERS type.
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r-- | gcc/coverage.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c index 1dcda43..f353c9c 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -245,7 +245,9 @@ read_counts_file (void) else if (GCOV_TAG_IS_COUNTER (tag) && fn_ident) { counts_entry **slot, *entry, elt; - unsigned n_counts = GCOV_TAG_COUNTER_NUM (length); + int read_length = (int)length; + length = read_length > 0 ? read_length : 0; + unsigned n_counts = GCOV_TAG_COUNTER_NUM (abs (read_length)); unsigned ix; elt.ident = fn_ident; @@ -274,8 +276,9 @@ read_counts_file (void) counts_hash = NULL; break; } - for (ix = 0; ix != n_counts; ix++) - entry->counts[ix] += gcov_read_counter (); + if (read_length > 0) + for (ix = 0; ix != n_counts; ix++) + entry->counts[ix] = gcov_read_counter (); } gcov_sync (offset, length); if ((is_error = gcov_is_error ())) |