title: Subroutine not returning correct numerical values in assumed shape array due to index renaming in the main program
body: <p>The argument of my fortran 95 subroutine is an assumed shape array with intent inout:</p>
  
  <pre><code>the_subroutine(my_argument)
  real, dimension(:,:), intent(inout) :: my_argument
  (...)
  </code></pre>
  
  <p>In the main program, I have an allocatable array. I allocate it <strong>and also rename indexes</strong>. Then I call the subroutine and pass that (correctly allocated) array to the subroutine:</p>
  
  <pre><code>allocate(the_array( 5:1005 , 5:1005 ))
  call the_subroutine(my_argument=the_array)
  </code></pre>
  
  <p>The subroutine does certain calculations and fills the array with values. In <strong>the very last line before the end of the subroutine</strong>, I check a random value:</p>
  
  <pre><code>(...)
  print*, my_argument(213,126) ! I get 2.873...
  end subroutine the_subroutine
  </code></pre>
  
  <p>Then, in <strong>the very first line after the subroutine call</strong>, I check if the value has been correctly communicated by the subroutine to the outer world, but that is not the case:</p>
  
  <pre><code>call the_subroutine(my_argument=the_array)
  print*, the_array(213,126) ! I get 3.798... A completely different value.
  </code></pre>
  
  <p>The problem arises from having re-indexed the array in the main program as:</p>
  
  <pre><code>allocate(the_array( 5:1005 , 5:1005 ))
  </code></pre>
  
  <p>where max_index - min_index = 1000-1, but the subroutine "sees" the array internally as if I had declared the normal way, i.e.:</p>
  
  <pre><code>allocate(the_array( 1:1000, 1:1000))
  </code></pre>
  
  <p>Or simply, allocate(the_array( 1000, 1000 ))</p>
  
  <p>Therefore, the element (213,126) in the internal array is in another location as in the main program array. Is there any easy way out of this?</p>