RISC-V: Refactor Dynamic LMUL codes
[official-gcc.git] / gcc / testsuite / gfortran.dg / minval_char_2.f90
blobb61fb6c433259942863414d9f636ed35c73d2beb
1 ! { dg-do run }
2 program main
3 implicit none
4 integer, parameter :: n=5, m=3
5 character(kind=4,len=5), dimension(n) :: a
6 character(kind=4,len=5), dimension(n,m) :: b
7 character(kind=4,len=5) :: res
8 integer, dimension(n,m) :: v
9 real, dimension(n,m) :: r
10 integer :: i,j
11 logical, dimension(n,m) :: mask
12 character(kind=4,len=5), dimension(:,:), allocatable :: empty
13 integer(kind=4), dimension(5) :: kmin = [-1, -1, -1, -1, -1]
14 character(kind=4,len=5) :: all_full
15 logical :: smask
17 all_full = transfer(kmin,all_full)
18 write (unit=a,fmt='(I5.5)') (21-i*i+6*i,i=1,n)
19 res = minval(a)
20 if (res /= 4_'00026') STOP 1
22 call random_number(r)
23 v = int(r * 100)
24 if (count(v<30) > 1) exit
25 end do
26 write (unit=b,fmt='(I5.5)') v
27 write (unit=res,fmt='(I5.5)') minval(v)
28 if (res /= minval(b)) STOP 2
29 smask = .true.
30 if (res /= minval(b, smask)) STOP 3
31 smask = .false.
32 if (all_full /= minval(b, smask)) STOP 4
34 mask = v < 30
35 write (unit=res,fmt='(I5.5)') minval(v,mask)
36 if (res /= minval(b, mask)) STOP 5
37 mask = .false.
38 if (minval(b, mask) /= all_full) STOP 6
39 allocate (empty(0:3,0))
40 res = minval(empty)
41 if (res /= all_full) STOP 7
42 end program main