aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
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
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')
-rw-r--r--gcc/fortran/ChangeLog14
-rw-r--r--gcc/fortran/decl.c7
-rw-r--r--gcc/fortran/module.c36
3 files changed, 55 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a0cf78f..32ae40e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,17 @@
+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-10 Richard Henderson <rth@redhat.com>, Jakub Jelinek <jakub@redhat.com>
* f95-lang.c (gfc_init_builtin_functions): Add __emutls_get_address
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index b25bcc0..f29b035 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -939,8 +939,13 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp,
gfc_set_constant_character_len (len, init, false);
else if (init->expr_type == EXPR_ARRAY)
{
- gfc_free_expr (init->ts.cl->length);
+ /* Build a new charlen to prevent simplification from
+ deleting the length before it is resolved. */
+ init->ts.cl = gfc_get_charlen ();
+ init->ts.cl->next = gfc_current_ns->cl_list;
+ gfc_current_ns->cl_list = sym->ts.cl;
init->ts.cl->length = gfc_copy_expr (sym->ts.cl->length);
+
for (p = init->value.constructor; p; p = p->next)
gfc_set_constant_character_len (len, p->expr, false);
}
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 ();