From cd612e8a0124c51cd7bc3d18a1cba6c2d4e144c4 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Wed, 26 Oct 2016 14:48:02 +0000 Subject: re PR fortran/78108 (Generic type-bound operator conflicts) 2016-10-26 Paul Thomas PR fortran/78108 * resolve.c (resolve_typebound_intrinsic_op): For submodules suppress the error and return if the same procedure symbol is added more than once to the interface. 2016-10-26 Paul Thomas PR fortran/78108 * gfortran.dg/submodule_18.f08: New test. * gfortran.dg/submodule_19.f08: New test. From-SVN: r241555 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/resolve.c | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 65911dc..bae08b8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2016-10-26 Paul Thomas + + PR fortran/78108 + * resolve.c (resolve_typebound_intrinsic_op): For submodules + suppress the error and return if the same procedure symbol + is added more than once to the interface. + 2016-10-26 Fritz Reese * frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 785203b..fe966aa 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12797,7 +12797,17 @@ resolve_typebound_intrinsic_op (gfc_symbol* derived, gfc_intrinsic_op op, && p->access != ACCESS_PRIVATE && derived->ns == gfc_current_ns) { gfc_interface *head, *intr; - if (!gfc_check_new_interface (derived->ns->op[op], target_proc, p->where)) + + /* Preempt 'gfc_check_new_interface' for submodules, where the + mechanism for handling module procedures winds up resolving + operator interfaces twice and would otherwise cause an error. */ + for (intr = derived->ns->op[op]; intr; intr = intr->next) + if (intr->sym == target_proc + && target_proc->attr.used_in_submodule) + return true; + + if (!gfc_check_new_interface (derived->ns->op[op], + target_proc, p->where)) return false; head = derived->ns->op[op]; intr = gfc_get_interface (); -- cgit v1.1