re PR fortran/80904 (Matmul result allocated to wrong size)

2017-06-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/80904
	* frontend-passes.c (matmul_lhs_realloc):  Correct
	allocation size for case A1B2.

2017-06-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/80904
	* gfortran.dg/matmul_bounds_12.f90:  New test.

From-SVN: r248842
This commit is contained in:
Thomas Koenig 2017-06-02 17:44:19 +00:00
parent f278c49389
commit bc21704623
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-06-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80904
* frontend-passes.c (matmul_lhs_realloc): Correct
allocation size for case A1B2.
2017-06-02 Jakub Jelinek <jakub@redhat.com>
PR fortran/80918

View File

@ -2362,7 +2362,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));

View File

@ -1,3 +1,8 @@
2017-06-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80904
* gfortran.dg/matmul_bounds_12.f90: New test.
2017-06-02 Prakhar Bahuguna <prakhar.bahuguna@arm.com>
Backport from mainline

View File

@ -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