summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_dotprod.f90
blob: 5444dd6dac13c84aa5cd80780796fe22188b81dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
! Program to test the DOT_PRODUCT intrinsic
program testforall
   implicit none
   integer, dimension (3) :: a
   integer, dimension (3) :: b
   real, dimension(3) :: c
   real r
   complex, dimension (2) :: z1
   complex, dimension (2) :: z2
   complex z

   a = (/1, 2, 3/);
   b = (/4, 5, 6/);
   c = (/4, 5, 6/);

   if (dot_product(a, b) .ne. 32) call abort

   r = dot_product(a, c)
   if (abs(r - 32.0) .gt. 0.001) call abort

   z1 = (/(1.0, 2.0), (2.0, 3.0)/)
   z2 = (/(3.0, 4.0), (4.0, 5.0)/)
   z = dot_product (z1, z2)
   if (abs (z - (34.0, -4.0)) .gt. 0.001) call abort
end program