summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/anyallcount_1.f90
blob: 9e8c7768b5023b2d3c836c8fd06d38c05afe9d9a (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
! { dg-do run }
program main
   character(len=*), parameter :: f='(3L1)'
   character(len=*), parameter :: g='(3I1)'
   real, dimension(3,3) :: a
   logical(kind=1), dimension(3,3) :: m1
   logical(kind=2), dimension(3,3) :: m2
   logical(kind=4), dimension(3,3) :: m4
   logical(kind=8), dimension(3,3) :: m8
   character(len=3) :: res
   data a /-1.0, -2.0, -3.0, 2.0, 1.0, -2.1, 1.0, 2.0, 3.0 /

   m1 = a > 0
   m2 = a > 0
   m4 = a > 0
   m8 = a > 0

   write (unit=res,fmt=f) any(m1,dim=1)
   if (res /= 'FTT') call abort
   write (unit=res,fmt=f) any(m2,dim=1)
   if (res /= 'FTT') call abort
   write (unit=res,fmt=f) any(m4,dim=1)
   if (res /= 'FTT') call abort
   write (unit=res,fmt=f) any(m8,dim=1)
   if (res /= 'FTT') call abort
   write (unit=res,fmt=f) any(m1,dim=2)
   if (res /= 'TTT') call abort
   write (unit=res,fmt=f) any(m2,dim=2)
   if (res /= 'TTT') call abort
   write (unit=res,fmt=f) any(m4,dim=2)
   if (res /= 'TTT') call abort
   write (unit=res,fmt=f) any(m8,dim=2)
   if (res /= 'TTT') call abort

   write (unit=res,fmt=f) all(m1,dim=1)
   if (res /= 'FFT') call abort
   write (unit=res,fmt=f) all(m2,dim=1)
   if (res /= 'FFT') call abort
   write (unit=res,fmt=f) all(m4,dim=1)
   if (res /= 'FFT') call abort
   write (unit=res,fmt=f) all(m8,dim=1)
   if (res /= 'FFT') call abort

   write (unit=res,fmt=f) all(m1,dim=2)
   if (res /= 'FFF') call abort
   write (unit=res,fmt=f) all(m2,dim=2)
   if (res /= 'FFF') call abort
   write (unit=res,fmt=f) all(m4,dim=2)
   if (res /= 'FFF') call abort
   write (unit=res,fmt=f) all(m8,dim=2)
   if (res /= 'FFF') call abort

   write (unit=res,fmt=g) count(m1,dim=1)
   if (res /= '023') call abort
   write (unit=res,fmt=g) count(m2,dim=1)
   if (res /= '023') call abort
   write (unit=res,fmt=g) count(m4,dim=1)
   if (res /= '023') call abort
   write (unit=res,fmt=g) count(m8,dim=1)
   if (res /= '023') call abort

   write (unit=res,fmt=g) count(m1,dim=2)
   if (res /= '221') call abort
   write (unit=res,fmt=g) count(m2,dim=2)
   if (res /= '221') call abort
   write (unit=res,fmt=g) count(m4,dim=2)
   if (res /= '221') call abort
   write (unit=res,fmt=g) count(m8,dim=2)
   if (res /= '221') call abort

end program main