Multidimensional array 用ifort 16实现Fortran中连续多维数组的边界重映射
我在ifort 16中出现了索引重新映射问题,但在ifort 14或gfortran中没有出现(下面列出了确切的版本号)。问题发生在以下测试程序中:Multidimensional array 用ifort 16实现Fortran中连续多维数组的边界重映射,multidimensional-array,fortran,intel-fortran,Multidimensional Array,Fortran,Intel Fortran,我在ifort 16中出现了索引重新映射问题,但在ifort 14或gfortran中没有出现(下面列出了确切的版本号)。问题发生在以下测试程序中: program remap_problem implicit none type :: tp real, dimension(:,:,:), allocatable :: trg_in end type tp real, dimension(:,:,:), allocatable, target :: trg_out
program remap_problem
implicit none
type :: tp
real, dimension(:,:,:), allocatable :: trg_in
end type tp
real, dimension(:,:,:), allocatable, target :: trg_out
type(tp), target :: instance
real, dimension(:,:), pointer :: ptr
allocate(instance%trg_in(3,4,5))
allocate(trg_out(3,4,5))
ptr(0:2,0:3) => instance%trg_in(:,:,2)
ptr(0:2,0:3) => trg_out(:,:,2)
end program remap_problem
Fortran中有一条规则,如果目标是连续的或秩为1,则只能重新定义索引(使用0:2,0:3完成)。在本例中,目标子数组是连续的,因为最后一个索引是Fortran中最慢的
使用ifort 14或gfortran,它可以正常编译。
但是ifort 16抱怨派生类型中的目标数组不连续,我得到以下错误:
error #8527: If a bound remapping list is specified, data target must be simply contiguous or of rank one. [TRG_IN]
但是,trg_out不会出现错误。因此,
,不知何故,ifort 16无法将(:,:,2)中的实例%trg_识别为连续的,因为它是派生类型。我尝试在这里和那里添加关键字continuous
,并将allocatable
替换为pointer
,但似乎没有任何效果
解决办法是:
ptr(0:2,-4:3) => instance%trg_in
将所需元素放在正确的索引上,但这是肮脏的。是否有正确的方法来修复此问题,或者我必须等待编译器更新
my iforts和gfortran的版本为:
ifort(ifort)14.0.2 20140120
ifort(ifort)16.0.0 20150815
GNU Fortran(Debian 4.9.2-10)4.9.2对我来说,这对供应商来说似乎是个问题。史蒂夫·莱昂内尔不时来这里,但我不知道他是否还能向英特尔员工提出问题。在我看来,这是一个bug(回归),应该在官方论坛上报告。您的代码也使用ifort 18.0中的PGI 15.10组件为我编译。(我手边没有17.0。)