I'm using a Fortran function declared with array type. The problem is that the compiler doesn't preserve the bounds of arrays, for example, I declared
function normalize(vector)
real,dimension(0:)::vector
real,dimension(0:size(vector)-1)::normalize
real scale
integer dim
scale=norm_real(vector)
if (scale/=0) then
do dim=0,size(vector)-1
normalize(dim)=vector/scale
end do
end if
write(*,*) Lbound(normalize,1)
end function normalize
...
real, dimension(:), allocatable :: B
B = normalize(vector)
write(*,*) Lbound(B,1)
In this case I verify the Lbound of the function normalize and it's 0, yet it's Lbound In main program or in another side is 1. So how can I preserve it's Lbound?