【发布时间】:2020-01-13 18:43:25
【问题描述】:
所以我又被 Fortran 搞糊涂了。去搞清楚。无论如何,我正在尝试编写一个非常简单的例程,将值从数组的末尾剥离。一切复杂的工作都很好,除了我想编写子例程,这样我就不必将输入数组的下限传递给它。这是子程序:
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]
我不知道如何解决这个问题。有什么建议?
【问题讨论】:
-
这是哪个编译器?不同的编译器有不同的错误信息。
标签: fortran