Created attachment 43359 [details] simple test case Optimization bug at -O2, -O3 with message vr = matmul( orth(:,:,n), v ) 1 Error: The upper bound in the last dimension must appear in the reference to the assumed size array ‘orth’ at (1) lhcal.f90:33:25: Attached test case is taken from larger program, and only appears to be a problem if orth is an assumed size arrays with the * in the last dimension. (If assumed shape, also fine.) Obviously easy to work around, so minor.
The bug disappears with -fno-frontend-optimize.
Looks like a matmul inlining bug, I'll take a look.
Author: tkoenig Date: Sat Feb 17 15:53:07 2018 New Revision: 257783 URL: https://gcc.gnu.org/viewcvs?rev=257783&root=gcc&view=rev Log: 2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84270 * frontend-passes (scalarized_expr): If the expression is an assumed size array, leave in the last reference and pass AR_SECTION instead of AR_FULL to gfc_resolve in order to avoid an error. 2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84270 * gfortran.dg/inline_matmul_22.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/inline_matmul_22.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/frontend-passes.c trunk/gcc/testsuite/ChangeLog
Author: tkoenig Date: Sat Feb 17 16:01:50 2018 New Revision: 257784 URL: https://gcc.gnu.org/viewcvs?rev=257784&root=gcc&view=rev Log: 2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/84270 * frontend-passes (scalarized_expr): If the expression is an assumed size array, leave in the last reference and pass AR_SECTION instead of AR_FULL to gfc_resolve in order to avoid an error. 2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/84270 * gfortran.dg/inline_matmul_22.f90: New test. Added: branches/gcc-7-branch/gcc/testsuite/gfortran.dg/inline_matmul_22.f90 Modified: branches/gcc-7-branch/gcc/fortran/ChangeLog branches/gcc-7-branch/gcc/fortran/frontend-passes.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Fixed on all affected branches, closing.