aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-02-11 20:58:48 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-02-11 20:58:48 +0000
commitdcdc7b6c9d3b3d0170cfeed1d4ebe5d84b73b346 (patch)
tree97afc311a32371e5a733bcc5f86550b0ef6fcc6f /gcc/fortran/module.c
parentba139ba8b7f96b2f1867945d8cec54a99239d31a (diff)
downloadgcc-dcdc7b6c9d3b3d0170cfeed1d4ebe5d84b73b346.zip
gcc-dcdc7b6c9d3b3d0170cfeed1d4ebe5d84b73b346.tar.gz
gcc-dcdc7b6c9d3b3d0170cfeed1d4ebe5d84b73b346.tar.bz2
re PR fortran/30554 ([4.1 only] ICE in mio_pointer_ref at module.c:1945)
2007-02-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * module.c (find_symtree_for_symbol): New function to return a symtree that is not a "unique symtree" given a symbol. (read_module): Do not automatically set pointer_info to referenced because this inhibits the generation of a unique symtree. Recycle the existing symtree if possible by calling find_symtree_for_symbol. PR fortran/30319 * decl.c (add_init_expr_to_sym): Make new charlen for an array constructor initializer. 2007-02-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * gfortran.dg/used_dummy_types_6.f90: Add the "privatized" versions of the modules. PR fortran/30617 * gfortran.dg/intrinsic_actual_2.f90: Make this legal fortran by getting rid of recursive I/O and providing functions with results. PR fortran/30319 * gfortran.dg/char_array_constructor_2.f90 From-SVN: r121824
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index e76bd0e..1dd81e3 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3304,6 +3304,31 @@ read_cleanup (pointer_info *p)
}
+/* Given a root symtree node and a symbol, try to find a symtree that
+ references the symbol that is not a unique name. */
+
+static gfc_symtree *
+find_symtree_for_symbol (gfc_symtree *st, gfc_symbol *sym)
+{
+ gfc_symtree *s = NULL;
+
+ if (st == NULL)
+ return s;
+
+ s = find_symtree_for_symbol (st->right, sym);
+ if (s != NULL)
+ return s;
+ s = find_symtree_for_symbol (st->left, sym);
+ if (s != NULL)
+ return s;
+
+ if (st->n.sym == sym && !check_unique_name (st->name))
+ return st;
+
+ return s;
+}
+
+
/* Read a module file. */
static void
@@ -3363,8 +3388,17 @@ read_module (void)
continue;
info->u.rsym.state = USED;
- info->u.rsym.referenced = 1;
info->u.rsym.sym = sym;
+
+ /* If possible recycle the symtree that references the symbol.
+ If a symtree is not found and the module does not import one,
+ a unique-name symtree is found by read_cleanup. */
+ st = find_symtree_for_symbol (gfc_current_ns->sym_root, sym);
+ if (st != NULL)
+ {
+ info->u.rsym.symtree = st;
+ info->u.rsym.referenced = 1;
+ }
}
mio_rparen ();