Sometimes the "is this thing a target" logic for the associate name of an associate construct goes awry.
PROGRAM p IMPLICIT NONE TYPE ta INTEGER :: i END TYPE ta TYPE tb TYPE(ta), POINTER :: p END TYPE tb TYPE(tb) :: obj INTEGER, POINTER :: pi !**** ! 6.7.1.4p1 Allocation of a pointer implicitly creates an object that ! has the target attribute. So the thing pointed at by `obj%p` has ! the TARGET attribute, though `obj` itself does not. ALLOCATE(obj%p) ! The component `i` is a subobject of the thing pointed at by `obj%p`. ! As the thing pointed at by `obj%p` is a variable, `obj%p%i` is a ! variable. ! ! 5.3.17p2 If an object has the TARGET attribute, then all of its ! nonpointer subobjects also have the TARGET attribute. ! ! 8.1.3.3p1 The associating entity has the TARGET attribute if an ! only if the selector is a variable (which it is) and has either ! the TARGET (which it does) or POINTER attribute. ASSOCIATE(x => obj%p%i) pi => x ! ifort says "error #6976: the variable must ! have the target attribute...". Bad ifort! END ASSOCIATE END PROGRAM p
>ifort /check:all /warn:all /standard-semantics "2014-10-09 associate-ptr.f90" Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.108 Build 201407 26 Copyright (C) 1985-2014 Intel Corporation. All rights reserved. 2014-10-09 associate-ptr.f90(32): error #6796: The variable must have the TARGET attribute or be a subobject of an objec t with the TARGET attribute, or it must have the POINTER attribute. [X] pi => x ! ifort says "error #6976: the variable must ----------^ compilation aborted for 2014-10-09 associate-ptr.f90 (code 1)