From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EC84C383A621; Tue, 28 Nov 2023 15:28:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC84C383A621 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701185281; bh=D6E4c7rNzqfA41gerWMcsYyQ2XaKTo12ZOvTe9+1qEs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hwjAtLcPcDoGS7qvvc2hgL7+LYSEaAe1euucgFuSuQ7S1GWyi+FonsHZkwYFkYWOT ommb/WT5xcHAihu+99zSiFvw1f1TRPn/Nw0WbQJhKM65GlaTXdyEIb2eXZ3waE4dUd rxIlZcbytmWSkg77Do3QAZRTbmPJVz8jJ/UBlDiU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110415] (Re)allocation on assignment to allocatable polymorphic variable from allocatable polymorphic function result Date: Tue, 28 Nov 2023 15:28:00 +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: 13.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110415 --- Comment #4 from GCC Commits --- The master branch has been updated by Andrew Jenner : https://gcc.gnu.org/g:b247e917ff13328298c1eecf8563b12edd7ade04 commit r14-5931-gb247e917ff13328298c1eecf8563b12edd7ade04 Author: Andrew Jenner Date: Tue Nov 28 15:27:05 2023 +0000 Fortran: fix reallocation on assignment of polymorphic variables [PR110= 415] This patch fixes two bugs related to polymorphic class assignment in the Fortran front-end. One (described in PR110415) is an issue with the mal= loc and realloc calls using the size from the old vptr rather than the new = one. The other is caused by the return value from the realloc call being ignored. Testcases are added for these issues. 2023-11-28 Andrew Jenner gcc/fortran/ PR fortran/110415 * trans-expr.cc (trans_class_vptr_len_assignment): Add from_vptrp parameter. Populate it. Don't check for DECL_P when deciding whether to create temporary. (trans_class_pointer_fcn, gfc_trans_pointer_assignment): Add NULL argument to trans_class_vptr_len_assignment calls. (trans_class_assignment): Get rhs_vptr from trans_class_vptr_len_assignment and use it for determining size for allocation/reallocation. Use return value from realloc. gcc/testsuite/ PR fortran/110415 * gfortran.dg/pr110415.f90: New test. * gfortran.dg/asan/pr110415-2.f90: New test. * gfortran.dg/asan/pr110415-3.f90: New test. Co-Authored-By: Tobias Burnus =