| 1 |
! { dg-do compile } |
| 2 |
! { dg-additional-options "-O" } |
| 3 |
! |
| 4 |
! Check that the inline code generated for MINLOC and MAXLOC supports |
| 5 |
! a non-constant DIM argument if ARRAY has rank 1. |
| 6 |
|
| 7 |
program p |
| 8 |
implicit none |
| 9 |
integer, parameter :: n = 5 |
| 10 |
integer :: a(n), i |
| 11 |
a = (/ (i**2, i=1,n) /) |
| 12 |
print *, f(a, 1), g(a, 1) |
| 13 |
contains |
| 14 |
function f(a, d) |
| 15 |
integer :: a(n) |
| 16 |
integer :: d |
| 17 |
integer :: f |
| 18 |
f = minloc(a, dim=d) |
| 19 |
end function |
| 20 |
function g(a, d) |
| 21 |
integer :: a(n) |
| 22 |
integer :: d |
| 23 |
integer :: g |
| 24 |
g = maxloc(a, dim=d) |
| 25 |
end function |
| 26 |
end program p |