diff mbox series

[Committed] PR fortran/83900 -- Remove bogus assert

Message ID 20180120061716.GA22278@troutmask.apl.washington.edu
State New
Headers show
Series [Committed] PR fortran/83900 -- Remove bogus assert | expand

Commit Message

Steve Kargl Jan. 20, 2018, 6:17 a.m. UTC
The patch and testcase are sufficient to describe the problem.

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

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

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

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

Patch

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