[PATCH] Ensure entries pid_map are initialized to NULL

Diego Novillo dnovillo@google.com
Wed Aug 5 18:05:00 GMT 2009


On Wed, Aug 5, 2009 at 13:59, Neil Vachharajani<nvachhar@google.com> wrote:

>
>       * value-prof.c (init_pid_map): Replace xmalloc with xcalloc.
>
> --- gcc/value-prof.c.orig        2009-08-04 17:10:24.000000000 -0700
> +++ gcc/value-prof.c  2009-08-04 16:41:00.021142462 -0700
> @@ -1060,7 +1060,7 @@
>     return;
>
>   pid_map
> -    = (struct cgraph_node**) xmalloc (sizeof (struct cgraph_node*) *
> cgraph_max_pid);
> +    = (struct cgraph_node**) xcalloc (cgraph_max_pid, sizeof (struct
> cgraph_node*));

OK, though I slightly prefer using XCNEWVEC as it's more compact.

pid_map = XCNEWVEC (struct cgraph_node, cgraph_max_pid);

I suppose that given the difficulty in reproducing that you don't have
a testcase for this?


Diego.



More information about the Gcc-patches mailing list