summaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-09-29 23:19:10 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2003-09-29 21:19:10 +0000
commitf820b0cf2cb6595ed42b16fd1615eb3aec0a6ada (patch)
treeac8d51ac3e224b015d329e29e83234c8093f3647 /gcc/profile.c
parent2cd5614273c9579fa35eff4b53a773c95b74fc75 (diff)
downloadgcc-f820b0cf2cb6595ed42b16fd1615eb3aec0a6ada.tar.gz
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
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 09949819064..082ed322e5a 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;