* [Patch, Fortran] PR 86116: Ambiguous generic interface not recognised
@ 2018-08-05 13:24 Janus Weil
2018-08-14 8:12 ` Janus Weil
0 siblings, 1 reply; 4+ messages in thread
From: Janus Weil @ 2018-08-05 13:24 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 967 bytes --]
Hi all,
the attached patch fixes PR 86116 by splitting up the function
'compare_type' into two variants: One that is used for checking
generic interfaces and operators (keeping the old name), and one that
is used for checking dummy functions and procedure pointer assignments
('compare_type_characteristics'). The latter calls the former, but
includes an additional check that must not be done when checking
generics.
Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
Cheers,
Janus
2018-08-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/86116
* interface.c (compare_type): Remove a CLASS/TYPE check.
(compare_type_characteristics): New function that behaves like the old
'compare_type'.
(gfc_check_dummy_characteristics, gfc_check_result_characteristics):
Call 'compare_type_characteristics' instead of 'compare_type'.
2018-08-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/86116
* gfortran.dg/generic_34.f90: New test case.
[-- Attachment #2: pr86116.diff --]
[-- Type: text/x-patch, Size: 1715 bytes --]
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c (revision 263308)
+++ gcc/fortran/interface.c (working copy)
@@ -735,6 +735,13 @@ compare_type (gfc_symbol *s1, gfc_symbol *s2)
if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return true;
+ return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED;
+}
+
+
+static bool
+compare_type_characteristics (gfc_symbol *s1, gfc_symbol *s2)
+{
/* TYPE and CLASS of the same declared type are type compatible,
but have different characteristics. */
if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED)
@@ -741,7 +748,7 @@ compare_type (gfc_symbol *s1, gfc_symbol *s2)
|| (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS))
return false;
- return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED;
+ return compare_type (s1, s2);
}
@@ -1309,7 +1316,8 @@ gfc_check_dummy_characteristics (gfc_symbol *s1, g
/* Check type and rank. */
if (type_must_agree)
{
- if (!compare_type (s1, s2) || !compare_type (s2, s1))
+ if (!compare_type_characteristics (s1, s2)
+ || !compare_type_characteristics (s2, s1))
{
snprintf (errmsg, err_len, "Type mismatch in argument '%s' (%s/%s)",
s1->name, gfc_typename (&s1->ts), gfc_typename (&s2->ts));
@@ -1528,7 +1536,7 @@ gfc_check_result_characteristics (gfc_symbol *s1,
return true;
/* Check type and rank. */
- if (!compare_type (r1, r2))
+ if (!compare_type_characteristics (r1, r2))
{
snprintf (errmsg, err_len, "Type mismatch in function result (%s/%s)",
gfc_typename (&r1->ts), gfc_typename (&r2->ts));
[-- Attachment #3: generic_34.f90 --]
[-- Type: text/x-fortran, Size: 532 bytes --]
! { dg-do compile }
!
! PR 86116: [6/7/8/9 Regression] Ambiguous generic interface not recognised
!
! Contributed by martin <mscfd@gmx.net>
module mod
type :: t
end type t
interface sub
module procedure s1
module procedure s2
end interface
contains
subroutine s1(x) ! { dg-error "Ambiguous interfaces in generic interface" }
type(t) :: x
end subroutine
subroutine s2(x) ! { dg-error "Ambiguous interfaces in generic interface" }
class(*), allocatable :: x
end subroutine
end
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] PR 86116: Ambiguous generic interface not recognised
2018-08-05 13:24 [Patch, Fortran] PR 86116: Ambiguous generic interface not recognised Janus Weil
@ 2018-08-14 8:12 ` Janus Weil
2018-08-14 14:16 ` Fritz Reese
0 siblings, 1 reply; 4+ messages in thread
From: Janus Weil @ 2018-08-14 8:12 UTC (permalink / raw)
To: gfortran, gcc-patches
ping!
Am So., 5. Aug. 2018 um 15:23 Uhr schrieb Janus Weil <janus@gcc.gnu.org>:
>
> Hi all,
>
> the attached patch fixes PR 86116 by splitting up the function
> 'compare_type' into two variants: One that is used for checking
> generic interfaces and operators (keeping the old name), and one that
> is used for checking dummy functions and procedure pointer assignments
> ('compare_type_characteristics'). The latter calls the former, but
> includes an additional check that must not be done when checking
> generics.
>
> Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
>
> Cheers,
> Janus
>
>
> 2018-08-05 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/86116
> * interface.c (compare_type): Remove a CLASS/TYPE check.
> (compare_type_characteristics): New function that behaves like the old
> 'compare_type'.
> (gfc_check_dummy_characteristics, gfc_check_result_characteristics):
> Call 'compare_type_characteristics' instead of 'compare_type'.
>
> 2018-08-05 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/86116
> * gfortran.dg/generic_34.f90: New test case.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] PR 86116: Ambiguous generic interface not recognised
2018-08-14 8:12 ` Janus Weil
@ 2018-08-14 14:16 ` Fritz Reese
2018-08-14 19:13 ` Janus Weil
0 siblings, 1 reply; 4+ messages in thread
From: Fritz Reese @ 2018-08-14 14:16 UTC (permalink / raw)
To: Janus Weil; +Cc: fortran, gcc-patches
Looks OK to me.
On Tue, Aug 14, 2018 at 4:12 AM Janus Weil <janus@gcc.gnu.org> wrote:
>
> ping!
>
>
> Am So., 5. Aug. 2018 um 15:23 Uhr schrieb Janus Weil <janus@gcc.gnu.org>:
> >
> > Hi all,
> >
> > the attached patch fixes PR 86116 by splitting up the function
> > 'compare_type' into two variants: One that is used for checking
> > generic interfaces and operators (keeping the old name), and one that
> > is used for checking dummy functions and procedure pointer assignments
> > ('compare_type_characteristics'). The latter calls the former, but
> > includes an additional check that must not be done when checking
> > generics.
> >
> > Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
> >
> > Cheers,
> > Janus
> >
> >
> > 2018-08-05 Janus Weil <janus@gcc.gnu.org>
> >
> > PR fortran/86116
> > * interface.c (compare_type): Remove a CLASS/TYPE check.
> > (compare_type_characteristics): New function that behaves like the old
> > 'compare_type'.
> > (gfc_check_dummy_characteristics, gfc_check_result_characteristics):
> > Call 'compare_type_characteristics' instead of 'compare_type'.
> >
> > 2018-08-05 Janus Weil <janus@gcc.gnu.org>
> >
> > PR fortran/86116
> > * gfortran.dg/generic_34.f90: New test case.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] PR 86116: Ambiguous generic interface not recognised
2018-08-14 14:16 ` Fritz Reese
@ 2018-08-14 19:13 ` Janus Weil
0 siblings, 0 replies; 4+ messages in thread
From: Janus Weil @ 2018-08-14 19:13 UTC (permalink / raw)
To: Fritz Reese; +Cc: gfortran, gcc-patches
Am Di., 14. Aug. 2018 um 16:16 Uhr schrieb Fritz Reese <fritzoreese@gmail.com>:
>
> Looks OK to me.
Thanks, Fritz. Committed as r263540.
Since this PR is a regression, it should probably be backported to the
release branches as well. However, I'll a wait a week or two with
that, in order to check for possible problems on trunk ...
Cheers,
Janus
> On Tue, Aug 14, 2018 at 4:12 AM Janus Weil <janus@gcc.gnu.org> wrote:
> >
> > ping!
> >
> >
> > Am So., 5. Aug. 2018 um 15:23 Uhr schrieb Janus Weil <janus@gcc.gnu.org>:
> > >
> > > Hi all,
> > >
> > > the attached patch fixes PR 86116 by splitting up the function
> > > 'compare_type' into two variants: One that is used for checking
> > > generic interfaces and operators (keeping the old name), and one that
> > > is used for checking dummy functions and procedure pointer assignments
> > > ('compare_type_characteristics'). The latter calls the former, but
> > > includes an additional check that must not be done when checking
> > > generics.
> > >
> > > Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
> > >
> > > Cheers,
> > > Janus
> > >
> > >
> > > 2018-08-05 Janus Weil <janus@gcc.gnu.org>
> > >
> > > PR fortran/86116
> > > * interface.c (compare_type): Remove a CLASS/TYPE check.
> > > (compare_type_characteristics): New function that behaves like the old
> > > 'compare_type'.
> > > (gfc_check_dummy_characteristics, gfc_check_result_characteristics):
> > > Call 'compare_type_characteristics' instead of 'compare_type'.
> > >
> > > 2018-08-05 Janus Weil <janus@gcc.gnu.org>
> > >
> > > PR fortran/86116
> > > * gfortran.dg/generic_34.f90: New test case.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-14 19:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-05 13:24 [Patch, Fortran] PR 86116: Ambiguous generic interface not recognised Janus Weil
2018-08-14 8:12 ` Janus Weil
2018-08-14 14:16 ` Fritz Reese
2018-08-14 19:13 ` Janus Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).