From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9EB6838930DD; Fri, 24 Apr 2020 06:23:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EB6838930DD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587709398; bh=7HxW0Qu9dDRpIuguLD2Ay03FQTt3xvSRJyYOGMcVzb4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XcSNkIL9GQQE1LNkr0WN4F6dFtju0SIElHLr73O8BU7ZIDGJqjbzOeXijf2+/9Z0O Nz2d0NxVEloEiXWjy8re+g1Yaa22zmpg8vc4HYsLF69Ve/3kljJFK4o9zII+A2C/dC ikl3CEz36TfGAc7JyRLSKxEvtZLpphwnkiCKoel8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/93956] Wrong array creation with p => array_dt(1:n)%component Date: Fri, 24 Apr 2020 06:23:18 +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.1.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: tkoenig 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 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, 24 Apr 2020 06:23:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D93956 --- Comment #9 from CVS Commits --- The releases/gcc-9 branch has been updated by Thomas K=C3=A0=C2=A4=C2=A5=C3= =A0=C2=A4nig : https://gcc.gnu.org/g:2a732dbdfcc0a3bc2b4bdb5387fffa193fea6df6 commit r9-8541-g2a732dbdfcc0a3bc2b4bdb5387fffa193fea6df6 Author: Thomas K=C3=B6nig Date: Fri Apr 24 08:22:48 2020 +0200 Fix PR 93956, wrong pointer when returned via function. Backport from trunk. This one took a bit of detective work. When array pointers point to components of derived types, we currently set the span field and then create an array temporary when we pass the array pointer to a procedure as a non-pointer or non-target argument. (This is inefficient, but that's for another release). Now, the compiler detected this case when there was a direct assignment like p =3D> a%b, but not when p was returned either as a function result or via an argument. This patch fixes that. 2020-04-24 Thomas Koenig PR fortran/93956 * expr.c (gfc_check_pointer_assign): Also set subref_array_poin= ter when a function returns a pointer. * interface.c (gfc_set_subref_array_pointer_arg): New function. (gfc_procedure_use): Call it. 2020-04-24 Thomas Koenig PR fortran/93956 * gfortran.dg/pointer_assign_13.f90: New test.=