From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 10DE83858D37; Tue, 5 Apr 2022 19:58:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10DE83858D37 From: "baradi09 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/105170] New: Invalid finalization in intrinsic assignment Date: Tue, 05 Apr 2022 19:58:35 +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.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: baradi09 at gmail dot 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 attachments.created 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: Tue, 05 Apr 2022 19:58:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105170 Bug ID: 105170 Summary: Invalid finalization in intrinsic assignment Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: baradi09 at gmail dot com Target Milestone: --- Created attachment 52754 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52754&action=3Dedit Minimal working example demonstrating the bug I have a derived type (TWrapper), which has a component with defined assignment. The containing derived type itself has no defined assignment. U= pon an assignment between two TWrapper instances, a copy of the RHS seems to get finalized. The attached MWE demonstrates the problem. Expected output (as delivered by current Intel and NAG compilers): RefCounter_final, id:0 TRefCounter_init: id:42 -> Assignment wrapper2 =3D wrapper TRefCounter_final, id:0 TRefCounter_final, id:0 TRefCounter_assign: this%id, other%id: 0 42 GFortran output: TRefCounter_final, id:0 TRefCounter_init: id:42 -> Assignment wrapper2 =3D wrapper TRefCounter_final, id:42 TRefCounter_assign: this%id, other%id: 0 42 One finalization seems to be missing. Additionally, the finalized instance seems to be a copy of the RHS. (A copy, because after the finalization, the= RHS still seems to have kept its id-value...)=