From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DA7733861032; Thu, 24 Dec 2020 12:01:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA7733861032 From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98433] double free detected in tcache 2, after merge of structures Date: Thu, 24 Dec 2020 12:01:45 +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: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc cf_reconfirmed_on everconfirmed 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: Thu, 24 Dec 2020 12:01:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98433 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |anlauf at gcc dot gnu.org Last reconfirmed| |2020-12-24 Ever confirmed|0 |1 --- Comment #5 from anlauf at gcc dot gnu.org --- The user code is alright, it is the implementation of the intrinsic MERGE w= hich prevents doing the right thing when assigning to the l.h.s. Extending the subroutine of the test program to module bug_merge_m implicit none contains subroutine bug_merge type t real, allocatable :: v(:) end type t type(t) :: x1, x2, x3, x4, x5 logical :: f =3D .false. allocate(x1%v(1)) x1%v =3D 1. allocate(x2%v(1)) x2%v =3D 2. x3 =3D merge(x1, x2, .false.) print *, "x3%v =3D ", x3%v x4 =3D merge(x1, x2, f) print *, "x4%v =3D ", x4%v if (f) then; x5 =3D x1; else; x5 =3D x2; endif print *, "x5%v =3D ", x5%v end subroutine bug_merge end module bug_merge_m and looking a the generated dump-tree, one sees that the assignments to x3 = and x4 are generating wrong code, only the assignment to x5 is fine. @Steve: that's pretty basic F2003 stuff, almost TR15581...=