From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 593033858D28; Fri, 4 Feb 2022 12:49:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 593033858D28 From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104382] New: Finalization of parent components not compliant with standard Date: Fri, 04 Feb 2022 12:49:30 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org 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: Fri, 04 Feb 2022 12:49:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104382 Bug ID: 104382 Summary: Finalization of parent components not compliant with standard Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: pault at gcc dot gnu.org Target Milestone: --- Created attachment 52349 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52349&action=3Dedit Testcase for the problems With all branches that feature finalization, the attached testcase outputs: final_count after assignment =3D 0 destructor4(complicated) 4.00000000 5.00000000=20=20=20=20 destructor5 (simple2) -1 destructor5 (simple2) -2 destructor2(simple) 3 4 final_count after deallocation =3D 4 Ifort, on the other hand, outputs: destructor4(complicated) 2.000000 2.000000=20=20=20=20 destructor5 (simple2) 5 destructor5 (simple2) 6 destructor1(simple) 1 destructor1(simple) 1 final_count after assignment =3D 5 destructor4(complicated) 4.000000 5.000000=20=20=20=20 destructor5 (simple2) -1 destructor5 (simple2) -2 destructor1(simple) 3 destructor1(simple) 4 final_count after deallocation =3D 10 There are two problems: (i) The finalization of 'var' prior to reallocation is not ocurring. This is fixed by the patch that I posted to the list yesterday. (ii) The parent component is not being treated as a component, as mandated = by F2018 7.5.6.2/1(3). Ifort is behaving correctly. Paul=