annotate gcc/testsuite/gfortran.dg/inline_matmul_13.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900 (2020-02-13)
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! { dg-options "-ffrontend-optimize -fdump-tree-original -Wrealloc-lhs" }
kono
parents:
diff changeset
3 ! PR 66094: Check functionality for MATMUL(A, TRANSPSE(B))
kono
parents:
diff changeset
4 module x
kono
parents:
diff changeset
5 contains
kono
parents:
diff changeset
6 subroutine mm1(a,b,c)
kono
parents:
diff changeset
7 real, dimension(:,:), intent(in) :: a, b
kono
parents:
diff changeset
8 real, dimension(:,:), intent(out) :: c
kono
parents:
diff changeset
9 c = -42.
kono
parents:
diff changeset
10 c = matmul(a, transpose(b))
kono
parents:
diff changeset
11 end subroutine mm1
kono
parents:
diff changeset
12 end module x
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 program main
kono
parents:
diff changeset
15 use x
kono
parents:
diff changeset
16 implicit none
kono
parents:
diff changeset
17 integer, parameter :: n = 3, m=4, cnt=2
kono
parents:
diff changeset
18 real, dimension(n,cnt) :: a
kono
parents:
diff changeset
19 real, dimension(m,cnt) :: b
kono
parents:
diff changeset
20 real, dimension(n,m) :: c, cres
kono
parents:
diff changeset
21 real, dimension(:,:), allocatable :: calloc
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 data a / 2., -3., 5., -7., 11., -13./
kono
parents:
diff changeset
24 data b /17., -23., 29., -31., 37., -39., 41., -47./
kono
parents:
diff changeset
25 data cres / -225., 356., -396., 227., -360., 392., &
kono
parents:
diff changeset
26 -229., 364., -388., 267., -424., 456./
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 c = matmul(a,transpose(b))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 if (sum(c-cres)>1e-4) STOP 1
111
kono
parents:
diff changeset
30 call mm1 (a, b, c)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
31 if (sum(c-cres)>1e-4) STOP 2
111
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 ! Unallocated
kono
parents:
diff changeset
34 calloc = matmul(a,transpose(b)) ! { dg-warning "Code for reallocating the allocatable array" }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 if (any(shape(c) /= shape(calloc))) STOP 3
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
36 if (sum(calloc-cres)>1e-4) STOP 4
111
kono
parents:
diff changeset
37 deallocate(calloc)
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 ! Allocated to wrong shape
kono
parents:
diff changeset
40 allocate (calloc(10,10))
kono
parents:
diff changeset
41 calloc = matmul(a,transpose(b)) ! { dg-warning "Code for reallocating the allocatable array" }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
42 if (any(shape(c) /= shape(calloc))) STOP 5
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 if (sum(calloc-cres)>1e-4) STOP 6
111
kono
parents:
diff changeset
44 deallocate(calloc)
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 end program main
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
47 ! { dg-final { scan-tree-dump-times "_gfortran_matmul" 1 "original" } }