From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32716 invoked by alias); 28 Jan 2005 16:46:04 -0000 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 Received: (qmail 32658 invoked by uid 48); 28 Jan 2005 16:46:01 -0000 Date: Fri, 28 Jan 2005 16:46:00 -0000 From: "paulthomas2 at wanadoo dot fr" To: gcc-bugs@gcc.gnu.org Message-ID: <20050128164600.19673.paulthomas2@wanadoo.fr> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug fortran/19673] New: pointer function with RESULT specified returns pointer to "ptr" rather than "*ptr" X-Bugzilla-Reason: CC X-SW-Source: 2005-01/txt/msg04196.txt.bz2 List-Id: This is a bug that is specific to functions where RESULT is specified in the function statement(function foo). In this case, the pointer itself is printed. Where RESULT is not specified, functions return a pointer result correctly(function bar). Here the value pointed too is printed. $ cat return_pointer.f90 ! Test the return of pointer program ret_ptr print *, foo (99) , " from function foo (arg) result (ptr)" print *, bar (99) , " from function bar (arg)" contains function foo (arg) result(ptr) integer :: arg integer, pointer :: ptr allocate (ptr) ptr = arg end function foo function bar (arg) integer :: arg integer, pointer :: bar allocate (bar) bar = arg end function bar end program ret_ptr $ ./a 168034328 from function foo (arg) result (ptr) 99 from function bar (arg) -- Summary: pointer function with RESULT specified returns pointer to "ptr" rather than "*ptr" Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: paulthomas2 at wanadoo dot fr CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19673