所以我再次被Fortran困惑。去搞清楚。無論如何,我正在試圖寫一個非常簡單的例程,這些條帶在數組的末尾。一切複雜工作正常,除了我想寫的子例程,我不必將輸入數組的下限傳遞給它。下面是子程序:Fortran - 綁定拋出錯誤6366「數組表達式的形狀不符合」
subroutine Strip(list,lstart, index)
implicit none
integer :: i, index, isize, tsize, lstart, istart
real, dimension(:), allocatable, intent(inout) :: list
real, dimension(:), allocatable :: tlist
isize = size(list)
tsize = index-1
print *, 'index', index
print *, 'isize', isize
print*, 'lbound', INT(lbound(list))
print*, 'tsize', tsize
istart = lbound(list) !<---- This lines throws the error
!These are commented out because everything below here works
!allocate(tlist(lstart:tsize))
!tlist = list(lstart:index-1)
!deallocate(list)
!call move_alloc(tlist,list)
end subroutine Strip
現在,我路過下界輸入列表進入子程序(lstart),但我想沒有這樣做。無論如何,這段代碼不會編譯,編譯器會拋出錯誤6366: The shapes of the array expressions do not conform [ISTART]
我不知道如何解決這個問題。有什麼建議麼?
這是哪個編譯器?不同的編譯器有不同的錯誤信息。 –