2 ! { dg-options "-ffrontend-optimize -fdump-tree-original -Wrealloc-lhs" }
3 ! PR 66094: Check functionality for MATMUL(A, TRANSPSE(B))
7 real, dimension(:,:), intent(in
) :: a
, b
8 real, dimension(:,:), intent(out
) :: c
10 c
= matmul(a
, transpose(b
))
17 integer, parameter :: n
= 3, m
=4, cnt
=2
18 real, dimension(n
,cnt
) :: a
19 real, dimension(m
,cnt
) :: b
20 real, dimension(n
,m
) :: c
, cres
21 real, dimension(:,:), allocatable
:: calloc
23 data a
/ 2., -3., 5., -7., 11., -13./
24 data b
/17., -23., 29., -31., 37., -39., 41., -47./
25 data cres
/ -225., 356., -396., 227., -360., 392., &
26 -229., 364., -388., 267., -424., 456./
28 c
= matmul(a
,transpose(b
))
29 if (sum(c
-cres
)>1e-4) call abort
31 if (sum(c
-cres
)>1e-4) call abort
34 calloc
= matmul(a
,transpose(b
)) ! { dg-warning "Code for reallocating the allocatable array" }
35 if (any(shape(c
) /= shape(calloc
))) call abort
36 if (sum(calloc
-cres
)>1e-4) call abort
39 ! Allocated to wrong shape
40 allocate (calloc(10,10))
41 calloc
= matmul(a
,transpose(b
)) ! { dg-warning "Code for reallocating the allocatable array" }
42 if (any(shape(c
) /= shape(calloc
))) call abort
43 if (sum(calloc
-cres
)>1e-4) call abort
47 ! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }