diff options
author | Janus Weil <janus@gcc.gnu.org> | 2010-08-21 16:50:57 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2010-08-21 16:50:57 +0200 |
commit | 1d0134b3ccdc7e224f89540f05898742b13fecf9 (patch) | |
tree | 73b55a92cbe026c1c26f39ee2a1feac959a278bd /gcc/fortran/class.c | |
parent | 02be26e48b35198e854bdfe4e608d8060fe7dfd6 (diff) | |
download | gcc-1d0134b3ccdc7e224f89540f05898742b13fecf9.zip gcc-1d0134b3ccdc7e224f89540f05898742b13fecf9.tar.gz gcc-1d0134b3ccdc7e224f89540f05898742b13fecf9.tar.bz2 |
re PR fortran/45271 ([OOP] Polymorphic code breaks when changing order of USE statements)
2010-08-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/45271
PR fortran/45290
* class.c (add_proc_comp): Add static initializer for PPCs.
(add_procs_to_declared_vtab): Modified comment.
* module.c (mio_component): Add argument 'vtype'. Don't read/write the
initializer if the component is part of a vtype.
(mio_component_list): Add argument 'vtype', pass it on to
'mio_component'.
(mio_symbol): Modified call to 'mio_component_list'.
* trans.h (gfc_conv_initializer): Modified prototype.
(gfc_trans_assign_vtab_procs): Removed.
* trans-common.c (create_common): Modified call to
'gfc_conv_initializer'.
* trans-decl.c (gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_emit_parameter_debug_info): Modified call to
'gfc_conv_initializer'.
(build_function_decl): Remove assertion.
* trans-expr.c (gfc_conv_derived_to_class,gfc_trans_class_assign):
Removed call to 'gfc_trans_assign_vtab_procs'.
(gfc_conv_initializer): Add argument 'procptr'.
(gfc_conv_structure): Modified call to 'gfc_conv_initializer'.
(gfc_trans_assign_vtab_procs): Removed.
* trans-stmt.c (gfc_trans_allocate): Removed call to
'gfc_trans_assign_vtab_procs'.
2010-08-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/44863
PR fortran/45271
PR fortran/45290
* gfortran.dg/dynamic_dispatch_10.f03: New (PR 44863 comment #1).
* gfortran.dg/pointer_init_5.f90: New (PR 45290 comment #6).
* gfortran.dg/typebound_call_18.f03: New (PR 45271 comment #3).
From-SVN: r163445
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r-- | gcc/fortran/class.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 7dc9344..df3a314 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -214,8 +214,6 @@ add_proc_comp (gfc_symbol *vtype, const char *name, gfc_typebound_proc *tb) /* Add procedure component. */ if (gfc_add_component (vtype, name, &c) == FAILURE) return; - if (tb->u.specific) - c->ts.interface = tb->u.specific->n.sym; if (!c->tb) c->tb = XCNEW (gfc_typebound_proc); @@ -228,17 +226,18 @@ add_proc_comp (gfc_symbol *vtype, const char *name, gfc_typebound_proc *tb) c->attr.external = 1; c->attr.untyped = 1; c->attr.if_source = IFSRC_IFBODY; - - /* A static initializer cannot be used here because the specific - function is not a constant; internal compiler error: in - output_constant, at varasm.c:4623 */ - c->initializer = NULL; } else if (c->attr.proc_pointer && c->tb) { *c->tb = *tb; c->tb->ppc = 1; - c->ts.interface = tb->u.specific->n.sym; + } + + if (tb->u.specific) + { + c->ts.interface = tb->u.specific->n.sym; + if (!tb->deferred) + c->initializer = gfc_get_variable_expr (tb->u.specific); } } @@ -296,7 +295,7 @@ add_procs_to_declared_vtab (gfc_symbol *derived, gfc_symbol *vtype) { /* Make sure that the PPCs appear in the same order as in the parent. */ copy_vtab_proc_comps (super_type, vtype); - /* Only needed to get the PPC interfaces right. */ + /* Only needed to get the PPC initializers right. */ add_procs_to_declared_vtab (super_type, vtype); } |