diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2016-09-21 06:57:28 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2016-09-21 06:57:28 +0000 |
commit | 096506bb6e4bea8d0f8beafb5eff866e4a7ce3fe (patch) | |
tree | 459aac4366329e2d1aa20be78c5dcf75594ef327 /gcc/fortran/interface.c | |
parent | 37d168aedcc08d271bf5546288be7ad18d4def5e (diff) | |
download | gcc-096506bb6e4bea8d0f8beafb5eff866e4a7ce3fe.zip gcc-096506bb6e4bea8d0f8beafb5eff866e4a7ce3fe.tar.gz gcc-096506bb6e4bea8d0f8beafb5eff866e4a7ce3fe.tar.bz2 |
re PR fortran/77657 (link error with implementation of user-defined derived type input/output (UD-DTIO) in child extending abstract parent)
2016-09-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77657
* interface.c (gfc_find_specific_dtio_proc): Borrow trick from
resolve_typebound_generic_call to find dtio procedures that
over-ride those in the declared type.
2016-09-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77657
* gfortran.dg/dtio_12.f90: New test.
From-SVN: r240301
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 45a9afe..f8a4edb 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -4792,6 +4792,9 @@ gfc_find_specific_dtio_proc (gfc_symbol *derived, bool write, bool formatted) if (tb_io_st != NULL) { + const char *genname; + gfc_symtree *st; + tb_io_proc = tb_io_st->n.tb; gcc_assert (tb_io_proc != NULL); gcc_assert (tb_io_proc->is_generic); @@ -4800,7 +4803,16 @@ gfc_find_specific_dtio_proc (gfc_symbol *derived, bool write, bool formatted) specific_proc = tb_io_proc->u.generic->specific; gcc_assert (!specific_proc->is_generic); - dtio_sub = specific_proc->u.specific->n.sym; + /* Go back and make sure that we have the right specific procedure. + Here we most likely have a procedure from the parent type, which + can be overridden in extensions. */ + genname = tb_io_proc->u.generic->specific_st->name; + st = gfc_find_typebound_proc (derived, NULL, genname, + true, &tb_io_proc->where); + if (st) + dtio_sub = st->n.tb->u.specific->n.sym; + else + dtio_sub = specific_proc->u.specific->n.sym; } if (tb_io_st != NULL) |