aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 9dc1cae..f3ffac5 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -74,6 +74,7 @@ struct counts_entry : pointer_hash <counts_entry>
unsigned lineno_checksum;
unsigned cfg_checksum;
gcov_type *counts;
+ unsigned n_counts;
/* hash_table support. */
static inline hashval_t hash (const counts_entry *);
@@ -260,6 +261,7 @@ read_counts_file (void)
entry->lineno_checksum = lineno_checksum;
entry->cfg_checksum = cfg_checksum;
entry->counts = XCNEWVEC (gcov_type, n_counts);
+ entry->n_counts = n_counts;
}
else if (entry->lineno_checksum != lineno_checksum
|| entry->cfg_checksum != cfg_checksum)
@@ -295,7 +297,7 @@ read_counts_file (void)
gcov_type *
get_coverage_counts (unsigned counter, unsigned cfg_checksum,
- unsigned lineno_checksum)
+ unsigned lineno_checksum, unsigned int n_counts)
{
counts_entry *entry, elt;
@@ -344,17 +346,27 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum,
return NULL;
}
- if (entry->cfg_checksum != cfg_checksum)
+ if (entry->cfg_checksum != cfg_checksum || entry->n_counts != n_counts)
{
static int warned = 0;
bool warning_printed = false;
- warning_printed =
- warning_at (DECL_SOURCE_LOCATION (current_function_decl),
- OPT_Wcoverage_mismatch,
- "the control flow of function %qD does not match "
- "its profile data (counter %qs)", current_function_decl,
- ctr_names[counter]);
+ if (entry->n_counts != n_counts)
+ warning_printed =
+ warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+ OPT_Wcoverage_mismatch,
+ "number of counters in profile data for function %qD "
+ "does not match "
+ "its profile data (counter %qs, expected %i and have %i)",
+ current_function_decl,
+ ctr_names[counter], entry->n_counts, n_counts);
+ else
+ warning_printed =
+ warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+ OPT_Wcoverage_mismatch,
+ "the control flow of function %qD does not match "
+ "its profile data (counter %qs)", current_function_decl,
+ ctr_names[counter]);
if (warning_printed && dump_enabled_p ())
{
dump_user_location_t loc