From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15944 invoked by alias); 22 Nov 2005 20:16:10 -0000 Received: (qmail 15910 invoked by uid 48); 22 Nov 2005 20:16:07 -0000 Date: Tue, 22 Nov 2005 20:16:00 -0000 Message-ID: <20051122201607.15909.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/15809] ICE Using Pointer Functions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-11/txt/msg03144.txt.bz2 List-Id: ------- 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