From dc2627426e2148029476e688f67f5f6b1bba7bf7 Mon Sep 17 00:00:00 2001 From: tkoenig Date: Sun, 28 May 2017 14:02:57 +0000 Subject: [PATCH] 2017-05-28 Thomas Koenig * frontend-passes.c (matmul_lhs_realloc): Correct allocation size for case A1B2. 2017-05-28 Thomas Koenig * gfortran.dg/matmul_bounds_12.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248546 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/frontend-passes.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/matmul_bounds_12.f90 | 17 +++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/matmul_bounds_12.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2674815ed8d..c9c6a027d87 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2017-05-28 Thomas Koenig + + * frontend-passes.c (matmul_lhs_realloc): Correct + allocation size for case A1B2. + 2017-05-25 Thomas Koenig * dump-parse-tree.c (show_expr): Also replace diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 1ea5b5403ce..62cccc81b67 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -2447,7 +2447,7 @@ matmul_lhs_realloc (gfc_expr *c, gfc_expr *a, gfc_expr *b, break; case A1B2: - ar->start[0] = get_array_inq_function (GFC_ISYM_SIZE, b, 1); + ar->start[0] = get_array_inq_function (GFC_ISYM_SIZE, b, 2); cond = build_logical_expr (INTRINSIC_NE, get_array_inq_function (GFC_ISYM_SIZE, c, 1), get_array_inq_function (GFC_ISYM_SIZE, b, 2)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55aed107baa..bdad0677a3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-05-28 Thomas Koenig + + * gfortran.dg/matmul_bounds_12.f90: New test. + 2017-05-27 Jakub Jelinek PR bootstrap/80887 diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_12.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_12.f90 new file mode 100644 index 00000000000..01b3df92c3f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_12.f90 @@ -0,0 +1,17 @@ +! { dg-do run } +program main + real, dimension(3,2) :: a + real, dimension(3) :: bp + real, dimension(3) :: res1 + real, dimension(:), allocatable :: c3 + real, dimension(2) :: res2 + + data a /-2., 3., -5., 7., -11., 13./ + data bp /-23., -31., -41./ + data res2 /158., -353./ + + c3 = matmul(bp,a) + if (size(c3,1) /= 2) call abort + if (any(c3 /= res2)) call abort + +end program main -- 2.11.4.GIT