From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AE59D3858D33; Mon, 25 Apr 2022 00:57:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE59D3858D33 From: "xudong.luo@compiler-dev.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/105372] New: The result of the merge function is different when it's type of parameters is the extensions type of derived type Date: Mon, 25 Apr 2022 00:57:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xudong.luo@compiler-dev.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Mon, 25 Apr 2022 00:57:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105372 Bug ID: 105372 Summary: The result of the merge function is different when it's type of parameters is the extensions type of derived type Product: gcc Version: 11.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: xudong.luo@compiler-dev.com Target Milestone: --- Whether the mask is a constant or a variable causes inconsistent results of= the merge function when it's type of parameters is the extensions type of deri= ved type. 1.The mask is constant Program test00 Type t Integer :: c End Type Type,Extends(t) :: t2 Integer :: c2 End Type Class(t),Allocatable :: x,y,r logical :: ok =3D .true. x =3D t2(1,-1) y =3D t2(2,-2) r =3D merge (x,y,.true.) Select Type (z=3D>r) Type Is (t) print *,z%c Type Is (t2) print *,z%c,z%c2 End Select End Program 2. The mask is variable Program test01 Type t Integer :: c End Type Type,Extends(t) :: t2 Integer :: c2 End Type Class(t),Allocatable :: x,y,r logical :: ok =3D .true. integer :: i =3D 1 x =3D t2(1,-1) y =3D t2(2,-2) r =3D merge (x,y,i =3D=3D 1) Select Type (z=3D>r) Type Is (t) print *,z%c Type Is (t2) print *,z%c,z%c2 End Select End Program=