title: How to have generic subroutine to work in fortran with assumed size array
body: <p>I have an interface block to define a generic subroutine which have an assumed size array as dummy argument (in order to be able to act on 'the middle' of a passed array, like a C pointer) and it does not compile. Here is simple exemple:</p>
  
  <pre><code>module foo
  
    interface sub
       module procedure isub
       module procedure dsub
    end interface
  
    contains
  
    subroutine isub(a,n)
      integer, intent(in) :: a(*), n
      integer :: i
      print*, 'isub'
      do i=1,n
       print*, a(i)
      enddo
    end subroutine isub
  
    subroutine dsub(a)
      real(8), intent(in) :: a(*)
      integer, intent(in) :: n
      integer :: i
      print*, 'dsub'
      do i=1,n
       print*, a(i)
      enddo
    end subroutine dsub
  
  end module foo
  
  program test
  
    use foo
  
    implicit none
  
    integer :: ai(4)
    real(8) :: ad(4)
  
    ai=(/1,2,3,4/)
    ad=(/1.,2.,3.,4./)
  
    call sub(ai,3)
    call sub(ad,3)
  
    call isub(ai(2),3)
    !call sub(ai(2),3)
  
  end program test
  </code></pre>
  
  <p>The commented line does not compile, whereas it is ok when calling directly the subroutine with <code>call isub(ai(2),3)</code> (tested with gfortran and ifort). Why and is it possible to have it to work with <code>call sub(ai(2),3)</code>?</p>
  
  <p><strong>edit:</strong> with ifort, it says:</p>
  
  <pre><code>$ ifort overload.f90
  overload.f90(37): error #6285: There is no matching specific subroutine for this generic subroutine call.   [SUB]
    call sub(ai(2),3)
  -------^
  compilation aborted for overload.f90 (code 1)
  </code></pre>
  
  <p>Thanks</p>