+2017-05-01 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/37131
+ * frontend-passes.c (inline_matmul_assign): Also check bounds
+ for allocatable lhs and matrix-vector-multiplication.
+
2017-04-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/80484
gfc_code *lhs_alloc;
/* Only need to check a single dimension for the A2B2 case for
- bounds checking, the rest will be allocated. */
+ bounds checking, the rest will be allocated. Also check this
+ for A2B1. */
- if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS && m_case == A2B2)
+ if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) && (m_case == A2B2 || m_case == A2B1))
{
gfc_code *test;
gfc_expr *a2, *b1;
+2017-05-01 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/37131
+ * gfortran.dg/matmul_bounds_11.f90: New test.
+
2017-05-01 Martin Sebor <msebor@redhat.com>
PR tree-optimization/79715
--- /dev/null
+! { dg-do run }
+! { dg-options "-O -finline-matmul-limit=30 -fcheck=all" }
+! { dg-shouldfail "Dimension of array B incorrect in MATMUL intrinsic" }
+program main
+ real, dimension(:,:), allocatable :: a
+ real, dimension(:), allocatable :: b
+ real, dimension(:), allocatable :: res
+ allocate (a(2,2), b(3))
+ call random_number(a)
+ call random_number(b)
+ res = matmul(a,b)
+ print *,res
+end program main
+! { dg-output "Fortran runtime error: Dimension of array B incorrect in MATMUL intrinsic.*" }
+