I tied myself in knots today using MAXLOC not realising that the same maximum value was appearing multiple times in an array, so I wonder if the Keywork 'Back' can be added to the wish list for functions such MINLOC, MAXLOC, and FINDLOC, to detect when this happens?
program p
implicit none
real*8:: a(1:10) =[1,2,10,1,10,8,7,10,8,7]
print*, minloc(a) ! Returns 1
print*, maxloc(a) ! Returns 3
print*, findloc(a,8.d0) ! Returns 6
print*, minloc(a,BACK=.TRUE.) ! Would return 4
print*, maxloc(a,BACK=.TRUE.) ! Would return 8
print*, findloc(a,8.d0,BACK=.TRUE.) ! Would return 9
end program p