From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D9AE03898C6A; Sat, 2 Apr 2022 00:47:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9AE03898C6A From: "damian at archaeologic dot codes" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/65347] [F03] Final subroutine not called for function result Date: Sat, 02 Apr 2022 00:47:50 +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: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: damian at archaeologic dot codes X-Bugzilla-Status: NEW 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: cc 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: Sat, 02 Apr 2022 00:47:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D65347 Damian Rouson changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |damian at archaeologic dot= codes --- Comment #3 from Damian Rouson --- I suspect the code below is a simpler reproducer (25 lines) of this bug % cat missing-finalization.f90=20 module object_m implicit none type object_t contains final :: count_finalizations end type contains subroutine count_finalizations(self) type(object_t) self print *,"finalization" end subroutine function new_object()=20 type(object_t) new_object end function end module use object_m implicit none type(object_t) object object =3D new_object() end % gfortran missing-finalization.f90=20 % ./a.out % gfortran --version GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0=