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.
+
+2008-01-24 Daniel Franke <franke.daniel@gmail.com>
+
PR fortran/34202
* data.c (formalize_structure_cons): Skip formalization on
empty structures.
void gfc_undo_symbols (void);
void gfc_commit_symbols (void);
void gfc_commit_symbol (gfc_symbol *);
-void gfc_free_common_tree (gfc_symtree *);
void gfc_free_namespace (gfc_namespace *);
void gfc_symbol_init_2 (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--;
/* 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);
}
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)
{