I'm trying to compile my program with the intel Fortran compiler for Linux (version 12.0.3) and I'm getting this error:
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
----------------------------------------^
This is within a module. type(spect) comes from another module, which I use at the beginning of the troublesome module. Here's some code; more details can be found below.
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
I have read about what the error means, but I have the impression that does not apply to what I'm doing in my code - no array bounds are specified on those lines. As the error goes away if I rename the second occurrence of spectrum to something else, I was wondering whether the problem might have something to do with the module variable spectrum in module non_buggy (but then the error persists, even if I comment out the line in which the module variable is declared). If a Fortran expert could clarify that issue I would be most grateful.
Thanks a lot in advance!