diff options
author | dfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-24 21:36:14 +0000 |
---|---|---|
committer | dfranke <dfranke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-24 21:36:14 +0000 |
commit | 8342527a11e425df54b6087c4116f87a2afcd7b7 (patch) | |
tree | 002aa4e5c6d655e2dca2be8b456e05e85aacd7c1 /gcc/fortran/symbol.c | |
parent | 2b119350d78db29e82a4778dcffcf84f5f83602e (diff) | |
download | gcc-8342527a11e425df54b6087c4116f87a2afcd7b7.tar.gz |
2008-01-24 Daniel Franke <franke.daniel@gmail.com>
PR fortran/33375
PR fortran/34858
* gfortran.h: Revert changes from 2008-01-17.
* match.c: Likewise.
* symbol.c: Likewise.
(gfc_undo_symbols): Undo namespace changes related to common blocks.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131811 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index a50ed261141..a802fa16dc8 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2582,6 +2582,33 @@ gfc_undo_symbols (void) if (p->new) { /* Symbol was new. */ + if (p->attr.in_common && p->common_block->head) + { + /* If the symbol was added to any common block, it + needs to be removed to stop the resolver looking + for a (possibly) dead symbol. */ + + if (p->common_block->head == p) + p->common_block->head = p->common_next; + else + { + gfc_symbol *cparent, *csym; + + cparent = p->common_block->head; + csym = cparent->common_next; + + while (csym != p) + { + cparent = csym; + csym = csym->common_next; + } + + gcc_assert(cparent->common_next == p); + + cparent->common_next = csym->common_next; + } + } + delete_symtree (&p->ns->sym_root, p->name); p->refs--; @@ -2726,14 +2753,14 @@ gfc_commit_symbol (gfc_symbol *sym) /* Recursive function that deletes an entire tree and all the common head structures it points to. */ -void -gfc_free_common_tree (gfc_symtree * common_tree) +static void +free_common_tree (gfc_symtree * common_tree) { if (common_tree == NULL) return; - gfc_free_common_tree (common_tree->left); - gfc_free_common_tree (common_tree->right); + free_common_tree (common_tree->left); + free_common_tree (common_tree->right); gfc_free (common_tree); } @@ -2863,7 +2890,7 @@ gfc_free_namespace (gfc_namespace *ns) free_sym_tree (ns->sym_root); free_uop_tree (ns->uop_root); - gfc_free_common_tree (ns->common_root); + free_common_tree (ns->common_root); for (cl = ns->cl_list; cl; cl = cl2) { |