내가 Linux 용 인텔 포트란 컴파일러 (버전 12.0.3) 내 프로그램을 컴파일하기 위해 노력하고있어 나는이 오류를 받고 있어요는 :포트란 컴파일러 오류
buggy.f90(206): error #6219: A specification expression object must be a dummy
argument, a COMMON block object, or an object accessible through host or use
association [SPECTRUM]
type(spect) :: spectrum
----------------------------------------^
이 모듈에 있습니다. type(spect)
은 문제가되는 모듈의 시작 부분에있는 I use
의 다른 모듈에서 가져온 것입니다. 여기에 몇 가지 코드가 있습니다. 자세한 내용은 아래에서 확인할 수 있습니다.
module non_buggy
implicit none
type axis
character(len=6) :: nucleus
integer :: num_data_points
real :: spectral_width
end type axis
type spect
integer :: num_dim
type(axis), allocatable :: axes(:)
real, allocatable :: intensity(:)
character(len=10) :: type = ''
end type spect
type(spect), target :: spectrum ! might this be a cause of error?
contains
! ...
end module non_buggy
module buggy
use non_buggy
implicit none
contains
subroutine no_problem_here()
type(spect) :: spectrum ! compiles beautifully
! ...
end subroutine no_problem_here
subroutine problem()
type(spect) :: spectrum ! does not compile, but no error if I change the variable name
! ...
end subroutine problem
end module buggy
나는 오류가 무엇을 의미하는지에 대해 읽고,하지만 난 내 코드에서 뭘하는지에 적용되지 않는 인상을 - 아니 배열 범위는 그 라인에 지정되지 않습니다. spectrum
의 두 번째 항목의 이름을 다른 것으로 변경하면 문제가 모듈 변수 spectrum
(모듈 non_buggy
)에서 발생했는지 궁금합니다 (줄을 주석 처리하더라도 오류가 계속 발생 함). 모듈 변수가 선언 된). 포트란 전문가가 그 문제를 분명히 할 수 있다면 나는 가장 감사 할 것입니다.
미리 감사드립니다.
오류는 다른 곳에서 발생합니다. 나는 심지어 모듈을 컴파일하려고 시도했다. 그러나 나는 문제의 근원이 다른 곳에 있다고 확신한다. 공유 한 코드의 평화에 아무런 문제가 없기 때문입니다. 가능한 경우 더 많은 코드를 입력하십시오. – Wildcat
@kemiisto 당신은 절대적으로 옳았습니다! 나는 문제를 발견했다. 그것은 컴파일러가 지적한 줄 아래 세 줄이었다. 거기에 실제로 배열 경계 선언에서 '스펙트럼'의 일부를 사용했습니다. 물론 컴파일 타임에 크기가 지정되지 않았습니다 ... – canavanin