From 099ec19a2a8b6707a663fe0daea507f4b8657b78 Mon Sep 17 00:00:00 2001 From: tkoenig Date: Sun, 7 Aug 2016 13:24:32 +0000 Subject: [PATCH] 2016-08-07 Thomas Koenig PR fortran/71961 * gfortran.dg/matmul_10.f90: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239220 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/matmul_10.f90 | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/matmul_10.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fece69cab09..bc95f00edaa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-07 Thomas Koenig + + PR fortran/71961 + * gfortran.dg/matmul_10.f90: New testcase. + 2016-08-07 Jan Hubicka * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Update testcase. diff --git a/gcc/testsuite/gfortran.dg/matmul_10.f90 b/gcc/testsuite/gfortran.dg/matmul_10.f90 new file mode 100644 index 00000000000..55f1c9cf336 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_10.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! { dg-options "-Warray-temporaries" } +! PR 71961 - no array temporary was created. +! Original test case by Joost VandeVondele +program main + implicit none + integer :: i + integer, dimension(:,:), pointer :: a + integer, dimension(:,:), allocatable :: b + ALLOCATE(a(4,4),b(4,2)) + a=1 ; b=2 + a(:,1:2)=matmul(a(:,1:4),b(:,:)) ! { dg-warning "Creating array temporary" } + if (any(a /= reshape((/8,8,8,8,8,8,8,8,1,1,1,1,1,1,1,1/),(/4,4/)))) & + call abort + a = reshape([((-1**i)*i,i=1,16)],[4,4]) + b = reshape([((-1**(i-1))*i**2,i=1,8)],[4,2]) + b(1:2,1:2) = matmul(a(1:2,:),b) ! { dg-warning "Creating array temporary" } + if (any(b /= reshape([310, 340, -9, -16, 1478, 1652, -49, -64],[4,2]))) & + call abort + deallocate(a) + deallocate(b) +end program main -- 2.11.4.GIT