1! { dg-do run }
2program main
3  implicit none
4  integer, parameter :: n=5, m=3
5  character(len=5), dimension(n) :: a
6  character(len=5), dimension(n,m) :: b
7  character(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(len=5), dimension(:,:), allocatable :: empty
13  character(len=5) , parameter :: all_full = achar(255) // achar(255) // achar(255) // achar(255) // achar(255)
14  logical :: smask
15
16  write (unit=a,fmt='(I5.5)') (21-i*i+6*i,i=1,n)
17  res = minval(a)
18  if (res /= '00026') STOP 1
19  do
20     call random_number(r)
21     v = int(r * 100)
22     if (count(v < 30) > 1) exit
23  end do
24  write (unit=b,fmt='(I5.5)') v
25  write (unit=res,fmt='(I5.5)') minval(v)
26  if (res /= minval(b)) STOP 2
27  smask = .true.
28  if (res /= minval(b, smask)) STOP 3
29  smask = .false.
30  if (all_full /= minval(b, smask)) STOP 4
31
32  mask = v < 30
33  write (unit=res,fmt='(I5.5)') minval(v,mask)
34  if (res /= minval(b, mask)) STOP 5
35  mask = .false.
36  if (minval(b, mask) /= all_full) STOP 6
37  allocate (empty(0:3,0))
38  res = minval(empty)
39  if (res /= all_full) STOP 7
40end program main
41