I am using intel fortran 17.1 and get this compiler error message:
test2.f90(15): error #6516: This attribute specification is not valid for a component definition statement. [TARGET]
the code I am compiling is:
integer, parameter :: rldf = 8 ! default real floating point
real(kind=rldf), dimension(:), ALLOCATABLE :: x, z
real(kind=rldf), dimension(:), ALLOCATABLE, TARGET :: a, b
real(kind=rldf), dimension(:), POINTER :: y
character(len=6) :: rout = 'test2: ', cntr
logical :: local_debug = .true.
! Body of testp
if ( local_debug ) print *,rout,'Enter routine'
print *, 'Hello World'
if ( local_debug ) print *,rout,'Exit routine'
end program test2
My hope is to have the pointer y(i) point to either a(i) or b(i) depending on the situation.
I am unclear what the error the compiler is concerned about. Is there another way to get to having y(i) switch between a(i) and b(i) in the type datacurvinfo?
TARGET is an attribute on variables, not types or components. If you make the components POINTER rather than ALLOCATABLE, they will automatically have TARGET. Or just add TARGET as an attribute of the variable declared of type DatCurvInfo.