This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] fix potential memory corruption in annotated value cache
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Sep 2011 10:22:55 +0200
- Subject: Re: [Ada] fix potential memory corruption in annotated value cache
- References: <orzki59dh3.fsf@livre.localdomain>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Sep 16, 2011 at 04:02:32AM -0300, Alexandre Oliva wrote:
> - struct tree_int_map in;
> + struct tree_int_map **h;
> +
> if (!annotate_value_cache)
> annotate_value_cache = htab_create_ggc (512, tree_int_map_hash,
> tree_int_map_eq, 0);
> in.base.from = gnu_size;
> h = (struct tree_int_map **)
> - htab_find_slot (annotate_value_cache, &in, INSERT);
> + htab_find_slot (annotate_value_cache, &in, NO_INSERT);
I wonder why don't you use htab_find instead here.
> - if (*h)
> + if (h)
> return (Node_Ref_Or_Val) (*h)->to;
> }
Jakub