From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AC3E03849ADD; Mon, 13 May 2024 14:44:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC3E03849ADD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715611448; bh=m2xbE7IEloDXZBS0YVeALstuLr/8BR0yXMWDhVXqQTk=; h=From:To:Subject:Date:From; b=dLBrR+OUzaj39gR//MAVVK2Pq4bg+h8CfyfBtVQkQVBEd2mWWB6PTAKXqiKoW5HPk 0hT9PURRlHw7tocxvTDvWbajNSkzaAeDpPc6H174SnSHj9gvmMJ8iS500A6YRnmcVX +PV49hXpabIiC9ZNDEZSmrWZvG9SNmA6C6scF82A= From: "rnhmjoj at eurofusion dot eu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/115072] New: Memory link with unlimited polymorphic function result Date: Mon, 13 May 2024 14:44:07 +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: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rnhmjoj at eurofusion dot eu 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115072 Bug ID: 115072 Summary: Memory link with unlimited polymorphic function result Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: rnhmjoj at eurofusion dot eu Target Milestone: --- The following program works as expected, but the result of the id(x) functi= on does not appear to be ever deallocated creating a memory leak: program test print *, transfer(id(7), 1) contains pure function id(x) result(y) class(*), intent(in) :: x class(*), allocatable :: y y =3D x end function end program test Specifically, running the program in valgrind memcheck with --leak-check=3D= full reveals this: 4 bytes in 1 blocks are definitely lost in loss record 1 of 1 at 0x484276B: malloc (in vgpreload_memcheck-amd64-linux.so) by 0x401338: id.1 (test.f90:10) by 0x401243: MAIN__ (test.f90:3) by 0x401432: main (test.f90:3) Replacing the `class(*)` with some other type does not produce a leak.=