------- Comment #17 from pault at gcc dot gnu dot org 2005-11-22 20:16 ------- I have started to see a light at the end of the tunnel. Going back to easier but related things, I have found that this is broken, as is its character cousin:
integer, DIMENSION(:), POINTER :: ptr allocate (ptr(2)) ptr = 123 call a (ptr, 12) IF ( .NOT. ASSOCIATED(ptr) ) THEN print *, "not associated in MAIN" else print *, "associated in MAIN ", size(ptr,1), ptr END IF contains SUBROUTINE A(p, l) integer, DIMENSION(:), POINTER :: p integer, DIMENSION(2), target :: t t = 456 IF ( .NOT. ASSOCIATED(p) ) THEN p => t print *, "not associated in A ", size(p,1), p else print *, "associated in A ", size(p,1), p t = 789 p => t END IF END SUBROUTINE A end The subroutine works but the wrong result is returned. The reason for this is now abundantly clear, although why it was not so before is not....*sigh* A pointer array is passed as an array descriptor; this means that the value is not returned if the association is changed! I have most of the way cured this, up to backend complaints about violating the sanctity of pointers (I need to get the PARM_DECL to be of the right type but have all the indirect referencing sorted out.). Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15809