https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94841
Bug ID: 94841 Summary: [10 Regression]527.cam4_r 7.68% regression on Intel Cascadelaker with -O2, 9.57% regression with -Ofast -march=native -funroll-loops -flto Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com CC: hjl.tools at gmail dot com, tkoenig at gcc dot gnu.org, wwwhhhyyy333 at gmail dot com Target Milestone: --- Target: i386, x86-64 Starting with ---- commit 06eca1acafa27e19e82dc73927394a7a4d0bdbc5 Author: Thomas König <tkoe...@gcc.gnu.org> 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 => 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 <tkoe...@gcc.gnu.org> PR fortran/93956 * expr.c (gfc_check_pointer_assign): Also set subref_array_pointer 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 <tkoe...@gcc.gnu.org> PR fortran/93956 * gfortran.dg/pointer_assign_13.f90: New test. ------