From f820b0cf2cb6595ed42b16fd1615eb3aec0a6ada Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 29 Sep 2003 23:19:10 +0200 Subject: re PR c++/12175 (Tru64 UNIX bootstrap failure: multiply defined symbols linking libstdc++.so) PR c++/12175 * varasm.c (notice_global_symbol): Discard external symbols. PR optimization/12286 * gcov-io.c (gcov_read_words): Fix memmove call. * profile.c (compute_branch_probabilities): Add extra sanity checks. PR C++/12047 * except.c (build_eh_type_type): Call mark_used on the type. From-SVN: r71916 --- gcc/profile.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/profile.c') diff --git a/gcc/profile.c b/gcc/profile.c index 0994981..082ed32 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -280,6 +280,22 @@ compute_branch_probabilities (void) gcov_type *exec_counts = get_exec_counts (); int exec_counts_pos = 0; + /* Very simple sanity checks so we catch bugs in our profiling code. */ + if (profile_info) + { + if (profile_info->run_max * profile_info->runs < profile_info->sum_max) + { + error ("corrupted profile info: run_max * runs < sum_max"); + exec_counts = NULL; + } + + if (profile_info->sum_all < profile_info->sum_max) + { + error ("corrupted profile info: sum_all is smaller than sum_max"); + exec_counts = NULL; + } + } + /* Attach extra info block to each bb. */ alloc_aux_for_blocks (sizeof (struct bb_info)); @@ -315,6 +331,11 @@ compute_branch_probabilities (void) if (exec_counts) { e->count = exec_counts[exec_counts_pos++]; + if (e->count > profile_info->sum_max) + { + error ("corrupted profile info: edge from %i to %i exceeds maximal count", + bb->index, e->dest->index); + } } else e->count = 0; -- cgit v1.1