PR rtl-optimization/82913
[official-gcc.git] / gcc / testsuite / gfortran.fortran-torture / execute / intrinsic_product.f90
blob6ada0a4219181d9c1c78af5a432d4ef95e772352
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
9 a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/));
11 b = product (a, 1)
13 tr = .true.
15 if (any(b .ne. (/6, 120, 504/))) call abort
17 write (line, 9000) product(a,1)
18 if (line .ne. ' 6 120 504') call abort
20 if (product (a) .ne. 362880) call abort
22 write (line, 9010) product(a)
23 if (line .ne. '362880') call abort
25 m = .true.
26 m(1, 1) = .false.
27 m(2, 1) = .false.
29 b = product (a, 2, m)
30 if (any(b .ne. (/28, 40, 162/))) call abort
32 b = product (a, 2, m .and. tr)
33 if (any(b .ne. (/28, 40, 162/))) call abort
35 write (line, 9000) product(a, 2, m)
36 if (line .ne. ' 28 40 162') call abort
38 if (product (a, mask=m) .ne. 181440) call abort
40 if (product (a, mask=m .and. tr) .ne. 181440) call abort
42 write (line, 9010) product(a, mask=m)
43 if (line .ne. '181440') call abort
45 9000 format (3I4)
46 9010 format (I6)
47 end program