サブルーチンの先頭で宣言されている整数変数があります。コンストラクト内の制御変数として使用した後は、ループforall
の制御変数として使用できなくなりました。do
コンパイラ (Intel、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
また、この問題に遭遇したのはこれが 2 回目です。
コンパイルは次のように行われます (xyz.f90 は、プログラム全体を構成する多くのファイルの 1 つです)。
ifort -c -g -C -check noarg_temp_created -traceback -warn -warn nodeclarations -nogen-interface xyz.f90
何が問題なのか知っている人はいますか?
お時間をありがとうございました!