PR fortran/85938 is another example of a failure caused by not setting the rank correctly. The issues with setting rank were fixed in r261081. I've converted the testcase in PR fortran/85938 to be suitable for the testsuite and committed it.
2018-06-02 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/85938 * gfortran.dg/pr85938.f90: Fixed by revision r261081 -- Steve
Index: gcc/testsuite/gfortran.dg/pr85938.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr85938.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr85938.f90 (working copy) @@ -0,0 +1,9 @@ +! { dg-do run } +! PR fortran/85938 +program foo + real a(9), b(3) + integer :: n = 3 + a = 1.0 + b = 1.0 + if (any(matmul(reshape(A, (/ n, n /)), b) /= 3.)) stop 1 +end program