This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GOOGLE] Fix uninitialized memory in AutoFDO implementation
- From: Xinliang David Li <davidxl at google dot com>
- To: Dehao Chen <dehao at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 1 Jun 2013 22:54:04 -0700
- Subject: Re: [GOOGLE] Fix uninitialized memory in AutoFDO implementation
- References: <CAO2gOZUboa7DGiM1c4=856p-zD_XzqWeykeWtc-fkurgw5s=Dw at mail dot gmail dot com>
ok.
David
On Sat, Jun 1, 2013 at 9:05 PM, Dehao Chen <dehao@google.com> wrote:
> This patch fixes an uninitialized memory error and a hashtable
> comparison bug in AutoFDO.
>
> Bootstrapped and passed regression test.
>
> OK for google branches?
>
> Thanks,
> Dehao
>
> Index: gcc/auto-profile.c
> ===================================================================
> --- gcc/auto-profile.c (revision 199461)
> +++ gcc/auto-profile.c (working copy)
> @@ -310,10 +310,11 @@ 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);
> if (i != afdo_get_original_name_size (s2->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)