aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2013-06-02 19:13:52 +0000
committerDehao Chen <dehao@google.com>2013-06-02 19:13:52 +0000
commit8e955d2567f300ef6f97f32b8f73adc1f15637bd (patch)
treee7a845b05166374d54634326ea4e3c8b7ee98fb5
parent2e9281336673f75e50c25fdcb0e058255f51015e (diff)
Fix uninitialized memory and incorrect hash_eq function.
2013-06-02 Dehao Chen <dehao@google.com> * gcc/auto-profile.c (afdo_stack_eq): Fix incorrect hash_eq function. (process_auto_profile): Fix uninitialized memory error. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7@199592 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/auto-profile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index e1a05fb7567..075d30a0a3c 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -310,9 +310,10 @@ afdo_stack_eq (const void *p, const void *q)
if (s2->callee_name != NULL)
return 0;
}
- else if (s2->callee_name != NULL
- && strcmp (afdo_get_bfd_name (s1->callee_name),
- afdo_get_bfd_name (s2->callee_name)))
+ else if (s2->callee_name == NULL)
+ return 0;
+ else if (strcmp (afdo_get_bfd_name (s1->callee_name),
+ afdo_get_bfd_name (s2->callee_name)))
return 0;
i = afdo_get_original_name_size (s1->func_name);
@@ -1214,6 +1215,8 @@ process_auto_profile (void)
new_stack->num_inst = 0;
new_stack->count = 0;
new_stack->max_count = 0;
+ new_stack->hist_size = 0;
+ new_stack->hist = NULL;
stack_slot = (struct gcov_stack **)
htab_find_slot (stack_htab, new_stack, INSERT);
if (!*stack_slot)