diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-09-02 12:41:08 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-09-02 05:41:08 -0700 |
commit | 9bf777eedf9bb3fe6ae516051d101456636f34e9 (patch) | |
tree | 1694f7e36c9401df62c8941c4af4cd07410647b6 /gcc/tree-nested.c | |
parent | b8d7f9febca57fbd2070e4c1c6148ae24f9b19ca (diff) | |
download | gcc-9bf777eedf9bb3fe6ae516051d101456636f34e9.zip gcc-9bf777eedf9bb3fe6ae516051d101456636f34e9.tar.gz gcc-9bf777eedf9bb3fe6ae516051d101456636f34e9.tar.bz2 |
re PR middle-end/23547 ([non-unit-at-a-time] ICE with recursive call to nested function)
2005-09-02 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23547
* tree-nested.c (struct var_map_elt): Mark with GTY.
(struct nesting_info): Mark with GTY. Mark var_map's param is struct
var_map_elt.
(lookup_field_for_decl): Allocate new element in GC memory.
(lookup_tramp_for_decl): Likewise.
(convert_nl_goto_reference): Likewise
(create_nesting_tree): Allocate info in GC memory. Likewise for info->var_map.
(free_nesting_tree): Free with ggc_free instead of free.
(root): New static variable.
(lower_nested_functions): Remove root as local variable. And zero out root at the end of the function.
2005-09-02 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23547
* gcc.dg/pr23547.c: New test.
From-SVN: r103777
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r-- | gcc/tree-nested.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 45c9bfe..6f0b7fd 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -77,19 +77,19 @@ been written as independent functions without change. */ -struct var_map_elt +struct var_map_elt GTY(()) { tree old; tree new; }; -struct nesting_info +struct nesting_info GTY ((chain_next ("%h.next"))) { struct nesting_info *outer; struct nesting_info *inner; struct nesting_info *next; - htab_t var_map; + htab_t GTY ((param_is (struct var_map_elt))) var_map; tree context; tree new_local_var_chain; tree frame_type; @@ -288,7 +288,7 @@ lookup_field_for_decl (struct nesting_info *info, tree decl, insert_field_into_struct (get_frame_type (info), field); - elt = xmalloc (sizeof (*elt)); + elt = ggc_alloc (sizeof (*elt)); elt->old = decl; elt->new = field; *slot = elt; @@ -474,7 +474,7 @@ lookup_tramp_for_decl (struct nesting_info *info, tree decl, insert_field_into_struct (get_frame_type (info), field); - elt = xmalloc (sizeof (*elt)); + elt = ggc_alloc (sizeof (*elt)); elt->old = decl; elt->new = field; *slot = elt; @@ -698,8 +698,8 @@ check_for_nested_with_variably_modified (tree fndecl, tree orig_fndecl) static struct nesting_info * create_nesting_tree (struct cgraph_node *cgn) { - struct nesting_info *info = xcalloc (1, sizeof (*info)); - info->var_map = htab_create (7, var_map_hash, var_map_eq, free); + struct nesting_info *info = ggc_calloc (1, sizeof (*info)); + info->var_map = htab_create_ggc (7, var_map_hash, var_map_eq, ggc_free); info->context = cgn->decl; for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested) @@ -1108,7 +1108,7 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data) /* Enter this association into var_map so that we can insert the new label into the IL during a second pass. */ - elt = xmalloc (sizeof (*elt)); + elt = ggc_alloc (sizeof (*elt)); elt->old = label; elt->new = new_label; slot = htab_find_slot (i->var_map, elt, INSERT); @@ -1474,19 +1474,20 @@ free_nesting_tree (struct nesting_info *root) free_nesting_tree (root->inner); htab_delete (root->var_map); next = root->next; - free (root); + ggc_free (root); root = next; } while (root); } +static GTY(()) struct nesting_info *root; + /* Main entry point for this pass. Process FNDECL and all of its nested subroutines and turn them into something less tightly bound. */ void lower_nested_functions (tree fndecl) { - struct nesting_info *root; struct cgraph_node *cgn; /* If there are no nested functions, there's nothing to do. */ @@ -1502,6 +1503,7 @@ lower_nested_functions (tree fndecl) convert_all_function_calls (root); finalize_nesting_tree (root); free_nesting_tree (root); + root = NULL; } #include "gt-tree-nested.h" |