This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Toon Moene <toon at moene dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 18 Jan 2016 23:14:25 +0100
- Subject: Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094
- Authentication-results: sourceware.org; auth=none
- References: <569B8CAF dot 8020207 at netcologne dot de> <569D434C dot 7050404 at moene dot org>
Hi Toon,
It will also perform the following tests (minus the
"inline_matmul_13.f90" one, which wasn't included in the attachements :-)
Well, here it is.
Regards
Thomas
! { dg-do run }
! { dg-options "-ffrontend-optimize -fdump-tree-original -Wrealloc-lhs" }
! PR 66094: Check functionality for MATMUL(A, TRANSPSE(B))
module x
contains
subroutine mm1(a,b,c)
real, dimension(:,:), intent(in) :: a, b
real, dimension(:,:), intent(out) :: c
c = -42.
c = matmul(a, transpose(b))
end subroutine mm1
end module x
program main
use x
implicit none
integer, parameter :: n = 3, m=4, cnt=2
real, dimension(n,cnt) :: a
real, dimension(m,cnt) :: b
real, dimension(n,m) :: c, cres
real, dimension(:,:), allocatable :: calloc
data a / 2., -3., 5., -7., 11., -13./
data b /17., -23., 29., -31., 37., -39., 41., -47./
data cres / -225., 356., -396., 227., -360., 392., &
-229., 364., -388., 267., -424., 456./
c = matmul(a,transpose(b))
if (sum(c-cres)>1e-4) call abort
call mm1 (a, b, c)
if (sum(c-cres)>1e-4) call abort
! Unallocated
calloc = matmul(a,transpose(b)) ! { dg-warning "Code for reallocating the allocatable array" }
if (any(shape(c) /= shape(calloc))) call abort
if (sum(calloc-cres)>1e-4) call abort
deallocate(calloc)
! Allocated to wrong shape
allocate (calloc(10,10))
calloc = matmul(a,transpose(b)) ! { dg-warning "Code for reallocating the allocatable array" }
if (any(shape(c) /= shape(calloc))) call abort
if (sum(calloc-cres)>1e-4) call abort
deallocate(calloc)
end program main
! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }