Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

target in type specification

Scott_L_
New Contributor I
877 Views

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:

program test2
implicit none
integer, parameter :: rldf = 8 ! default real floating point
! Variables

TYPE DataCurvInfo
real(kind=rldf), dimension(:), ALLOCATABLE :: x, z
real(kind=rldf), dimension(:), ALLOCATABLE, TARGET :: a, b
real(kind=rldf), dimension(:), POINTER :: y
END TYPE

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'
stop
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?

thanks

scott

 

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
864 Views

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.

0 Kudos
Reply