From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9638F395A014; Thu, 23 Apr 2020 18:31:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9638F395A014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587666662; bh=3IxY6yo+4Fum0LtSernCyW+SrMKbeoXtYq1AlpNDIV8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pfGCi2FX8HFzskAyiKhTwfzit+LEZZEUIw78LF13moFUuwAJzUlrXdySt8pJ/5Fg7 Bnhre+rtuZyJWyw8YxbpwnHssGctbFUpBpI0E4G0YCXP9jOAlYyM3siCrs0Dwh7y7j nowTb1lZw3V9bH5G8taac+muz5i8rxmfWpqkn9Y0= 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: Thu, 23 Apr 2020 18:31:02 +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: Thu, 23 Apr 2020 18:31:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D93956 --- Comment #8 from CVS Commits --- The master branch has been updated by Thomas K=C3=A0=C2=A4=C2=A5=C3=A0=C2= =A4nig : https://gcc.gnu.org/g:06eca1acafa27e19e82dc73927394a7a4d0bdbc5 commit r10-7920-g06eca1acafa27e19e82dc73927394a7a4d0bdbc5 Author: Thomas K=C3=B6nig Date: Thu Apr 23 20:30:01 2020 +0200 Fix PR 93956, wrong pointer when returned via function. 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-23 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-23 Thomas Koenig PR fortran/93956 * gfortran.dg/pointer_assign_13.f90: New test.=