public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/19673] New: pointer function with RESULT specified returns pointer to "ptr" rather than "*ptr"
@ 2005-01-28 16:46 paulthomas2 at wanadoo dot fr
  2005-03-03 22:00 ` [Bug fortran/19673] " tobi at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2005-01-28 16:46 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-03-04 22:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-28 16:46 [Bug fortran/19673] New: pointer function with RESULT specified returns pointer to "ptr" rather than "*ptr" paulthomas2 at wanadoo dot fr
2005-03-03 22:00 ` [Bug fortran/19673] " tobi at gcc dot gnu dot org
2005-03-03 22:08 ` tobi at gcc dot gnu dot org
2005-03-03 22:17 ` tobi at gcc dot gnu dot org
2005-03-03 22:44 ` paulthomas2 at wanadoo dot fr
2005-03-03 22:54 ` tobi at gcc dot gnu dot org
2005-03-03 23:24 ` paulthomas2 at wanadoo dot fr
2005-03-04 21:04 ` cvs-commit at gcc dot gnu dot org
2005-03-04 22:21 ` cvs-commit at gcc dot gnu dot org
2005-03-04 22:29 ` tobi at gcc dot gnu dot org
2005-03-04 22:39 ` tobi at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).