[patch][trunk] Part of PR 34483

Richard Guenther richard.guenther@gmail.com
Thu Jan 24 18:04:00 GMT 2008


On Jan 24, 2008 5:35 PM, Olga Golovanevsky <OLGA@il.ibm.com> wrote:
>
> This patch resolves the ICE in PR 34483 comment #1:
>
> wo_prof_two_strs.c:56: internal compiler error:
> in find_new_var_of_type, at ipa-struct-reorg.c:605
>
>
> It fixes an inconsistency of struct-reorg data structures
> by removing structure allocations when the structure itself
> is excluded from consideration.
>
> Bootstrapped/regtested on ppc/linux, x86_64/linux.
>
> ok for mainline?

(please use -p for generating patches, see http://gcc.gnu.org/wiki/SvnSetup)

This is ok.

Still this looks like you use the wrong data structures or that you needlessy
build things to throw them away later.  Please consider cleaning things
up here during 4.4.

Thanks,
Richard.

> Olga
>
> Index: ipa-struct-reorg.c
> ===================================================================
> --- ipa-struct-reorg.c  (revision 131778)
> +++ ipa-struct-reorg.c  (working copy)
> @@ -187,7 +187,7 @@
>  typedef const struct func_alloc_sites *const_fallocs_t;
>
>  /* All allocation sites in the program.  */
> -htab_t alloc_sites;
> +htab_t alloc_sites = NULL;
>
>  /* New global variables. Generated once for whole program.  */
>  htab_t new_global_vars;.
> @@ -2344,6 +2344,41 @@
>      htab_traverse (accs, dump_acc, NULL);
>  }
>
> +/* This function is a callback for alloc_sites hashtable
> +   traversal. SLOT is a pointer to fallocs_t. This function
> +   removes all allocations of the structure defined by DATA.  */
> +
> +static int
> +remove_str_allocs_in_func (void **slot, void *data)
> +{
> +  fallocs_t fallocs = *(fallocs_t *) slot;
> +  unsigned i = 0;
> +  alloc_site_t *call;
> +
> +  while (VEC_iterate (alloc_site_t, fallocs->allocs, i, call))
> +    {
> +      if (call->str == (d_str) data)
> +     VEC_ordered_remove (alloc_site_t, fallocs->allocs, i);
> +      else
> +     i++;
> +    }
> +
> +  return 1;
> +}
> +}
> +/* This function remove all entries corresponding to the STR structure
> +   from alloc_sites hashtable.   */
> +
> +static void
> +remove_str_allocs (d_str str).
> +{
> +  if (!str)
> +    return;
> +
> +  if (alloc_sites)
> +    htab_traverse (alloc_sites, remove_str_allocs_in_func, str);
> +}
> +}
>  /* This function removes the structure with index I from structures
> vector.  */
>
>  static void
> @@ -2354,7 +2389,11 @@
>    if (i >= VEC_length (structure, structures))
>      return;
>
> -  str = VEC_index (structure, structures, i);
> +  str = VEC_index (structure, structures, i);
> +
> +  /* Before removing the structure str, we have to remove its
> +     allocations from alloc_sites hashtable.  */
> +  remove_str_allocs (str);
>    free_data_struct (str);;
>    VEC_ordered_remove (structure, structures, i);
>  }
> Index: ChangeLog
> ===================================================================
> --- ChangeLog     (revision 131777)
> +++ ChangeLog     (working copy)
> @@ -1,3 +1,9 @@
> +2008-01-24  Golovanevsky Olga  <olga@il.ibm.com>
> +
> +     * ipa-struct-reorg.c (remove_str_allocs_in_func, remove_str_allocs):
> +     New functions.
> +     (remove_structure): Update allocations list before removing
> structure.
> +
>  2008-01-23  Hans-Peter Nilsson  <hp@axis.com>
>
>       * config/cris/cris.h (CC1PLUS_SPEC, OPTIMIZATION_OPTIONS): Drop
>
>



More information about the Gcc-patches mailing list