aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-22 17:43:43 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-22 17:43:43 -0300
commita926878ddbd5a98b272c22171ce58663fc04c3e0 (patch)
tree86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/coverage.c
parent542730f087133690b47e036dfd43eb0db8a650ce (diff)
parent07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff)
downloadgcc-a926878ddbd5a98b272c22171ce58663fc04c3e0.zip
gcc-a926878ddbd5a98b272c22171ce58663fc04c3e0.tar.gz
gcc-a926878ddbd5a98b272c22171ce58663fc04c3e0.tar.bz2
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 7d82e44..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 ()))
@@ -345,8 +348,11 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum,
can do about it. */
return NULL;
}
-
- if (entry->cfg_checksum != cfg_checksum || entry->n_counts != n_counts)
+
+ if (entry->cfg_checksum != cfg_checksum
+ || (counter != GCOV_COUNTER_V_INDIR
+ && counter != GCOV_COUNTER_V_TOPN
+ && entry->n_counts != n_counts))
{
static int warned = 0;
bool warning_printed = false;