With a recent gfortran, the following compiles, but generates the wrong results:
REAL,TARGET :: x CALL s3(f(x)) CONTAINS FUNCTION f(a) REAL,POINTER :: f REAL,TARGET :: a f => a END FUNCTION SUBROUTINE s3(targ) REAL,TARGET :: targ REAL,POINTER :: p p => targ IF (.NOT. ASSOCIATED(p,x)) CALL ABORT() END SUBROUTINE END -- Summary: wrong code generated with gfortran Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jv244 at cam dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31200