After using C for a while, I went back to Fortran and allocated the arrays in my code from index 0 to N:
real(kind=dp), dimension(:), allocatable :: a
alloc
Your array a indeed starts at index 0, but you did not use that. You searched for a minimum of array abs(a(:)). This anonymous array expression starts at 1 as all arrays do by default.
But even if you used a the result would be the same and is consistent with how array argument passing works in Fortran.
The Fortran standard clearly states:
The i subscript returned lies in the range 1 to ei , where ei is the extent of the idimension of ARRAY. If ARRAY has size zero, all elements of the result are zero.
Lower bounds are not automatically passed with the array if you used assumed shape arguments. For example if you have your own function
function f(arg)
real :: arg(:)
arg starts always at 1 no matter where the actual argument started in the calling code.
You can change it to start at some other value
function f(arg)
real :: arg(-42:)
and it would be indexed starting from that value.