aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2011-02-02 20:51:03 +0100
committerPaul Thomas <pault@gcc.gnu.org>2011-02-02 19:51:03 +0000
commit8e2bc95be59aa82767921fe0b83e0da93caaa611 (patch)
treeffaee50911754a7de580e03aa7a2d82de33596ed /gcc/fortran
parent932e32375ae90a7ca6d146efccf7e87b820f032a (diff)
downloadgcc-8e2bc95be59aa82767921fe0b83e0da93caaa611.zip
gcc-8e2bc95be59aa82767921fe0b83e0da93caaa611.tar.gz
gcc-8e2bc95be59aa82767921fe0b83e0da93caaa611.tar.bz2
re PR fortran/47082 ([OOP] ICE in gfc_conv_component_ref)
2011-02-02 Janus Weil <janus@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/47082 * trans-expr.c (gfc_trans_class_init_assign): Add call to gfc_get_derived_type. * module.c (read_cleanup): Do not use unique_symtrees for vtabs or vtypes. 2011-02-02 Janus Weil <janus@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/47082 * gfortran.dg/class_37.f03 : New test. Co-Authored-By: Paul Thomas <pault@gcc.gnu.org> From-SVN: r169767
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/module.c16
-rw-r--r--gcc/fortran/trans-expr.c5
3 files changed, 29 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2331b97..09606e1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,4 +1,13 @@
2011-02-02 Janus Weil <janus@gcc.gnu.org>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/47082
+ * trans-expr.c (gfc_trans_class_init_assign): Add call to
+ gfc_get_derived_type.
+ * module.c (read_cleanup): Do not use unique_symtrees for vtabs
+ or vtypes.
+
+2011-02-02 Janus Weil <janus@gcc.gnu.org>
PR fortran/47572
* resolve.c (resolve_fl_variable): Handle polymorphic allocatables.
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 6c3455b..267809c 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4219,9 +4219,23 @@ read_cleanup (pointer_info *p)
if (p->type == P_SYMBOL && p->u.rsym.state == USED && !p->u.rsym.referenced)
{
+ gfc_namespace *ns;
/* Add hidden symbols to the symtree. */
q = get_integer (p->u.rsym.ns);
- st = gfc_get_unique_symtree ((gfc_namespace *) q->u.pointer);
+ ns = (gfc_namespace *) q->u.pointer;
+
+ if (!p->u.rsym.sym->attr.vtype
+ && !p->u.rsym.sym->attr.vtab)
+ st = gfc_get_unique_symtree (ns);
+ else
+ {
+ /* There is no reason to use 'unique_symtrees' for vtabs or
+ vtypes - their name is fine for a symtree and reduces the
+ namespace pollution. */
+ st = gfc_find_symtree (ns->sym_root, p->u.rsym.sym->name);
+ if (!st)
+ st = gfc_new_symtree (&ns->sym_root, p->u.rsym.sym->name);
+ }
st->n.sym = p->u.rsym.sym;
st->n.sym->refs++;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 57bdb5d..f19c015 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6300,6 +6300,11 @@ gfc_trans_class_init_assign (gfc_code *code)
rhs = gfc_copy_expr (code->expr1);
gfc_add_vptr_component (rhs);
+
+ /* Make sure that the component backend_decls have been built, which
+ will not have happened if the derived types concerned have not
+ been referenced. */
+ gfc_get_derived_type (rhs->ts.u.derived);
gfc_add_def_init_component (rhs);
sz = gfc_copy_expr (code->expr1);