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

Variable loosing TARGET attribute inside an associate construct

thomas_boehme
New Contributor II
530 Views

I just came across a small issue with the ASSOCIATE construct

If you associate to a field within a type which originally had the TARGET attribute, you can no longer assign a pointer to the field through the associated variable. See my small example below.

I believe, this code should be legal, but I haven't really studied the F2003 specification on that issue.

I'm using IVF11.0.65
best regards,
Thomas

[fortran]    program AssociateTargetProb
    implicit none
    ! Variables
      TYPE TypeA
        REAL :: Val
      END TYPE      
      Type(TypeA), TARGET :: AType  
      REAL, POINTER :: ARealPtr
    ! Body 
    ARealPtr => AType%Val
    ASSOCIATE ( A => AType%Val )
      ARealPtr => A
    END ASSOCIATE
    end program 
[/fortran]
0 Kudos
3 Replies
Steven_L_Intel1
Employee
530 Views
I think this should be legal too. The standard says: "The associating entity has the ASYNCHRONOUS, TARGET, or VOLATILE attribute if and only if the selector is a variable and has the attribute." [8.1.4.3] The definition of "variable" in section 6 includes "structure-component". Lastly, 5.1.2.14 says "If an object has the TARGET attribute. then all of its nonpointer subobjects also have the TARGET attribute."

I will report this to the developers. Issue ID is DPD200158406.
0 Kudos
tboehme
Beginner
530 Views
I just checked and this issue seems to be fixed with the new Composer XE 2011 release.
Thank you,
Thomas
0 Kudos
Steven_L_Intel1
Employee
530 Views
Ah, so it is. I missed this one.
0 Kudos
Reply