Debian Codegraph @

gcc/testsuite/gfortran.dg/minmaxloc_17.f90

raw
1 ! { dg-do run }
2 !
3 ! Check that the code necessary to evaluate MINLOC's or MAXLOC's MASK
4 ! argument is correctly generated.
5
6 program p
7 implicit none
8 integer, parameter :: data10(*) = (/ 2, 5, 2, 0, 6, 5, 3, 6, 0, 1 /)
9 logical, parameter :: mask10(*) = (/ .false., .true., .false., &
10 .false., .true., .true., &
11 .true. , .true., .false., &
12 .false. /)
13 type bool_wrapper
14 logical :: l
15 end type
16 call check_minloc
17 call check_maxloc
18 contains
19 subroutine check_minloc
20 integer :: a(10)
21 integer :: r
22 a = data10
23 r = minloc(a, dim = 1, mask = sum(a) > 0)
24 if (r /= 4) stop 11
25 end subroutine
26 subroutine check_maxloc
27 integer :: a(10)
28 integer :: r
29 a = data10
30 r = maxloc(a, dim = 1, mask = sum(a) > 0)
31 if (r /= 5) stop 18
32 end subroutine
33 end program