This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/19673] New: pointer function with RESULT specified returns pointer to "ptr" rather than "*ptr"
- From: "paulthomas2 at wanadoo dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2005 16:46:01 -0000
- Subject: [Bug fortran/19673] New: pointer function with RESULT specified returns pointer to "ptr" rather than "*ptr"
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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