Debian Codegraph @

gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_product.f90

raw
1 ! Program to test the PRODUCT intrinsic
2 program testproduct
3 implicit none
4 integer, dimension (3, 3) :: a
5 integer, dimension (3) :: b
6 logical, dimension (3, 3) :: m, tr
7 character(len=12) line
8
9 a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/));
10
11 b = product (a, 1)
12
13 tr = .true.
14
15 if (any(b .ne. (/6, 120, 504/))) STOP 1
16
17 write (line, 9000) product(a,1)
18 if (line .ne. ' 6 120 504') STOP 2
19
20 if (product (a) .ne. 362880) STOP 3
21
22 write (line, 9010) product(a)
23 if (line .ne. '362880') STOP 4
24
25 m = .true.
26 m(1, 1) = .false.
27 m(2, 1) = .false.
28
29 b = product (a, 2, m)
30 if (any(b .ne. (/28, 40, 162/))) STOP 5
31
32 b = product (a, 2, m .and. tr)
33 if (any(b .ne. (/28, 40, 162/))) STOP 6
34
35 write (line, 9000) product(a, 2, m)
36 if (line .ne. ' 28 40 162') STOP 7
37
38 if (product (a, mask=m) .ne. 181440) STOP 8
39
40 if (product (a, mask=m .and. tr) .ne. 181440) STOP 9
41
42 write (line, 9010) product(a, mask=m)
43 if (line .ne. '181440') STOP 10
44
45 9000 format (3I4)
46 9010 format (I6)
47 end program