https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95293
--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Sun, May 24, 2020 at 06:47:18AM +0000, tkoenig at gcc dot gnu.org wrote: > > and the effective argument has the TARGET attribute > > That I will have to look up; if a has the TARGET attribute, > does a%b have it as well? > You're looking for If an object has the TARGET attribute, then all of its nonpointer subobjects also have the TARGET attribute. I believe it does not matter. The effective argument is s1%cc%cbar. The subroutine sub2() accesses s1%cc(2)%cbar via host association. I've quoted the relevant part of the standard that says an effective should be accessed via the dummy argument. You basically have an aliasing problem where something is known by a dummy argument and by host association. It's a rather questionable programming idiom. Consider, program foo real x x = 42 call bar(x) print *, x contains subroutine bar(a) real, intent(inout) :: a a = 12 x = 0 end subroutine bar end program foo Should this print 12 or 0? When bar returns 'a' has a value of 12, should this value be transferred to 'x' before the print statement is executed?