hppa64: Fix fmt_f_default_field_width_3.f90 and fmt_g_default_field_width_3.f90
[official-gcc.git] / gcc / testsuite / gfortran.dg / maxval_char_4.f90
blob6d2fb01ebad0ddb1a70f065d1a4945a944b49b99
1 ! { dg-do run }
2 program main
3 implicit none
4 integer, parameter :: n=5
5 character(kind=4,len=6), dimension(n,n) :: a
6 integer, dimension(n,n) :: v
7 character(kind=4,len=6), dimension(n) :: r1, r2
8 character(kind=4,len=6), dimension(:,:), allocatable :: a_alloc
9 integer, dimension(:,:), allocatable :: v_alloc
10 character(kind=4,len=6), parameter :: zero = achar(0,4) // achar(0,4) // achar(0,4) // achar(0,4) // achar(0,4) // achar(0,4)
11 integer :: i
12 character(kind=4,len=6),dimension(1) :: ret
13 logical, dimension(n,n) :: mask
14 logical :: smask
16 v = reshape([(i*i+200-17*i,i=1,n*n)],shape(v))
17 write (unit=a,fmt='(I6.6)') (i*i+200-17*i,i=1,n*n)
19 r1 = maxval(a,dim=1)
20 write (unit=r2,fmt='(I6.6)') maxval(v,dim=1)
21 if (any (r1 /= r2)) STOP 1
22 r1 = 4_'x'
23 write (unit=r1,fmt='(I6.6)') maxval(v,dim=1)
24 if (any (r1 /= r2)) STOP 2
26 r1 = 4_'y'
27 r1 = maxval(a,dim=2)
28 write (unit=r2,fmt='(I6.6)') maxval(v,dim=2)
29 if (any (r1 /= r2)) STOP 3
30 r1 = 4_'z'
31 write (unit=r1,fmt='(I6.6)') maxval(v,dim=2)
32 if (any (r1 /= r2)) STOP 4
34 allocate (a_alloc(0,1), v_alloc(0,1))
35 ret = 4_'what'
36 ret = maxval(a_alloc,dim=1)
37 if (ret(1) /= zero) STOP 5
39 r1 = 4_'qq'
40 r1 = maxval(a, dim=1, mask=a>4_"000200");
41 if (any(r1 /= zero .neqv. maxval(v,dim=1, mask=v>200) > 0)) STOP 6
42 if (any(maxval(a, dim=1, mask=a>4_"000200") /= zero .neqv. maxval(v,dim=1, mask=v>200) > 0)) STOP 7
44 r1 = 4_'rr'
45 r1 = maxval(a, dim=2, mask=a>4_"000200");
46 if (any(r1 /= zero .neqv. maxval(v,dim=2, mask=v>200) > 0)) STOP 8
47 if (any(maxval(a, dim=2, mask=a>4_"000200") /= zero .neqv. maxval(v,dim=2, mask=v>200) > 0)) STOP 9
49 mask = .true.
50 forall (i=1:n)
51 mask(i,i) = .false.
52 end forall
54 r1 = 4_'aa'
55 r1 = maxval(a, dim=1, mask=mask)
56 write(unit=r2,fmt='(I6.6)') maxval(v,dim=1, mask=mask)
57 if (any(r1 /= r2)) STOP 10
59 r1 = 4_'xyz'
60 smask = .true.
61 r1 = maxval(a, dim=1, mask=smask)
62 write (unit=r2,fmt='(I6.6)') maxval(v,dim=1)
63 if (any (r1 /= r2)) STOP 11
65 smask = .false.
66 r1 = 4_'foobar'
67 r1 = maxval(a, dim=1, mask=smask)
68 if (any(r1 /= zero)) STOP 12
69 end program main