[PATCH] Add debug support for merging identical functions (aka ICF)

Jason Merrill jason@redhat.com
Mon Oct 5 05:16:00 GMT 2009


On 08/15/2009 08:05 PM, Cary Coutant wrote:
> +  vcall_insn_table = htab_create_ggc (10, vcall_insn_table_hash,
> +                                      vcall_insn_table_eq, NULL);

> +          struct vcall_insn *item = XNEW (struct vcall_insn);
> +          struct vcall_insn **slot;
> +
> +          gcc_assert (item);
> +          item->insn_uid = insn_uid;
> +          item->vtable_slot = TREE_INT_CST_LOW (token);
> +          slot = (struct vcall_insn **)
> +              htab_find_slot_with_hash (vcall_insn_table, (void *) &item,
> +                                        (hashval_t) insn_uid, INSERT);
> +          *slot = item;

It looks like vcall_insn_table is a GC hash table, but you're allocating 
items from the heap.  Do you want GGC_NEW instead of XNEW?

I also don't think the (void *) cast is necessary.

Jason



More information about the Gcc-patches mailing list