This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is it a bug ?


fun_ptr should return the value of ptr, but it return the address ?known bug ?



program ptr
 interface
    function fun_ptr(m1,m2)result(ptr)
      integer,intent(in)::m1,m2
      integer,pointer::ptr
    end function fun_ptr
 end interface

 integer::x, y
 integer,target::rm

! read*, x, y rm=fun_ptr(4,5)
print*,rm
end program ptr


function fun_ptr(m1,m2)result(ptr)
 integer,intent(in)::m1,m2
 integer,pointer::ptr
 allocate(ptr)

 if(m1<m2) then
    ptr=m1
 else
    ptr=m2
 end if
end function fun_ptr

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]