From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66868386F411; Sun, 3 Jan 2021 12:22:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66868386F411 From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98498] Interp request: defined operators and unlimited polymorphic Date: Sun, 03 Jan 2021 12:22:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2021 12:22:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98498 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gn= u.org --- Comment #1 from Paul Thomas --- Created attachment 49869 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D49869&action=3Dedit Fix pending the iterpretation request ! { dg-do compile } ! { dg-options "-fdump-tree-original" } ! ! gfortran.dg/interface_49.f90 ! Tests the fix for PR98498 in which the '=3D=3D' operator interface was not ! applied to intrinsic type/kind expressions. This meant that the ! interface was not applied to the .eq. expressions in 'star_eq' even ! though the unlimited polymorphic dummies are type compatible with all ! entities. The tree dump used to contain 10 'star_eq's. ! ! Note that overridding intrinsic operators with functions that have ! compliant intrinsic dummies still yields the error "Operator interface ! at (1) conflicts with intrinsic interface", as required by ! F2003(12.3.2.1.1). ! ! Contributed by Paul Thomas ! MODULE mytypes IMPLICIT none TYPE pvar character(len=3D20) :: name integer :: level end TYPE pvar interface operator (=3D=3D) module procedure star_eq end interface contains RECURSIVE function star_eq(a,b) ! The recursive attribute should not be required. implicit none class(*), intent(in) ::a,b logical ::star_eq if (.not. same_type_as (a, b)) then star_eq =3D .false. return end if select type (a) type is (pvar) select type (b) type is (pvar) print *, "a & b are type pvar" if((a%level.eq. b%level) .and. (a%name .eq. b%name)) then star_eq =3D .true. else star_eq =3D .false. end if end select class default print *, "class default: returning false" star_eq =3D .false. end select end function star_eq end MODULE mytypes program test_eq use mytypes implicit none type(pvar) x, y x =3D pvar('test 1', 100) y =3D pvar('test 1', 100) write(*, *) x =3D=3D y x =3D pvar('test 1', 100) y =3D pvar('test 2', 100) write(*, *) x =3D=3D y end program test_eq ! { dg-final { scan-tree-dump-times "star_eq" 12 "original" } }=