aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-06-02 10:11:07 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:15:51 -0300
commitbcec22b6a70978bba4b41a6c465dba12cbb9b7bc (patch)
tree61af8967a7cb17c342aa8fe75ec8e10b1919c295 /gcc/gcov.c
parentfb4a20d95983d4c6548cf559ab3021f67671b5e4 (diff)
downloadgcc-bcec22b6a70978bba4b41a6c465dba12cbb9b7bc.zip
gcc-bcec22b6a70978bba4b41a6c465dba12cbb9b7bc.tar.gz
gcc-bcec22b6a70978bba4b41a6c465dba12cbb9b7bc.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/gcov.c')
-rw-r--r--gcc/gcov.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index b2d2fda..b302e21 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -1972,11 +1972,16 @@ read_count_file (void)
}
else if (tag == GCOV_TAG_FOR_COUNTER (GCOV_COUNTER_ARCS) && fn)
{
+ int read_length = (int)length;
+ length = abs (read_length);
if (length != GCOV_TAG_COUNTER_LENGTH (fn->counts.size ()))
goto mismatch;
- for (ix = 0; ix != fn->counts.size (); ix++)
- fn->counts[ix] += gcov_read_counter ();
+ if (read_length > 0)
+ for (ix = 0; ix != fn->counts.size (); ix++)
+ fn->counts[ix] += gcov_read_counter ();
+ else
+ length = 0;
}
gcov_sync (base, length);
if ((error = gcov_is_error ()))