diff options
author | Jan Hubicka <jh@suse.cz> | 2003-12-29 10:29:21 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-12-29 09:29:21 +0000 |
commit | 24a4a0338aa591091fbbaaf39de0e31529600bbd (patch) | |
tree | 065b7688977c1e6f73e8de2bd3f41a33f5c9dc88 | |
parent | f46a52d25219bfbdb22f8b8edb22c00f53490c33 (diff) | |
download | gcc-24a4a0338aa591091fbbaaf39de0e31529600bbd.zip gcc-24a4a0338aa591091fbbaaf39de0e31529600bbd.tar.gz gcc-24a4a0338aa591091fbbaaf39de0e31529600bbd.tar.bz2 |
coverage.c (read_counts_file): Better error messages...
* coverage.c (read_counts_file): Better error messages; cause corrupted
profiles to produce hard errors, not just warnings
(get_coverage_counts): Similarly.
From-SVN: r75198
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/coverage.c | 48 |
2 files changed, 38 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b71bea3..4559835 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2003-12-29 Jan Hubicka <jh@suse.cz> + * coverage.c (read_counts_file): Better error messages; cause corrupted + profiles to produce hard errors, not just warnings + (get_coverage_counts): Similarly. + * toplev.c (rest_of_handle_loop_optimize): Enable LOOP_AUTO_UNROLL. 2003-12-29 Phil Edwards <phil@codesourcery.com> diff --git a/gcc/coverage.c b/gcc/coverage.c index 9e25413..8b43d6a 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -154,7 +154,7 @@ read_counts_file (void) counts_entry_t *summaried = NULL; unsigned seen_summary = 0; gcov_unsigned_t tag; - int error = 0; + int is_error = 0; if (!gcov_open (da_file_name, 1)) return; @@ -250,17 +250,26 @@ read_counts_file (void) entry->summary.num = n_counts; entry->counts = xcalloc (n_counts, sizeof (gcov_type)); } - else if (entry->checksum != checksum - || entry->summary.num != n_counts) + else if (entry->checksum != checksum) { - warning ("coverage mismatch for function %u", fn_ident); + error ("coverage mismatch for function %u while reading execution counters.", + fn_ident); + error ("checksum is %x instead of %x", entry->checksum, checksum); + htab_delete (counts_hash); + break; + } + else if (entry->summary.num != n_counts) + { + error ("coverage mismatch for function %u while reading execution counters.", + fn_ident); + error ("number of counters is %d instead of %d", entry->summary.num, n_counts); htab_delete (counts_hash); break; } else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE) { - warning ("cannot merge separate %s counters for function %u", - ctr_names[elt.ctr], fn_ident); + error ("cannot merge separate %s counters for function %u", + ctr_names[elt.ctr], fn_ident); goto skip_merge; } @@ -278,14 +287,14 @@ read_counts_file (void) skip_merge:; } gcov_sync (offset, length); - if ((error = gcov_is_error ())) + if ((is_error = gcov_is_error ())) break; } if (!gcov_is_eof ()) { - warning (error < 0 ? "`%s' has overflowed" : "`%s' is corrupted", - da_file_name); + error (is_error < 0 ? "`%s' has overflowed" : "`%s' is corrupted", + da_file_name); htab_delete (counts_hash); } @@ -299,6 +308,7 @@ get_coverage_counts (unsigned counter, unsigned expected, const struct gcov_ctr_summary **summary) { counts_entry_t *entry, elt; + gcov_unsigned_t checksum = -1; /* No hash table, no counts. */ if (!counts_hash) @@ -321,12 +331,22 @@ get_coverage_counts (unsigned counter, unsigned expected, return 0; } - if (expected != entry->summary.num - || compute_checksum () != entry->checksum) + checksum = compute_checksum (); + if (entry->checksum != checksum) { - warning ("coverage mismatch for `%s'", IDENTIFIER_POINTER - (DECL_ASSEMBLER_NAME (current_function_decl))); - return NULL; + error ("coverage mismatch for function '%s' while reading counter '%s'.", + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)), + ctr_names[counter]); + error ("checksum is %x instead of %x", entry->checksum, checksum); + return 0; + } + else if (entry->summary.num != expected) + { + error ("coverage mismatch for function '%s' while reading counter '%s'.", + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)), + ctr_names[counter]); + error ("number of counters is %d instead of %d", entry->summary.num, expected); + return 0; } if (summary) |