http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45586
--- Comment #19 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 2010-11-26 13:39:00 UTC --- Tobias, thanks for the clean explanation. I overlooked that the target of a pointer has that target attribute (seems logical!). Richard, I tried to get to a testcase for which the ME generates wrong code, but somehow things are always 'right'. I was expecting this to fail (-O3 -fno-inline), since the ME should not now that X aliases with V1%D: MODULE M1 IMPLICIT NONE TYPE T1 REAL, DIMENSION(:), ALLOCATABLE :: D END TYPE T1 CONTAINS SUBROUTINE S1(V1) TYPE(T1), POINTER :: V1 REAL, DIMENSION(:), POINTER :: X INTEGER :: I CALL PA(V1,X) DO i=1,4 V1%D(i)=1 X(i)=2 V1%D(i)=2*V1%D(i) ENDDO END SUBROUTINE S1 SUBROUTINE PA(V1,X) TYPE(T1), POINTER :: V1 REAL, DIMENSION(:), POINTER :: X X=>V1%D END SUBROUTINE END MODULE M1 USE M1 IMPLICIT NONE TYPE(T1), POINTER :: V1 INTEGER :: i ALLOCATE(V1) ALLOCATE(V1%D(4)) V1%D=(/(i,i=1,4)/) CALL S1(V1) IF (ANY(V1%D.NE.4)) STOP "BUG" write(6,*) "ALL IS FINE" END