在forall构造之后,整数变量不再可用

时间:2012-05-09 09:20:29

标签: variables integer fortran

我有一个在我的子程序的头部声明的整数变量。我在forall构造中使用它作为控制变量之后,我再也不能将它用作do循环的控制变量。编译器(英特尔,v.12.0.3)抱怨

xyz.f90(1210): error #6404: This name does not have a type, and must have an explicit type.   [I]
            do i=1,sp_basis%num_dim
---------------^
xyz.f90(1210): error #6063: An INTEGER or REAL data type is required in this context.   [I]
        do i=1,sp_basis%num_dim

我曾尝试编写一个小例子来复制这种行为(并使用与-c除了实际有问题的编译器选项相同的编译器选项编译该文件),但是这个编译过的&工作得很好,所以下面是我的(稍微缩短)有问题的代码(implicit none适用于此代码所属的整个模块):

subroutine xyz(stuff)

   use data, only: ppm, npeaks

   ! some declarations
   integer :: i ! ...

   associate(sp_basis => public_spectra%basis(counter))

      spots = npeaks * np

      allocate(ref_curves(spots,npeaks,sp_basis%num_dim), stat=stat)
      if (stat.ne.0) then
         ! ...
      end if

      forall (i=1:max_dim) uppers(i) = ubound(sp_int%int,i)
      forall (i=1:max_dim) lowers(i) = lbound(sp_int%int,i)
      forall (i=1:npeaks,j=1:sp_basis%num_dim) peak_pos_hertz(j,i) = ppm_to_hertz(ppm(permutation(j),i), sp_axes(j))

      do peak_considered=1,npeaks
         do pos=(peak_considered-1)*np+1,peak_considered*np
            do i=1,sp_basis%num_dim   ! <-- COMPLAINT

如果我将i更改为未用作forall构造的控件变量的名称,则一切正常。此外,这是我第二次遇到这个问题。

这就是编译的完成方式(xyz.f90是构成整个程序的众多文件之一):

ifort -c -g -C -check noarg_temp_created -traceback -warn -warn nodeclarations -nogen-interface xyz.f90

你们有谁知道问题可能是什么?

非常感谢你的时间!

1 个答案:

答案 0 :(得分:3)

对于所有感兴趣的人来说,这是英特尔编译器中的一个错误。 Here您可以阅读更多相关信息。此外,听起来这个错误将在2012年某个时候发布的编译器版本中修复。