From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6907038930EC; Fri, 24 Apr 2020 07:27:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6907038930EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587713238; bh=PyqJkYbODeYHpCelSzhnQbM6VkyOLr5YlPdYNZlrtz0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tslI7HXr9V8LCJJjRVBfgW/FooEW/dhJUpZM+lLgD7kq5/7O4eyudLiH6EE0ckAck 3bb1BdBvQxrUQNkP6+WweMAGnb0h5Jw2Y0xeX6A28UqqH5BVSJUdsEB0IrUQkKwYWM RvQ7l4doer+8LFwDjKxAmz37wQoAouh+QdNEmQTY= 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 07:27: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 07:27:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D93956 --- Comment #10 from CVS Commits --- The releases/gcc-8 branch has been updated by Thomas K=C3=A0=C2=A4=C2=A5=C3= =A0=C2=A4nig : https://gcc.gnu.org/g:aadc54867cc200ad7d073222769b9de7f13b5bcd commit r8-10218-gaadc54867cc200ad7d073222769b9de7f13b5bcd Author: Thomas K=C3=B6nig Date: Fri Apr 24 09:26: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.=