The patch and testcase are sufficient to describe the problem.

2018-01-19  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/83900
        * simplify.c (gfc_simplify_matmul): Delete bogus assertion.

2018-01-19  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/83900
        * gfortran.dg/matmul_17.f90: New test.

Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c      (revision 256905)
+++ gcc/fortran/simplify.c      (working copy)
@@ -4590,7 +4590,6 @@ gfc_simplify_matmul (gfc_expr *matrix_a, gfc_expr *mat
       || !is_constant_array_expr (matrix_b))
     return NULL;
 
-  gcc_assert (gfc_compare_types (&matrix_a->ts, &matrix_b->ts));
   result = gfc_get_array_expr (matrix_a->ts.type,
                               matrix_a->ts.kind,
                               &matrix_a->where);
Index: gcc/testsuite/gfortran.dg/matmul_17.f90
===================================================================
--- gcc/testsuite/gfortran.dg/matmul_17.f90     (nonexistent)
+++ gcc/testsuite/gfortran.dg/matmul_17.f90     (working copy)
@@ -0,0 +1,9 @@
+! { dg-do run }
+! PR Fortran/83900
+! Contributed by Gerhard Steinmetz  <gscfq t t-online dot de>
+program p
+   integer, parameter :: a(3,2) = 1
+   real, parameter :: b(2,3) = 2
+   real, parameter :: c(3,3) = matmul(a, b)
+   if (any(c /= 4.)) call abort
+end

-- 
Steve

Reply via email to