From: Thomas Koenig <tkoenig@netcologne.de>
To: Toon Moene <toon@moene.org>,
"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094
Date: Mon, 18 Jan 2016 22:14:00 -0000 [thread overview]
Message-ID: <569D63C1.6060009@netcologne.de> (raw)
In-Reply-To: <569D434C.7050404@moene.org>
[-- Attachment #1: Type: text/plain, Size: 178 bytes --]
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
[-- Attachment #2: inline_matmul_13.f90 --]
[-- Type: text/x-fortran, Size: 1474 bytes --]
! { 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" } }
next prev parent reply other threads:[~2016-01-18 22:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-17 12:44 Thomas Koenig
2016-01-18 19:56 ` Toon Moene
2016-01-18 22:14 ` Thomas Koenig [this message]
2016-01-18 22:25 ` Toon Moene
2016-01-19 19:04 ` Toon Moene
2016-01-23 12:26 ` Thomas Koenig
2016-01-23 23:06 ` Jerry DeLisle
2016-01-24 14:44 ` Toon Moene
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=569D63C1.6060009@netcologne.de \
--to=tkoenig@netcologne.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=toon@moene.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).