frontend-passes.c (matmul_lhs_realloc): Correct allocation size for case A1B2.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 May 2017 14:02:57 +0000 (14:02 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 May 2017 14:02:57 +0000 (14:02 +0000)
2017-05-28  Thomas Koenig  <tkoenig@gcc.gnu.org>

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

2017-05-28  Thomas Koenig  <tkoenig@gcc.gnu.org>

* gfortran.dg/matmul_bounds_12.f90:  New test.

From-SVN: r248546

gcc/fortran/ChangeLog
gcc/fortran/frontend-passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/matmul_bounds_12.f90 [new file with mode: 0644]

index 2674815ed8d6e4eea8ce3aa7a5466a486ca60ca5..c9c6a027d87ecf5a8ffe20b00feb21ad6022ae0a 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-28  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       * frontend-passes.c (matmul_lhs_realloc):  Correct
+       allocation size for case A1B2.
+
 2017-05-25  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * dump-parse-tree.c (show_expr):  Also replace
index 1ea5b5403ce0523b56a85e1dd54a11d826f42efb..62cccc81b67120d747fc1f2b613341ac2c264b36 100644 (file)
@@ -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));
index 55aed107baa92cc6ea8a30e5f97979cc2a555da7..bdad0677a3ea7882b47721391ec723aa4a9b3757 100644 (file)
@@ -1,3 +1,7 @@
+2017-05-28  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       * gfortran.dg/matmul_bounds_12.f90:  New test.
+
 2017-05-27  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..01b3df9
--- /dev/null
@@ -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