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

TARGET attribute in a data type

butette
Beginner
2,089 Views
I looked at the Fortran 2003 standard handbook and could not find anywhere that disallow the use of a TARGET attribute inside a TYPE declaration, for example something like this
module junk
type :: abc
integer, target :: i
integer, pointer :: j
end type abc
end module junk
when I compile it using ifort, I would get
error #6516 : This attribute specification is not valid for a component definition statement. [TARGET]
and it points to the target attribute as the problem. I can see why things would be very confusing if this is allowed
but I cannot find where the standard disallows it though.
Anybody has any idea ?
Thanks.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
2,089 Views
Look at section 4.5.3 of the standard, page 50, where it describes a component of a derived type. The only attributes permitted for a data component are:

  • POINTER
  • DIMENSION
  • ALLOCATABLE
  • PUBLIC
  • PRIVATE
You can specify that a variable of derived type has the TARGET attribute, but you can't selectively give the attribute to a component.
0 Kudos
butette
Beginner
2,089 Views
Thank you Steve... I must have missed it when I try to look for it earlier.
0 Kudos
Reply